diff options
Diffstat (limited to 'support/export')
-rw-r--r-- | support/export/client.c | 8 | ||||
-rw-r--r-- | support/export/export.c | 12 | ||||
-rw-r--r-- | support/export/rmtab.c | 4 | ||||
-rw-r--r-- | support/export/xtab.c | 4 |
4 files changed, 16 insertions, 12 deletions
diff --git a/support/export/client.c b/support/export/client.c index 076b0c0..da3a976 100644 --- a/support/export/client.c +++ b/support/export/client.c @@ -32,8 +32,12 @@ static int client_checkaddr(nfs_client *clp, struct in_addr addr); nfs_client *clientlist[MCL_MAXTYPES] = { NULL, }; +/* if canonical is set, then we *know* this is already a canonical name + * so hostname lookup is avoided. + * This is used when reading /proc/fs/nfs/exports + */ nfs_client * -client_lookup(char *hname) +client_lookup(char *hname, int canonical) { nfs_client *clp = NULL; int htype; @@ -41,7 +45,7 @@ client_lookup(char *hname) htype = client_gettype(hname); - if (htype == MCL_FQDN) { + if (htype == MCL_FQDN && !canonical) { struct hostent *hp2; hp = gethostbyname(hname); if (hp == NULL || hp->h_addrtype != AF_INET) { diff --git a/support/export/export.c b/support/export/export.c index ef12056..4cfb448 100644 --- a/support/export/export.c +++ b/support/export/export.c @@ -33,9 +33,9 @@ export_read(char *fname) setexportent(fname, "r"); while ((eep = getexportent()) != NULL) { - exp = export_lookup(eep->e_hostname, eep->e_path); + exp = export_lookup(eep->e_hostname, eep->e_path, 0); if (!exp) - export_create(eep); + export_create(eep,0); else { if (exp->m_export.e_flags != eep->e_flags) { xlog(L_ERROR, "incompatible duplicated export entries:"); @@ -61,12 +61,12 @@ export_read(char *fname) * Create an in-core export struct from an export entry. */ nfs_export * -export_create(struct exportent *xep) +export_create(struct exportent *xep, int canonical) { nfs_client *clp; nfs_export *exp; - if (!(clp = client_lookup(xep->e_hostname))) { + if (!(clp = client_lookup(xep->e_hostname, canonical))) { /* bad export entry; complaint already logged */ return NULL; } @@ -203,12 +203,12 @@ export_allowed(struct hostent *hp, char *path) } nfs_export * -export_lookup(char *hname, char *path) +export_lookup(char *hname, char *path, int canonical) { nfs_client *clp; nfs_export *exp; - if (!(clp = client_lookup(hname))) + if (!(clp = client_lookup(hname, canonical))) return NULL; for (exp = exportlist[clp->m_type]; exp; exp = exp->m_next) if (exp->m_client == clp && !strcmp(exp->m_export.e_path, path)) diff --git a/support/export/rmtab.c b/support/export/rmtab.c index 4e141c3..3c55267 100644 --- a/support/export/rmtab.c +++ b/support/export/rmtab.c @@ -37,12 +37,12 @@ rmtab_read(void) /* see if the entry already exists, otherwise this was an instantiated * wild card, and we must add it */ - exp = export_lookup(rep->r_client, xp->e_path); + exp = export_lookup(rep->r_client, xp->e_path, 0); if (!exp) { strncpy (xp->e_hostname, rep->r_client, sizeof (xp->e_hostname) - 1); xp->e_hostname[sizeof (xp->e_hostname) -1] = '\0'; - exp = export_create(xp); + exp = export_create(xp, 0); } free (hp); diff --git a/support/export/xtab.c b/support/export/xtab.c index b0c3095..54470c1 100644 --- a/support/export/xtab.c +++ b/support/export/xtab.c @@ -33,8 +33,8 @@ xtab_read(char *xtab, int is_export) return 0; setexportent(xtab, "r"); while ((xp = getexportent()) != NULL) { - if (!(exp = export_lookup(xp->e_hostname, xp->e_path)) && - !(exp = export_create(xp))) { + if (!(exp = export_lookup(xp->e_hostname, xp->e_path, is_export != 1)) && + !(exp = export_create(xp, is_export!=1))) { continue; } switch (is_export) { |