aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/nfs4state.c59
1 files changed, 29 insertions, 30 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 9014dc2a632a..f100eeab5458 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -869,16 +869,16 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi
869 } 869 }
870 unconf = clp; 870 unconf = clp;
871 } 871 }
872 /* CASE 1:
873 * unconf record that matches input clientid and input confirm.
874 * conf record that matches input clientid.
875 * conf and unconf records match names, verifiers
876 */
877 if ((conf && unconf) && 872 if ((conf && unconf) &&
878 (cmp_verf(&unconf->cl_confirm, &confirm)) && 873 (cmp_verf(&unconf->cl_confirm, &confirm)) &&
879 (cmp_verf(&conf->cl_verifier, &unconf->cl_verifier)) && 874 (cmp_verf(&conf->cl_verifier, &unconf->cl_verifier)) &&
880 (same_name(conf->cl_recdir,unconf->cl_recdir)) && 875 (same_name(conf->cl_recdir,unconf->cl_recdir)) &&
881 (!cmp_verf(&conf->cl_confirm, &unconf->cl_confirm))) { 876 (!cmp_verf(&conf->cl_confirm, &unconf->cl_confirm))) {
877 /* CASE 1:
878 * unconf record that matches input clientid and input confirm.
879 * conf record that matches input clientid.
880 * conf and unconf records match names, verifiers
881 */
882 if (!cmp_creds(&conf->cl_cred, &unconf->cl_cred)) 882 if (!cmp_creds(&conf->cl_cred, &unconf->cl_cred))
883 status = nfserr_clid_inuse; 883 status = nfserr_clid_inuse;
884 else { 884 else {
@@ -891,29 +891,29 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi
891 status = nfs_ok; 891 status = nfs_ok;
892 892
893 } 893 }
894 } 894 } else if ((conf && !unconf) ||
895 /* CASE 2:
896 * conf record that matches input clientid.
897 * if unconf record that matches input clientid, then unconf->cl_name
898 * or unconf->cl_verifier don't match the conf record.
899 */
900 else if ((conf && !unconf) ||
901 ((conf && unconf) && 895 ((conf && unconf) &&
902 (!cmp_verf(&conf->cl_verifier, &unconf->cl_verifier) || 896 (!cmp_verf(&conf->cl_verifier, &unconf->cl_verifier) ||
903 !same_name(conf->cl_recdir, unconf->cl_recdir)))) { 897 !same_name(conf->cl_recdir, unconf->cl_recdir)))) {
898 /* CASE 2:
899 * conf record that matches input clientid.
900 * if unconf record matches input clientid, then
901 * unconf->cl_name or unconf->cl_verifier don't match the
902 * conf record.
903 */
904 if (!cmp_creds(&conf->cl_cred,&rqstp->rq_cred)) { 904 if (!cmp_creds(&conf->cl_cred,&rqstp->rq_cred)) {
905 status = nfserr_clid_inuse; 905 status = nfserr_clid_inuse;
906 } else { 906 } else {
907 clp = conf; 907 clp = conf;
908 status = nfs_ok; 908 status = nfs_ok;
909 } 909 }
910 } 910 } else if (!conf && unconf
911 /* CASE 3: 911 && cmp_verf(&unconf->cl_confirm, &confirm)) {
912 * conf record not found. 912 /* CASE 3:
913 * unconf record found. 913 * conf record not found.
914 * unconf->cl_confirm matches input confirm 914 * unconf record found.
915 */ 915 * unconf->cl_confirm matches input confirm
916 else if (!conf && unconf && cmp_verf(&unconf->cl_confirm, &confirm)) { 916 */
917 if (!cmp_creds(&unconf->cl_cred, &rqstp->rq_cred)) { 917 if (!cmp_creds(&unconf->cl_cred, &rqstp->rq_cred)) {
918 status = nfserr_clid_inuse; 918 status = nfserr_clid_inuse;
919 } else { 919 } else {
@@ -928,18 +928,17 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi
928 move_to_confirmed(unconf); 928 move_to_confirmed(unconf);
929 status = nfs_ok; 929 status = nfs_ok;
930 } 930 }
931 } 931 } else if ((!conf || (conf && !cmp_verf(&conf->cl_confirm, &confirm)))
932 /* CASE 4: 932 && (!unconf || (unconf && !cmp_verf(&unconf->cl_confirm,
933 * conf record not found, or if conf, then conf->cl_confirm does not 933 &confirm)))) {
934 * match input confirm. 934 /* CASE 4:
935 * unconf record not found, or if unconf, then unconf->cl_confirm 935 * conf record not found, or if conf, conf->cl_confirm does not
936 * does not match input confirm. 936 * match input confirm.
937 */ 937 * unconf record not found, or if unconf, unconf->cl_confirm
938 else if ((!conf || (conf && !cmp_verf(&conf->cl_confirm, &confirm))) && 938 * does not match input confirm.
939 (!unconf || (unconf && !cmp_verf(&unconf->cl_confirm, &confirm)))) { 939 */
940 status = nfserr_stale_clientid; 940 status = nfserr_stale_clientid;
941 } 941 } else {
942 else {
943 /* check that we have hit one of the cases...*/ 942 /* check that we have hit one of the cases...*/
944 status = nfserr_clid_inuse; 943 status = nfserr_clid_inuse;
945 } 944 }