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 hp = gethostbyname(rep->r_client);
40 exp = export_allowed(hp, rep->r_path);
45 exp2 = export_lookup(rep->r_client, exp->m_export.e_path, 0);
49 memset(&ee, 0, sizeof(ee));
50 dupexportent(&ee, &exp->m_export);
52 ee.e_hostname = rep->r_client;
53 exp2 = export_create(&ee, 0);
54 exp2->m_changed = exp->m_changed;
56 exp2->m_mayexport = 1;
65 while ((rep = getrmtabent(1, NULL)) != NULL) {
68 htype = client_gettype(rep->r_client);
69 if (htype == MCL_FQDN || htype == MCL_SUBNETWORK)
70 rmtab_read_wildcard(rep);
73 if (errno == EINVAL) {
74 /* Something goes wrong. We need to fix the rmtab
78 if ((lockid = xflock(_PATH_RMTABLCK, "w")) < 0)
81 if (!(fp = fsetrmtabent(_PATH_RMTABTMP, "w"))) {
86 while ((rep = getrmtabent(0, NULL)) != NULL) {
87 fputrmtabent(fp, rep, NULL);
89 if (rename(_PATH_RMTABTMP, _PATH_RMTAB) < 0) {
90 xlog(L_ERROR, "couldn't rename %s to %s",
91 _PATH_RMTABTMP, _PATH_RMTAB);