useenctype, -1, 0, &client_key))
break;
}
- if (!(client_key)) {
- /* Cannot find an appropriate key */
- state->status = "CANT_FIND_CLIENT_KEY";
- errcode = KRB5KDC_ERR_ETYPE_NOSUPP;
- goto egress;
- }
- state->rock.client_key = client_key;
- /* convert client.key_data into a real key */
- if ((errcode = krb5_dbe_decrypt_key_data(kdc_context, NULL,
- client_key,
- &state->client_keyblock,
- NULL))) {
- state->status = "DECRYPT_CLIENT_KEY";
- goto egress;
+ if (client_key != NULL) {
+ /* Decrypt the client key data entry to get the real reply key. */
+ errcode = krb5_dbe_decrypt_key_data(kdc_context, NULL, client_key,
+ &state->client_keyblock, NULL);
+ if (errcode) {
+ state->status = "DECRYPT_CLIENT_KEY";
+ goto egress;
+ }
+ state->client_keyblock.enctype = useenctype;
+ state->rock.client_key = client_key;
}
- state->client_keyblock.enctype = useenctype;
/* Start assembling the response */
state->reply.msg_type = KRB5_AS_REP;
goto egress;
}
+ /* If we didn't find a client long-term key and no preauth mechanism
+ * replaced the reply key, error out now. */
+ if (state->client_keyblock.enctype == ENCTYPE_NULL) {
+ state->status = "CANT_FIND_CLIENT_KEY";
+ errcode = KRB5KDC_ERR_ETYPE_NOSUPP;
+ goto egress;
+ }
+
errcode = handle_authdata(kdc_context,
state->c_flags,
state->client,
&state->reply_encpart, 0,
as_encrypting_key,
&state->reply, &response);
- state->reply.enc_part.kvno = client_key->key_data_kvno;
+ if (client_key != NULL)
+ state->reply.enc_part.kvno = client_key->key_data_kvno;
if (errcode) {
state->status = "ENCODE_KDC_REP";
goto egress;
krb5_etype_info_entry **entry = NULL;
krb5_data *scratch = NULL;
+ if (client_key == NULL)
+ return 0;
+
/*
* Skip PA-ETYPE-INFO completely if AS-REQ lists any "newer"
* enctypes.
krb5_key_data * client_key = rock->client_key;
int i;
+ if (client_key == NULL)
+ return 0;
+
for (i = 0; i < request->nktypes; i++) {
if (enctype_requires_etype_info_2(request->ktype[i]))
return 0;