diff options
author | Simo Sorce <simo@redhat.com> | 2012-06-18 11:34:58 -0400 |
---|---|---|
committer | Günther Deschner <gdeschner@redhat.com> | 2012-06-26 14:44:43 +0200 |
commit | a50328cb5bcf425afb1860d09de255cf79ef2132 (patch) | |
tree | f8f71c04c53b38d08ecd88e15c85fb3e8177466d | |
parent | 80f5f7355607c5a95b793f7b1d2fa36e23d7df53 (diff) | |
download | gss-proxy-a50328cb5bcf425afb1860d09de255cf79ef2132.tar.gz gss-proxy-a50328cb5bcf425afb1860d09de255cf79ef2132.tar.xz gss-proxy-a50328cb5bcf425afb1860d09de255cf79ef2132.zip |
Fix handling deleg_creds in accept_sec_context
We would segfault if the user didn't want delegated redentials.
-rw-r--r-- | proxy/src/mechglue/gpm_accept_sec_context.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/proxy/src/mechglue/gpm_accept_sec_context.c b/proxy/src/mechglue/gpm_accept_sec_context.c index 11637c9..d5eeb8a 100644 --- a/proxy/src/mechglue/gpm_accept_sec_context.c +++ b/proxy/src/mechglue/gpm_accept_sec_context.c @@ -46,7 +46,6 @@ OM_uint32 gpm_accept_sec_context(OM_uint32 *minor_status, gssx_name *name = NULL; gss_OID_desc *mech = NULL; gss_buffer_t outbuf = NULL; - gssx_cred *deleg_cred = NULL; uint32_t ret_maj; int ret; @@ -117,13 +116,6 @@ OM_uint32 gpm_accept_sec_context(OM_uint32 *minor_status, goto done; } - if (res->delegated_cred_handle) { - deleg_cred = res->delegated_cred_handle; - /* we are stealing the delegated creds on success, so we do not want - * it to be freed by xdr_free */ - res->delegated_cred_handle = NULL; - } - /* replace old ctx handle if any */ if (*context_handle) { xdr_free((xdrproc_t)xdr_gssx_ctx, (char *)*context_handle); @@ -146,7 +138,16 @@ OM_uint32 gpm_accept_sec_context(OM_uint32 *minor_status, if (time_rec) { *time_rec = ctx->lifetime; } - *delegated_cred_handle = (gss_cred_id_t)deleg_cred; + + if (res->delegated_cred_handle) { + if (delegated_cred_handle) { + *delegated_cred_handle = (gss_cred_id_t)res->delegated_cred_handle; + } + /* we are stealing the delegated creds on success, so we do not want + * it to be freed by xdr_free */ + res->delegated_cred_handle = NULL; + } + *minor_status = 0; ret_maj = GSS_S_COMPLETE; @@ -173,10 +174,6 @@ done: free(outbuf->value); free(outbuf); } - if (deleg_cred) { - xdr_free((xdrproc_t)xdr_gssx_cred, (char *)deleg_cred); - free(deleg_cred); - } *minor_status = ret; return GSS_S_FAILURE; } |