summaryrefslogtreecommitdiff
path: root/lib/libtelnet/auth.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>1998-03-12 04:48:56 +0000
committerArtur Grabowski <art@cvs.openbsd.org>1998-03-12 04:48:56 +0000
commitc92f682d7d5ceca500a5fcdd24089ff4cd403652 (patch)
tree834df750fb418c9ccffede3afc9d34b26c163929 /lib/libtelnet/auth.c
parent080599dec65befdb0705fb5e6a001b1550da8a49 (diff)
support for encryption from kth-krb 0.9.8
Diffstat (limited to 'lib/libtelnet/auth.c')
-rw-r--r--lib/libtelnet/auth.c50
1 files changed, 36 insertions, 14 deletions
diff --git a/lib/libtelnet/auth.c b/lib/libtelnet/auth.c
index 76ff5dfbaf4..412fe75a406 100644
--- a/lib/libtelnet/auth.c
+++ b/lib/libtelnet/auth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth.c,v 1.2 1996/03/19 23:15:48 niklas Exp $ */
+/* $OpenBSD: auth.c,v 1.3 1998/03/12 04:48:45 art Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -36,10 +36,21 @@
#ifndef lint
/* from: static char sccsid[] = "@(#)auth.c 8.3 (Berkeley) 5/30/95" */
/* from: static char *rcsid = "$NetBSD: auth.c,v 1.5 1996/02/24 01:15:17 jtk Exp $"; */
-static char *rcsid = "$OpenBSD: auth.c,v 1.2 1996/03/19 23:15:48 niklas Exp $";
#endif /* not lint */
/*
+ * This source code is no longer held under any constraint of USA
+ * `cryptographic laws' since it was exported legally. The cryptographic
+ * functions were removed from the code and a "Bones" distribution was
+ * made. A Commodity Jurisdiction Request #012-94 was filed with the
+ * USA State Department, who handed it to the Commerce department. The
+ * code was determined to fall under General License GTDA under ECCN 5D96G,
+ * and hence exportable. The cryptographic interfaces were re-added by Eric
+ * Young, and then KTH proceeded to maintain the code in the free world.
+ *
+ */
+
+/*
* Copyright (C) 1990 by the Massachusetts Institute of Technology
*
* Export of this software from the United States of America is assumed
@@ -61,19 +72,15 @@ static char *rcsid = "$OpenBSD: auth.c,v 1.2 1996/03/19 23:15:48 niklas Exp $";
#if defined(AUTHENTICATION)
+
#include <stdio.h>
#include <sys/types.h>
+#include <unistd.h>
#include <signal.h>
#define AUTH_NAMES
#include <arpa/telnet.h>
-#ifdef __STDC__
#include <stdlib.h>
-#endif
-#ifdef NO_STRING_H
-#include <strings.h>
-#else
#include <string.h>
-#endif
#include "encrypt.h"
#include "auth.h"
@@ -132,18 +139,34 @@ Authenticator authenticators[] = {
spx_printsub },
#endif
#ifdef KRB5
+ { AUTHTYPE_KERBEROS_V5, AUTH_WHO_CLIENT|AUTH_HOW_MUTUAL,
+ kerberos5_init,
+ kerberos5_send_mutual,
+ kerberos5_is,
+ kerberos5_reply,
+ kerberos5_status,
+ kerberos5_printsub },
+
{ AUTHTYPE_KERBEROS_V5, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY,
kerberos5_init,
- kerberos5_send,
+ kerberos5_send_oneway,
kerberos5_is,
kerberos5_reply,
kerberos5_status,
kerberos5_printsub },
#endif
#ifdef KRB4
+ { AUTHTYPE_KERBEROS_V4, AUTH_WHO_CLIENT|AUTH_HOW_MUTUAL,
+ kerberos4_init,
+ kerberos4_send_mutual,
+ kerberos4_is,
+ kerberos4_reply,
+ kerberos4_status,
+ kerberos4_printsub },
+
{ AUTHTYPE_KERBEROS_V4, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY,
kerberos4_init,
- kerberos4_send,
+ kerberos4_send_oneway,
kerberos4_is,
kerberos4_reply,
kerberos4_status,
@@ -486,7 +509,7 @@ auth_is(data, cnt)
return;
}
- if (ap = findauthenticator(data[0], data[1])) {
+ if ((ap = findauthenticator(data[0], data[1]))) {
if (ap->is)
(*ap->is)(ap, data+2, cnt-2);
} else if (auth_debug_mode)
@@ -504,7 +527,7 @@ auth_reply(data, cnt)
if (cnt < 2)
return;
- if (ap = findauthenticator(data[0], data[1])) {
+ if ((ap = findauthenticator(data[0], data[1]))) {
if (ap->reply)
(*ap->reply)(ap, data+2, cnt-2);
} else if (auth_debug_mode)
@@ -517,7 +540,6 @@ auth_name(data, cnt)
unsigned char *data;
int cnt;
{
- Authenticator *ap;
unsigned char savename[256];
if (cnt < 1) {
@@ -646,7 +668,7 @@ auth_gen_printsub(data, cnt, buf, buflen)
buf[buflen-2] = '*';
buflen -= 2;
for (; cnt > 0; cnt--, data++) {
- sprintf((char *)tbuf, " %d", *data);
+ snprintf((char *)tbuf, sizeof(tbuf), " %d", *data);
for (cp = tbuf; *cp && buflen > 0; --buflen)
*buf++ = *cp++;
if (buflen <= 0)