aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2009-08-09 15:09:31 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-08-09 15:09:31 -0400
commit059f90b323c0f5d34656ab7e0548d7d033c2a51a (patch)
tree00886f92addd883a30f100219605c2c46eecb879 /fs/nfs
parent0b524123c93893391ec9e6c9b04998a45235f9c8 (diff)
NFS: Fix auth flavor len accounting
Previous logic in the NFS mount parsing code path assumed auth_flavor_len was set to zero for simple authentication flavors (like AUTH_UNIX), and 1 for compound flavors (like AUTH_GSS). At some earlier point (maybe even before the option parsers were merged?) specific checks for auth_flavor_len being zero were removed from the functions that validate the mount option that sets the mount point's authentication flavor. Since we are populating an array for authentication flavors, the auth_flavor_len should always be set to the number of flavors. Let's eliminate some cleverness here, and prepare for new logic that needs to know the number of flavors in the auth_flavors[] array. (auth_flavors[] is an array because at some point we want to allow a list of acceptable authentication flavors to be specified via the sec= mount option. For now it remains a single element array). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/super.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 83a31070bc1a..a33e608713e9 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -904,8 +904,6 @@ static void nfs_set_mount_transport_protocol(struct nfs_parsed_mount_data *mnt)
904 904
905/* 905/*
906 * Parse the value of the 'sec=' option. 906 * Parse the value of the 'sec=' option.
907 *
908 * The flavor_len setting is for v4 mounts.
909 */ 907 */
910static int nfs_parse_security_flavors(char *value, 908static int nfs_parse_security_flavors(char *value,
911 struct nfs_parsed_mount_data *mnt) 909 struct nfs_parsed_mount_data *mnt)
@@ -916,53 +914,43 @@ static int nfs_parse_security_flavors(char *value,
916 914
917 switch (match_token(value, nfs_secflavor_tokens, args)) { 915 switch (match_token(value, nfs_secflavor_tokens, args)) {
918 case Opt_sec_none: 916 case Opt_sec_none:
919 mnt->auth_flavor_len = 0;
920 mnt->auth_flavors[0] = RPC_AUTH_NULL; 917 mnt->auth_flavors[0] = RPC_AUTH_NULL;
921 break; 918 break;
922 case Opt_sec_sys: 919 case Opt_sec_sys:
923 mnt->auth_flavor_len = 0;
924 mnt->auth_flavors[0] = RPC_AUTH_UNIX; 920 mnt->auth_flavors[0] = RPC_AUTH_UNIX;
925 break; 921 break;
926 case Opt_sec_krb5: 922 case Opt_sec_krb5:
927 mnt->auth_flavor_len = 1;
928 mnt->auth_flavors[0] = RPC_AUTH_GSS_KRB5; 923 mnt->auth_flavors[0] = RPC_AUTH_GSS_KRB5;
929 break; 924 break;
930 case Opt_sec_krb5i: 925 case Opt_sec_krb5i:
931 mnt->auth_flavor_len = 1;
932 mnt->auth_flavors[0] = RPC_AUTH_GSS_KRB5I; 926 mnt->auth_flavors[0] = RPC_AUTH_GSS_KRB5I;
933 break; 927 break;
934 case Opt_sec_krb5p: 928 case Opt_sec_krb5p:
935 mnt->auth_flavor_len = 1;
936 mnt->auth_flavors[0] = RPC_AUTH_GSS_KRB5P; 929 mnt->auth_flavors[0] = RPC_AUTH_GSS_KRB5P;
937 break; 930 break;
938 case Opt_sec_lkey: 931 case Opt_sec_lkey:
939 mnt->auth_flavor_len = 1;
940 mnt->auth_flavors[0] = RPC_AUTH_GSS_LKEY; 932 mnt->auth_flavors[0] = RPC_AUTH_GSS_LKEY;
941 break; 933 break;
942 case Opt_sec_lkeyi: 934 case Opt_sec_lkeyi:
943 mnt->auth_flavor_len = 1;
944 mnt->auth_flavors[0] = RPC_AUTH_GSS_LKEYI; 935 mnt->auth_flavors[0] = RPC_AUTH_GSS_LKEYI;
945 break; 936 break;
946 case Opt_sec_lkeyp: 937 case Opt_sec_lkeyp:
947 mnt->auth_flavor_len = 1;
948 mnt->auth_flavors[0] = RPC_AUTH_GSS_LKEYP; 938 mnt->auth_flavors[0] = RPC_AUTH_GSS_LKEYP;
949 break; 939 break;
950 case Opt_sec_spkm: 940 case Opt_sec_spkm:
951 mnt->auth_flavor_len = 1;
952 mnt->auth_flavors[0] = RPC_AUTH_GSS_SPKM; 941 mnt->auth_flavors[0] = RPC_AUTH_GSS_SPKM;
953 break; 942 break;
954 case Opt_sec_spkmi: 943 case Opt_sec_spkmi:
955 mnt->auth_flavor_len = 1;
956 mnt->auth_flavors[0] = RPC_AUTH_GSS_SPKMI; 944 mnt->auth_flavors[0] = RPC_AUTH_GSS_SPKMI;
957 break; 945 break;
958 case Opt_sec_spkmp: 946 case Opt_sec_spkmp:
959 mnt->auth_flavor_len = 1;
960 mnt->auth_flavors[0] = RPC_AUTH_GSS_SPKMP; 947 mnt->auth_flavors[0] = RPC_AUTH_GSS_SPKMP;
961 break; 948 break;
962 default: 949 default:
963 return 0; 950 return 0;
964 } 951 }
965 952
953 mnt->auth_flavor_len = 1;
966 return 1; 954 return 1;
967} 955}
968 956
@@ -1680,6 +1668,7 @@ static int nfs_validate_mount_data(void *options,
1680 args->nfs_server.port = 0; /* autobind unless user sets port */ 1668 args->nfs_server.port = 0; /* autobind unless user sets port */
1681 args->nfs_server.protocol = XPRT_TRANSPORT_TCP; 1669 args->nfs_server.protocol = XPRT_TRANSPORT_TCP;
1682 args->auth_flavors[0] = RPC_AUTH_UNIX; 1670 args->auth_flavors[0] = RPC_AUTH_UNIX;
1671 args->auth_flavor_len = 1;
1683 1672
1684 switch (data->version) { 1673 switch (data->version) {
1685 case 1: 1674 case 1:
@@ -2343,7 +2332,7 @@ static int nfs4_validate_mount_data(void *options,
2343 args->acdirmax = NFS_DEF_ACDIRMAX; 2332 args->acdirmax = NFS_DEF_ACDIRMAX;
2344 args->nfs_server.port = NFS_PORT; /* 2049 unless user set port= */ 2333 args->nfs_server.port = NFS_PORT; /* 2049 unless user set port= */
2345 args->auth_flavors[0] = RPC_AUTH_UNIX; 2334 args->auth_flavors[0] = RPC_AUTH_UNIX;
2346 args->auth_flavor_len = 0; 2335 args->auth_flavor_len = 1;
2347 args->minorversion = 0; 2336 args->minorversion = 0;
2348 2337
2349 switch (data->version) { 2338 switch (data->version) {