Author: rmacklem
Date: Fri Jul  3 22:11:07 2015
New Revision: 285113
URL: https://svnweb.freebsd.org/changeset/base/285113

Log:
  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.
  
  PR:           201073
  Submitted by: [email protected]
  MFC after:    2 weeks

Modified:
  head/sys/fs/nfsclient/nfs_clvfsops.c

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvfsops.c        Fri Jul  3 20:43:31 2015        
(r285112)
+++ head/sys/fs/nfsclient/nfs_clvfsops.c        Fri Jul  3 22:11:07 2015        
(r285113)
@@ -779,7 +779,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 minvers = 0;
@@ -1158,8 +1158,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)
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to