summaryrefslogtreecommitdiffstats
path: root/proxy/src/gp_rpc_init_sec_context.c
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-11-15 10:33:52 -0500
committerGünther Deschner <gdeschner@redhat.com>2013-11-19 14:34:47 +0100
commit556ea844a5783f9876ee748e1c686bb268f54e8a (patch)
treee21df0795873b1f5a77b6e82bc4d8d69dee99ee2 /proxy/src/gp_rpc_init_sec_context.c
parentb8901d1d20a5d0ef1a3118bfe5816e04c09e6cf5 (diff)
downloadgss-proxy-556ea844a5783f9876ee748e1c686bb268f54e8a.tar.gz
gss-proxy-556ea844a5783f9876ee748e1c686bb268f54e8a.tar.xz
gss-proxy-556ea844a5783f9876ee748e1c686bb268f54e8a.zip
Fix continuations in context establishment calls
Properly support continuations, including returning the rigth error code and exporting partial contexts. Fixes multistep authentications in particular for the initialization case which always uses continuations. Resolves: https://fedorahosted.org/gss-proxy/ticket/108 Reviewed-by: Günther Deschner <gdeschner@redhat.com>
Diffstat (limited to 'proxy/src/gp_rpc_init_sec_context.c')
-rw-r--r--proxy/src/gp_rpc_init_sec_context.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/proxy/src/gp_rpc_init_sec_context.c b/proxy/src/gp_rpc_init_sec_context.c
index 944389c..2781238 100644
--- a/proxy/src/gp_rpc_init_sec_context.c
+++ b/proxy/src/gp_rpc_init_sec_context.c
@@ -45,6 +45,8 @@ int gp_init_sec_context(struct gp_call_ctx *gpcall,
gss_buffer_desc obuf = GSS_C_EMPTY_BUFFER;
uint32_t ret_maj;
uint32_t ret_min;
+ uint32_t init_maj;
+ uint32_t init_min;
int exp_ctx_type;
int ret;
@@ -121,6 +123,12 @@ int gp_init_sec_context(struct gp_call_ctx *gpcall,
if (ret_maj != GSS_S_COMPLETE &&
ret_maj != GSS_S_CONTINUE_NEEDED) {
goto done;
+ } else {
+ init_maj = ret_maj;
+ init_min = ret_min;
+ }
+ if (init_maj == GSS_S_CONTINUE_NEEDED) {
+ exp_ctx_type = gp_get_continue_needed_type();
}
iscr->context_handle = calloc(1, sizeof(gssx_ctx));
@@ -129,7 +137,7 @@ int gp_init_sec_context(struct gp_call_ctx *gpcall,
ret_min = ENOMEM;
goto done;
}
- ret_maj = gp_export_ctx_id_to_gssx(&ret_min, exp_ctx_type,
+ ret_maj = gp_export_ctx_id_to_gssx(&ret_min, exp_ctx_type, mech_type,
&ctx, iscr->context_handle);
if (ret_maj) {
goto done;
@@ -150,7 +158,13 @@ int gp_init_sec_context(struct gp_call_ctx *gpcall,
}
}
+ ret_maj = GSS_S_COMPLETE;
+
done:
+ if (ret_maj == GSS_S_COMPLETE) {
+ ret_maj = init_maj;
+ ret_min = init_min;
+ }
ret = gp_conv_status_to_gssx(&isca->call_ctx,
ret_maj, ret_min, mech_type,
&iscr->status);