return NULL;
}
+struct hostent *
+client_resolve(struct in_addr addr)
+{
+ struct hostent *he = NULL;
+
+ if (clientlist[MCL_WILDCARD] || clientlist[MCL_NETGROUP])
+ he = get_reliable_hostbyaddr((const char*)&addr, sizeof(addr), AF_INET);
+ if (he == NULL)
+ he = get_hostent((const char*)&addr, sizeof(addr), AF_INET);
+
+ return he;
+}
+
/*
* Find client name given an IP address
* This is found by gathering all known names that match that IP address,
static char *add_name(char *old, char *add);
char *
-client_compose(struct in_addr addr)
+client_compose(struct hostent *he)
{
- struct hostent *he = NULL;
char *name = NULL;
int i;
- if (clientlist[MCL_WILDCARD] || clientlist[MCL_NETGROUP])
- he = get_reliable_hostbyaddr((const char*)&addr, sizeof(addr), AF_INET);
- if (he == NULL)
- he = get_hostent((const char*)&addr, sizeof(addr), AF_INET);
-
for (i = 0 ; i < MCL_MAXTYPES; i++) {
nfs_client *clp;
for (clp = clientlist[i]; clp ; clp = clp->m_next) {
name = add_name(name, clp->m_hostname);
}
}
- free(he);
return name;
}
int client_match(nfs_client *, char *hname);
void client_release(nfs_client *);
void client_freeall(void);
-char * client_compose(struct in_addr addr);
+char * client_compose(struct hostent *he);
+struct hostent * client_resolve(struct in_addr addr);
int client_member(char *client, char *name);
int export_read(char *fname);
/* return static nfs_export with details filled in */
char *n;
my_client.m_addrlist[0] = caller->sin_addr;
- n = client_compose(caller->sin_addr);
+ n = client_compose(hp);
*error = unknown_host;
if (!n)
return NULL;
epath[sizeof (epath) - 1] = '\0';
auth_fixpath(epath); /* strip duplicate '/' etc */
- hp = get_reliable_hostbyaddr((const char*)&caller->sin_addr, sizeof(struct in_addr),
- AF_INET);
- if (!hp)
- hp = get_hostent((const char*)&caller->sin_addr, sizeof(struct in_addr),
- AF_INET);
+ hp = client_resolve(caller->sin_addr);
if (!hp)
return exp;
char ipaddr[20];
char *client;
struct in_addr addr;
+ struct hostent *he;
if (readline(fileno(f), &lbuf, &lbuflen) != 1)
return;
auth_reload();
/* addr is a valid, interesting address, find the domain name... */
- client = client_compose(addr);
+ he = client_resolve(addr);
+ client = client_compose(he);
qword_print(f, "nfsd");
qword_eol(f);
if (client) free(client);
-
+ free(he);
}
void auth_unix_gid(FILE *f)