diff options
author | Simo Sorce <simo@redhat.com> | 2012-02-23 16:26:53 -0500 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2012-02-23 16:53:22 -0500 |
commit | d0989ef842fb3cd48265521cd139b3ffa2aa3889 (patch) | |
tree | bc56f4964a9337a7de8c7dd9d2abc651a62ed851 | |
parent | e56dff9fe3484e0cc89f8cb75c42fa485176c1f3 (diff) | |
download | gss-proxy-d0989ef842fb3cd48265521cd139b3ffa2aa3889.tar.gz gss-proxy-d0989ef842fb3cd48265521cd139b3ffa2aa3889.tar.xz gss-proxy-d0989ef842fb3cd48265521cd139b3ffa2aa3889.zip |
gp_conv: use maj/min err codes with gp_conv_ctx_id_to_gssx too
-rw-r--r-- | proxy/src/gp_conv.c | 20 | ||||
-rw-r--r-- | proxy/src/gp_conv.h | 3 | ||||
-rw-r--r-- | proxy/src/gp_rpc_accept_sec_context.c | 6 | ||||
-rw-r--r-- | proxy/src/gp_rpc_init_sec_context.c | 6 |
4 files changed, 18 insertions, 17 deletions
diff --git a/proxy/src/gp_conv.c b/proxy/src/gp_conv.c index 8da3784..4bf52e6 100644 --- a/proxy/src/gp_conv.c +++ b/proxy/src/gp_conv.c @@ -462,7 +462,7 @@ done: return ret_maj; } -int gp_conv_ctx_id_to_gssx(gss_ctx_id_t *in, gssx_ctx *out) +uint32_t gp_conv_ctx_id_to_gssx(uint32_t *min, gss_ctx_id_t *in, gssx_ctx *out) { uint32_t ret_maj; uint32_t ret_min; @@ -486,24 +486,23 @@ int gp_conv_ctx_id_to_gssx(gss_ctx_id_t *in, gssx_ctx *out) &lifetime_rec, &mech_type, &ctx_flags, &is_locally_initiated, &is_open); if (ret_maj) { - ret = EINVAL; goto done; } ret = gp_conv_oid_to_gssx(mech_type, &out->mech); if (ret) { + ret_maj = GSS_S_FAILURE; + ret_min = ret; goto done; } ret_maj = gp_conv_name_to_gssx(&ret_min, src_name, &out->src_name); if (ret_maj) { - ret = EINVAL; goto done; } ret_maj = gp_conv_name_to_gssx(&ret_min, targ_name, &out->targ_name); if (ret_maj) { - ret = EINVAL; goto done; } @@ -523,16 +522,20 @@ int gp_conv_ctx_id_to_gssx(gss_ctx_id_t *in, gssx_ctx *out) * so this must be the last call to use it */ out->exported_context_token = calloc(1, sizeof(octet_string)); if (!out->exported_context_token) { - ret = ENOMEM; + ret_maj = GSS_S_FAILURE; + ret_min = ENOMEM; goto done; } ret_maj = gss_export_sec_context(&ret_min, in, &export_buffer); if (ret_maj) { - ret = EINVAL; + ret_maj = GSS_S_FAILURE; + ret_min = ENOMEM; goto done; } ret = gp_conv_buffer_to_gssx(&export_buffer, out->exported_context_token); if (ret) { + ret_maj = GSS_S_FAILURE; + ret_min = ret; goto done; } @@ -540,15 +543,16 @@ int gp_conv_ctx_id_to_gssx(gss_ctx_id_t *in, gssx_ctx *out) /* out->gssx_option */ done: + *min = ret_min; gss_release_name(&ret_min, &src_name); gss_release_name(&ret_min, &targ_name); gss_release_buffer(&ret_min, &export_buffer); - if (ret) { + if (ret_maj) { xdr_free((xdrproc_t)xdr_gssx_OID, (char *)&out->mech); xdr_free((xdrproc_t)xdr_gssx_name, (char *)&out->src_name); xdr_free((xdrproc_t)xdr_gssx_name, (char *)&out->targ_name); } - return ret; + return ret_maj; } int gp_conv_gssx_to_ctx_id(gssx_ctx *in, gss_ctx_id_t *out) diff --git a/proxy/src/gp_conv.h b/proxy/src/gp_conv.h index 4fb477b..3c1ceb6 100644 --- a/proxy/src/gp_conv.h +++ b/proxy/src/gp_conv.h @@ -60,7 +60,8 @@ uint32_t gp_conv_name_to_gssx_alloc(uint32_t *min, gss_name_t in, gssx_name **out); uint32_t gp_conv_gssx_to_name(uint32_t *min, gssx_name *in, gss_name_t *out); -int gp_conv_ctx_id_to_gssx(gss_ctx_id_t *in, gssx_ctx *out); +uint32_t gp_conv_ctx_id_to_gssx(uint32_t *min, + gss_ctx_id_t *in, gssx_ctx *out); int gp_conv_gssx_to_ctx_id(gssx_ctx *in, gss_ctx_id_t *out); int gp_conv_status_to_gssx(struct gssx_call_ctx *call_ctx, diff --git a/proxy/src/gp_rpc_accept_sec_context.c b/proxy/src/gp_rpc_accept_sec_context.c index 6cb16ed..5e85748 100644 --- a/proxy/src/gp_rpc_accept_sec_context.c +++ b/proxy/src/gp_rpc_accept_sec_context.c @@ -87,10 +87,8 @@ int gp_accept_sec_context(struct gssproxy_ctx *gpctx, ret_min = ENOMEM; goto done; } - ret = gp_conv_ctx_id_to_gssx(&ctx, ascr->context_handle); - if (ret) { - ret_maj = GSS_S_FAILURE; - ret_min = ret; + ret_maj = gp_conv_ctx_id_to_gssx(&ret_min, &ctx, ascr->context_handle); + if (ret_maj) { goto done; } diff --git a/proxy/src/gp_rpc_init_sec_context.c b/proxy/src/gp_rpc_init_sec_context.c index 1a4026d..c8f7f82 100644 --- a/proxy/src/gp_rpc_init_sec_context.c +++ b/proxy/src/gp_rpc_init_sec_context.c @@ -115,10 +115,8 @@ int gp_init_sec_context(struct gssproxy_ctx *gpctx, ret_min = ENOMEM; goto done; } - ret = gp_conv_ctx_id_to_gssx(&ctx, iscr->context_handle); - if (ret) { - ret_maj = GSS_S_FAILURE; - ret_min = ret; + ret_maj = gp_conv_ctx_id_to_gssx(&ret_min, &ctx, iscr->context_handle); + if (ret_maj) { goto done; } |