]> andersk Git - gssapi-openssh.git/blobdiff - openssh/auth-passwd.c
Re-import of OpenSSH 3.7.1p2 (Chase\!)
[gssapi-openssh.git] / openssh / auth-passwd.c
index a27170cccb4bf76653af750782e25f698286b452..971c7ba19d9be09cc4efdd1d37f0c9dfc6c13f53 100644 (file)
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: auth-passwd.c,v 1.30 2003/11/04 08:54:09 djm Exp $");
+RCSID("$OpenBSD: auth-passwd.c,v 1.29 2003/08/26 09:58:43 markus Exp $");
 
 #include "packet.h"
 #include "log.h"
 #include "servconf.h"
 #include "auth.h"
 #ifdef WITH_AIXAUTHENTICATE
+# include "buffer.h"
 # include "canohost.h"
+extern Buffer loginmsg;
 #endif
 
 extern ServerOptions options;
@@ -58,8 +60,11 @@ auth_password(Authctxt *authctxt, const char *password)
        struct passwd * pw = authctxt->pw;
        int ok = authctxt->valid;
 
+       /* deny if no user. */
+       if (pw == NULL)
+               return 0;
 #ifndef HAVE_CYGWIN
-       if (pw->pw_uid == 0 && options.permit_root_login != PERMIT_YES)
+       if (pw && pw->pw_uid == 0 && options.permit_root_login != PERMIT_YES)
                ok = 0;
 #endif
        if (*password == '\0' && options.permit_empty_passwd == 0)
@@ -87,11 +92,44 @@ auth_password(Authctxt *authctxt, const char *password)
        }
 # endif
 # ifdef WITH_AIXAUTHENTICATE
-       if (aix_authenticate(pw->pw_name, password,
-           get_canonical_hostname(options.use_dns)) == 0)
-               return 0;
-       else
-               return ok;
+       {
+               char *authmsg = NULL;
+               int reenter = 1;
+               int authsuccess = 0;
+
+               if (authenticate(pw->pw_name, password, &reenter,
+                   &authmsg) == 0 && ok) {
+                       char *msg;
+                       char *host = 
+                           (char *)get_canonical_hostname(options.use_dns);
+
+                       authsuccess = 1;
+                       aix_remove_embedded_newlines(authmsg);  
+
+                       debug3("AIX/authenticate succeeded for user %s: %.100s",
+                               pw->pw_name, authmsg);
+
+                       /* No pty yet, so just label the line as "ssh" */
+                       aix_setauthdb(authctxt->user);
+                       if (loginsuccess(authctxt->user, host, "ssh", 
+                           &msg) == 0) {
+                               if (msg != NULL) {
+                                       debug("%s: msg %s", __func__, msg);
+                                       buffer_append(&loginmsg, msg, 
+                                           strlen(msg));
+                                       xfree(msg);
+                               }
+                       }
+               } else {
+                       debug3("AIX/authenticate failed for user %s: %.100s",
+                           pw->pw_name, authmsg);
+               }
+
+               if (authmsg != NULL)
+                       xfree(authmsg);
+
+               return authsuccess;
+       }
 # endif
 # ifdef BSD_AUTH
        if (auth_userokay(pw->pw_name, authctxt->style, "auth-ssh",
This page took 0.032674 seconds and 4 git commands to generate.