aboutsummaryrefslogtreecommitdiff
path: root/src/kdc/dispatch.c
diff options
context:
space:
mode:
authorJohn Kohl <jtkohl@mit.edu>1990-04-23 16:54:42 +0000
committerJohn Kohl <jtkohl@mit.edu>1990-04-23 16:54:42 +0000
commite598066985f77d76dd221c3c60a87cabecab1f0f (patch)
tree4ddd6f162b87a4b6721c3eab6a603c3032608ef3 /src/kdc/dispatch.c
parent99c3d088ce68c9ae807a92be3cc49179c12454a8 (diff)
downloadkrb5-e598066985f77d76dd221c3c60a87cabecab1f0f.zip
krb5-e598066985f77d76dd221c3c60a87cabecab1f0f.tar.gz
krb5-e598066985f77d76dd221c3c60a87cabecab1f0f.tar.bz2
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
Diffstat (limited to 'src/kdc/dispatch.c')
-rw-r--r--src/kdc/dispatch.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/kdc/dispatch.c b/src/kdc/dispatch.c
index 7c0a682..2365ecb 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;
}