From: Zhanna Tsitkov Date: Mon, 23 Sep 2013 21:25:13 +0000 (-0400) Subject: Re-factoring of service processing code in AS-REQ X-Git-Tag: krb5-1.12-alpha1~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf6734efe7ddedd302fc126e4c4e13764c276d23;p=thirdparty%2Fkrb5.git Re-factoring of service processing code in AS-REQ Take one step toward re-factoring of the KDC code: keep the service principal related code in one place. The code pattern was changed from: - unparse client - - unparse service - - db_get_ client - - client referrals - - db_get_ service - - validate policies etc into: - unparse client - - db_get_ client - - client referrals - - unparse service - - db_get_ service - - validate policies etc --- diff --git a/src/kdc/do_as_req.c b/src/kdc/do_as_req.c index 8790ec4032..036840739c 100644 --- a/src/kdc/do_as_req.c +++ b/src/kdc/do_as_req.c @@ -516,18 +516,6 @@ process_as_req(krb5_kdc_req *request, krb5_data *req_pkt, goto errout; } limit_string(state->cname); - 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 @@ -575,6 +563,18 @@ process_as_req(krb5_kdc_req *request, krb5_data *req_pkt, goto errout; } + 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); s_flags = 0; setflag(s_flags, KRB5_KDB_FLAG_ALIAS_OK); if (isflagset(state->request->kdc_options, KDC_OPT_CANONICALIZE)) {