From 739b82b2646fc82e06edef7d604ca9da3fd48058 Mon Sep 17 00:00:00 2001 From: John Kohl Date: Fri, 2 Feb 1990 08:57:43 +0000 Subject: [PATCH] convert to use valid_etype macro git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@229 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/krb/decode_kdc.c | 4 +--- src/lib/krb5/krb/decrypt_tk.c | 4 +--- src/lib/krb5/krb/encode_kdc.c | 4 ++++ src/lib/krb5/krb/encrypt_tk.c | 4 +--- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/lib/krb5/krb/decode_kdc.c b/src/lib/krb5/krb/decode_kdc.c index b9fedde4c..7a7aaad23 100644 --- a/src/lib/krb5/krb/decode_kdc.c +++ b/src/lib/krb5/krb/decode_kdc.c @@ -79,9 +79,7 @@ krb5_kdc_rep **dec_rep; return(ENOMEM); } - if (local_dec_rep->etype > max_cryptosystem || - local_dec_rep->etype < 0 || - !csarray[local_dec_rep->etype]) + if (!valid_etype(local_dec_rep->etype)) return KRB5KDC_ERR_ETYPE_NOSUPP; /* put together an eblock for this encryption */ diff --git a/src/lib/krb5/krb/decrypt_tk.c b/src/lib/krb5/krb/decrypt_tk.c index aae30a095..1801c552b 100644 --- a/src/lib/krb5/krb/decrypt_tk.c +++ b/src/lib/krb5/krb/decrypt_tk.c @@ -49,9 +49,7 @@ register krb5_ticket *ticket; krb5_data scratch; krb5_error_code retval; - if (ticket->etype > max_cryptosystem || - ticket->etype < 0 || - !csarray[ticket->etype]) + if (!valid_etype(ticket->etype)) return KRB5KDC_ERR_ETYPE_NOSUPP; /* put together an eblock for this encryption */ diff --git a/src/lib/krb5/krb/encode_kdc.c b/src/lib/krb5/krb/encode_kdc.c index b9e5b758d..62546db20 100644 --- a/src/lib/krb5/krb/encode_kdc.c +++ b/src/lib/krb5/krb/encode_kdc.c @@ -26,6 +26,7 @@ static char rcsid_encode_kdc_c [] = /* array of pointers into encryption systems */ extern krb5_cs_table_entry *csarray[]; +extern int max_cryptosystem; /* max entry in array */ /* Takes KDC rep parts in *rep and *encpart, and formats it into *enc_rep, @@ -51,6 +52,9 @@ krb5_data **enc_rep; krb5_encrypt_block eblock; krb5_error_code retval; + if (!valid_etype(dec_rep->etype)) + return KRB5KDC_ERR_ETYPE_NOSUPP; + switch (type) { case KRB5_AS_REP: case KRB5_TGS_REP: diff --git a/src/lib/krb5/krb/encrypt_tk.c b/src/lib/krb5/krb/encrypt_tk.c index faf393714..a2b141ccb 100644 --- a/src/lib/krb5/krb/encrypt_tk.c +++ b/src/lib/krb5/krb/encrypt_tk.c @@ -51,9 +51,7 @@ register krb5_ticket *dec_ticket; /* encrypt the encrypted part */ - if (dec_ticket->etype > max_cryptosystem || - dec_ticket->etype < 0 || - !csarray[dec_ticket->etype]) + if (!valid_etype(dec_ticket->etype)) return KRB5KDC_ERR_ETYPE_NOSUPP; /* start by encoding the to-be-encrypted part. */ -- 2.26.2