]> andersk Git - openssh.git/blobdiff - auth1.c
- (tim) [regress/README.regress] Document ssh-rand-helper issue. ok bal
[openssh.git] / auth1.c
diff --git a/auth1.c b/auth1.c
index d8b5836bafc9bc282417de599de00f3b8bf8766e..f145cf03d66e4542008ee3e59fed3e27c3f7c5db 100644 (file)
--- a/auth1.c
+++ b/auth1.c
@@ -10,7 +10,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: auth1.c,v 1.50 2003/08/13 08:46:30 markus Exp $");
+RCSID("$OpenBSD: auth1.c,v 1.55 2003/11/08 16:02:40 jakob Exp $");
 
 #include "xmalloc.h"
 #include "rsa.h"
@@ -49,10 +49,6 @@ get_authname(int type)
        case SSH_CMSG_AUTH_TIS:
        case SSH_CMSG_AUTH_TIS_RESPONSE:
                return "challenge-response";
-#ifdef KRB5
-       case SSH_CMSG_AUTH_KERBEROS:
-               return "kerberos";
-#endif
        }
        snprintf(buf, sizeof buf, "bad-auth-msg-%d", type);
        return buf;
@@ -119,47 +115,6 @@ do_authloop(Authctxt *authctxt)
 
                /* Process the packet. */
                switch (type) {
-
-#ifdef KRB5
-               case SSH_CMSG_AUTH_KERBEROS:
-                       if (!options.kerberos_authentication) {
-                               verbose("Kerberos authentication disabled.");
-                       } else {
-                               char *kdata = packet_get_string(&dlen);
-                               packet_check_eom();
-
-                               if (kdata[0] != 4) { /* KRB_PROT_VERSION */
-                                       krb5_data tkt, reply;
-                                       tkt.length = dlen;
-                                       tkt.data = kdata;
-
-                                       if (PRIVSEP(auth_krb5(authctxt, &tkt,
-                                           &client_user, &reply))) {
-                                               authenticated = 1;
-                                               snprintf(info, sizeof(info),
-                                                   " tktuser %.100s",
-                                                   client_user);
-
-                                               /* Send response to client */
-                                               packet_start(
-                                                   SSH_SMSG_AUTH_KERBEROS_RESPONSE);
-                                               packet_put_string((char *)
-                                                   reply.data, reply.length);
-                                               packet_send();
-                                               packet_write_wait();
-
-                                               if (reply.length)
-                                                       xfree(reply.data);
-                                       }
-                               }
-                               xfree(kdata);
-                       }
-                       break;
-               case SSH_CMSG_HAVE_KERBEROS_TGT:
-                       packet_send_debug("Kerberos TGT passing disabled before authentication.");
-                       break;
-#endif
-
                case SSH_CMSG_AUTH_RHOSTS_RSA:
                        if (!options.rhosts_rsa_authentication) {
                                verbose("Rhosts with RSA authentication disabled.");
@@ -184,7 +139,7 @@ do_authloop(Authctxt *authctxt)
                                    BN_num_bits(client_host_key->rsa->n), bits);
                        packet_check_eom();
 
-                       authenticated = auth_rhosts_rsa(pw, client_user,
+                       authenticated = auth_rhosts_rsa(authctxt, client_user,
                            client_host_key);
                        key_free(client_host_key);
 
@@ -201,7 +156,7 @@ do_authloop(Authctxt *authctxt)
                                fatal("do_authloop: BN_new failed");
                        packet_get_bignum(n);
                        packet_check_eom();
-                       authenticated = auth_rsa(pw, n);
+                       authenticated = auth_rsa(authctxt, n);
                        BN_clear_free(n);
                        break;
 
@@ -280,7 +235,7 @@ do_authloop(Authctxt *authctxt)
                if (authenticated &&
                    !check_nt_auth(type == SSH_CMSG_AUTH_PASSWORD, pw)) {
                        packet_disconnect("Authentication rejected for uid %d.",
-                       pw == NULL ? -1 : pw->pw_uid);
+                           pw == NULL ? -1 : pw->pw_uid);
                        authenticated = 0;
                }
 #else
@@ -291,7 +246,7 @@ do_authloop(Authctxt *authctxt)
 #endif
 
 #ifdef USE_PAM
-               if (options.use_pam && authenticated && 
+               if (options.use_pam && authenticated &&
                    !PRIVSEP(do_pam_account()))
                        authenticated = 0;
 #endif
@@ -320,10 +275,9 @@ do_authloop(Authctxt *authctxt)
  * Performs authentication of an incoming connection.  Session key has already
  * been exchanged and encryption is enabled.
  */
-Authctxt *
-do_authentication(void)
+void
+do_authentication(Authctxt *authctxt)
 {
-       Authctxt *authctxt;
        u_int ulen;
        char *user, *style = NULL;
 
@@ -337,32 +291,23 @@ do_authentication(void)
        if ((style = strchr(user, ':')) != NULL)
                *style++ = '\0';
 
-#ifdef KRB5
-       /* XXX - SSH.com Kerberos v5 braindeath. */
-       if ((datafellows & SSH_BUG_K5USER) &&
-           options.kerberos_authentication) {
-               char *p;
-               if ((p = strchr(user, '@')) != NULL)
-                       *p = '\0';
-       }
-#endif
-
-       authctxt = authctxt_new();
        authctxt->user = user;
        authctxt->style = style;
 
        /* Verify that the user is a valid user. */
        if ((authctxt->pw = PRIVSEP(getpwnamallow(user))) != NULL)
                authctxt->valid = 1;
-       else
+       else {
                debug("do_authentication: illegal user %s", user);
+               authctxt->pw = fakepw();
+       }
 
        setproctitle("%s%s", authctxt->pw ? user : "unknown",
            use_privsep ? " [net]" : "");
 
 #ifdef USE_PAM
        if (options.use_pam)
-               PRIVSEP(start_pam(user));
+               PRIVSEP(start_pam(authctxt));
 #endif
 
        /*
@@ -385,6 +330,4 @@ do_authentication(void)
        packet_start(SSH_SMSG_SUCCESS);
        packet_send();
        packet_write_wait();
-
-       return (authctxt);
 }
This page took 0.040991 seconds and 4 git commands to generate.