fix bugs, improve error reporting
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13140 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -183,13 +183,6 @@ _krb5_pk_create_sign(krb5_context context,
|
|||||||
|
|
||||||
sd.version = 3;
|
sd.version = 3;
|
||||||
|
|
||||||
/* for win2k we have to use a different object identifier */
|
|
||||||
if (context->pkinit_win2k_compatible) {
|
|
||||||
oid = &pkcs7_data_oid;
|
|
||||||
} else {
|
|
||||||
oid = &heim_pkauthdata_oid;
|
|
||||||
}
|
|
||||||
|
|
||||||
sd.digestAlgorithms.len = 0;
|
sd.digestAlgorithms.len = 0;
|
||||||
sd.digestAlgorithms.val = NULL;
|
sd.digestAlgorithms.val = NULL;
|
||||||
copy_oid(oid, &sd.encapContentInfo.eContentType);
|
copy_oid(oid, &sd.encapContentInfo.eContentType);
|
||||||
@@ -975,14 +968,17 @@ get_reply_key(krb5_context context,
|
|||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
if (oid_cmp(eContentType, &heim_pkrkeydata_oid) != 0)
|
if (oid_cmp(eContentType, &heim_pkrkeydata_oid) != 0) {
|
||||||
|
krb5_set_error_string(context, "PKINIT, reply key, wrong oid");
|
||||||
return KRB5KRB_AP_ERR_MSG_TYPE;
|
return KRB5KRB_AP_ERR_MSG_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
ret = decode_ReplyKeyPack(eContent->data,
|
ret = decode_ReplyKeyPack(eContent->data,
|
||||||
eContent->length,
|
eContent->length,
|
||||||
&key_pack,
|
&key_pack,
|
||||||
&size);
|
&size);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
krb5_set_error_string(context, "PKINIT decoding reply key failed");
|
||||||
free_ReplyKeyPack(&key_pack);
|
free_ReplyKeyPack(&key_pack);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -994,6 +990,7 @@ get_reply_key(krb5_context context,
|
|||||||
|
|
||||||
*key = malloc (sizeof (**key));
|
*key = malloc (sizeof (**key));
|
||||||
if (*key == NULL) {
|
if (*key == NULL) {
|
||||||
|
krb5_set_error_string(context, "PKINIT failed allocating reply key");
|
||||||
free_ReplyKeyPack(&key_pack);
|
free_ReplyKeyPack(&key_pack);
|
||||||
krb5_set_error_string(context, "malloc: out of memory");
|
krb5_set_error_string(context, "malloc: out of memory");
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
@@ -1001,8 +998,10 @@ get_reply_key(krb5_context context,
|
|||||||
|
|
||||||
ret = copy_EncryptionKey(&key_pack.replyKey, *key);
|
ret = copy_EncryptionKey(&key_pack.replyKey, *key);
|
||||||
free_ReplyKeyPack(&key_pack);
|
free_ReplyKeyPack(&key_pack);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
krb5_set_error_string(context, "PKINIT failed allocating reply key");
|
||||||
free(*key);
|
free(*key);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -1195,10 +1194,8 @@ pk_rd_pa_reply_enckey(krb5_context context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = get_reply_key(context, &eContentType, &eContent, nonce, key);
|
ret = get_reply_key(context, &eContentType, &eContent, nonce, key);
|
||||||
if (ret) {
|
if (ret)
|
||||||
krb5_set_error_string(context, "failed getting reply key: %d", ret);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX compare given etype with key->etype */
|
/* XXX compare given etype with key->etype */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user