version 1.1, 1995/10/18 08:46:15 |
version 1.2, 1996/03/27 19:33:10 |
|
|
|
/* $OpenBSD$ */ |
|
/* $NetBSD: telnet.c,v 1.7 1996/02/28 21:04:15 thorpej Exp $ */ |
|
|
/* |
/* |
* Copyright (c) 1988, 1990, 1993 |
* Copyright (c) 1988, 1990, 1993 |
* The Regents of the University of California. All rights reserved. |
* The Regents of the University of California. All rights reserved. |
|
|
*/ |
*/ |
|
|
#ifndef lint |
#ifndef lint |
/* from: static char sccsid[] = "@(#)telnet.c 8.1 (Berkeley) 6/6/93"; */ |
#if 0 |
static char *rcsid = "$Id$"; |
static char sccsid[] = "@(#)telnet.c 8.4 (Berkeley) 5/30/95"; |
|
static char rcsid[] = "$NetBSD: telnet.c,v 1.7 1996/02/28 21:04:15 thorpej Exp $"; |
|
#else |
|
static char rcsid[] = "$OpenBSD$"; |
|
#endif |
#endif /* not lint */ |
#endif /* not lint */ |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
|
#include "general.h" |
#include "general.h" |
|
|
|
|
#define strip(x) ((x)&0x7f) |
#define strip(x) ((my_want_state_is_wont(TELOPT_BINARY)) ? ((x)&0x7f) : (x)) |
|
|
static unsigned char subbuffer[SUBBUFSIZE], |
static unsigned char subbuffer[SUBBUFSIZE], |
*subpointer, *subend; /* buffer for sub-options */ |
*subpointer, *subend; /* buffer for sub-options */ |
|
|
ClearArray(options); |
ClearArray(options); |
|
|
connected = In3270 = ISend = localflow = donebinarytoggle = 0; |
connected = In3270 = ISend = localflow = donebinarytoggle = 0; |
#if defined(AUTHENTICATION) |
#if defined(AUTHENTICATION) |
auth_encrypt_connect(connected); |
auth_encrypt_connect(connected); |
#endif /* defined(AUTHENTICATION) */ |
#endif /* defined(AUTHENTICATION) */ |
restartany = -1; |
restartany = -1; |
|
|
register char c, *cp, **argvp, *cp2, **argv, **avt; |
register char c, *cp, **argvp, *cp2, **argv, **avt; |
|
|
if (name) { |
if (name) { |
if (strlen(name) > 40) { |
if ((int)strlen(name) > 40) { |
name = 0; |
name = 0; |
unknown[0] = name_unknown; |
unknown[0] = name_unknown; |
} else { |
} else { |
|
|
else if (islower(c)) |
else if (islower(c)) |
*cp = toupper(c); |
*cp = toupper(c); |
} |
} |
|
|
/* |
/* |
* Check for an old V6 2 character name. If the second |
* Check for an old V6 2 character name. If the second |
* name points to the beginning of the buffer, and is |
* name points to the beginning of the buffer, and is |
|
|
(setupterm(tname, 1, &err) == 0)) { |
(setupterm(tname, 1, &err) == 0)) { |
tnamep = mklist(termbuf, tname); |
tnamep = mklist(termbuf, tname); |
} else { |
} else { |
if (tname && (strlen(tname) <= 40)) { |
if (tname && ((int)strlen(tname) <= 40)) { |
unknown[0] = tname; |
unknown[0] = tname; |
upcase(tname); |
upcase(tname); |
} else |
} else |
|
|
case TS_IAC: |
case TS_IAC: |
process_iac: |
process_iac: |
switch (c) { |
switch (c) { |
|
|
case WILL: |
case WILL: |
telrcv_state = TS_WILL; |
telrcv_state = TS_WILL; |
continue; |
continue; |
|
|
ring_full_consecutive(&ttyiring)); |
ring_full_consecutive(&ttyiring)); |
if (c) { |
if (c) { |
returnValue = 1; |
returnValue = 1; |
ring_consumed(&ttyiring, c); |
ring_consumed(&ttyiring, c); |
} |
} |
} else { |
} else { |
# endif /* defined(TN3270) */ |
# endif /* defined(TN3270) */ |
|
|
{ |
{ |
sys_telnet_init(); |
sys_telnet_init(); |
|
|
#if defined(AUTHENTICATION) |
#if defined(AUTHENTICATION) |
{ |
{ |
static char local_host[256] = { 0 }; |
static char local_host[256] = { 0 }; |
|
|
|
|
next = nextitem(next); |
next = nextitem(next); |
} while (wewant(next) && (nfrontp > next)); |
} while (wewant(next) && (nfrontp > next)); |
length = next-thisitem; |
length = next-thisitem; |
memcpy(good, thisitem, length); |
memmove(good, thisitem, length); |
good += length; |
good += length; |
thisitem = next; |
thisitem = next; |
} else { |
} else { |