diff options
author | Simo Sorce <simo@redhat.com> | 2012-06-14 14:12:32 -0400 |
---|---|---|
committer | Günther Deschner <gdeschner@redhat.com> | 2012-06-26 14:44:44 +0200 |
commit | e3a355d5f2a46f90aa13653c0178442d84e7d1d3 (patch) | |
tree | 557063113727ff4d91ea8af29b03fe457b93db61 | |
parent | a9c0609b686a369e16ed313a27b8acf968a47f07 (diff) | |
download | gss-proxy-e3a355d5f2a46f90aa13653c0178442d84e7d1d3.tar.gz gss-proxy-e3a355d5f2a46f90aa13653c0178442d84e7d1d3.tar.xz gss-proxy-e3a355d5f2a46f90aa13653c0178442d84e7d1d3.zip |
WIP: Add context handle wrappers
-rw-r--r-- | proxy/src/mechglue/gpm_init_sec_context.c | 6 | ||||
-rw-r--r-- | proxy/src/mechglue/gpp_init_sec_context.c | 16 | ||||
-rw-r--r-- | proxy/src/mechglue/gss_plugin.h | 5 | ||||
-rw-r--r-- | proxy/src/mechglue/gssapi_gpm.h | 2 |
4 files changed, 23 insertions, 6 deletions
diff --git a/proxy/src/mechglue/gpm_init_sec_context.c b/proxy/src/mechglue/gpm_init_sec_context.c index 581dbc5..ab6ed80 100644 --- a/proxy/src/mechglue/gpm_init_sec_context.c +++ b/proxy/src/mechglue/gpm_init_sec_context.c @@ -28,7 +28,7 @@ OM_uint32 gpm_init_sec_context(OM_uint32 *minor_status, gssx_cred *cred_handle, - gss_ctx_id_t *context_handle, + gssx_ctx **context_handle, gss_name_t target_name, gss_OID mech_type, OM_uint32 req_flags, @@ -60,7 +60,7 @@ OM_uint32 gpm_init_sec_context(OM_uint32 *minor_status, } if (*context_handle) { - arg->context_handle = (gssx_ctx *)*context_handle; + arg->context_handle = *context_handle; } if (target_name != GSS_C_NO_NAME) { @@ -142,7 +142,7 @@ done: xdr_free((xdrproc_t)xdr_gssx_ctx, (char *)*context_handle); free(*context_handle); } - *context_handle = (gss_ctx_id_t)ctx; + *context_handle = ctx; if (actual_mech_type) { *actual_mech_type = mech; } diff --git a/proxy/src/mechglue/gpp_init_sec_context.c b/proxy/src/mechglue/gpp_init_sec_context.c index fcc37f0..80bab99 100644 --- a/proxy/src/mechglue/gpp_init_sec_context.c +++ b/proxy/src/mechglue/gpp_init_sec_context.c @@ -39,6 +39,7 @@ OM_uint32 gssi_init_sec_context(OM_uint32 *minor_status, OM_uint32 *ret_flags, OM_uint32 *time_rec) { + struct gpm_context_handle *ctx_handle = NULL; struct gpm_cred_handle *cred_handle = NULL; gss_cred_id_t local_cred_handle = GSS_C_NO_CREDENTIAL; gssx_cred *remote_cred_handle = NULL; @@ -50,6 +51,16 @@ OM_uint32 gssi_init_sec_context(OM_uint32 *minor_status, remote_cred_handle = cred_handle->remote_cred_handle; } + if (*context_handle) { + ctx_handle = (struct gpm_context_handle *)*context_handle; + } else { + ctx_handle = calloc(1, sizeof(struct gpm_context_handle)); + if (!ctx_handle) { + *minor_status = gpm_map_error(ENOMEM); + return GSS_S_FAILURE; + } + } + /* if we get our own mechanism it means the original * caller did not specify any mechanism, and the default * (interposed) mechanism was choosen */ @@ -71,7 +82,7 @@ OM_uint32 gssi_init_sec_context(OM_uint32 *minor_status, maj = gss_init_sec_context(&min, local_cred_handle, - context_handle, + &ctx_handle->local_ctx_handle, target_name, gpm_special_mech(mech_type), req_flags, @@ -86,7 +97,7 @@ OM_uint32 gssi_init_sec_context(OM_uint32 *minor_status, maj = gpm_init_sec_context(&min, remote_cred_handle, - context_handle, + &ctx_handle->remote_ctx_handle, target_name, mech_type, req_flags, @@ -99,6 +110,7 @@ OM_uint32 gssi_init_sec_context(OM_uint32 *minor_status, time_rec); } + *context_handle = (gss_ctx_id_t)ctx_handle; *minor_status = gpm_map_error(min); return maj; } diff --git a/proxy/src/mechglue/gss_plugin.h b/proxy/src/mechglue/gss_plugin.h index 3ab5c98..921bcd3 100644 --- a/proxy/src/mechglue/gss_plugin.h +++ b/proxy/src/mechglue/gss_plugin.h @@ -33,6 +33,11 @@ struct gpm_cred_handle { gss_cred_id_t local_cred_handle; }; +struct gpm_context_handle { + gssx_ctx *remote_ctx_handle; + gss_ctx_id_t local_ctx_handle; +}; + extern const gss_OID_desc gssproxy_mech_interposer; gss_OID_set gss_mech_interposer(gss_OID mech_type); diff --git a/proxy/src/mechglue/gssapi_gpm.h b/proxy/src/mechglue/gssapi_gpm.h index 06853c1..e4281d2 100644 --- a/proxy/src/mechglue/gssapi_gpm.h +++ b/proxy/src/mechglue/gssapi_gpm.h @@ -148,7 +148,7 @@ OM_uint32 gpm_inquire_name(OM_uint32 *minor_status, OM_uint32 gpm_init_sec_context(OM_uint32 *minor_status, gssx_cred *cred_handle, - gss_ctx_id_t *context_handle, + gssx_ctx **context_handle, gss_name_t target_name, gss_OID mech_type, OM_uint32 req_flags, |