From e598066985f77d76dd221c3c60a87cabecab1f0f Mon Sep 17 00:00:00 2001 From: John Kohl Date: Mon, 23 Apr 1990 16:54:42 +0000 Subject: [PATCH] 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 --- src/kdc/dispatch.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) 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; } -- 2.26.2