summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2012-02-08 10:54:11 -0500
committerSimo Sorce <simo@redhat.com>2012-02-09 01:43:03 -0500
commitee9b3fc03fffb13225f2217303a18bc7703e6dbf (patch)
tree7c1c415a69138f1f6cdcd4e9bf5a2e99cb722add
parent9907bfd3384e3b04b97c42063cfe8adc3324d7d0 (diff)
downloadgss-proxy-ee9b3fc03fffb13225f2217303a18bc7703e6dbf.tar.gz
gss-proxy-ee9b3fc03fffb13225f2217303a18bc7703e6dbf.tar.xz
gss-proxy-ee9b3fc03fffb13225f2217303a18bc7703e6dbf.zip
Test init_sec_context
-rw-r--r--proxy/tests/cli_srv_comm.c47
1 files changed, 25 insertions, 22 deletions
diff --git a/proxy/tests/cli_srv_comm.c b/proxy/tests/cli_srv_comm.c
index c8268a5..2d7d3eb 100644
--- a/proxy/tests/cli_srv_comm.c
+++ b/proxy/tests/cli_srv_comm.c
@@ -204,6 +204,7 @@ void *client_thread(void *pvt)
gss_buffer_desc out_token = GSS_C_EMPTY_BUFFER;
gss_name_t name = GSS_C_NO_NAME;
gss_ctx_id_t ctx = GSS_C_NO_CONTEXT;
+ gss_cred_id_t cred_handle = GSS_C_NO_CREDENTIAL;
int ret = 0;
data = (struct athread *)pvt;
@@ -211,15 +212,15 @@ void *client_thread(void *pvt)
target_buf.value = (void *)data->target;
target_buf.length = strlen(data->target) + 1;
- ret_maj = gss_import_name(&ret_min, &target_buf,
+ ret_maj = gpm_import_name(&ret_min, &target_buf,
GSS_C_NT_HOSTBASED_SERVICE, &name);
if (ret_maj) {
goto done;
}
do {
- ret_maj = gss_init_sec_context(&ret_min,
- GSS_C_NO_CREDENTIAL,
+ ret_maj = gpm_init_sec_context(&ret_min,
+ cred_handle,
&ctx,
name,
GSS_C_NO_OID,
@@ -231,42 +232,44 @@ void *client_thread(void *pvt)
&out_token,
NULL,
NULL);
- if (ret_maj == GSS_S_COMPLETE) {
- break;
- }
- if (ret_maj != GSS_S_CONTINUE_NEEDED) {
+ if (ret_maj != GSS_S_COMPLETE &&
+ ret_maj != GSS_S_CONTINUE_NEEDED) {
fprintf(stdout,
"gss_init_sec_context() failed with: %d\n", ret_maj);
goto done;
}
- if (!ctx) {
- goto done;
+ if (out_token.length != 0) {
+ /* send to server */
+ ret = gp_send_buffer(data->srv_pipe[1],
+ out_token.value, out_token.length);
+ if (ret) {
+ goto done;
+ }
+
+ gss_release_buffer(&ret_min, &out_token);
}
- /* send to server */
- ret = gp_send_buffer(data->srv_pipe[1],
- out_token.value, out_token.length);
- if (ret) {
+ if (!ctx) {
goto done;
}
- gss_release_buffer(&ret_min, &out_token);
+ if (ret_maj == GSS_S_CONTINUE_NEEDED) {
+ /* and wait for reply */
+ ret = gp_recv_buffer(data->cli_pipe[0], buffer, &buflen);
+ if (ret) {
+ goto done;
+ }
- /* and wait for reply */
- ret = gp_recv_buffer(data->cli_pipe[0], buffer, &buflen);
- if (ret) {
- goto done;
+ in_token.value = buffer;
+ in_token.length = buflen;
}
- in_token.value = buffer;
- in_token.length = buflen;
-
} while (ret_maj == GSS_S_CONTINUE_NEEDED);
fprintf(stdout, "client: Success!\n");
done:
- gss_release_name(&ret_min, &name);
+ gpm_release_name(&ret_min, &name);
gss_release_buffer(&ret_min, &out_token);
close(data->cli_pipe[0]);
close(data->srv_pipe[1]);