X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=support%2Fexport%2Fclient.c;h=f8c84de32178ba7c6b685aeb0f8c3dacdf927ff7;hp=1cb242f33fa62b993695df7c8623c7d9d9318a45;hb=aa4c771fc359e097a3a6c3637f78c7bed7c450e9;hpb=180238a295c1a8127953c96f0b462688d0f57a09 diff --git a/support/export/client.c b/support/export/client.c index 1cb242f..f8c84de 100644 --- a/support/export/client.c +++ b/support/export/client.c @@ -211,28 +211,6 @@ client_freeall(void) } } -nfs_client * -client_find(struct hostent *hp) -{ - nfs_client *clp; - int i; - - for (i = 0; i < MCL_MAXTYPES; i++) { - for (clp = clientlist[i]; clp; clp = clp->m_next) { - if (!client_check(clp, hp)) - continue; -#ifdef notdef - if (clp->m_type == MCL_FQDN) - return clp; - return client_dup(clp, hp); -#else - return clp; -#endif - } - } - return NULL; -} - struct hostent * client_resolve(struct in_addr addr) { @@ -297,7 +275,7 @@ name_cmp(char *a, char *b) /* compare strings a and b, but only upto ',' in a */ while (*a && *b && *a != ',' && *a == *b) a++, b++; - if (!*b && (!*a || !a == ',') ) + if (!*b && (!*a || *a == ',')) return 0; if (!*b) return 1; if (!*a || *a == ',') return -1; @@ -371,7 +349,7 @@ client_check(nfs_client *clp, struct hostent *hp) #ifdef HAVE_INNETGR { char *dot; - int match; + int match, i; struct hostent *nhp = NULL; struct sockaddr_in addr; @@ -380,6 +358,12 @@ client_check(nfs_client *clp, struct hostent *hp) if (innetgr(cname+1, hname, NULL, NULL)) return 1; + /* try the aliases as well */ + for (i = 0; hp->h_aliases[i]; i++) { + if (innetgr(cname+1, hp->h_aliases[i], NULL, NULL)) + return 1; + } + /* If hname is ip address convert to FQDN */ if (inet_aton(hname, &addr.sin_addr) && (nhp = gethostbyaddr((const char *)&(addr.sin_addr),