diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/kdc/dispatch.c | 36 |
1 files 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; } |
