krb5 commit: Re-factoring of service processing code in AS-REQ

Zhanna A Tsitkova tsitkova at MIT.EDU
Mon Sep 23 17:57:14 EDT 2013


https://github.com/krb5/krb5/commit/bf6734efe7ddedd302fc126e4c4e13764c276d23
commit bf6734efe7ddedd302fc126e4c4e13764c276d23
Author: Zhanna Tsitkov <tsitkova at mit.edu>
Date:   Mon Sep 23 17:25:13 2013 -0400

    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

 src/kdc/do_as_req.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/kdc/do_as_req.c b/src/kdc/do_as_req.c
index 8790ec4..0368407 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)) {


More information about the cvs-krb5 mailing list