2 * support/export/rmntab.c
4 * Interface to the rmnt file.
23 * See if the entry already exists. If not,
24 * this was an instantiated wild card, and we
28 rmtab_read_wildcard(struct rmtabent *rep)
30 nfs_export *exp, *exp2;
33 ai = host_addrinfo(rep->r_client);
37 exp = export_allowed(ai, rep->r_path);
42 exp2 = export_lookup(rep->r_client, exp->m_export.e_path, 0);
46 memset(&ee, 0, sizeof(ee));
47 dupexportent(&ee, &exp->m_export);
49 ee.e_hostname = rep->r_client;
50 exp2 = export_create(&ee, 0);
51 exp2->m_changed = exp->m_changed;
53 exp2->m_mayexport = 1;
62 while ((rep = getrmtabent(1, NULL)) != NULL) {
65 htype = client_gettype(rep->r_client);
66 if (htype == MCL_FQDN || htype == MCL_SUBNETWORK)
67 rmtab_read_wildcard(rep);
70 if (errno == EINVAL) {
71 /* Something goes wrong. We need to fix the rmtab
75 if ((lockid = xflock(_PATH_RMTABLCK, "w")) < 0)
78 if (!(fp = fsetrmtabent(_PATH_RMTABTMP, "w"))) {
83 while ((rep = getrmtabent(0, NULL)) != NULL) {
84 fputrmtabent(fp, rep, NULL);
86 if (rename(_PATH_RMTABTMP, _PATH_RMTAB) < 0) {
87 xlog(L_ERROR, "couldn't rename %s to %s",
88 _PATH_RMTABTMP, _PATH_RMTAB);