diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2013-03-16 15:54:34 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-03-29 15:42:56 -0400 |
commit | fb15b26f8ba3ff629a052faf3f4a4744585ca2dc (patch) | |
tree | 2218a2e577bf075170497549847d49840f296aae /fs/nfs | |
parent | 72f4dc117b57e05120aaac6e218b8abc09a5c350 (diff) |
SUNRPC: Define rpcsec_gss_info structure
The NFSv4 SECINFO procedure returns a list of security flavors. Any
GSS flavor also has a GSS tuple containing an OID, a quality-of-
protection value, and a service value, which specifies a particular
GSS pseudoflavor.
For simplicity and efficiency, I'd like to return each GSS tuple
from the NFSv4 SECINFO XDR decoder and pass it straight into the RPC
client.
Define a data structure that is visible to both the NFS client and
the RPC client. Take structure and field names from the relevant
standards to avoid confusion.
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/nfs4namespace.c | 12 | ||||
-rw-r--r-- | fs/nfs/nfs4xdr.c | 21 |
2 files changed, 18 insertions, 15 deletions
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index 0dd766079e1c..88231c92317c 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c | |||
@@ -138,23 +138,23 @@ rpc_authflavor_t nfs_find_best_sec(struct nfs4_secinfo_flavors *flavors) | |||
138 | { | 138 | { |
139 | struct gss_api_mech *mech; | 139 | struct gss_api_mech *mech; |
140 | struct xdr_netobj oid; | 140 | struct xdr_netobj oid; |
141 | int i; | 141 | unsigned int i; |
142 | rpc_authflavor_t pseudoflavor = RPC_AUTH_UNIX; | 142 | rpc_authflavor_t pseudoflavor = RPC_AUTH_UNIX; |
143 | 143 | ||
144 | for (i = 0; i < flavors->num_flavors; i++) { | 144 | for (i = 0; i < flavors->num_flavors; i++) { |
145 | struct nfs4_secinfo_flavor *flavor; | 145 | struct nfs4_secinfo4 *flavor = &flavors->flavors[i]; |
146 | flavor = &flavors->flavors[i]; | ||
147 | 146 | ||
148 | if (flavor->flavor == RPC_AUTH_NULL || flavor->flavor == RPC_AUTH_UNIX) { | 147 | if (flavor->flavor == RPC_AUTH_NULL || flavor->flavor == RPC_AUTH_UNIX) { |
149 | pseudoflavor = flavor->flavor; | 148 | pseudoflavor = flavor->flavor; |
150 | break; | 149 | break; |
151 | } else if (flavor->flavor == RPC_AUTH_GSS) { | 150 | } else if (flavor->flavor == RPC_AUTH_GSS) { |
152 | oid.len = flavor->gss.sec_oid4.len; | 151 | oid.len = flavor->flavor_info.oid.len; |
153 | oid.data = flavor->gss.sec_oid4.data; | 152 | oid.data = flavor->flavor_info.oid.data; |
154 | mech = gss_mech_get_by_OID(&oid); | 153 | mech = gss_mech_get_by_OID(&oid); |
155 | if (!mech) | 154 | if (!mech) |
156 | continue; | 155 | continue; |
157 | pseudoflavor = gss_svc_to_pseudoflavor(mech, flavor->gss.service); | 156 | pseudoflavor = gss_svc_to_pseudoflavor(mech, |
157 | flavor->flavor_info.service); | ||
158 | gss_mech_put(mech); | 158 | gss_mech_put(mech); |
159 | break; | 159 | break; |
160 | } | 160 | } |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 0b744895b9e1..a38fd179c34f 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -5205,27 +5205,30 @@ static int decode_delegreturn(struct xdr_stream *xdr) | |||
5205 | return decode_op_hdr(xdr, OP_DELEGRETURN); | 5205 | return decode_op_hdr(xdr, OP_DELEGRETURN); |
5206 | } | 5206 | } |
5207 | 5207 | ||
5208 | static int decode_secinfo_gss(struct xdr_stream *xdr, struct nfs4_secinfo_flavor *flavor) | 5208 | static int decode_secinfo_gss(struct xdr_stream *xdr, |
5209 | struct nfs4_secinfo4 *flavor) | ||
5209 | { | 5210 | { |
5211 | u32 oid_len; | ||
5210 | __be32 *p; | 5212 | __be32 *p; |
5211 | 5213 | ||
5212 | p = xdr_inline_decode(xdr, 4); | 5214 | p = xdr_inline_decode(xdr, 4); |
5213 | if (unlikely(!p)) | 5215 | if (unlikely(!p)) |
5214 | goto out_overflow; | 5216 | goto out_overflow; |
5215 | flavor->gss.sec_oid4.len = be32_to_cpup(p); | 5217 | oid_len = be32_to_cpup(p); |
5216 | if (flavor->gss.sec_oid4.len > GSS_OID_MAX_LEN) | 5218 | if (oid_len > GSS_OID_MAX_LEN) |
5217 | goto out_err; | 5219 | goto out_err; |
5218 | 5220 | ||
5219 | p = xdr_inline_decode(xdr, flavor->gss.sec_oid4.len); | 5221 | p = xdr_inline_decode(xdr, oid_len); |
5220 | if (unlikely(!p)) | 5222 | if (unlikely(!p)) |
5221 | goto out_overflow; | 5223 | goto out_overflow; |
5222 | memcpy(flavor->gss.sec_oid4.data, p, flavor->gss.sec_oid4.len); | 5224 | memcpy(flavor->flavor_info.oid.data, p, oid_len); |
5225 | flavor->flavor_info.oid.len = oid_len; | ||
5223 | 5226 | ||
5224 | p = xdr_inline_decode(xdr, 8); | 5227 | p = xdr_inline_decode(xdr, 8); |
5225 | if (unlikely(!p)) | 5228 | if (unlikely(!p)) |
5226 | goto out_overflow; | 5229 | goto out_overflow; |
5227 | flavor->gss.qop4 = be32_to_cpup(p++); | 5230 | flavor->flavor_info.qop = be32_to_cpup(p++); |
5228 | flavor->gss.service = be32_to_cpup(p); | 5231 | flavor->flavor_info.service = be32_to_cpup(p); |
5229 | 5232 | ||
5230 | return 0; | 5233 | return 0; |
5231 | 5234 | ||
@@ -5238,10 +5241,10 @@ out_err: | |||
5238 | 5241 | ||
5239 | static int decode_secinfo_common(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) | 5242 | static int decode_secinfo_common(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) |
5240 | { | 5243 | { |
5241 | struct nfs4_secinfo_flavor *sec_flavor; | 5244 | struct nfs4_secinfo4 *sec_flavor; |
5245 | unsigned int i, num_flavors; | ||
5242 | int status; | 5246 | int status; |
5243 | __be32 *p; | 5247 | __be32 *p; |
5244 | int i, num_flavors; | ||
5245 | 5248 | ||
5246 | p = xdr_inline_decode(xdr, 4); | 5249 | p = xdr_inline_decode(xdr, 4); |
5247 | if (unlikely(!p)) | 5250 | if (unlikely(!p)) |