From 501e4133524f89438224059c5be805ccbf9ba323 Mon Sep 17 00:00:00 2001 From: rmacklem Date: Fri, 31 Jul 2015 21:31:58 +0000 Subject: MFC: r285113 If a "principal" argument isn't provided for a Kerberized NFS mount, the kernel would generate a bogus one with a ":/" 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. --- sys/fs/nfsclient/nfs_clvfsops.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sys/fs') diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index fba565e..0f8c36a 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -774,7 +774,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; @@ -1153,8 +1153,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) -- cgit v1.1