summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-12-15 20:43:29 -0500
committerSimo Sorce <simo@redhat.com>2013-12-15 21:10:20 -0500
commit8f99637195b6b7f29f1e6316c4de0a4f962d44f2 (patch)
treeb77e7c5e95cae61531488a7023e0c524b3e01551 /tests
parent23a45a4d4de4290ed9eb960881e8caf0a39a92f3 (diff)
downloadgss-ntlmssp-8f99637195b6b7f29f1e6316c4de0a4f962d44f2.tar.gz
gss-ntlmssp-8f99637195b6b7f29f1e6316c4de0a4f962d44f2.tar.xz
gss-ntlmssp-8f99637195b6b7f29f1e6316c4de0a4f962d44f2.zip
Test export/import context functionsexport_ctx
Diffstat (limited to 'tests')
-rw-r--r--tests/ntlmssptest.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/ntlmssptest.c b/tests/ntlmssptest.c
index f8af5d4..638da62 100644
--- a/tests/ntlmssptest.c
+++ b/tests/ntlmssptest.c
@@ -1115,6 +1115,7 @@ int test_gssapi_1(bool user_env_file)
uint32_t retmin, retmaj;
char *msg = "Sample, signature checking, message.";
gss_buffer_desc message = { strlen(msg), msg };
+ gss_buffer_desc ctx_token;
int ret;
setenv("NTLM_USER_FILE", TEST_USER_FILE, 0);
@@ -1219,6 +1220,23 @@ int test_gssapi_1(bool user_env_file)
gss_release_buffer(&retmin, &cli_token);
+ /* test importing and exporting context before it is fully estabished */
+ retmaj = gssntlm_export_sec_context(&retmin, &srv_ctx, &ctx_token);
+ if (retmaj != GSS_S_COMPLETE) {
+ fprintf(stderr, "gssntlm_export_sec_context 1 failed! (%d/%d, %s)",
+ retmaj, retmin, strerror(retmin));
+ ret = EINVAL;
+ goto done;
+ }
+ retmaj = gssntlm_import_sec_context(&retmin, &ctx_token, &srv_ctx);
+ if (retmaj != GSS_S_COMPLETE) {
+ fprintf(stderr, "gssntlm_import_sec_context 1 failed! (%d/%d, %s)",
+ retmaj, retmin, strerror(retmin));
+ ret = EINVAL;
+ goto done;
+ }
+ gss_release_buffer(&retmin, &ctx_token);
+
retmaj = gssntlm_init_sec_context(&retmin, cli_cred, &cli_ctx,
gss_srvname, GSS_C_NO_OID,
GSS_C_CONF_FLAG | GSS_C_INTEG_FLAG,
@@ -1248,6 +1266,23 @@ int test_gssapi_1(bool user_env_file)
gss_release_buffer(&retmin, &cli_token);
gss_release_buffer(&retmin, &srv_token);
+ /* test importing and exporting context after it is fully estabished */
+ retmaj = gssntlm_export_sec_context(&retmin, &cli_ctx, &ctx_token);
+ if (retmaj != GSS_S_COMPLETE) {
+ fprintf(stderr, "gssntlm_export_sec_context 2 failed! (%d/%d, %s)",
+ retmaj, retmin, strerror(retmin));
+ ret = EINVAL;
+ goto done;
+ }
+ retmaj = gssntlm_import_sec_context(&retmin, &ctx_token, &cli_ctx);
+ if (retmaj != GSS_S_COMPLETE) {
+ fprintf(stderr, "gssntlm_import_sec_context 2 failed! (%d/%d, %s)",
+ retmaj, retmin, strerror(retmin));
+ ret = EINVAL;
+ goto done;
+ }
+ gss_release_buffer(&retmin, &ctx_token);
+
retmaj = gssntlm_get_mic(&retmin, cli_ctx, 0, &message, &cli_token);
if (retmaj != GSS_S_COMPLETE) {
fprintf(stderr, "gssntlm_get_mic(cli) failed! (%d/%d, %s)",