From 6a5fa46b1ff59dbf601d59f8ac2717f8e5ddc6f0 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Thu, 24 Sep 1992 23:27:43 +0000 Subject: [PATCH] Removed some saber lint flames git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2399 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/krb/copy_tick.c | 25 ++++++++++++++++--------- src/lib/krb5/krb/decrypt_tk.c | 16 ++++++++++------ src/lib/krb5/krb/gc_frm_kdc.c | 4 ++-- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/lib/krb5/krb/copy_tick.c b/src/lib/krb5/krb/copy_tick.c index bdb950d44..6cdc5473d 100644 --- a/src/lib/krb5/krb/copy_tick.c +++ b/src/lib/krb5/krb/copy_tick.c @@ -45,12 +45,14 @@ krb5_enc_tkt_part **partto; if (!(tempto = (krb5_enc_tkt_part *)malloc(sizeof(*tempto)))) return ENOMEM; *tempto = *partfrom; - if (retval = krb5_copy_keyblock(partfrom->session, - &tempto->session)) { + retval = krb5_copy_keyblock(partfrom->session, + &tempto->session); + if (retval) { xfree(tempto); return retval; } - if (retval = krb5_copy_principal(partfrom->client, &tempto->client)) { + retval = krb5_copy_principal(partfrom->client, &tempto->client); + if (retval) { krb5_free_keyblock(tempto->session); xfree(tempto); return retval; @@ -72,7 +74,8 @@ krb5_enc_tkt_part **partto; partfrom->transited.tr_contents.length); } - if (retval = krb5_copy_addresses(partfrom->caddrs, &tempto->caddrs)) { + retval = krb5_copy_addresses(partfrom->caddrs, &tempto->caddrs); + if (retval) { xfree(tempto->transited.tr_contents.data); krb5_free_principal(tempto->client); krb5_free_keyblock(tempto->session); @@ -80,8 +83,9 @@ krb5_enc_tkt_part **partto; return retval; } if (partfrom->authorization_data) { - if (retval = krb5_copy_authdata(partfrom->authorization_data, - &tempto->authorization_data)) { + retval = krb5_copy_authdata(partfrom->authorization_data, + &tempto->authorization_data); + if (retval) { krb5_free_addresses(tempto->caddrs); xfree(tempto->transited.tr_contents.data); krb5_free_principal(tempto->client); @@ -106,16 +110,19 @@ krb5_ticket **pto; if (!(tempto = (krb5_ticket *)malloc(sizeof(*tempto)))) return ENOMEM; *tempto = *from; - if (retval = krb5_copy_principal(from->server, &tempto->server)) + retval = krb5_copy_principal(from->server, &tempto->server); + if (retval) return retval; - if (retval = krb5_copy_data(&from->enc_part.ciphertext, &scratch)) { + retval = krb5_copy_data(&from->enc_part.ciphertext, &scratch); + if (retval) { krb5_free_principal(tempto->server); xfree(tempto); return retval; } tempto->enc_part.ciphertext = *scratch; xfree(scratch); - if (retval = krb5_copy_enc_tkt_part(from->enc_part2, &tempto->enc_part2)) { + retval = krb5_copy_enc_tkt_part(from->enc_part2, &tempto->enc_part2); + if (retval) { xfree(tempto->enc_part.ciphertext.data); krb5_free_principal(tempto->server); xfree(tempto); diff --git a/src/lib/krb5/krb/decrypt_tk.c b/src/lib/krb5/krb/decrypt_tk.c index 287973a8e..a35f60981 100644 --- a/src/lib/krb5/krb/decrypt_tk.c +++ b/src/lib/krb5/krb/decrypt_tk.c @@ -67,28 +67,32 @@ register krb5_ticket *ticket; return(ENOMEM); /* do any necessary key pre-processing */ - if (retval = krb5_process_key(&eblock, srv_key)) { + retval = krb5_process_key(&eblock, srv_key); + if (retval) { free(scratch.data); return(retval); } /* call the encryption routine */ - if (retval = krb5_decrypt((krb5_pointer) ticket->enc_part.ciphertext.data, - (krb5_pointer) scratch.data, - scratch.length, &eblock, 0)) { + retval = krb5_decrypt((krb5_pointer) ticket->enc_part.ciphertext.data, + (krb5_pointer) scratch.data, + scratch.length, &eblock, 0); + if (retval) { (void) krb5_finish_key(&eblock); free(scratch.data); return retval; } #define clean_scratch() {memset(scratch.data, 0, scratch.length); \ free(scratch.data);} - if (retval = krb5_finish_key(&eblock)) { + retval = krb5_finish_key(&eblock); + if (retval) { clean_scratch(); return retval; } /* now decode the decrypted stuff */ - if (!(retval = decode_krb5_enc_tkt_part(&scratch, &dec_tkt_part))) { + retval = decode_krb5_enc_tkt_part(&scratch, &dec_tkt_part); + if (!retval) { ticket->enc_part2 = dec_tkt_part; } clean_scratch(); diff --git a/src/lib/krb5/krb/gc_frm_kdc.c b/src/lib/krb5/krb/gc_frm_kdc.c index 4aa8d9dea..1127ba7a3 100644 --- a/src/lib/krb5/krb/gc_frm_kdc.c +++ b/src/lib/krb5/krb/gc_frm_kdc.c @@ -133,7 +133,8 @@ krb5_get_cred_from_kdc (ccache, cred, tgts) /* walk the list BACKWARDS until we find a cached TGT, then move forward obtaining TGTs until we get the last TGT needed */ - for (next_server = tgs_list; *next_server; next_server++); + for (next_server = tgs_list; *next_server;) + next_server++; nservers = next_server - tgs_list; next_server--; @@ -187,7 +188,6 @@ krb5_get_cred_from_kdc (ccache, cred, tgts) krb5_free_realm_tree(tgs_list); goto out; } - krb5_free_data(krb5_princ_realm(final_server)); krb5_princ_set_realm(final_server, tmpdata); tgtq.server = final_server; -- 2.26.2