From e2a39f0f1dd6193ffae41d369f3aad85a66603bc Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Tue, 8 Nov 1994 04:39:02 +0000 Subject: [PATCH] Only print each possible authentication type once in the auth status report. Remove excess call to getauthmask() in auth_onoff() which stomped the mask field. Only print each possible authentication type once in the help message. Fix reversed sense of strcasecmp comparison in getauthmask(). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4642 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/telnet/libtelnet/ChangeLog | 10 ++++++++++ src/appl/telnet/libtelnet/auth.c | 20 +++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/appl/telnet/libtelnet/ChangeLog b/src/appl/telnet/libtelnet/ChangeLog index 6a71f9416..4697b6ee1 100644 --- a/src/appl/telnet/libtelnet/ChangeLog +++ b/src/appl/telnet/libtelnet/ChangeLog @@ -1,5 +1,15 @@ Mon Nov 7 22:36:20 1994 Theodore Y. Ts'o (tytso@dcl) + * auth.c (auth_status): Only print each possible authentication + type once in the status report. + + * auth.c (auth_onoff): Remove excess call to getauthmask() which + stomped the mask field. Only print each possible + authentication type once in the help message. + + * auth.c (getauthmask): Fix reversed sense of strcasecmp + comparison. + * auth.c (auth_enable, auth_disable): Change the input type to be a char *, which is what auth_onoff wants anyway. diff --git a/src/appl/telnet/libtelnet/auth.c b/src/appl/telnet/libtelnet/auth.c index 60f5ed6be..2587a561e 100644 --- a/src/appl/telnet/libtelnet/auth.c +++ b/src/appl/telnet/libtelnet/auth.c @@ -244,7 +244,7 @@ getauthmask(type, maskp) { register int x; - if (strcasecmp(type, AUTHTYPE_NAME(0))) { + if (!strcasecmp(type, AUTHTYPE_NAME(0))) { *maskp = -1; return(1); } @@ -277,15 +277,20 @@ auth_onoff(type, on) char *type; int on; { - int mask = -1; + int i, mask = -1; Authenticator *ap; if (!strcasecmp(type, "?") || !strcasecmp(type, "help")) { printf("auth %s 'type'\n", on ? "enable" : "disable"); printf("Where 'type' is one of:\n"); printf("\t%s\n", AUTHTYPE_NAME(0)); - for (ap = authenticators; ap->type; ap++) + mask = 0; + for (ap = authenticators; ap->type; ap++) { + if ((mask & (i = typemask(ap->type))) != 0) + continue; + mask |= i; printf("\t%s\n", AUTHTYPE_NAME(ap->type)); + } return(0); } @@ -293,7 +298,6 @@ auth_onoff(type, on) printf("%s: invalid authentication type\n", type); return(0); } - mask = getauthmask(type, &mask); if (on) i_wont_support &= ~mask; else @@ -317,16 +321,22 @@ auth_togdebug(on) auth_status() { Authenticator *ap; + int i, mask; if (i_wont_support == -1) printf("Authentication disabled\n"); else printf("Authentication enabled\n"); - for (ap = authenticators; ap->type; ap++) + mask = 0; + for (ap = authenticators; ap->type; ap++) { + if ((mask & (i = typemask(ap->type))) != 0) + continue; + mask |= i; printf("%s: %s\n", AUTHTYPE_NAME(ap->type), (i_wont_support & typemask(ap->type)) ? "disabled" : "enabled"); + } return(1); } -- 2.26.2