+2003-05-23 Sam Hartman <hartmans@mit.edu>
+
+ * kdc_preauth.c (_make_etype_info_entry): Add flag to know if we
+ are producing etype_info2 so we know whether filling in s2kparams
+ is allowed. In the etype_info2 case support afs3 salts.
+ (etype_info_helper): Pass in flag
+ (return_etype_info2): And here
+
2003-05-23 Ezra Peisach <epeisach@mit.edu>
* kdc_preauth.c (return_etype_info2): After encoding the
}
static krb5_error_code
-_make_etype_info_entry(context, request, client_key, etype, entry)
- krb5_context context;
- krb5_kdc_req * request;
- krb5_key_data * client_key;
- const krb5_enctype etype;
- krb5_etype_info_entry ** entry;
+_make_etype_info_entry(krb5_context context,
+ krb5_kdc_req *request, krb5_key_data *client_key,
+ krb5_enctype etype, krb5_etype_info_entry **entry,
+ int etype_info2)
{
krb5_data salt;
krb5_etype_info_entry * tmp_entry;
client_key, &salt);
if (retval)
goto fail;
+ if (etype_info2 && client_key->key_data_ver > 1 &&
+ client_key->key_data_type[1] == KRB5_KDB_SALTTYPE_AFS3) {
+ switch (etype) {
+ case ENCTYPE_DES_CBC_CRC:
+ case ENCTYPE_DES_CBC_MD4:
+ case ENCTYPE_DES_CBC_MD5:
+ tmp_entry->s2kparams.data = malloc(1);
+ if (tmp_entry->s2kparams.data == NULL) {
+ retval = ENOMEM;
+ goto fail;
+ }
+ tmp_entry->s2kparams.length = 1;
+ tmp_entry->s2kparams.data[0] = 1;
+ break;
+ default:
+ break;
+ }
+ }
if (salt.length >= 0) {
tmp_entry->length = salt.length;
return 0;
fail:
- if (tmp_entry)
+ if (tmp_entry) {
+ if (tmp_entry->s2kparams.data)
+ free(tmp_entry->s2kparams.data);
free(tmp_entry);
+ }
if (salt.data)
free(salt.data);
return retval;
assert(etype_info2 ||
!enctype_requires_etype_info_2(db_etype));
if ((retval = _make_etype_info_entry(context, request, client_key,
- db_etype, &entry[i])) != 0) {
+ db_etype, &entry[i], etype_info2)) != 0) {
goto cleanup;
}
entry[i+1] = 0;
}
if (request_contains_enctype(context, request, db_etype)) {
if ((retval = _make_etype_info_entry(context, request,
- client_key, db_etype, &entry[i])) != 0) {
+ client_key, db_etype, &entry[i], etype_info2)) != 0) {
goto cleanup;
}
entry[i+1] = 0;
entry[0] = NULL;
entry[1] = NULL;
retval = _make_etype_info_entry(context, request, client_key, client_key->key_data_type[0],
- entry);
+ entry, 1);
if (retval)
goto cleanup;
retval = encode_krb5_etype_info2((const krb5_etype_info_entry **) entry, &scratch);