Linux NFS development
 help / color / mirror / Atom feed
* [PATCH 0/4] Support parsing multiple security flavors
@ 2008-06-24 20:33 Chuck Lever
       [not found] ` <20080624202913.3366.44867.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Chuck Lever @ 2008-06-24 20:33 UTC (permalink / raw)
  To: trond.myklebust; +Cc: linux-nfs

Hi Trond-

The following four patches implement support in the NFS client's mount option
parser for multiple security flavors via "sec=flavor:flavor:flavor:..."  This
replicates similar support in the legacy (non text-based) mount.nfs command.

Since the NFS client itself doesn't support multiple security flavors at the
moment, these have been build-tested only.

Please consider them for 2.6.27.

---

Chuck Lever (4):
      NFS: text-based mounts should support multiple security flavors
      NFS4: Set security flavor default for NFSv4 mounts like other defaults
      NFS: Set security flavor default for NFSv2/3 mounts like other defaults
      NFS: Refactor logic for parsing NFS security flavor mount options


 fs/nfs/internal.h |    4 +
 fs/nfs/super.c    |  187 +++++++++++++++++++++++++++++------------------------
 2 files changed, 105 insertions(+), 86 deletions(-)

-- 
Chuck Lever
chu ckl eve rat ora cle dot com

^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH 2/4] NFS: Set security flavor default for NFSv2/3 mounts like other defaults
@ 2008-03-21 21:50 Chuck Lever
  0 siblings, 0 replies; 9+ messages in thread
From: Chuck Lever @ 2008-03-21 21:50 UTC (permalink / raw)
  To: trond.myklebust; +Cc: linux-nfs

Set the default security flavor when we set the other mount option default
values.

After this change, the only path that needs to know the NFS_MOUNT_SECFLAVOUR
setting is the binary NFSv2/3 mount path; the flag is set only by user space
when passing in the legacy nfs_mount_data structure.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 fs/nfs/super.c |   23 +++++------------------
 1 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index fad43d1..55b24c3 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -743,9 +743,7 @@ static void nfs_parse_server_address(char *value,
 /*
  * Parse the value of the 'sec=' option.
  *
- * The flags setting is for v2/v3.  The flavor_len
- * setting is for v4.  v2/v3 also need to know the
- * difference between NULL and UNIX.
+ * The flavor_len setting is for v4 mounts.
  */
 static int nfs_parse_security_flavors(char *string,
 				      struct nfs_parsed_mount_data *mnt)
@@ -763,57 +761,46 @@ static int nfs_parse_security_flavors(char *string,
 
 	switch (token) {
 	case Opt_sec_none:
-		mnt->flags &= ~NFS_MOUNT_SECFLAVOUR;
 		mnt->auth_flavor_len = 0;
 		mnt->auth_flavors[0] = RPC_AUTH_NULL;
 		break;
 	case Opt_sec_sys:
-		mnt->flags &= ~NFS_MOUNT_SECFLAVOUR;
 		mnt->auth_flavor_len = 0;
 		mnt->auth_flavors[0] = RPC_AUTH_UNIX;
 		break;
 	case Opt_sec_krb5:
-		mnt->flags |= NFS_MOUNT_SECFLAVOUR;
 		mnt->auth_flavor_len = 1;
 		mnt->auth_flavors[0] = RPC_AUTH_GSS_KRB5;
 		break;
 	case Opt_sec_krb5i:
-		mnt->flags |= NFS_MOUNT_SECFLAVOUR;
 		mnt->auth_flavor_len = 1;
 		mnt->auth_flavors[0] = RPC_AUTH_GSS_KRB5I;
 		break;
 	case Opt_sec_krb5p:
-		mnt->flags |= NFS_MOUNT_SECFLAVOUR;
 		mnt->auth_flavor_len = 1;
 		mnt->auth_flavors[0] = RPC_AUTH_GSS_KRB5P;
 		break;
 	case Opt_sec_lkey:
-		mnt->flags |= NFS_MOUNT_SECFLAVOUR;
 		mnt->auth_flavor_len = 1;
 		mnt->auth_flavors[0] = RPC_AUTH_GSS_LKEY;
 		break;
 	case Opt_sec_lkeyi:
-		mnt->flags |= NFS_MOUNT_SECFLAVOUR;
 		mnt->auth_flavor_len = 1;
 		mnt->auth_flavors[0] = RPC_AUTH_GSS_LKEYI;
 		break;
 	case Opt_sec_lkeyp:
-		mnt->flags |= NFS_MOUNT_SECFLAVOUR;
 		mnt->auth_flavor_len = 1;
 		mnt->auth_flavors[0] = RPC_AUTH_GSS_LKEYP;
 		break;
 	case Opt_sec_spkm:
-		mnt->flags |= NFS_MOUNT_SECFLAVOUR;
 		mnt->auth_flavor_len = 1;
 		mnt->auth_flavors[0] = RPC_AUTH_GSS_SPKM;
 		break;
 	case Opt_sec_spkmi:
-		mnt->flags |= NFS_MOUNT_SECFLAVOUR;
 		mnt->auth_flavor_len = 1;
 		mnt->auth_flavors[0] = RPC_AUTH_GSS_SPKMI;
 		break;
 	case Opt_sec_spkmp:
-		mnt->flags |= NFS_MOUNT_SECFLAVOUR;
 		mnt->auth_flavor_len = 1;
 		mnt->auth_flavors[0] = RPC_AUTH_GSS_SPKMP;
 		break;
@@ -1259,6 +1246,7 @@ static int nfs_validate_mount_data(void *options,
 	args->mount_server.protocol = XPRT_TRANSPORT_UDP;
 	args->nfs_server.port	= 0;	/* autobind unless user sets port */
 	args->nfs_server.protocol = XPRT_TRANSPORT_TCP;
+	args->auth_flavors[0] = RPC_AUTH_UNIX;
 
 	switch (data->version) {
 	case 1:
@@ -1317,7 +1305,9 @@ static int nfs_validate_mount_data(void *options,
 		args->nfs_server.hostname = kstrdup(data->hostname, GFP_KERNEL);
 		args->namlen		= data->namlen;
 		args->bsize		= data->bsize;
-		args->auth_flavors[0]	= data->pseudoflavor;
+
+		if (data->flags & NFS_MOUNT_SECFLAVOUR)
+			args->auth_flavors[0] = data->pseudoflavor;
 
 		/*
 		 * The legacy version 6 binary mount data from userspace has a
@@ -1378,9 +1368,6 @@ static int nfs_validate_mount_data(void *options,
 		}
 	}
 
-	if (!(args->flags & NFS_MOUNT_SECFLAVOUR))
-		args->auth_flavors[0] = RPC_AUTH_UNIX;
-
 #ifndef CONFIG_NFS_V3
 	if (args->flags & NFS_MOUNT_VER3)
 		goto out_v3_not_compiled;


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

end of thread, other threads:[~2008-06-26 20:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-24 20:33 [PATCH 0/4] Support parsing multiple security flavors Chuck Lever
     [not found] ` <20080624202913.3366.44867.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-06-24 20:33   ` [PATCH 1/4] NFS: Refactor logic for parsing NFS security flavor mount options Chuck Lever
2008-06-24 20:33   ` [PATCH 2/4] NFS: Set security flavor default for NFSv2/3 mounts like other defaults Chuck Lever
     [not found]     ` <20080624203345.3366.31456.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-06-26 19:48       ` Trond Myklebust
2008-06-26 20:53         ` Chuck Lever
2008-06-24 20:33   ` [PATCH 3/4] NFS4: Set security flavor default for NFSv4 " Chuck Lever
2008-06-24 20:34   ` [PATCH 4/4] NFS: text-based mounts should support multiple security flavors Chuck Lever
2008-06-24 20:51   ` [PATCH 0/4] Support parsing " Trond Myklebust
  -- strict thread matches above, loose matches on Subject: below --
2008-03-21 21:50 [PATCH 2/4] NFS: Set security flavor default for NFSv2/3 mounts like other defaults Chuck Lever

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