diff options
author | Simo Sorce <simo@redhat.com> | 2013-03-16 16:51:01 -0400 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2013-03-22 14:14:36 -0400 |
commit | 2364627972cb8bd419dc4a52d66eef6adda4124f (patch) | |
tree | e4e49c6b87e4afdd06765e8cf06b7abc8f96f0f7 /proxy/src/mechglue/gpp_context.c | |
parent | 01b4fbd08ab869ba612935b1058f211965204282 (diff) | |
download | gss-proxy-2364627972cb8bd419dc4a52d66eef6adda4124f.tar.gz gss-proxy-2364627972cb8bd419dc4a52d66eef6adda4124f.tar.xz gss-proxy-2364627972cb8bd419dc4a52d66eef6adda4124f.zip |
Create helper function to wrap token
Wrap the token in a helper function so that the code can be reused elsewhere.
Diffstat (limited to 'proxy/src/mechglue/gpp_context.c')
-rw-r--r-- | proxy/src/mechglue/gpp_context.c | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/proxy/src/mechglue/gpp_context.c b/proxy/src/mechglue/gpp_context.c index 5a3311b..cb3b172 100644 --- a/proxy/src/mechglue/gpp_context.c +++ b/proxy/src/mechglue/gpp_context.c @@ -24,7 +24,6 @@ */ #include "gss_plugin.h" -#include <endian.h> #include <time.h> OM_uint32 gssi_export_sec_context(OM_uint32 *minor_status, @@ -91,28 +90,12 @@ OM_uint32 gssi_import_sec_context_by_mech(OM_uint32 *minor_status, /* NOTE: it makes no sense to import a context remotely atm, * so we only handle the local case for now. */ - spmech = gpp_special_mech(mech_type); - if (spmech == GSS_C_NO_OID) { - maj = GSS_S_FAILURE; - goto done; - } - - wrap_token.length = sizeof(uint32_t) + spmech->length + - interprocess_token->length; - wrap_token.value = malloc(wrap_token.length); - if (!wrap_token.value) { - wrap_token.length = 0; - maj = GSS_S_FAILURE; + maj = gpp_wrap_sec_ctx_token(&min, mech_type, + interprocess_token, &wrap_token); + if (maj != GSS_S_COMPLETE) { goto done; } - len = htobe32(spmech->length); - memcpy(wrap_token.value, &len, sizeof(uint32_t)); - memcpy(wrap_token.value + sizeof(uint32_t), - spmech->elements, spmech->length); - memcpy(wrap_token.value + sizeof(uint32_t) + spmech->length, - interprocess_token->value, interprocess_token->length); - maj = gss_import_sec_context(&min, &wrap_token, &ctx->local); done: |