-2001-06-21 Ezra Peisach <epeisach@rna.mit.edu>
+2001-06-22 Ezra Peisach <epeisach@mit.edu>
+
+ * 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 <epeisach@mit.edu>
* forward.c: If NEED_SETENV defined, provide prototype for setenv.
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
int data;
{
register struct stinfo *stp = &fb[CFB].streams[DIR_DECRYPT-1];
- int index;
+ int idx;
if (data == -1) {
/*
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]);
}
/*
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
int data;
{
register struct stinfo *stp = &fb[OFB].streams[DIR_DECRYPT-1];
- int index;
+ int idx;
if (data == -1) {
/*
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 */
kerberos4_send(ap)
Authenticator *ap;
{
- KTEXT_ST auth;
+ KTEXT_ST kauth;
char instance[INST_SZ];
char *realm;
char *krb_realmofhost();
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");
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);
}
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);
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);
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;
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");
#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");
}
}
int
-kerberos4_status(ap, name, level)
+kerberos4_status(ap, kname, level)
Authenticator *ap;
- char *name;
+ char *kname;
int level;
{
if (level < AUTH_USER)
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
(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");