aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth_null.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/auth_null.c')
-rw-r--r--net/sunrpc/auth_null.c56
1 files changed, 30 insertions, 26 deletions
diff --git a/net/sunrpc/auth_null.c b/net/sunrpc/auth_null.c
index d0ceac57c06e..41a633a4049e 100644
--- a/net/sunrpc/auth_null.c
+++ b/net/sunrpc/auth_null.c
@@ -59,15 +59,21 @@ nul_match(struct auth_cred *acred, struct rpc_cred *cred, int taskflags)
59/* 59/*
60 * Marshal credential. 60 * Marshal credential.
61 */ 61 */
62static __be32 * 62static int
63nul_marshal(struct rpc_task *task, __be32 *p) 63nul_marshal(struct rpc_task *task, struct xdr_stream *xdr)
64{ 64{
65 *p++ = htonl(RPC_AUTH_NULL); 65 __be32 *p;
66 *p++ = 0; 66
67 *p++ = htonl(RPC_AUTH_NULL); 67 p = xdr_reserve_space(xdr, 4 * sizeof(*p));
68 *p++ = 0; 68 if (!p)
69 69 return -EMSGSIZE;
70 return p; 70 /* Credential */
71 *p++ = rpc_auth_null;
72 *p++ = xdr_zero;
73 /* Verifier */
74 *p++ = rpc_auth_null;
75 *p = xdr_zero;
76 return 0;
71} 77}
72 78
73/* 79/*
@@ -80,25 +86,19 @@ nul_refresh(struct rpc_task *task)
80 return 0; 86 return 0;
81} 87}
82 88
83static __be32 * 89static int
84nul_validate(struct rpc_task *task, __be32 *p) 90nul_validate(struct rpc_task *task, struct xdr_stream *xdr)
85{ 91{
86 rpc_authflavor_t flavor; 92 __be32 *p;
87 u32 size; 93
88 94 p = xdr_inline_decode(xdr, 2 * sizeof(*p));
89 flavor = ntohl(*p++); 95 if (!p)
90 if (flavor != RPC_AUTH_NULL) { 96 return -EIO;
91 printk("RPC: bad verf flavor: %u\n", flavor); 97 if (*p++ != rpc_auth_null)
92 return ERR_PTR(-EIO); 98 return -EIO;
93 } 99 if (*p != xdr_zero)
94 100 return -EIO;
95 size = ntohl(*p++); 101 return 0;
96 if (size != 0) {
97 printk("RPC: bad verf size: %u\n", size);
98 return ERR_PTR(-EIO);
99 }
100
101 return p;
102} 102}
103 103
104const struct rpc_authops authnull_ops = { 104const struct rpc_authops authnull_ops = {
@@ -114,6 +114,8 @@ static
114struct rpc_auth null_auth = { 114struct rpc_auth null_auth = {
115 .au_cslack = NUL_CALLSLACK, 115 .au_cslack = NUL_CALLSLACK,
116 .au_rslack = NUL_REPLYSLACK, 116 .au_rslack = NUL_REPLYSLACK,
117 .au_verfsize = NUL_REPLYSLACK,
118 .au_ralign = NUL_REPLYSLACK,
117 .au_ops = &authnull_ops, 119 .au_ops = &authnull_ops,
118 .au_flavor = RPC_AUTH_NULL, 120 .au_flavor = RPC_AUTH_NULL,
119 .au_count = REFCOUNT_INIT(1), 121 .au_count = REFCOUNT_INIT(1),
@@ -125,8 +127,10 @@ const struct rpc_credops null_credops = {
125 .crdestroy = nul_destroy_cred, 127 .crdestroy = nul_destroy_cred,
126 .crmatch = nul_match, 128 .crmatch = nul_match,
127 .crmarshal = nul_marshal, 129 .crmarshal = nul_marshal,
130 .crwrap_req = rpcauth_wrap_req_encode,
128 .crrefresh = nul_refresh, 131 .crrefresh = nul_refresh,
129 .crvalidate = nul_validate, 132 .crvalidate = nul_validate,
133 .crunwrap_resp = rpcauth_unwrap_resp_decode,
130}; 134};
131 135
132static 136static