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
This commit is contained in:
Love Hörnquist Åstrand
2008-07-24 20:02:19 +00:00
parent 6223a7ba18
commit 1dd872ca5c

View File

@@ -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;