public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] CIFS: make sec=none force an anonymous mount
@ 2007-05-03 18:32 Jeff Layton
  2007-05-03 18:43 ` Christoph Hellwig
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Layton @ 2007-05-03 18:32 UTC (permalink / raw)
  To: linux-cifs-client; +Cc: linux-kernel

We had a customer report that attempting to make CIFS mount with a null
username (i.e. doing an anonymous mount) doesn't work. Looking through the
code, it looks like CIFS expects a NULL username from userspace in order
to trigger an anonymous mount. The mount.cifs code doesn't seem to ever
pass a null username to the kernel, however.

It looks also like the kernel can take a sec=none option, but it only seems
to look at it if the username is already NULL. This seems redundant and
effectively makes sec=none useless.

The following patch makes sec=none force an anonymous mount. I've briefly
tested it and it seems to work. I suppose we could alternately do some
stuff in userspace to make mount.cifs force a null username instead, but this
seems more straightforward to me.

Signed-off-by: Jeff Layton <jlayton@redhat.com>

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index cf40e24..330e290 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1721,12 +1721,13 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
 		return -EINVAL;
 	}
 
-	if (volume_info.username) {
+	if (volume_info.nullauth) {
+		cFYI(1,("null user"));
+		volume_info.username = NULL;
+	} else if (volume_info.username) {
 		/* BB fixme parse for domain name here */
 		cFYI(1, ("Username: %s ", volume_info.username));
 
-	} else if (volume_info.nullauth) {
-		cFYI(1,("null user"));
 	} else {
 		cifserror("No username specified");
         /* In userspace mount helper we can get user name from alternate

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-05-05 20:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20070504024910.CE97B1638AF@lists.samba.org>
2007-05-04 15:26 ` [PATCH] CIFS: make sec=none force an anonymous mount Steve French (smfltc)
2007-05-04 15:57   ` Jeff Layton
2007-05-04 16:41     ` Steve French (smfltc)
     [not found]       ` <OFEFD715DD.89A7A57F-ON872572D2.003A0BCE-862572D2.003AC6CA@us.ibm.com>
2007-05-05 12:03         ` [linux-cifs-client] " Jeff Layton
2007-05-05 20:47         ` Steve French (smfltc)
2007-05-03 18:32 Jeff Layton
2007-05-03 18:43 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox