Author: rmacklem
Date: Mon Aug 10 22:26:14 2015
New Revision: 286607
URL: https://svnweb.freebsd.org/changeset/base/286607

Log:
  MFC: r285113
  If a "principal" argument isn't provided for a Kerberized NFS mount,
  the kernel would generate a bogus one with a ":/<path>" suffix.
  This would only occur for the case where there was no explicit
  "principal" argument and the getaddrinfo() call in mount_nfs.c failed to a
  return a cannonical name for the server.
  This patch fixes this unusual case.

Modified:
  stable/9/sys/fs/nfsclient/nfs_clvfsops.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/fs/   (props changed)

Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- stable/9/sys/fs/nfsclient/nfs_clvfsops.c    Mon Aug 10 22:02:01 2015        
(r286606)
+++ stable/9/sys/fs/nfsclient/nfs_clvfsops.c    Mon Aug 10 22:26:14 2015        
(r286607)
@@ -767,7 +767,7 @@ nfs_mount(struct mount *mp)
        struct thread *td;
        char hst[MNAMELEN];
        u_char nfh[NFSX_FHMAX], krbname[100], dirpath[100], srvkrbname[100];
-       char *opt, *name, *secname;
+       char *cp, *opt, *name, *secname;
        int nametimeo = NFS_DEFAULT_NAMETIMEO;
        int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO;
        int dirlen, has_nfs_args_opt, krbnamelen, srvkrbnamelen;
@@ -1105,8 +1105,12 @@ nfs_mount(struct mount *mp)
 
        if (vfs_getopt(mp->mnt_optnew, "principal", (void **)&name, NULL) == 0)
                strlcpy(srvkrbname, name, sizeof (srvkrbname));
-       else
+       else {
                snprintf(srvkrbname, sizeof (srvkrbname), "nfs@%s", hst);
+               cp = strchr(srvkrbname, ':');
+               if (cp != NULL)
+                       *cp = '\0';
+       }
        srvkrbnamelen = strlen(srvkrbname);
 
        if (vfs_getopt(mp->mnt_optnew, "gssname", (void **)&name, NULL) == 0)
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to