Only print each possible authentication type once in the auth status
authorTheodore Tso <tytso@mit.edu>
Tue, 8 Nov 1994 04:39:02 +0000 (04:39 +0000)
committerTheodore Tso <tytso@mit.edu>
Tue, 8 Nov 1994 04:39:02 +0000 (04:39 +0000)
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
src/appl/telnet/libtelnet/auth.c

index 6a71f9416efce1ebbb2c14e646b38457642307c0..4697b6ee1434eddbb7209f852bb0682ba23b3c6b 100644 (file)
@@ -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.
 
index 60f5ed6bef164e1c76f67a6bc23dbb830a717d57..2587a561e4b39391e82a86f26ae36a026f8de67c 100644 (file)
@@ -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);
 }