Change ENCRYPT to ENCRYPTION
[unix-history] / usr / src / lib / libtelnet / auth.c
index fb0d4cb..8874b36 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)auth.c     5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)auth.c     5.3 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -30,7 +30,7 @@ static char sccsid[] = "@(#)auth.c    5.2 (Berkeley) %G%";
  */
 
 
  */
 
 
-#if    defined(AUTHENTICATE)
+#if    defined(AUTHENTICATION)
 #include <stdio.h>
 #include <sys/types.h>
 #include <signal.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <signal.h>
@@ -52,6 +52,24 @@ static char sccsid[] = "@(#)auth.c   5.2 (Berkeley) %G%";
 
 #define        typemask(x)             (1<<((x)-1))
 
 
 #define        typemask(x)             (1<<((x)-1))
 
+#ifdef KRB4_ENCPWD
+extern krb4encpwd_init();
+extern krb4encpwd_send();
+extern krb4encpwd_is();
+extern krb4encpwd_reply();
+extern krb4encpwd_status();
+extern krb4encpwd_printsub();
+#endif
+
+#ifdef RSA_ENCPWD
+extern rsaencpwd_init();
+extern rsaencpwd_send();
+extern rsaencpwd_is();
+extern rsaencpwd_reply();
+extern rsaencpwd_status();
+extern rsaencpwd_printsub();
+#endif
+
 int auth_debug_mode = 0;
 static         char    *Name = "Noname";
 static int     Server = 0;
 int auth_debug_mode = 0;
 static         char    *Name = "Noname";
 static int     Server = 0;
@@ -67,7 +85,24 @@ static       int     auth_send_cnt = 0;
  * in priority order, i.e. try the first one first.
  */
 Authenticator authenticators[] = {
  * in priority order, i.e. try the first one first.
  */
 Authenticator authenticators[] = {
+#ifdef SPX
+       { AUTHTYPE_SPX, AUTH_WHO_CLIENT|AUTH_HOW_MUTUAL,
+                               spx_init,
+                               spx_send,
+                               spx_is,
+                               spx_reply,
+                               spx_status,
+                               spx_printsub },
+       { AUTHTYPE_SPX, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY,
+                               spx_init,
+                               spx_send,
+                               spx_is,
+                               spx_reply,
+                               spx_status,
+                               spx_printsub },
+#endif
 #ifdef KRB5
 #ifdef KRB5
+# ifdef        ENCRYPTION
        { AUTHTYPE_KERBEROS_V5, AUTH_WHO_CLIENT|AUTH_HOW_MUTUAL,
                                kerberos5_init,
                                kerberos5_send,
        { AUTHTYPE_KERBEROS_V5, AUTH_WHO_CLIENT|AUTH_HOW_MUTUAL,
                                kerberos5_init,
                                kerberos5_send,
@@ -75,6 +110,7 @@ Authenticator authenticators[] = {
                                kerberos5_reply,
                                kerberos5_status,
                                kerberos5_printsub },
                                kerberos5_reply,
                                kerberos5_status,
                                kerberos5_printsub },
+# endif
        { AUTHTYPE_KERBEROS_V5, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY,
                                kerberos5_init,
                                kerberos5_send,
        { AUTHTYPE_KERBEROS_V5, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY,
                                kerberos5_init,
                                kerberos5_send,
@@ -84,6 +120,7 @@ Authenticator authenticators[] = {
                                kerberos5_printsub },
 #endif
 #ifdef KRB4
                                kerberos5_printsub },
 #endif
 #ifdef KRB4
+# ifdef ENCRYPTION
        { AUTHTYPE_KERBEROS_V4, AUTH_WHO_CLIENT|AUTH_HOW_MUTUAL,
                                kerberos4_init,
                                kerberos4_send,
        { AUTHTYPE_KERBEROS_V4, AUTH_WHO_CLIENT|AUTH_HOW_MUTUAL,
                                kerberos4_init,
                                kerberos4_send,
@@ -91,6 +128,7 @@ Authenticator authenticators[] = {
                                kerberos4_reply,
                                kerberos4_status,
                                kerberos4_printsub },
                                kerberos4_reply,
                                kerberos4_status,
                                kerberos4_printsub },
+# endif
        { AUTHTYPE_KERBEROS_V4, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY,
                                kerberos4_init,
                                kerberos4_send,
        { AUTHTYPE_KERBEROS_V4, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY,
                                kerberos4_init,
                                kerberos4_send,
@@ -98,6 +136,24 @@ Authenticator authenticators[] = {
                                kerberos4_reply,
                                kerberos4_status,
                                kerberos4_printsub },
                                kerberos4_reply,
                                kerberos4_status,
                                kerberos4_printsub },
+#endif
+#ifdef KRB4_ENCPWD
+       { AUTHTYPE_KRB4_ENCPWD, AUTH_WHO_CLIENT|AUTH_HOW_MUTUAL,
+                               krb4encpwd_init,
+                               krb4encpwd_send,
+                               krb4encpwd_is,
+                               krb4encpwd_reply,
+                               krb4encpwd_status,
+                               krb4encpwd_printsub },
+#endif
+#ifdef RSA_ENCPWD
+       { AUTHTYPE_RSA_ENCPWD, AUTH_WHO_CLIENT|AUTH_HOW_ONE_WAY,
+                               rsaencpwd_init,
+                               rsaencpwd_send,
+                               rsaencpwd_is,
+                               rsaencpwd_reply,
+                               rsaencpwd_status,
+                               rsaencpwd_printsub },
 #endif
        { 0, },
 };
 #endif
        { 0, },
 };
@@ -340,9 +396,7 @@ auth_send(data, cnt)
                if ((i_support & ~i_wont_support) & typemask(*auth_send_data)) {
                        ap = findauthenticator(auth_send_data[0],
                                               auth_send_data[1]);
                if ((i_support & ~i_wont_support) & typemask(*auth_send_data)) {
                        ap = findauthenticator(auth_send_data[0],
                                               auth_send_data[1]);
-                       if (!ap) {
-                               printf("Internal state error: cannot find authentication type %d a second time\r\n", *auth_send_data);
-                       } else if (ap->send) {
+                       if (ap && ap->send) {
                                if (auth_debug_mode)
                                        printf(">>>%s: Trying %d %d\r\n",
                                                Name, auth_send_data[0],
                                if (auth_debug_mode)
                                        printf(">>>%s: Trying %d %d\r\n",
                                                Name, auth_send_data[0],
@@ -372,6 +426,14 @@ auth_send(data, cnt)
        if (auth_debug_mode)
                printf(">>>%s: Sent failure message\r\n", Name);
        auth_finished(0, AUTH_REJECT);
        if (auth_debug_mode)
                printf(">>>%s: Sent failure message\r\n", Name);
        auth_finished(0, AUTH_REJECT);
+#ifdef KANNAN
+       /*
+        *  We requested strong authentication, however no mechanisms worked.
+        *  Therefore, exit on client end.
+        */
+       printf("Unable to securely authenticate user ... exit\n"); 
+       exit(0);
+#endif /* KANNAN */
 }
 
        void
 }
 
        void