1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-26 07:55:01 +00:00

Fix big f*ckup by doing "make nocrypt"

(Don't think I don't realize what a big f*ckup this was.)
Submitted by:	geoff.
This commit is contained in:
Geoff Rehmet 1994-08-27 15:46:29 +00:00
parent de662aeac4
commit c59d31f62f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2315
11 changed files with 10 additions and 435 deletions

View File

@ -56,18 +56,4 @@ NOCRYPT_DIR=${.CURDIR}/Nocrypt
.include <bsd.prog.mk>
nocrypt:
#ifdef ENCRYPTION
@for i in ${CRYPT_SRC}; do \
if [ ! -d ${NOCRYPT_DIR} ]; then \
echo Creating subdirectory ${NOCRYPT_DIR}; \
mkdir ${NOCRYPT_DIR}; \
fi; \
echo ${NOCRYPT_DIR}/$$i; \
unifdef -UENCRYPTION ${.CURDIR}/$$i | \
sed "s/ || defined(ENCRYPTION)//" > ${NOCRYPT_DIR}/$$i; \
done
placeholder:
#else /* ENCRYPTION */
@echo "Encryption code already removed."
#endif /* ENCRYPTION */

View File

@ -35,7 +35,7 @@
static char sccsid[] = "@(#)authenc.c 8.1 (Berkeley) 6/6/93";
#endif /* not lint */
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
#if defined(AUTHENTICATION)
#include <sys/types.h>
#include <arpa/telnet.h>
#include <libtelnet/encrypt.h>
@ -64,12 +64,6 @@ net_write(str, len)
void
net_encrypt()
{
#ifdef ENCRYPTION
if (encrypt_output)
ring_encrypt(&netoring, encrypt_output);
else
ring_clearto(&netoring);
#endif /* ENCRYPTION */
}
int
@ -108,4 +102,4 @@ telnet_gets(prompt, result, length, echo)
TerminalNewMode(om);
return(res);
}
#endif /* defined(AUTHENTICATION) || defined(ENCRYPTION) */
#endif /* defined(AUTHENTICATION) */

View File

@ -619,12 +619,6 @@ static int togglehelp P((void));
#if defined(AUTHENTICATION)
extern int auth_togdebug P((int));
#endif
#ifdef ENCRYPTION
extern int EncryptAutoEnc P((int));
extern int EncryptAutoDec P((int));
extern int EncryptDebug P((int));
extern int EncryptVerbose P((int));
#endif /* ENCRYPTION */
struct togglelist {
char *name; /* name of toggle */
@ -657,28 +651,6 @@ static struct togglelist Togglelist[] = {
0,
"print authentication debugging information" },
#endif
#ifdef ENCRYPTION
{ "autoencrypt",
"automatic encryption of data stream",
EncryptAutoEnc,
0,
"automatically encrypt output" },
{ "autodecrypt",
"automatic decryption of data stream",
EncryptAutoDec,
0,
"automatically decrypt input" },
{ "verbose_encrypt",
"Toggle verbose encryption output",
EncryptVerbose,
0,
"print verbose encryption output" },
{ "encdebug",
"Toggle encryption debugging",
EncryptDebug,
0,
"print encryption debugging information" },
#endif /* ENCRYPTION */
{ "skiprc",
"don't read ~/.telnetrc file",
0,
@ -1296,9 +1268,6 @@ display(argc, argv)
}
}
/*@*/optionstatus();
#ifdef ENCRYPTION
EncryptStatus();
#endif /* ENCRYPTION */
return 1;
#undef doset
#undef dotog
@ -1448,9 +1417,9 @@ bye(argc, argv)
(void) NetClose(net);
connected = 0;
resettermname = 1;
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
#if defined(AUTHENTICATION)
auth_encrypt_connect(connected);
#endif /* defined(AUTHENTICATION) || defined(ENCRYPTION) */
#endif /* defined(AUTHENTICATION) */
/* reset options */
tninit();
#if defined(TN3270)
@ -1978,120 +1947,6 @@ auth_cmd(argc, argv)
}
#endif
#ifdef ENCRYPTION
/*
* The ENCRYPT command.
*/
struct encryptlist {
char *name;
char *help;
int (*handler)();
int needconnect;
int minarg;
int maxarg;
};
extern int
EncryptEnable P((char *, char *)),
EncryptDisable P((char *, char *)),
EncryptType P((char *, char *)),
EncryptStart P((char *)),
EncryptStartInput P((void)),
EncryptStartOutput P((void)),
EncryptStop P((char *)),
EncryptStopInput P((void)),
EncryptStopOutput P((void)),
EncryptStatus P((void));
static int
EncryptHelp P((void));
struct encryptlist EncryptList[] = {
{ "enable", "Enable encryption. ('encrypt enable ?' for more)",
EncryptEnable, 1, 1, 2 },
{ "disable", "Disable encryption. ('encrypt enable ?' for more)",
EncryptDisable, 0, 1, 2 },
{ "type", "Set encryptiong type. ('encrypt type ?' for more)",
EncryptType, 0, 1, 1 },
{ "start", "Start encryption. ('encrypt start ?' for more)",
EncryptStart, 1, 0, 1 },
{ "stop", "Stop encryption. ('encrypt stop ?' for more)",
EncryptStop, 1, 0, 1 },
{ "input", "Start encrypting the input stream",
EncryptStartInput, 1, 0, 0 },
{ "-input", "Stop encrypting the input stream",
EncryptStopInput, 1, 0, 0 },
{ "output", "Start encrypting the output stream",
EncryptStartOutput, 1, 0, 0 },
{ "-output", "Stop encrypting the output stream",
EncryptStopOutput, 1, 0, 0 },
{ "status", "Display current status of authentication information",
EncryptStatus, 0, 0, 0 },
{ "help", 0, EncryptHelp, 0, 0, 0 },
{ "?", "Print help information", EncryptHelp, 0, 0, 0 },
{ 0 },
};
static int
EncryptHelp()
{
struct encryptlist *c;
for (c = EncryptList; c->name; c++) {
if (c->help) {
if (*c->help)
printf("%-15s %s\n", c->name, c->help);
else
printf("\n");
}
}
return 0;
}
encrypt_cmd(argc, argv)
int argc;
char *argv[];
{
struct encryptlist *c;
c = (struct encryptlist *)
genget(argv[1], (char **) EncryptList, sizeof(struct encryptlist));
if (c == 0) {
fprintf(stderr, "'%s': unknown argument ('encrypt ?' for help).\n",
argv[1]);
return 0;
}
if (Ambiguous(c)) {
fprintf(stderr, "'%s': ambiguous argument ('encrypt ?' for help).\n",
argv[1]);
return 0;
}
argc -= 2;
if (argc < c->minarg || argc > c->maxarg) {
if (c->minarg == c->maxarg) {
fprintf(stderr, "Need %s%d argument%s ",
c->minarg < argc ? "only " : "", c->minarg,
c->minarg == 1 ? "" : "s");
} else {
fprintf(stderr, "Need %s%d-%d arguments ",
c->maxarg < argc ? "only " : "", c->minarg, c->maxarg);
}
fprintf(stderr, "to 'encrypt %s' command. 'encrypt ?' for help.\n",
c->name);
return 0;
}
if (c->needconnect && !connected) {
if (!(argc && (isprefix(argv[2], "help") || isprefix(argv[2], "?")))) {
printf("?Need to be connected first.\n");
return 0;
}
}
return ((*c->handler)(argc > 0 ? argv[2] : 0,
argc > 1 ? argv[3] : 0,
argc > 2 ? argv[4] : 0));
}
#endif /* ENCRYPTION */
#if defined(unix) && defined(TN3270)
static void
@ -2158,9 +2013,6 @@ status(argc, argv)
printf("%s character echo\n", (mode&MODE_ECHO) ? "Local" : "Remote");
if (my_want_state_is_will(TELOPT_LFLOW))
printf("%s flow control\n", (mode&MODE_FLOW) ? "Local" : "No");
#ifdef ENCRYPTION
encrypt_display();
#endif /* ENCRYPTION */
}
} else {
printf("No connection.\n");
@ -2415,9 +2267,9 @@ tn(argc, argv)
return 0;
}
connected++;
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
#if defined(AUTHENTICATION)
auth_encrypt_connect(connected);
#endif /* defined(AUTHENTICATION) || defined(ENCRYPTION) */
#endif /* defined(AUTHENTICATION) */
} while (connected == 0);
cmdrc(hostp, hostname);
if (autologin && user == NULL) {
@ -2465,9 +2317,6 @@ static char
#if defined(AUTHENTICATION)
authhelp[] = "turn on (off) authentication ('auth ?' for more)",
#endif
#ifdef ENCRYPTION
encrypthelp[] = "turn on (off) encryption ('encrypt ?' for more)",
#endif /* ENCRYPTION */
#if defined(unix)
zhelp[] = "suspend telnet",
#endif /* defined(unix) */
@ -2496,9 +2345,6 @@ static Command cmdtab[] = {
#if defined(AUTHENTICATION)
{ "auth", authhelp, auth_cmd, 0 },
#endif
#ifdef ENCRYPTION
{ "encrypt", encrypthelp, encrypt_cmd, 0 },
#endif /* ENCRYPTION */
#if defined(unix)
{ "z", zhelp, suspend, 0 },
#endif /* defined(unix) */

View File

@ -162,10 +162,6 @@ extern char
wont[],
options[], /* All the little options */
*hostname; /* Who are we connected to? */
#ifdef ENCRYPTION
extern void (*encrypt_output) P((unsigned char *, int));
extern int (*decrypt_input) P((int));
#endif /* ENCRYPTION */
/*
* We keep track of each side of the option negotiation.

View File

@ -96,11 +96,7 @@ usage()
#else
"[-r] ",
#endif
#ifdef ENCRYPTION
"[-x] [host-name [port]]"
#else /* ENCRYPTION */
"[host-name [port]]"
#endif /* ENCRYPTION */
);
exit(1);
}
@ -267,14 +263,9 @@ main(argc, argv)
#endif
break;
case 'x':
#ifdef ENCRYPTION
encrypt_auto(1);
decrypt_auto(1);
#else /* ENCRYPTION */
fprintf(stderr,
"%s: Warning: -x ignored, no ENCRYPT support.\n",
prompt);
#endif /* ENCRYPTION */
break;
case '?':
default:

View File

@ -128,10 +128,6 @@ netflush()
{
register int n, n1;
#ifdef ENCRYPTION
if (encrypt_output)
ring_encrypt(&netoring, encrypt_output);
#endif /* ENCRYPTION */
if ((n1 = n = ring_full_consecutive(&netoring)) > 0) {
if (!ring_at_mark(&netoring)) {
n = send(net, (char *)netoring.consume, n, 0); /* normal write */

View File

@ -112,9 +112,6 @@ Ring *ring;
ring->top = ring->bottom+ring->size;
#ifdef ENCRYPTION
ring->clearto = 0;
#endif /* ENCRYPTION */
return 1;
}
@ -185,15 +182,6 @@ ring_consumed(ring, count)
(ring_subtract(ring, ring->mark, ring->consume) < count)) {
ring->mark = 0;
}
#ifdef ENCRYPTION
if (ring->consume < ring->clearto &&
ring->clearto <= ring->consume + count)
ring->clearto = 0;
else if (ring->consume + count > ring->top &&
ring->bottom <= ring->clearto &&
ring->bottom + ((ring->consume + count) - ring->top))
ring->clearto = 0;
#endif /* ENCRYPTION */
ring->consume = ring_increment(ring, ring->consume, count);
ring->consumetime = ++ring_clock;
/*
@ -325,38 +313,3 @@ ring_consume_data(ring, buffer, count)
}
#endif
#ifdef ENCRYPTION
void
ring_encrypt(ring, encryptor)
Ring *ring;
void (*encryptor)();
{
unsigned char *s, *c;
if (ring_empty(ring) || ring->clearto == ring->supply)
return;
if (!(c = ring->clearto))
c = ring->consume;
s = ring->supply;
if (s <= c) {
(*encryptor)(c, ring->top - c);
(*encryptor)(ring->bottom, s - ring->bottom);
} else
(*encryptor)(c, s - c);
ring->clearto = ring->supply;
}
void
ring_clearto(ring)
Ring *ring;
{
if (!ring_empty(ring))
ring->clearto = ring->supply;
else
ring->clearto = 0;
}
#endif /* ENCRYPTION */

View File

@ -59,10 +59,6 @@ typedef struct {
*bottom, /* lowest address in buffer */
*top, /* highest address+1 in buffer */
*mark; /* marker (user defined) */
#ifdef ENCRYPTION
unsigned char *clearto; /* Data to this point is clear text */
unsigned char *encryyptedto; /* Data is encrypted to here */
#endif /* ENCRYPTION */
int size; /* size in bytes of buffer */
u_long consumetime, /* help us keep straight full, empty, etc. */
supplytime;
@ -94,11 +90,6 @@ extern int
ring_full_count P((Ring *ring)),
ring_full_consecutive P((Ring *ring));
#ifdef ENCRYPTION
extern void
ring_encrypt P((Ring *ring, void (*func)())),
ring_clearto P((Ring *ring));
#endif /* ENCRYPTION */
extern void
ring_clear_mark(),

View File

@ -177,9 +177,9 @@ init_telnet()
ClearArray(options);
connected = In3270 = ISend = localflow = donebinarytoggle = 0;
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
#if defined(AUTHENTICATION)
auth_encrypt_connect(connected);
#endif /* defined(AUTHENTICATION) || defined(ENCRYPTION) */
#endif /* defined(AUTHENTICATION) */
restartany = -1;
SYNCHing = 0;
@ -369,9 +369,6 @@ willoption(option)
#if defined(AUTHENTICATION)
case TELOPT_AUTHENTICATION:
#endif
#ifdef ENCRYPTION
case TELOPT_ENCRYPT:
#endif /* ENCRYPTION */
new_state_ok = 1;
break;
@ -401,10 +398,6 @@ willoption(option)
}
}
set_my_state_do(option);
#ifdef ENCRYPTION
if (option == TELOPT_ENCRYPT)
encrypt_send_support();
#endif /* ENCRYPTION */
}
void
@ -492,9 +485,6 @@ dooption(option)
case TELOPT_LFLOW: /* local flow control */
case TELOPT_TTYPE: /* terminal type option */
case TELOPT_SGA: /* no big deal */
#ifdef ENCRYPTION
case TELOPT_ENCRYPT: /* encryption variable option */
#endif /* ENCRYPTION */
new_state_ok = 1;
break;
@ -1004,67 +994,6 @@ suboption()
}
break;
#endif
#ifdef ENCRYPTION
case TELOPT_ENCRYPT:
if (SB_EOF())
return;
switch(SB_GET()) {
case ENCRYPT_START:
if (my_want_state_is_dont(TELOPT_ENCRYPT))
return;
encrypt_start(subpointer, SB_LEN());
break;
case ENCRYPT_END:
if (my_want_state_is_dont(TELOPT_ENCRYPT))
return;
encrypt_end();
break;
case ENCRYPT_SUPPORT:
if (my_want_state_is_wont(TELOPT_ENCRYPT))
return;
encrypt_support(subpointer, SB_LEN());
break;
case ENCRYPT_REQSTART:
if (my_want_state_is_wont(TELOPT_ENCRYPT))
return;
encrypt_request_start(subpointer, SB_LEN());
break;
case ENCRYPT_REQEND:
if (my_want_state_is_wont(TELOPT_ENCRYPT))
return;
/*
* We can always send an REQEND so that we cannot
* get stuck encrypting. We should only get this
* if we have been able to get in the correct mode
* anyhow.
*/
encrypt_request_end();
break;
case ENCRYPT_IS:
if (my_want_state_is_dont(TELOPT_ENCRYPT))
return;
encrypt_is(subpointer, SB_LEN());
break;
case ENCRYPT_REPLY:
if (my_want_state_is_wont(TELOPT_ENCRYPT))
return;
encrypt_reply(subpointer, SB_LEN());
break;
case ENCRYPT_ENC_KEYID:
if (my_want_state_is_dont(TELOPT_ENCRYPT))
return;
encrypt_enc_keyid(subpointer, SB_LEN());
break;
case ENCRYPT_DEC_KEYID:
if (my_want_state_is_wont(TELOPT_ENCRYPT))
return;
encrypt_dec_keyid(subpointer, SB_LEN());
break;
default:
break;
}
break;
#endif /* ENCRYPTION */
default:
break;
}
@ -1746,10 +1675,6 @@ telrcv()
}
c = *sbp++ & 0xff, scc--; count++;
#ifdef ENCRYPTION
if (decrypt_input)
c = (*decrypt_input)(c);
#endif /* ENCRYPTION */
switch (telrcv_state) {
@ -1774,10 +1699,6 @@ telrcv()
*Ifrontp++ = c;
while (scc > 0) {
c = *sbp++ & 0377, scc--; count++;
#ifdef ENCRYPTION
if (decrypt_input)
c = (*decrypt_input)(c);
#endif /* ENCRYPTION */
if (c == IAC) {
telrcv_state = TS_IAC;
break;
@ -1796,10 +1717,6 @@ telrcv()
if ((c == '\r') && my_want_state_is_dont(TELOPT_BINARY)) {
if (scc > 0) {
c = *sbp&0xff;
#ifdef ENCRYPTION
if (decrypt_input)
c = (*decrypt_input)(c);
#endif /* ENCRYPTION */
if (c == 0) {
sbp++, scc--; count++;
/* a "true" CR */
@ -1809,10 +1726,6 @@ telrcv()
sbp++, scc--; count++;
TTYADD('\n');
} else {
#ifdef ENCRYPTION
if (decrypt_input)
(*decrypt_input)(-1);
#endif /* ENCRYPTION */
TTYADD('\r');
if (crmod) {
@ -2249,7 +2162,7 @@ telnet(user)
{
sys_telnet_init();
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
#if defined(AUTHENTICATION)
{
static char local_host[256] = { 0 };
@ -2260,17 +2173,13 @@ telnet(user)
auth_encrypt_init(local_host, hostname, "TELNET", 0);
auth_encrypt_user(user);
}
#endif /* defined(AUTHENTICATION) || defined(ENCRYPTION) */
#endif /* defined(AUTHENTICATION) */
# if !defined(TN3270)
if (telnetport) {
#if defined(AUTHENTICATION)
if (autologin)
send_will(TELOPT_AUTHENTICATION, 1);
#endif
#ifdef ENCRYPTION
send_do(TELOPT_ENCRYPT, 1);
send_will(TELOPT_ENCRYPT, 1);
#endif /* ENCRYPTION */
send_do(TELOPT_SGA, 1);
send_will(TELOPT_TTYPE, 1);
send_will(TELOPT_NAWS, 1);

View File

@ -205,29 +205,12 @@ getconnmode()
setconnmode(force)
int force;
{
#ifdef ENCRYPTION
static int enc_passwd = 0;
#endif /* ENCRYPTION */
register int newmode;
newmode = getconnmode()|(force?MODE_FORCE:0);
TerminalNewMode(newmode);
#ifdef ENCRYPTION
if ((newmode & (MODE_ECHO|MODE_EDIT)) == MODE_EDIT) {
if (my_want_state_is_will(TELOPT_ENCRYPT)
&& (enc_passwd == 0) && !encrypt_output) {
encrypt_request_start(0, 0);
enc_passwd = 1;
}
} else {
if (enc_passwd) {
encrypt_request_end();
enc_passwd = 0;
}
}
#endif /* ENCRYPTION */
}

View File

@ -486,76 +486,6 @@ printsub(direction, pointer, length)
break;
#endif
#ifdef ENCRYPTION
case TELOPT_ENCRYPT:
fprintf(NetTrace, "ENCRYPT");
if (length < 2) {
fprintf(NetTrace, " (empty suboption??\?)");
break;
}
switch (pointer[1]) {
case ENCRYPT_START:
fprintf(NetTrace, " START");
break;
case ENCRYPT_END:
fprintf(NetTrace, " END");
break;
case ENCRYPT_REQSTART:
fprintf(NetTrace, " REQUEST-START");
break;
case ENCRYPT_REQEND:
fprintf(NetTrace, " REQUEST-END");
break;
case ENCRYPT_IS:
case ENCRYPT_REPLY:
fprintf(NetTrace, " %s ", (pointer[1] == ENCRYPT_IS) ?
"IS" : "REPLY");
if (length < 3) {
fprintf(NetTrace, " (partial suboption??\?)");
break;
}
if (ENCTYPE_NAME_OK(pointer[2]))
fprintf(NetTrace, "%s ", ENCTYPE_NAME(pointer[2]));
else
fprintf(NetTrace, " %d (unknown)", pointer[2]);
encrypt_printsub(&pointer[1], length - 1, buf, sizeof(buf));
fprintf(NetTrace, "%s", buf);
break;
case ENCRYPT_SUPPORT:
i = 2;
fprintf(NetTrace, " SUPPORT ");
while (i < length) {
if (ENCTYPE_NAME_OK(pointer[i]))
fprintf(NetTrace, "%s ", ENCTYPE_NAME(pointer[i]));
else
fprintf(NetTrace, "%d ", pointer[i]);
i++;
}
break;
case ENCRYPT_ENC_KEYID:
fprintf(NetTrace, " ENC_KEYID ");
goto encommon;
case ENCRYPT_DEC_KEYID:
fprintf(NetTrace, " DEC_KEYID ");
goto encommon;
default:
fprintf(NetTrace, " %d (unknown)", pointer[1]);
encommon:
for (i = 2; i < length; i++)
fprintf(NetTrace, " %d", pointer[i]);
break;
}
break;
#endif /* ENCRYPTION */
case TELOPT_LINEMODE:
fprintf(NetTrace, "LINEMODE ");