From 1dd872ca5cac525f335b21965980c10e78c3a39b 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:19 +0000 Subject: [PATCH] Allow numbers to be enctypes to as long as they are valid. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23378 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/crypto.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/krb5/crypto.c b/lib/krb5/crypto.c index d905bb236..0864fdf3b 100644 --- a/lib/krb5/crypto.c +++ b/lib/krb5/crypto.c @@ -1081,12 +1081,22 @@ krb5_string_to_keytype(krb5_context context, const char *string, krb5_keytype *keytype) { + char *end; int i; + for(i = 0; i < num_keytypes; i++) if(strcasecmp(keytypes[i]->name, string) == 0){ *keytype = keytypes[i]->type; return 0; } + + /* check if the enctype is a number */ + *keytype = strtol(string, &end, 0); + if(*end == '\0' && *keytype != 0) { + if (krb5_enctype_valid(context, *keytype) == 0) + return 0; + } + krb5_set_error_message(context, KRB5_PROG_KEYTYPE_NOSUPP, "key type %s not supported", string); return KRB5_PROG_KEYTYPE_NOSUPP;