diff options
author | Simo Sorce <simo@redhat.com> | 2012-01-25 16:31:58 -0500 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2012-01-25 16:55:08 -0500 |
commit | 1f70f9d1361665fcd6b4fc01e23c2544b281421a (patch) | |
tree | 9461fd03227f7041180d64573513362a8416f6ec /proxy | |
parent | b57763f33402edd9f6980afd02e2e1dd82fdebd2 (diff) | |
download | gss-proxy-1f70f9d1361665fcd6b4fc01e23c2544b281421a.tar.gz gss-proxy-1f70f9d1361665fcd6b4fc01e23c2544b281421a.tar.xz gss-proxy-1f70f9d1361665fcd6b4fc01e23c2544b281421a.zip |
Add helper to return status from rpc functions
Diffstat (limited to 'proxy')
-rw-r--r-- | proxy/src/gp_conv.c | 36 | ||||
-rw-r--r-- | proxy/src/gp_conv.h | 4 | ||||
-rw-r--r-- | proxy/src/gp_rpc_accept_sec_context.c | 22 |
3 files changed, 43 insertions, 19 deletions
diff --git a/proxy/src/gp_conv.c b/proxy/src/gp_conv.c index 18d7e78..6354c80 100644 --- a/proxy/src/gp_conv.c +++ b/proxy/src/gp_conv.c @@ -333,3 +333,39 @@ done: return ret; } +int gp_conv_status_to_gssx(struct gssx_call_ctx *call_ctx, + uint32_t ret_maj, uint32_t ret_min, + gss_OID mech, struct gssx_status *status) +{ + int ret; + + status->major_status = ret_maj; + + ret = gp_conv_oid_to_gssx(mech, &status->mech); + if (ret) { + goto done; + } + + status->minor_status = ret_min; + + if (ret_maj) { + ret = gp_conv_err_to_gssx_string(ret_maj, GSS_C_GSS_CODE, mech, + &status->major_status_string); + if (ret) { + goto done; + } + } + + if (ret_min) { + ret = gp_conv_err_to_gssx_string(ret_min, GSS_C_MECH_CODE, mech, + &status->minor_status_string); + if (ret) { + goto done; + } + } + + ret = 0; + +done: + return ret; +} diff --git a/proxy/src/gp_conv.h b/proxy/src/gp_conv.h index e364df6..198a5c5 100644 --- a/proxy/src/gp_conv.h +++ b/proxy/src/gp_conv.h @@ -50,4 +50,8 @@ int gp_conv_name_to_gssx(gss_name_t in, gssx_name *out); int gp_conv_ctx_id_to_gssx(gss_ctx_id_t *in, gssx_ctx *out); +int gp_conv_status_to_gssx(struct gssx_call_ctx *call_ctx, + uint32_t ret_maj, uint32_t ret_min, + gss_OID mech, struct gssx_status *status); + #endif /* _GSS_CONV_H_ */ diff --git a/proxy/src/gp_rpc_accept_sec_context.c b/proxy/src/gp_rpc_accept_sec_context.c index 12022a8..ba4a26d 100644 --- a/proxy/src/gp_rpc_accept_sec_context.c +++ b/proxy/src/gp_rpc_accept_sec_context.c @@ -80,28 +80,12 @@ int gp_accept_sec_context(struct gssproxy_ctx *gpctx, &time_rec, &dch); - ascr->status.major_status = ret_maj; - ret = gp_conv_oid_to_gssx(oid, &ascr->status.mech); + ret = gp_conv_status_to_gssx(&asca->call_ctx, + ret_maj, ret_min, oid, + &ascr->status); if (ret) { goto done; } - ascr->status.minor_status = ret_min; - if (ret_maj) { - ret = gp_conv_err_to_gssx_string(ret_maj, GSS_C_GSS_CODE, oid, - &ascr->status.major_status_string); - if (ret) { - goto done; - } - } - if (ret_min) { - ret = gp_conv_err_to_gssx_string(ret_min, GSS_C_MECH_CODE, oid, - &ascr->status.minor_status_string); - if (ret) { - goto done; - } - } - /* Only used with PGSS, ignore for now */ - /* ascr->status.server_ctx; */ if (ret_maj) { ret = 0; |