diff options
author | Simo Sorce <simo@redhat.com> | 2012-02-05 19:05:01 -0500 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2012-02-05 20:43:13 -0500 |
commit | 09e04bcdf2a6da81f6a7edad8d105ed81205b151 (patch) | |
tree | 91f981bb6902f90e0f0b2adc4290208f9b61216b | |
parent | 484fa6386f322cbb93412bfd43b27476e655072f (diff) | |
download | gss-proxy-09e04bcdf2a6da81f6a7edad8d105ed81205b151.tar.gz gss-proxy-09e04bcdf2a6da81f6a7edad8d105ed81205b151.tar.xz gss-proxy-09e04bcdf2a6da81f6a7edad8d105ed81205b151.zip |
Fix accept_sec_context to properly return src_name
-rw-r--r-- | proxy/src/gp_conv.c | 47 | ||||
-rw-r--r-- | proxy/src/gp_conv.h | 2 | ||||
-rw-r--r-- | proxy/src/mechglue/gpm_accept_sec_context.c | 8 |
3 files changed, 57 insertions, 0 deletions
diff --git a/proxy/src/gp_conv.c b/proxy/src/gp_conv.c index 4f06987..f93f48e 100644 --- a/proxy/src/gp_conv.c +++ b/proxy/src/gp_conv.c @@ -631,3 +631,50 @@ int gp_conv_oid_set_to_gssx(gss_OID_set in, gssx_OID_set *out) return 0; } + +int gp_copy_gssx_name_alloc(gssx_name *in, gssx_name **out) +{ + gssx_name *o; + int ret; + + o = calloc(1, sizeof(gssx_name)); + if (!o) { + return ENOMEM; + } + + if (in->display_name) { + ret = gp_conv_octet_string_alloc(in->display_name->octet_string_len, + in->display_name->octet_string_val, + &o->display_name); + if (ret) { + goto done; + } + } + ret = gp_conv_octet_string(in->name_type.octet_string_len, + in->name_type.octet_string_val, + &o->name_type); + if (ret) { + goto done; + } + ret = gp_conv_octet_string(in->exported_name.octet_string_len, + in->exported_name.octet_string_val, + &o->exported_name); + if (ret) { + goto done; + } + ret = gp_conv_octet_string(in->exported_composite_name.octet_string_len, + in->exported_composite_name.octet_string_val, + &o->exported_composite_name); + if (ret) { + goto done; + } + + *out = o; + +done: + if (ret) { + xdr_free((xdrproc_t)xdr_gssx_name, (char *)o); + free(o); + } + return ret; +} diff --git a/proxy/src/gp_conv.h b/proxy/src/gp_conv.h index 110970a..02c8c52 100644 --- a/proxy/src/gp_conv.h +++ b/proxy/src/gp_conv.h @@ -68,4 +68,6 @@ int gp_copy_gssx_status_alloc(gssx_status *in, gssx_status **out); int gp_conv_gssx_to_oid_set(gssx_OID_set *in, gss_OID_set *out); int gp_conv_oid_set_to_gssx(gss_OID_set in, gssx_OID_set *out); +int gp_copy_gssx_name_alloc(gssx_name *in, gssx_name **out); + #endif /* _GSS_CONV_H_ */ diff --git a/proxy/src/mechglue/gpm_accept_sec_context.c b/proxy/src/mechglue/gpm_accept_sec_context.c index 3075938..11637c9 100644 --- a/proxy/src/mechglue/gpm_accept_sec_context.c +++ b/proxy/src/mechglue/gpm_accept_sec_context.c @@ -24,6 +24,7 @@ */ #include "gssapi_gpm.h" +#include "src/gp_conv.h" OM_uint32 gpm_accept_sec_context(OM_uint32 *minor_status, gss_ctx_id_t *context_handle, @@ -104,6 +105,13 @@ OM_uint32 gpm_accept_sec_context(OM_uint32 *minor_status, res->context_handle = NULL; } + if (src_name) { + ret = gp_copy_gssx_name_alloc(&ctx->src_name, &name); + if (ret) { + goto done; + } + } + ret = gp_conv_gssx_to_buffer_alloc(res->output_token, &outbuf); if (ret) { goto done; |