diff options
author | Simo Sorce <simo@redhat.com> | 2012-03-22 01:21:33 -0400 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2012-04-15 15:00:50 -0400 |
commit | 3639ccb6daceb3538f1d5ecd5eca97474990a104 (patch) | |
tree | 79e31f901b159e42886b4bb3645a4e7cfda0af41 /proxy/src | |
parent | 8d6079526dd9449f85b58e44c42b58caccaeb053 (diff) | |
download | gss-proxy-3639ccb6daceb3538f1d5ecd5eca97474990a104.tar.gz gss-proxy-3639ccb6daceb3538f1d5ecd5eca97474990a104.tar.xz gss-proxy-3639ccb6daceb3538f1d5ecd5eca97474990a104.zip |
Change accept/init_sec_context to use the new export context functions
Diffstat (limited to 'proxy/src')
-rw-r--r-- | proxy/src/gp_export.h | 7 | ||||
-rw-r--r-- | proxy/src/gp_rpc_accept_sec_context.c | 11 | ||||
-rw-r--r-- | proxy/src/gp_rpc_init_sec_context.c | 18 |
3 files changed, 23 insertions, 13 deletions
diff --git a/proxy/src/gp_export.h b/proxy/src/gp_export.h index bef285a..15a6780 100644 --- a/proxy/src/gp_export.h +++ b/proxy/src/gp_export.h @@ -40,11 +40,4 @@ uint32_t gp_export_ctx_id_to_gssx(uint32_t *min, int type, uint32_t gp_import_gssx_to_ctx_id(uint32_t *min, int type, gssx_ctx *in, gss_ctx_id_t *out); -/* Compat fns */ -#define gp_conv_ctx_id_to_gssx(min, in, out) \ - gp_export_ctx_id_to_gssx(min, 0, in, out) -static int32_t dummy_min; -#define gp_conv_gssx_to_ctx_id(in, out) \ - (uint32_t)gp_import_gssx_to_ctx_id(&dummy_min, 0, in, out) - #endif /* _GSS_EXPORT_H_ */ diff --git a/proxy/src/gp_rpc_accept_sec_context.c b/proxy/src/gp_rpc_accept_sec_context.c index 07030e8..664d233 100644 --- a/proxy/src/gp_rpc_accept_sec_context.c +++ b/proxy/src/gp_rpc_accept_sec_context.c @@ -45,11 +45,19 @@ int gp_accept_sec_context(struct gssproxy_ctx *gpctx, uint32_t ret_flags; gss_cred_id_t dch = GSS_C_NO_CREDENTIAL; gss_cred_id_t *pdch = NULL; + int exp_ctx_type; int ret; asca = &arg->accept_sec_context; ascr = &res->accept_sec_context; + exp_ctx_type = gp_get_exported_context_type(&asca->call_ctx); + if (exp_ctx_type == -1) { + ret_maj = GSS_S_FAILURE; + ret_min = EINVAL; + goto done; + } + if (asca->cred_handle) { ret = gp_find_cred(asca->cred_handle, &ach); if (ret) { @@ -105,7 +113,8 @@ int gp_accept_sec_context(struct gssproxy_ctx *gpctx, ret_min = ENOMEM; goto done; } - ret_maj = gp_conv_ctx_id_to_gssx(&ret_min, &ctx, ascr->context_handle); + ret_maj = gp_export_ctx_id_to_gssx(&ret_min, exp_ctx_type, + &ctx, ascr->context_handle); if (ret_maj) { goto done; } diff --git a/proxy/src/gp_rpc_init_sec_context.c b/proxy/src/gp_rpc_init_sec_context.c index d1afe39..76ade3a 100644 --- a/proxy/src/gp_rpc_init_sec_context.c +++ b/proxy/src/gp_rpc_init_sec_context.c @@ -45,16 +45,23 @@ int gp_init_sec_context(struct gssproxy_ctx *gpctx, gss_buffer_desc obuf = GSS_C_EMPTY_BUFFER; uint32_t ret_maj; uint32_t ret_min; + int exp_ctx_type; int ret; isca = &arg->init_sec_context; iscr = &res->init_sec_context; + exp_ctx_type = gp_get_exported_context_type(&isca->call_ctx); + if (exp_ctx_type == -1) { + ret_maj = GSS_S_FAILURE; + ret_min = EINVAL; + goto done; + } + if (isca->context_handle) { - ret = gp_conv_gssx_to_ctx_id(isca->context_handle, &ctx); - if (ret) { - ret_maj = GSS_S_NO_CONTEXT; - ret_min = ret; + ret_maj = gp_import_gssx_to_ctx_id(&ret_min, 0, + isca->context_handle, &ctx); + if (ret_maj) { goto done; } } @@ -116,7 +123,8 @@ int gp_init_sec_context(struct gssproxy_ctx *gpctx, ret_min = ENOMEM; goto done; } - ret_maj = gp_conv_ctx_id_to_gssx(&ret_min, &ctx, iscr->context_handle); + ret_maj = gp_export_ctx_id_to_gssx(&ret_min, exp_ctx_type, + &ctx, iscr->context_handle); if (ret_maj) { goto done; } |