From ac331b3e081a433e73ed55968f42dc70a6b44950 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Fri, 22 Jun 2001 15:35:07 +0000 Subject: [PATCH] * enc_des.c: Change local variable index to idx to not shadown global function. * kerberos5.c (kerberos5_is): Change errbuf to kerrbuf to not shadow previous local. * kerberos.c (kerberos4_send): Change random_key to rand_key to prevent redefine by des.h. Change auth to kauth to not shadow global. (kerberos4_status): Change name to kname for same reason. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13493 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/telnet/libtelnet/ChangeLog | 14 +++++++- src/appl/telnet/libtelnet/enc_des.c | 50 +++++++++++++-------------- src/appl/telnet/libtelnet/kerberos.c | 28 +++++++-------- src/appl/telnet/libtelnet/kerberos5.c | 11 +++--- 4 files changed, 58 insertions(+), 45 deletions(-) diff --git a/src/appl/telnet/libtelnet/ChangeLog b/src/appl/telnet/libtelnet/ChangeLog index ac0ac184f..ed1b7a40e 100644 --- a/src/appl/telnet/libtelnet/ChangeLog +++ b/src/appl/telnet/libtelnet/ChangeLog @@ -1,4 +1,16 @@ -2001-06-21 Ezra Peisach +2001-06-22 Ezra Peisach + + * enc_des.c: Change local variable index to idx to not shadown + global function. + + * kerberos5.c (kerberos5_is): Change errbuf to kerrbuf to not + shadow previous local. + + * kerberos.c (kerberos4_send): Change random_key to rand_key to + prevent redefine by des.h. Change auth to kauth to not shadow global. + (kerberos4_status): Change name to kname for same reason. + +2001-06-21 Ezra Peisach * forward.c: If NEED_SETENV defined, provide prototype for setenv. diff --git a/src/appl/telnet/libtelnet/enc_des.c b/src/appl/telnet/libtelnet/enc_des.c index 2b2091485..393ac3cdb 100644 --- a/src/appl/telnet/libtelnet/enc_des.c +++ b/src/appl/telnet/libtelnet/enc_des.c @@ -652,23 +652,23 @@ cfb64_encrypt(s, c) int c; { register struct stinfo *stp = &fb[CFB].streams[DIR_ENCRYPT-1]; - register int index; + register int idx; - index = stp->str_index; + idx = stp->str_index; while (c-- > 0) { - if (index == sizeof(Block)) { + if (idx == sizeof(Block)) { Block b; ecb_encrypt(stp, stp->str_output, b); memcpy((void *)stp->str_feed,(void *)b,sizeof(Block)); - index = 0; + idx = 0; } /* On encryption, we store (feed ^ data) which is cypher */ - *s = stp->str_output[index] = (stp->str_feed[index] ^ *s); + *s = stp->str_output[idx] = (stp->str_feed[idx] ^ *s); s++; - index++; + idx++; } - stp->str_index = index; + stp->str_index = idx; } int @@ -676,7 +676,7 @@ cfb64_decrypt(data) int data; { register struct stinfo *stp = &fb[CFB].streams[DIR_DECRYPT-1]; - int index; + int idx; if (data == -1) { /* @@ -689,18 +689,18 @@ cfb64_decrypt(data) return(0); } - index = stp->str_index++; - if (index == sizeof(Block)) { + idx = stp->str_index++; + if (idx == sizeof(Block)) { Block b; ecb_encrypt(stp, stp->str_output, b); memcpy((void *)stp->str_feed, (void *)b, sizeof(Block)); stp->str_index = 1; /* Next time will be 1 */ - index = 0; /* But now use 0 */ + idx = 0; /* But now use 0 */ } /* On decryption we store (data) which is cypher. */ - stp->str_output[index] = data; - return(data ^ stp->str_feed[index]); + stp->str_output[idx] = data; + return(data ^ stp->str_feed[idx]); } /* @@ -728,20 +728,20 @@ ofb64_encrypt(s, c) int c; { register struct stinfo *stp = &fb[OFB].streams[DIR_ENCRYPT-1]; - register int index; + register int idx; - index = stp->str_index; + idx = stp->str_index; while (c-- > 0) { - if (index == sizeof(Block)) { + if (idx == sizeof(Block)) { Block b; ecb_encrypt(stp, stp->str_feed, b); memcpy((void *)stp->str_feed,(void *)b,sizeof(Block)); - index = 0; + idx = 0; } - *s++ ^= stp->str_feed[index]; - index++; + *s++ ^= stp->str_feed[idx]; + idx++; } - stp->str_index = index; + stp->str_index = idx; } int @@ -749,7 +749,7 @@ ofb64_decrypt(data) int data; { register struct stinfo *stp = &fb[OFB].streams[DIR_DECRYPT-1]; - int index; + int idx; if (data == -1) { /* @@ -762,16 +762,16 @@ ofb64_decrypt(data) return(0); } - index = stp->str_index++; - if (index == sizeof(Block)) { + idx = stp->str_index++; + if (idx == sizeof(Block)) { Block b; ecb_encrypt(stp, stp->str_feed, b); memcpy((void *)stp->str_feed, (void *)b, sizeof(Block)); stp->str_index = 1; /* Next time will be 1 */ - index = 0; /* But now use 0 */ + idx = 0; /* But now use 0 */ } - return(data ^ stp->str_feed[index]); + return(data ^ stp->str_feed[idx]); } # endif /* DES_ENCRYPTION */ # endif /* AUTHENTICATION */ diff --git a/src/appl/telnet/libtelnet/kerberos.c b/src/appl/telnet/libtelnet/kerberos.c index 4fe0b11a5..3bcd16bab 100644 --- a/src/appl/telnet/libtelnet/kerberos.c +++ b/src/appl/telnet/libtelnet/kerberos.c @@ -198,7 +198,7 @@ int dst_realm_sz = REALM_SZ; kerberos4_send(ap) Authenticator *ap; { - KTEXT_ST auth; + KTEXT_ST kauth; char instance[INST_SZ]; char *realm; char *krb_realmofhost(); @@ -209,7 +209,7 @@ kerberos4_send(ap) krb5_data data; krb5_enc_data encdata; krb5_error_code code; - krb5_keyblock random_key; + krb5_keyblock rand_key; #endif printf("[ Trying KERBEROS4 ... ]\r\n"); @@ -233,7 +233,7 @@ kerberos4_send(ap) printf("Kerberos V4: no realm for %s\r\n", RemoteHostName); return(0); } - if ((r = krb_mk_req(&auth, KRB_SERVICE_NAME, instance, realm, 0))) { + if ((r = krb_mk_req(&kauth, KRB_SERVICE_NAME, instance, realm, 0))) { printf("mk_req failed: %s\r\n", krb_err_txt[r]); return(0); } @@ -247,8 +247,8 @@ kerberos4_send(ap) return(0); } if (auth_debug_mode) - printf("Sent %d bytes of authentication data\r\n", auth.length); - if (!Data(ap, KRB_AUTH, (void *)auth.dat, auth.length)) { + printf("Sent %d bytes of authentication data\r\n", kauth.length); + if (!Data(ap, KRB_AUTH, (void *)kauth.dat, kauth.length)) { if (auth_debug_mode) printf("Not enough room for authentication data\r\n"); return(0); @@ -272,7 +272,7 @@ kerberos4_send(ap) if ((code = krb5_c_make_random_key(telnet_context, ENCTYPE_DES_CBC_RAW, - &random_key))) { + &rand_key))) { com_err("libtelnet", code, "while creating random session key"); return(0); @@ -284,8 +284,8 @@ kerberos4_send(ap) krbkey.length = 8; krbkey.contents = cred.session; - encdata.ciphertext.data = random_key.contents; - encdata.ciphertext.length = random_key.length; + encdata.ciphertext.data = rand_key.contents; + encdata.ciphertext.length = rand_key.length; encdata.enctype = ENCTYPE_UNKNOWN; data.data = session_key; @@ -294,7 +294,7 @@ kerberos4_send(ap) code = krb5_c_decrypt(telnet_context, &krbkey, 0, 0, &encdata, &data); - krb5_free_keyblock_contents(telnet_context, &random_key); + krb5_free_keyblock_contents(telnet_context, &rand_key); if (code) { com_err("libtelnet", code, "while encrypting random key"); @@ -339,8 +339,8 @@ kerberos4_send(ap) #endif /* ENCRYPTION */ if (auth_debug_mode) { - printf("CK: %d:", kerberos4_cksum(auth.dat, auth.length)); - printd(auth.dat, auth.length); + printf("CK: %d:", kerberos4_cksum(kauth.dat, kauth.length)); + printd(kauth.dat, kauth.length); printf("\r\n"); printf("Sent Kerberos V4 credentials to server\r\n"); } @@ -596,9 +596,9 @@ kerberos4_reply(ap, data, cnt) } int -kerberos4_status(ap, name, level) +kerberos4_status(ap, kname, level) Authenticator *ap; - char *name; + char *kname; int level; { if (level < AUTH_USER) @@ -606,7 +606,7 @@ kerberos4_status(ap, name, level) if (UserNameRequested && !kuserok(&adat, UserNameRequested)) { /* the name buffer comes from telnetd/telnetd{-ktd}.c */ - strncpy(name, UserNameRequested, 255); + strncpy(kname, UserNameRequested, 255); name[255] = '\0'; return(AUTH_VALID); } else diff --git a/src/appl/telnet/libtelnet/kerberos5.c b/src/appl/telnet/libtelnet/kerberos5.c index b900e7758..44390d885 100644 --- a/src/appl/telnet/libtelnet/kerberos5.c +++ b/src/appl/telnet/libtelnet/kerberos5.c @@ -570,12 +570,13 @@ kerberos5_is(ap, data, cnt) (r = rd_and_store_for_creds(telnet_context, auth_context, &inbuf, ticket))) { - char errbuf[128]; + char kerrbuf[128]; - (void) strcpy(errbuf, "Read forwarded creds failed: "); - errbuf[sizeof(errbuf) - 1] = '\0'; - (void) strncat(errbuf, error_message(r), sizeof(errbuf) - 1 - strlen(errbuf)); - Data(ap, KRB_FORWARD_REJECT, errbuf, -1); + (void) strcpy(kerrbuf, "Read forwarded creds failed: "); + kerrbuf[sizeof(kerrbuf) - 1] = '\0'; + (void) strncat(kerrbuf, error_message(r), + sizeof(kerrbuf) - 1 - strlen(kerrbuf)); + Data(ap, KRB_FORWARD_REJECT, kerrbuf, -1); if (auth_debug_mode) printf( "telnetd: Could not read forwarded credentials\r\n"); -- 2.26.2