}
limit_string(state->sname);
+ if (!state->request->server) {
+ state->status = "NULL_SERVER";
+ errcode = KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN;
+ goto errout;
+ }
+ if ((errcode = krb5_unparse_name(kdc_context,
+ state->request->server,
+ &state->sname))) {
+ state->status = "UNPARSING_SERVER";
+ goto errout;
+ }
+ limit_string(state->sname);
+
/*
* We set KRB5_KDB_FLAG_CLIENT_REFERRALS_ONLY as a hint
* to the backend to return naming information in lieu
session_key.contents = NULL;
retval = decode_krb5_tgs_req(pkt, &request);
+ /* Save pointer to client-requested service principal, in case of errors
+ * before a successful call to search_sprinc(). */
+ sprinc = request->server;
if (retval)
return retval;
if (request->msg_type != KRB5_TGS_REQ) {
scratch.data = (char *) pa_tgs_req->contents;
errcode = kdc_find_fast(&request, &scratch, subkey,
header_ticket->enc_part2->session, state, NULL);
+ /* Reset sprinc because kdc_find_fast() can replace request. */
+ sprinc = request->server;
if (errcode !=0) {
status = "kdc_find_fast";
goto cleanup;