]> andersk Git - openssh.git/commitdiff
- (dtucker) Bug #543: [configure.ac port-aix.c port-aix.h]
authordtucker <dtucker>
Mon, 14 Jul 2003 06:41:55 +0000 (06:41 +0000)
committerdtucker <dtucker>
Mon, 14 Jul 2003 06:41:55 +0000 (06:41 +0000)
   Call setauthdb() before loginfailed(), which may load password registry-
   specific functions.  Based on patch by cawlfiel@us.ibm.com.

CREDITS
ChangeLog
configure.ac
openbsd-compat/port-aix.c
openbsd-compat/port-aix.h

diff --git a/CREDITS b/CREDITS
index 672e32ce9c2c20ac0fc6d55704a3dcc7175307d9..936d25ed314af1c7d176b817a46d566239f4354a 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -49,6 +49,7 @@ Juergen Keil <jk@tools.de> - scp bugfixing
 KAMAHARA Junzo <kamahara@cc.kshosen.ac.jp> - Configure fixes
 Kees Cook <cook@cpoint.net> - scp fixes
 Kenji Miyake <kenji@miyake.org> - Configure fixes
+Kevin Cawlfield <cawlfiel@us.ibm.com> - AIX fixes.
 Kevin O'Connor <kevin_oconnor@standardandpoors.com> - RSAless operation
 Kevin Steves <stevesk@pobox.com> - HP support, bugfixes, improvements
 Kiyokazu SUTO <suto@ks-and-ks.ne.jp> - Bugfixes
index ce12eaeb39fe9de30751bc680959c225dac7c1e2..9713c7cb1dcba49025c00d43e715b92b67c864de 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@
    loginfailed at all, so assume 3-arg loginfailed if not declared.
  - (dtucker) [port-aix.h] Work around name collision on AIX for r_type by
    undef'ing it.
+ - (dtucker) Bug #543: [configure.ac port-aix.c port-aix.h]
+   Call setauthdb() before loginfailed(), which may load password registry-
+   specific functions.  Based on patch by cawlfiel@us.ibm.com.
 
 20030708
  - (dtucker) [acconfig.h auth-passwd.c configure.ac session.c port-aix.[ch]]
index 206e8ebb7b306595438840966a47faab19990ef4..157117629f5259e919f42cf13aa66f73b376645c 100644 (file)
@@ -95,6 +95,7 @@ case "$host" in
                [],
                [#include <usersec.h>]
        )
+       AC_CHECK_FUNCS(setauthdb)
        AC_DEFINE(BROKEN_GETADDRINFO)
        AC_DEFINE(BROKEN_REALPATH)
        dnl AIX handles lastlog as part of its login message
index 562923720c54975ed2b3d2fe945d2385638c12a5..7a981634b1d236ff4fb67e256c0355664aeb8b52 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <uinfo.h>
 #include <../xmalloc.h>
+#include "port-aix.h"
 
 extern ServerOptions options;
 
@@ -92,12 +93,49 @@ record_failed_login(const char *user, const char *ttyname)
 {
        char *hostname = get_canonical_hostname(options.use_dns);
 
+       if (geteuid() != 0)
+               return;
+
+       aix_setauthdb(user);
 #  ifdef AIX_LOGINFAILED_4ARG
        loginfailed((char *)user, hostname, (char *)ttyname, AUDIT_FAIL_AUTH);
 #  else
        loginfailed((char *)user, hostname, (char *)ttyname);
 #  endif
 }
+
+/*
+ * If we have setauthdb, retrieve the password registry for the user's
+ * account then feed it to setauthdb.  This may load registry-specific method
+ * code.  If we don't have setauthdb or have already called it this is a no-op.
+ */
+void
+aix_setauthdb(const char *user)
+{
+#  ifdef HAVE_SETAUTHDB
+       static char *registry = NULL;
+
+       if (registry != NULL)   /* have already done setauthdb */
+               return;
+
+       if (setuserdb(S_READ) == -1) {
+               debug3("%s: Could not open userdb to read", __func__);
+               return;
+       }
+       
+       if (getuserattr((char *)user, S_REGISTRY, &registry, SEC_CHAR) == 0) {
+               if (setauthdb(registry, NULL) == 0)
+                       debug3("%s: AIX/setauthdb set registry %s", __func__,
+                           registry);
+               else 
+                       debug3("%s: AIX/setauthdb set registry %s failed: %s",
+                           __func__, registry, strerror(errno));
+       } else
+               debug3("%s: Could not read S_REGISTRY for user: %s", __func__,
+                   strerror(errno));
+       enduserdb();
+#  endif
+}
 # endif /* CUSTOM_FAILED_LOGIN */
 #endif /* _AIX */
 
index 2e5def54eaa4806ad8efdc40a5eac4666824a631..25ceb5b190c4597d08e1348f1a93861621689fb8 100644 (file)
@@ -53,6 +53,7 @@
 #ifdef WITH_AIXAUTHENTICATE
 # define CUSTOM_FAILED_LOGIN 1
 void record_failed_login(const char *user, const char *ttyname);
+void aix_setauthdb(const char *);
 #endif
 
 void aix_usrinfo(struct passwd *pw);
This page took 0.052281 seconds and 5 git commands to generate.