summaryrefslogtreecommitdiffstats
path: root/src/appl/telnet/libtelnet/kerberos.c
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1994-06-10 18:33:58 +0000
committerTheodore Tso <tytso@mit.edu>1994-06-10 18:33:58 +0000
commit5ef43beff03aa2cd77c7248356b9cb2ae17137a1 (patch)
treef9077fa94dce77e857c0a690f9af55954703a131 /src/appl/telnet/libtelnet/kerberos.c
parent62d4c19ae4464d001d5736b813d02286f2fe32ce (diff)
downloadkrb5-5ef43beff03aa2cd77c7248356b9cb2ae17137a1.tar.gz
krb5-5ef43beff03aa2cd77c7248356b9cb2ae17137a1.tar.xz
krb5-5ef43beff03aa2cd77c7248356b9cb2ae17137a1.zip
Updated telnet to be the 94.02.07 version, with some bugfixes
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3704 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/appl/telnet/libtelnet/kerberos.c')
-rw-r--r--src/appl/telnet/libtelnet/kerberos.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/appl/telnet/libtelnet/kerberos.c b/src/appl/telnet/libtelnet/kerberos.c
index 4393d2e3ac..57a58b41fe 100644
--- a/src/appl/telnet/libtelnet/kerberos.c
+++ b/src/appl/telnet/libtelnet/kerberos.c
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)kerberos.c 5.3 (Berkeley) 12/18/92";
+static char sccsid[] = "@(#)kerberos.c 8.1 (Berkeley) 6/4/93";
#endif /* not lint */
/*
@@ -100,11 +100,11 @@ static unsigned char str_name[1024] = { IAC, SB, TELOPT_AUTHENTICATION,
static KTEXT_ST auth;
static char name[ANAME_SZ];
static AUTH_DAT adat = { 0 };
-#if defined(ENCRYPTION)
+#ifdef ENCRYPTION
static Block session_key = { 0 };
static Schedule sched;
static Block challenge = { 0 };
-#endif
+#endif /* ENCRYPTION */
static int
Data(ap, type, d, c)
@@ -167,7 +167,9 @@ kerberos4_send(ap)
Authenticator *ap;
{
KTEXT_ST auth;
+#ifdef ENCRYPTION
Block enckey;
+#endif /* ENCRYPTION */
char instance[INST_SZ];
char *realm;
char *krb_realmofhost();
@@ -216,7 +218,7 @@ kerberos4_send(ap)
printf("Not enough room for authentication data\r\n");
return(0);
}
-#if defined(ENCRYPTION)
+#ifdef ENCRYPTION
/*
* If we are doing mutual authentication, get set up to send
* the challenge, and verify it when the response comes back.
@@ -241,7 +243,7 @@ kerberos4_send(ap)
}
des_ecb_encrypt(challenge, challenge, sched, 1);
}
-#endif
+#endif /* ENCRYPTION */
if (auth_debug_mode) {
printf("CK: %d:", kerberos4_cksum(auth.dat, auth.length));
@@ -258,8 +260,10 @@ kerberos4_is(ap, data, cnt)
unsigned char *data;
int cnt;
{
+#ifdef ENCRYPTION
Session_Key skey;
Block datablock;
+#endif /* ENCRYPTION */
char realm[REALM_SZ];
char instance[INST_SZ];
int r;
@@ -293,7 +297,7 @@ kerberos4_is(ap, data, cnt)
}
#ifdef ENCRYPTION
bcopy((void *)adat.session, (void *)session_key, sizeof(Block));
-#endif
+#endif /* ENCRYPTION */
krb_kntoln(&adat, name);
if (UserNameRequested && !kuserok(&adat, UserNameRequested))
@@ -305,9 +309,9 @@ kerberos4_is(ap, data, cnt)
break;
case KRB_CHALLENGE:
-#if !defined(ENCRYPTION)
+#ifndef ENCRYPTION
Data(ap, KRB_RESPONSE, (void *)0, 0);
-#else
+#else /* ENCRYPTION */
if (!VALIDKEY(session_key)) {
/*
* We don't have a valid session key, so just
@@ -344,7 +348,7 @@ kerberos4_is(ap, data, cnt)
}
des_ecb_encrypt(challenge, challenge, sched, 1);
Data(ap, KRB_RESPONSE, (void *)challenge, sizeof(challenge));
-#endif
+#endif /* ENCRYPTION */
break;
default:
@@ -361,7 +365,9 @@ kerberos4_reply(ap, data, cnt)
unsigned char *data;
int cnt;
{
+#ifdef ENCRYPTION
Session_Key skey;
+#endif /* ENCRYPTION */
if (cnt-- < 1)
return;
@@ -380,9 +386,9 @@ kerberos4_reply(ap, data, cnt)
/*
* Send over the encrypted challenge.
*/
-#if !defined(ENCRYPTION)
+#ifndef ENCRYPTION
Data(ap, KRB_CHALLENGE, (void *)0, 0);
-#else
+#else /* ENCRYPTION */
Data(ap, KRB_CHALLENGE, (void *)session_key,
sizeof(session_key));
des_ecb_encrypt(session_key, session_key, sched, 1);
@@ -390,13 +396,13 @@ kerberos4_reply(ap, data, cnt)
skey.length = 8;
skey.data = session_key;
encrypt_session_key(&skey, 0);
-#endif
+#endif /* ENCRYPTION */
return;
}
auth_finished(ap, AUTH_USER);
return;
case KRB_RESPONSE:
-#if defined(ENCRYPTION)
+#ifdef ENCRYPTION
/*
* Verify that the response to the challenge is correct.
*/
@@ -404,15 +410,15 @@ kerberos4_reply(ap, data, cnt)
(0 != memcmp((void *)data, (void *)challenge,
sizeof(challenge))))
{
-#endif
+#endif /* ENCRYPTION */
printf("[ Kerberos V4 challenge failed!!! ]\r\n");
auth_send_retry();
return;
-#if defined(ENCRYPTION)
+#ifdef ENCRYPTION
}
printf("[ Kerberos V4 challenge successful ]\r\n");
auth_finished(ap, AUTH_USER);
-#endif
+#endif /* ENCRYPTION */
break;
default:
if (auth_debug_mode)