diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2013-03-16 15:55:10 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-03-29 15:43:33 -0400 |
commit | a77c806fb9d097bb7733b64207cf52fc2c6438bb (patch) | |
tree | 198d62d0436f22e7288142eb7341880a1b99ee3e /net/sunrpc/auth_gss | |
parent | 83523d083a045a2069e5f3443d2e4f810a6e6d9a (diff) |
SUNRPC: Refactor nfsd4_do_encode_secinfo()
Clean up. This matches a similar API for the client side, and
keeps ULP fingers out the of the GSS mech switch.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Acked-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/auth_gss')
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 1 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/gss_mech_switch.c | 35 |
2 files changed, 34 insertions, 2 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index a7420076ef39..51415b07174e 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -1642,6 +1642,7 @@ static const struct rpc_authops authgss_ops = { | |||
1642 | .pipes_destroy = gss_pipes_dentries_destroy, | 1642 | .pipes_destroy = gss_pipes_dentries_destroy, |
1643 | .list_pseudoflavors = gss_mech_list_pseudoflavors, | 1643 | .list_pseudoflavors = gss_mech_list_pseudoflavors, |
1644 | .info2flavor = gss_mech_info2flavor, | 1644 | .info2flavor = gss_mech_info2flavor, |
1645 | .flavor2info = gss_mech_flavor2info, | ||
1645 | }; | 1646 | }; |
1646 | 1647 | ||
1647 | static const struct rpc_credops gss_credops = { | 1648 | static const struct rpc_credops gss_credops = { |
diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c index 81fb6f3e2424..deaa7ae81cdf 100644 --- a/net/sunrpc/auth_gss/gss_mech_switch.c +++ b/net/sunrpc/auth_gss/gss_mech_switch.c | |||
@@ -240,8 +240,6 @@ gss_mech_get_by_pseudoflavor(u32 pseudoflavor) | |||
240 | return gm; | 240 | return gm; |
241 | } | 241 | } |
242 | 242 | ||
243 | EXPORT_SYMBOL_GPL(gss_mech_get_by_pseudoflavor); | ||
244 | |||
245 | /** | 243 | /** |
246 | * gss_mech_list_pseudoflavors - Discover registered GSS pseudoflavors | 244 | * gss_mech_list_pseudoflavors - Discover registered GSS pseudoflavors |
247 | * @array: array to fill in | 245 | * @array: array to fill in |
@@ -315,6 +313,39 @@ rpc_authflavor_t gss_mech_info2flavor(struct rpcsec_gss_info *info) | |||
315 | return pseudoflavor; | 313 | return pseudoflavor; |
316 | } | 314 | } |
317 | 315 | ||
316 | /** | ||
317 | * gss_mech_flavor2info - look up a GSS tuple for a given pseudoflavor | ||
318 | * @pseudoflavor: GSS pseudoflavor to match | ||
319 | * @info: rpcsec_gss_info structure to fill in | ||
320 | * | ||
321 | * Returns zero and fills in "info" if pseudoflavor matches a | ||
322 | * supported mechanism. Otherwise a negative errno is returned. | ||
323 | */ | ||
324 | int gss_mech_flavor2info(rpc_authflavor_t pseudoflavor, | ||
325 | struct rpcsec_gss_info *info) | ||
326 | { | ||
327 | struct gss_api_mech *gm; | ||
328 | int i; | ||
329 | |||
330 | gm = gss_mech_get_by_pseudoflavor(pseudoflavor); | ||
331 | if (gm == NULL) | ||
332 | return -ENOENT; | ||
333 | |||
334 | for (i = 0; i < gm->gm_pf_num; i++) { | ||
335 | if (gm->gm_pfs[i].pseudoflavor == pseudoflavor) { | ||
336 | memcpy(info->oid.data, gm->gm_oid.data, gm->gm_oid.len); | ||
337 | info->oid.len = gm->gm_oid.len; | ||
338 | info->qop = gm->gm_pfs[i].qop; | ||
339 | info->service = gm->gm_pfs[i].service; | ||
340 | gss_mech_put(gm); | ||
341 | return 0; | ||
342 | } | ||
343 | } | ||
344 | |||
345 | gss_mech_put(gm); | ||
346 | return -ENOENT; | ||
347 | } | ||
348 | |||
318 | u32 | 349 | u32 |
319 | gss_pseudoflavor_to_service(struct gss_api_mech *gm, u32 pseudoflavor) | 350 | gss_pseudoflavor_to_service(struct gss_api_mech *gm, u32 pseudoflavor) |
320 | { | 351 | { |