From: John Kohl Date: Mon, 23 Apr 1990 16:54:42 +0000 (+0000) Subject: add const to args X-Git-Tag: krb5-1.0-alpha2~839 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e598066985f77d76dd221c3c60a87cabecab1f0f;p=krb5.git add const to args rearrange code to use new macros to predetermine packet types. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@556 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/kdc/dispatch.c b/src/kdc/dispatch.c index 7c0a682e9..2365ecbd0 100644 --- a/src/kdc/dispatch.c +++ b/src/kdc/dispatch.c @@ -25,8 +25,8 @@ static char rcsid_dispatch_c[] = krb5_error_code dispatch(pkt, from, response) -krb5_data *pkt; -krb5_fulladdr *from; +const krb5_data *pkt; +const krb5_fulladdr *from; krb5_data **response; { @@ -35,29 +35,23 @@ krb5_data **response; krb5_tgs_req *tgs_req; /* decode incoming packet, and dispatch */ - if (pkt->data[0] == 4) /* XXX old version */ - return(process_v4(pkt)); - /* try TGS_REQ first; they are more common! */ - retval = decode_krb5_tgs_req(pkt, &tgs_req); - switch (retval) { - case ISODE_50_LOCAL_ERR_BADDECODE: - retval = decode_krb5_as_req(pkt, &as_req); - switch (retval) { - case 0: + if (krb5_is_tgs_req(pkt)) { + if (!(retval = decode_krb5_tgs_req(pkt, &tgs_req))) { + /* it's now decoded, but still has an encrypted part to work on */ + if (!(retval = decrypt_tgs_req(tgs_req, from))) + retval = process_tgs_req(tgs_req, from, response); + krb5_free_tgs_req(tgs_req); + } + } else if (krb5_is_as_req(pkt)) { + if (!(retval = decode_krb5_as_req(pkt, &as_req))) { retval = process_as_req(as_req, from, response); krb5_free_as_req(as_req); - break; - default: - return(retval); } - case 0: - /* it's now decoded, but still has an encrypted part to work on */ - if (!(retval = decrypt_tgs_req(tgs_req, from))) - retval = process_tgs_req(tgs_req, from, response); - krb5_free_tgs_req(tgs_req); - break; - } + } else if (pkt->data[0] == 4) /* XXX old version */ + return(process_v4(pkt)); + else + retval = KRB5KRB_AP_ERR_MSG_TYPE; return retval; }