From 8cb7ec4b640568adc1bcbdd1c7cd2eb84d915ff9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Thu, 24 Jul 2008 20:02:45 +0000 Subject: [PATCH] Allow checking the session enctype git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23380 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/gssapi/test_context.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/gssapi/test_context.c b/lib/gssapi/test_context.c index 46c263af9..0d43846a6 100644 --- a/lib/gssapi/test_context.c +++ b/lib/gssapi/test_context.c @@ -47,7 +47,8 @@ static int dce_style_flag = 0; static int wrapunwrap_flag = 0; static int getverifymic_flag = 0; static int deleg_flag = 0; -static char *gsskrb5_acceptor_identity; +static char *gsskrb5_acceptor_identity = NULL; +static char *session_enctype_string = NULL; static int version_flag = 0; static int verbose_flag = 0; static int help_flag = 0; @@ -256,6 +257,7 @@ static struct getargs args[] = { "get and verify mic", NULL }, {"delegate",0, arg_flag, &deleg_flag, "delegate credential", NULL }, {"gsskrb5-acceptor-identity", 0, arg_string, &gsskrb5_acceptor_identity, "keytab", NULL }, + {"session-enctype", 0, arg_string, &session_enctype_string, "enctype", NULL }, {"version", 0, arg_flag, &version_flag, "print version", NULL }, {"verbose", 'v', arg_flag, &verbose_flag, "verbose", NULL }, {"help", 0, arg_flag, &help_flag, NULL, NULL } @@ -443,6 +445,22 @@ main(int argc, char **argv) errx(1, "key data mismatch"); } + if (session_enctype_string) { + krb5_enctype enctype; + + ret = krb5_string_to_enctype(context, + session_enctype_string, + &enctype); + + if (ret) + krb5_err(context, 1, ret, "krb5_string_to_enctype"); + + if (enctype != keyblock2->keytype) + errx(1, "keytype is not the expected %d != %d", + (int)enctype, (int)keyblock2->keytype); + } + + if (keyblock) krb5_free_keyblock(context, keyblock); if (keyblock2)