static void
unregister_services (void)
{
- if (nfs_version & 0x1)
+ if (nfs_version & (0x1 << 1)) {
pmap_unset (MOUNTPROG, MOUNTVERS);
- if (nfs_version & (0x1 << 1))
pmap_unset (MOUNTPROG, MOUNTVERS_POSIX);
+ }
if (nfs_version & (0x1 << 2))
pmap_unset (MOUNTPROG, MOUNTVERS_NFSV3);
}
}
bool_t
-mount_null_1_svc(struct svc_req *rqstp, void *argp, void *resp)
+mount_null_1_svc(struct svc_req *UNUSED(rqstp), void *UNUSED(argp),
+ void *UNUSED(resp))
{
return 1;
}
}
bool_t
-mount_dump_1_svc(struct svc_req *rqstp, void *argp, mountlist *res)
+mount_dump_1_svc(struct svc_req *rqstp, void *UNUSED(argp), mountlist *res)
{
struct sockaddr_in *addr = nfs_getrpccaller_in(rqstp->rq_xprt);
}
bool_t
-mount_umnt_1_svc(struct svc_req *rqstp, dirpath *argp, void *resp)
+mount_umnt_1_svc(struct svc_req *rqstp, dirpath *argp, void *UNUSED(resp))
{
struct sockaddr_in *sin = nfs_getrpccaller_in(rqstp->rq_xprt);
nfs_export *exp;
p = rpath;
}
- if (!(exp = auth_authenticate("unmount", sin, p))) {
+ exp = auth_authenticate("unmount", (struct sockaddr *)sin, p);
+ if (exp == NULL)
return 1;
- }
mountlist_del(inet_ntoa(sin->sin_addr), p);
return 1;
}
bool_t
-mount_umntall_1_svc(struct svc_req *rqstp, void *argp, void *resp)
+mount_umntall_1_svc(struct svc_req *rqstp, void *UNUSED(argp),
+ void *UNUSED(resp))
{
/* Reload /etc/xtab if necessary */
auth_reload();
}
bool_t
-mount_export_1_svc(struct svc_req *rqstp, void *argp, exports *resp)
+mount_export_1_svc(struct svc_req *rqstp, void *UNUSED(argp), exports *resp)
{
struct sockaddr_in *addr = nfs_getrpccaller_in(rqstp->rq_xprt);
}
bool_t
-mount_exportall_1_svc(struct svc_req *rqstp, void *argp, exports *resp)
+mount_exportall_1_svc(struct svc_req *rqstp, void *UNUSED(argp), exports *resp)
{
struct sockaddr_in *addr = nfs_getrpccaller_in(rqstp->rq_xprt);
}
/* Now authenticate the intruder... */
- exp = auth_authenticate("pathconf", sin, p);
- if (!exp) {
+ exp = auth_authenticate("pathconf", (struct sockaddr *)sin, p);
+ if (exp == NULL)
return 1;
- } else if (stat(p, &stb) < 0) {
+ else if (stat(p, &stb) < 0) {
xlog(L_WARNING, "can't stat exported dir %s: %s",
p, strerror(errno));
return 1;
}
/* Now authenticate the intruder... */
- exp = auth_authenticate("mount", sin, p);
- if (!exp) {
+ exp = auth_authenticate("mount", (struct sockaddr *)sin, p);
+ if (exp == NULL) {
*error = NFSERR_ACCES;
return NULL;
}
xtab_append(exp);
if (v3)
- fh = getfh_size ((struct sockaddr *) sin, p, 64);
+ fh = getfh_size(sin, p, 64);
if (!v3 || (fh == NULL && errno == EINVAL)) {
/* We first try the new nfs syscall. */
- fh = getfh ((struct sockaddr *) sin, p);
+ fh = getfh(sin, p);
if (fh == NULL && errno == EINVAL)
/* Let's try the old one. */
- fh = getfh_old ((struct sockaddr *) sin,
- stb.st_dev, stb.st_ino);
+ fh = getfh_old(sin, stb.st_dev, stb.st_ino);
}
if (fh == NULL && !did_export) {
exp->m_exported = 0;
static void prune_clients(nfs_export *exp, struct exportnode *e)
{
- struct hostent *hp;
+ struct addrinfo *ai = NULL;
struct groupnode *c, **cp;
cp = &e->ex_groups;
while ((c = *cp) != NULL) {
if (client_gettype(c->gr_name) == MCL_FQDN
- && (hp = gethostbyname(c->gr_name))) {
- hp = hostent_dup(hp);
- if (client_check(exp->m_client, hp)) {
+ && (ai = host_addrinfo(c->gr_name))) {
+ if (client_check(exp->m_client, ai)) {
*cp = c->gr_next;
xfree(c->gr_name);
xfree(c);
- xfree (hp);
+ freeaddrinfo(ai);
continue;
}
- xfree (hp);
+ freeaddrinfo(ai);
}
cp = &(c->gr_next);
}
continue;
e = lookup_or_create_elist_entry(&elist, exp);
- /* We need to check if we should remove
- previous ones. */
+ /* exports to "*" absorb any others */
if (i == MCL_ANONYMOUS && e->ex_groups) {
remove_all_clients(e);
continue;
}
-
- if (i != MCL_FQDN && e->ex_groups) {
+ /* non-FQDN's absorb FQDN's they contain: */
+ if (i != MCL_FQDN && e->ex_groups)
prune_clients(exp, e);
- }
- if (exp->m_export.e_hostname [0] != '\0') {
+ if (exp->m_export.e_hostname[0] != '\0')
insert_group(e, exp->m_export.e_hostname);
- }
}
}
usage(argv [0], 1);
}
- /* No more arguments allowed. */
- if (optind != argc || !(nfs_version & 0x7))
+ /* No more arguments allowed.
+ * Require at least one valid version (2, 3, or 4)
+ */
+ if (optind != argc || !(nfs_version & 0xE))
usage(argv [0], 1);
if (chdir(state_dir)) {
if (new_cache)
cache_open();
- if (nfs_version & 0x1)
+ if (nfs_version & (0x1 << 1)) {
rpc_init("mountd", MOUNTPROG, MOUNTVERS,
mount_dispatch, port);
- if (nfs_version & (0x1 << 1))
rpc_init("mountd", MOUNTPROG, MOUNTVERS_POSIX,
mount_dispatch, port);
+ }
if (nfs_version & (0x1 << 2))
rpc_init("mountd", MOUNTPROG, MOUNTVERS_NFSV3,
mount_dispatch, port);