From d0cc9002eded9ba2fd06a446881830ce996cb34d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Sun, 10 Apr 2005 14:47:41 +0000 Subject: [PATCH] print out client principla of delegated credential git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14762 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/test/gssapi_server.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/appl/test/gssapi_server.c b/appl/test/gssapi_server.c index eb535a8f7..40097a9bb 100644 --- a/appl/test/gssapi_server.c +++ b/appl/test/gssapi_server.c @@ -201,7 +201,7 @@ proto (int sock, const char *service) output_token, NULL, NULL, - /*&delegated_cred_handle*/ NULL); + &delegated_cred_handle); if(GSS_ERROR(maj_stat)) gss_err (1, min_stat, "gss_accept_sec_context"); if (output_token->length != 0) @@ -230,11 +230,26 @@ proto (int sock, const char *service) if (delegated_cred_handle != GSS_C_NO_CREDENTIAL) { krb5_context context; + printf("Delegated cred found\n"); + maj_stat = krb5_init_context(&context); maj_stat = krb5_cc_resolve(context, "FILE:/tmp/krb5cc_test", &ccache); maj_stat = gss_krb5_copy_ccache(&min_stat, delegated_cred_handle, ccache); + if (maj_stat == 0) { + krb5_principal p; + maj_stat = krb5_cc_get_principal(context, ccache, &p); + if (maj_stat == 0) { + char *name; + maj_stat = krb5_unparse_name(context, p, &name); + if (maj_stat == 0) { + printf("Delegated user is: `%s'\n", name); + free(name); + } + krb5_free_principal(context, p); + } + } krb5_cc_close(context, ccache); gss_release_cred(&min_stat, &delegated_cred_handle); }