From a9e3c2cdb5ca02a8ffbe5d02b3c60a8a34e96780 Mon Sep 17 00:00:00 2001 From: Unknown User d91-jda Date: Sun, 11 Feb 1996 09:50:08 +0000 Subject: [PATCH] Variable encrypt_verbose had to be turned on in main. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@253 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/telnet/libtelnet/enc-proto.h | 1 + appl/telnet/libtelnet/encrypt.c | 193 +++++++++++++----------------- appl/telnet/telnet/main.c | 1 + 3 files changed, 86 insertions(+), 109 deletions(-) diff --git a/appl/telnet/libtelnet/enc-proto.h b/appl/telnet/libtelnet/enc-proto.h index eafae79e9..5e72d3d3b 100644 --- a/appl/telnet/libtelnet/enc-proto.h +++ b/appl/telnet/libtelnet/enc-proto.h @@ -70,6 +70,7 @@ void encrypt_send_supprt P((void)); void encrypt_auto P((int)); void decrypt_auto P((int)); void encrypt_not P((void)); +void encrypt_verbose_quiet P((int)); void encrypt_is P((unsigned char *, int)); void encrypt_reply P((unsigned char *, int)); void encrypt_start_input P((int)); diff --git a/appl/telnet/libtelnet/encrypt.c b/appl/telnet/libtelnet/encrypt.c index 6b1b9e8a5..ec2947b95 100644 --- a/appl/telnet/libtelnet/encrypt.c +++ b/appl/telnet/libtelnet/encrypt.c @@ -84,7 +84,7 @@ char *nclearto; int encrypt_debug_mode = 0; static int decrypt_mode = 0; static int encrypt_mode = 0; -static int encrypt_verbose = 1; +static int encrypt_verbose = 0; static int autoencrypt = 0; static int autodecrypt = 0; static int havesessionkey = 0; @@ -137,9 +137,8 @@ static unsigned char str_suplen = 0; static unsigned char str_start[72] = { IAC, SB, TELOPT_ENCRYPT }; static unsigned char str_end[] = { IAC, SB, TELOPT_ENCRYPT, 0, IAC, SE }; - Encryptions * -findencryption(type) - int type; +Encryptions * +findencryption(int type) { Encryptions *ep = encryptions; @@ -150,9 +149,8 @@ findencryption(type) return(ep->type ? ep : 0); } - Encryptions * -finddecryption(type) - int type; +Encryptions * +finddecryption(int type) { Encryptions *ep = encryptions; @@ -176,10 +174,8 @@ static struct key_info { { { 0 }, 0, DIR_DECRYPT, &decrypt_mode, finddecryption }, }; - void -encrypt_init(name, server) - char *name; - int server; +void +encrypt_init(char *name, int server) { Encryptions *ep = encryptions; @@ -214,8 +210,8 @@ encrypt_init(name, server) str_send[str_suplen++] = SE; } - void -encrypt_list_types() +void +encrypt_list_types(void) { Encryptions *ep = encryptions; @@ -226,9 +222,8 @@ encrypt_list_types() } } - int -EncryptEnable(type, mode) - char *type, *mode; +int +EncryptEnable(char *type, char *mode) { if (isprefix(type, "help") || isprefix(type, "?")) { printf("Usage: encrypt enable [input|output]\n"); @@ -240,9 +235,8 @@ EncryptEnable(type, mode) return(0); } - int -EncryptDisable(type, mode) - char *type, *mode; +int +EncryptDisable(char *type, char *mode) { register Encryptions *ep; int ret = 0; @@ -274,10 +268,8 @@ EncryptDisable(type, mode) return(ret); } - int -EncryptType(type, mode) - char *type; - char *mode; +int +EncryptType(char *type, char *mode) { register Encryptions *ep; int ret = 0; @@ -307,9 +299,8 @@ EncryptType(type, mode) return(ret); } - int -EncryptStart(mode) - char *mode; +int +EncryptStart(char *mode) { register int ret = 0; if (mode) { @@ -329,8 +320,8 @@ EncryptStart(mode) return(ret); } - int -EncryptStartInput() +int +EncryptStartInput(void) { if (decrypt_mode) { encrypt_send_request_start(); @@ -340,8 +331,8 @@ EncryptStartInput() return(0); } - int -EncryptStartOutput() +int +EncryptStartOutput(void) { if (encrypt_mode) { encrypt_start_output(encrypt_mode); @@ -351,9 +342,8 @@ EncryptStartOutput() return(0); } - int -EncryptStop(mode) - char *mode; +int +EncryptStop(char *mode) { int ret = 0; if (mode) { @@ -373,22 +363,22 @@ EncryptStop(mode) return(ret); } - int -EncryptStopInput() +int +EncryptStopInput(void) { encrypt_send_request_end(); return(1); } - int -EncryptStopOutput() +int +EncryptStopOutput(void) { encrypt_send_end(); return(1); } - void -encrypt_display() +void +encrypt_display(void) { printf("Autoencrypt for output is %s. Autodecrypt for input is %s.\r\n", autoencrypt?"on":"off", autodecrypt?"on":"off"); @@ -406,8 +396,8 @@ encrypt_display() printf("Currently not decrypting input\r\n"); } - int -EncryptStatus() +int +EncryptStatus(void) { printf("Autoencrypt for output is %s. Autodecrypt for input is %s.\r\n", autoencrypt?"on":"off", autodecrypt?"on":"off"); @@ -435,8 +425,8 @@ EncryptStatus() return 1; } - void -encrypt_send_support() +void +encrypt_send_support(void) { if (str_suplen) { /* @@ -452,9 +442,8 @@ encrypt_send_support() } } - int -EncryptDebug(on) - int on; +int +EncryptDebug(int on) { if (on < 0) encrypt_debug_mode ^= 1; @@ -465,22 +454,27 @@ EncryptDebug(on) return(1); } - int -EncryptVerbose(on) - int on; +/* turn on verbose encryption, but dont keep telling the whole world + */ +void encrypt_verbose_quiet(int on) { - if (on < 0) - encrypt_verbose ^= 1; - else - encrypt_verbose = on; + if(on < 0) + encrypt_verbose ^= 1; + else + encrypt_verbose = on ? 1 : 0; +} + +int +EncryptVerbose(int on) +{ + encrypt_verbose_quiet(on); printf("Encryption %s verbose\r\n", encrypt_verbose ? "is" : "is not"); return(1); } - int -EncryptAutoEnc(on) - int on; +int +EncryptAutoEnc(int on) { encrypt_auto(on); printf("Automatic encryption of output is %s\r\n", @@ -488,9 +482,8 @@ EncryptAutoEnc(on) return(1); } - int -EncryptAutoDec(on) - int on; +int +EncryptAutoDec(int on) { decrypt_auto(on); printf("Automatic decryption of input is %s\r\n", @@ -510,10 +503,8 @@ encrypt_not(void) /* * Called when ENCRYPT SUPPORT is received. */ - void -encrypt_support(typelist, cnt) - unsigned char *typelist; - int cnt; +void +encrypt_support(unsigned char *typelist, int cnt) { register int type, use_type = 0; Encryptions *ep; @@ -552,10 +543,8 @@ encrypt_support(typelist, cnt) } } - void -encrypt_is(data, cnt) - unsigned char *data; - int cnt; +void +encrypt_is(unsigned char *data, int cnt) { Encryptions *ep; register int type, ret; @@ -598,10 +587,8 @@ encrypt_is(data, cnt) } } - void -encrypt_reply(data, cnt) - unsigned char *data; - int cnt; +void +encrypt_reply(unsigned char *data, int cnt) { Encryptions *ep; register int ret, type; @@ -648,10 +635,8 @@ encrypt_reply(data, cnt) /* * Called when a ENCRYPT START command is received. */ - void -encrypt_start(data, cnt) - unsigned char *data; - int cnt; +void +encrypt_start(unsigned char *data, int cnt) { Encryptions *ep; @@ -686,10 +671,8 @@ encrypt_start(data, cnt) } } - void -encrypt_session_key(key, server) - Session_Key *key; - int server; +void +encrypt_session_key(Session_Key *key, int server) { Encryptions *ep = encryptions; @@ -705,8 +688,8 @@ encrypt_session_key(key, server) /* * Called when ENCRYPT END is received. */ - void -encrypt_end() +void +encrypt_end(void) { decrypt_input = 0; if (encrypt_debug_mode) @@ -718,8 +701,8 @@ encrypt_end() /* * Called when ENCRYPT REQUEST-END is received. */ - void -encrypt_request_end() +void +encrypt_request_end(void) { encrypt_send_end(); } @@ -730,10 +713,8 @@ encrypt_request_end() * other side wants us to start encrypting data as soon as we * can. */ - void -encrypt_request_start(data, cnt) - unsigned char *data; - int cnt; +void +encrypt_request_start(unsigned char *data, int cnt) { if (encrypt_mode == 0) { if (Server) @@ -817,9 +798,8 @@ void encrypt_send_keyid(int dir, unsigned char *keyid, int keylen, int saveit) printsub('>', &str_keyid[2], strp - str_keyid - 2); } - void -encrypt_auto(on) - int on; +void +encrypt_auto(int on) { if (on < 0) autoencrypt ^= 1; @@ -827,9 +807,8 @@ encrypt_auto(on) autoencrypt = on ? 1 : 0; } - void -decrypt_auto(on) - int on; +void +decrypt_auto(int on) { if (on < 0) autodecrypt ^= 1; @@ -837,9 +816,8 @@ decrypt_auto(on) autodecrypt = on ? 1 : 0; } - void -encrypt_start_output(type) - int type; +void +encrypt_start_output(int type) { Encryptions *ep; register unsigned char *p; @@ -894,8 +872,8 @@ encrypt_start_output(type) ENCTYPE_NAME(type)); } - void -encrypt_send_end() +void +encrypt_send_end(void) { if (!encrypt_output) return; @@ -915,8 +893,8 @@ encrypt_send_end() printf("[ Output is now clear text ]\r\n"); } - void -encrypt_send_request_start() +void +encrypt_send_request_start(void) { register unsigned char *p; register int i; @@ -935,8 +913,8 @@ encrypt_send_request_start() printf(">>>%s: Request input to be encrypted\r\n", Name); } - void -encrypt_send_request_end() +void +encrypt_send_request_end(void) { str_end[3] = ENCRYPT_REQEND; net_write(str_end, sizeof(str_end)); @@ -958,9 +936,8 @@ void encrypt_wait(void) return; } - void -encrypt_debug(mode) - int mode; +void +encrypt_debug(int mode) { encrypt_debug_mode = mode; } @@ -985,10 +962,8 @@ void encrypt_gen_printsub(unsigned char *data, int cnt, *buf = '\0'; } - void -encrypt_printsub(data, cnt, buf, buflen) - unsigned char *data, *buf; - int cnt, buflen; +void +encrypt_printsub(unsigned char *data, int cnt, unsigned char *buf, int buflen) { Encryptions *ep; register int type = data[1]; diff --git a/appl/telnet/telnet/main.c b/appl/telnet/telnet/main.c index 7f8a4ffc6..e1d1c7a06 100644 --- a/appl/telnet/telnet/main.c +++ b/appl/telnet/telnet/main.c @@ -255,6 +255,7 @@ int main(int argc, char **argv) } } + encrypt_verbose_quiet(1); if (autologin == -1) { /* esc@magic.fi; force */ #if defined(AUTHENTICATION) autologin = 1;