summaryrefslogtreecommitdiffstats
path: root/support/export/client.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2010-08-24 07:06:14 -0400
committerSteve Dickson <steved@redhat.com>2010-08-24 07:22:51 -0400
commitabdc32b6af6f38a741a481aeefb5623916152498 (patch)
treec1bbabaab81ea5fc3bfa365d6e041a6460adbbc1 /support/export/client.c
parent396aac50f5addea2f4d62c25600ca68788a56d97 (diff)
downloadnfs-utils-abdc32b6af6f38a741a481aeefb5623916152498.tar.gz
nfs-utils-abdc32b6af6f38a741a481aeefb5623916152498.tar.xz
nfs-utils-abdc32b6af6f38a741a481aeefb5623916152498.zip
bexport: Add a common exit label to check_netgroup()
check_netgroup() is going to be changed to free dynamically allocated resources before it returns, so a common exit point is needed. Reviewed-by: Neil Brown <neilb@suse.de> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'support/export/client.c')
-rw-r--r--support/export/client.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/support/export/client.c b/support/export/client.c
index dc01067..b1a3a09 100644
--- a/support/export/client.c
+++ b/support/export/client.c
@@ -496,37 +496,46 @@ check_netgroup(const nfs_client *clp, const struct addrinfo *ai)
int i, match;
char *dot;
+ match = 0;
+
/* First, try to match the hostname without
* splitting off the domain */
- if (innetgr(netgroup, hname, NULL, NULL))
- return 1;
+ if (innetgr(netgroup, hname, NULL, NULL)) {
+ match = 1;
+ goto out;
+ }
/* See if hname aliases listed in /etc/hosts or nis[+]
* match the requested netgroup */
hp = gethostbyname(hname);
if (hp != NULL) {
for (i = 0; hp->h_aliases[i]; i++)
- if (innetgr(netgroup, hp->h_aliases[i], NULL, NULL))
- return 1;
+ if (innetgr(netgroup, hp->h_aliases[i], NULL, NULL)) {
+ match = 1;
+ goto out;
+ }
}
/* If hname is ip address convert to FQDN */
tmp = host_pton(hname);
if (tmp != NULL) {
freeaddrinfo(tmp);
- if (innetgr(netgroup, hname, NULL, NULL))
- return 1;
+ if (innetgr(netgroup, hname, NULL, NULL)) {
+ match = 1;
+ goto out;
+ }
}
/* Okay, strip off the domain (if we have one) */
dot = strchr(hname, '.');
if (dot == NULL)
- return 0;
+ goto out;
*dot = '\0';
match = innetgr(netgroup, hname, NULL, NULL);
*dot = '.';
+out:
return match;
}
#else /* !HAVE_INNETGR */