]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
mountd: support IPv6 in mountlist_del_all()
authorChuck Lever <chuck.lever@oracle.com>
Thu, 16 Sep 2010 17:46:26 +0000 (13:46 -0400)
committerSteve Dickson <steved@redhat.com>
Thu, 16 Sep 2010 18:33:51 +0000 (14:33 -0400)
Replace IPv4-specific code in the mountlist_del_all() path with code
that is address family agnostic.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/mountd/mountd.c
utils/mountd/mountd.h
utils/mountd/rmtab.c

index 19dc4ee1e78d27520925dadcf9ee6348f8a2bd46..98b396dbffd278fcc71b389b55d91a0f4990167a 100644 (file)
@@ -275,7 +275,7 @@ mount_umntall_1_svc(struct svc_req *rqstp, void *UNUSED(argp),
        /* Reload /etc/xtab if necessary */
        auth_reload();
 
-       mountlist_del_all(nfs_getrpccaller_in(rqstp->rq_xprt));
+       mountlist_del_all(nfs_getrpccaller(rqstp->rq_xprt));
        return 1;
 }
 
index 96e9bf18552be3a3abe989f5589b476593e0bd10..0d31ca74dc72d0a87fcda09c655b04daff801df1 100644 (file)
@@ -48,7 +48,7 @@ void          auth_export(nfs_export *exp);
 
 void           mountlist_add(char *host, const char *path);
 void           mountlist_del(char *host, const char *path);
-void           mountlist_del_all(struct sockaddr_in *sin);
+void           mountlist_del_all(const struct sockaddr *sap);
 mountlist      mountlist_list(void);
 
 
index d23712b28d500cf46df749fd9502e293eb7fc0ab..b2c04e769750d289a4fd8b2a929596e7e49ee0e5 100644 (file)
@@ -131,21 +131,20 @@ mountlist_del(char *hname, const char *path)
 }
 
 void
-mountlist_del_all(struct sockaddr_in *sin)
+mountlist_del_all(const struct sockaddr *sap)
 {
        char            *hostname;
        struct rmtabent *rep;
-       nfs_export      *exp;
        FILE            *fp;
        int             lockid;
 
        if ((lockid = xflock(_PATH_RMTABLCK, "w")) < 0)
                return;
-       hostname = host_canonname((struct sockaddr *)sin);
+       hostname = host_canonname(sap);
        if (hostname == NULL) {
-               char buf[INET_ADDRSTRLEN];
+               char buf[INET6_ADDRSTRLEN];
                xlog(L_ERROR, "can't get hostname of %s",
-                       host_ntop((struct sockaddr *)sin, buf, sizeof(buf)));
+                       host_ntop(sap, buf, sizeof(buf)));
                goto out_unlock;
        }
 
@@ -157,8 +156,7 @@ mountlist_del_all(struct sockaddr_in *sin)
 
        while ((rep = getrmtabent(1, NULL)) != NULL) {
                if (strcmp(rep->r_client, hostname) == 0 &&
-                   (exp = auth_authenticate("umountall",
-                               (struct sockaddr *)sin, rep->r_path)))
+                   auth_authenticate("umountall", sap, rep->r_path) != NULL)
                        continue;
                fputrmtabent(fp, rep, NULL);
        }