Skip to content

Commit d49afc9

Browse files
jtlaytonchucklever
authored andcommitted
sunrpc: fix handling of unknown auth status codes
In the case of an unknown error code from svc_authenticate or pg_authenticate, return AUTH_ERROR with a status of AUTH_FAILED. Also add the other auth_stat value from RFC 5531, and document all the status codes. Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 0396379 commit d49afc9

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

include/linux/sunrpc/msg_prot.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,17 @@ enum rpc_reject_stat {
6969
};
7070

7171
enum rpc_auth_stat {
72-
RPC_AUTH_OK = 0,
73-
RPC_AUTH_BADCRED = 1,
74-
RPC_AUTH_REJECTEDCRED = 2,
75-
RPC_AUTH_BADVERF = 3,
76-
RPC_AUTH_REJECTEDVERF = 4,
77-
RPC_AUTH_TOOWEAK = 5,
72+
RPC_AUTH_OK = 0, /* success */
73+
RPC_AUTH_BADCRED = 1, /* bad credential (seal broken) */
74+
RPC_AUTH_REJECTEDCRED = 2, /* client must begin new session */
75+
RPC_AUTH_BADVERF = 3, /* bad verifier (seal broken) */
76+
RPC_AUTH_REJECTEDVERF = 4, /* verifier expired or replayed */
77+
RPC_AUTH_TOOWEAK = 5, /* rejected for security reasons */
78+
RPC_AUTH_INVALIDRESP = 6, /* bogus response verifier */
79+
RPC_AUTH_FAILED = 7, /* reason unknown */
7880
/* RPCSEC_GSS errors */
79-
RPCSEC_GSS_CREDPROBLEM = 13,
80-
RPCSEC_GSS_CTXPROBLEM = 14
81+
RPCSEC_GSS_CREDPROBLEM = 13, /* no credentials for user */
82+
RPCSEC_GSS_CTXPROBLEM = 14 /* problem with context */
8183
};
8284

8385
#define RPC_MAXNETNAMELEN 256

include/linux/sunrpc/xdr.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ xdr_buf_init(struct xdr_buf *buf, void *start, size_t len)
119119
#define rpc_autherr_badverf cpu_to_be32(RPC_AUTH_BADVERF)
120120
#define rpc_autherr_rejectedverf cpu_to_be32(RPC_AUTH_REJECTEDVERF)
121121
#define rpc_autherr_tooweak cpu_to_be32(RPC_AUTH_TOOWEAK)
122+
#define rpc_autherr_invalidresp cpu_to_be32(RPC_AUTH_INVALIDRESP)
123+
#define rpc_autherr_failed cpu_to_be32(RPC_AUTH_FAILED)
122124
#define rpcsec_gsserr_credproblem cpu_to_be32(RPCSEC_GSS_CREDPROBLEM)
123125
#define rpcsec_gsserr_ctxproblem cpu_to_be32(RPCSEC_GSS_CTXPROBLEM)
124126

net/sunrpc/svc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,8 @@ svc_process_common(struct svc_rqst *rqstp)
13871387
goto sendit;
13881388
default:
13891389
pr_warn_once("Unexpected svc_auth_status (%d)\n", auth_res);
1390-
goto err_system_err;
1390+
rqstp->rq_auth_stat = rpc_autherr_failed;
1391+
goto err_bad_auth;
13911392
}
13921393

13931394
if (progp == NULL)

0 commit comments

Comments
 (0)