]> andersk Git - openssh.git/commitdiff
- (dtucker) [sshlogin.c openbsd-compat/port-aix.{c,h}] Bug #1595: make
authordtucker <dtucker>
Sun, 16 Aug 2009 23:40:00 +0000 (23:40 +0000)
committerdtucker <dtucker>
Sun, 16 Aug 2009 23:40:00 +0000 (23:40 +0000)
   PrintLastLog work on AIX.  Based in part on a patch from Miguel Sanders.

ChangeLog
openbsd-compat/port-aix.c
openbsd-compat/port-aix.h
sshlogin.c

index fc42b578593d1154de1da19fcb5ad38fef00b8ae..61ba1ed7bd87f5c19a3c85d1ba4a9c716285a554 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
  - (dtucker) [configure.ac] Check for headers before libraries for openssl an
    zlib, which should make the errors slightly more meaningful on platforms
    where there's separate "-devel" packages for those.
+ - (dtucker) [sshlogin.c openbsd-compat/port-aix.{c,h}] Bug #1595: make
+   PrintLastLog work on AIX.  Based in part on a patch from Miguel Sanders.
 
 20090729
  - (tim) [contrib/cygwin/ssh-user-config] Change script to call correct error
index 5b1cb73874dd51d38906d2ea848b0bf76ee3dedc..d9c0876f3ad37dee00b03a82ff0adc0287cda2d7 100644 (file)
@@ -57,6 +57,8 @@
 
 #include "port-aix.h"
 
+static char *lastlogin_msg = NULL;
+
 # ifdef HAVE_SETAUTHDB
 static char old_registry[REGISTRY_SIZE] = "";
 # endif
@@ -276,23 +278,30 @@ sys_auth_record_login(const char *user, const char *host, const char *ttynm,
     Buffer *loginmsg)
 {
        char *msg = NULL;
-       static int msg_done = 0;
        int success = 0;
 
        aix_setauthdb(user);
        if (loginsuccess((char *)user, (char *)host, (char *)ttynm, &msg) == 0) {
                success = 1;
-               if (msg != NULL && loginmsg != NULL && !msg_done) {
+               if (msg != NULL) {
                        debug("AIX/loginsuccess: msg %s", msg);
-                       buffer_append(loginmsg, msg, strlen(msg));
-                       xfree(msg);
-                       msg_done = 1;
+                       if (lastlogin_msg == NULL)
+                               lastlogin_msg = msg;
                }
        }
        aix_restoreauthdb();
        return (success);
 }
 
+char *
+sys_auth_get_lastlogin_msg(const char *user, uid_t uid)
+{
+       char *msg = lastlogin_msg;
+
+       lastlogin_msg = NULL;
+       return msg;
+}
+
 #  ifdef CUSTOM_FAILED_LOGIN
 /*
  * record_failed_login: generic "login failed" interface function
index 147ad0b35aefed289f29671b00f92ea85d10c6f5..8b891faf8b1ec3590dd8c9236597259627c48080 100644 (file)
@@ -87,6 +87,8 @@ void aix_usrinfo(struct passwd *);
 int sys_auth_allowed_user(struct passwd *, Buffer *);
 # define CUSTOM_SYS_AUTH_RECORD_LOGIN 1
 int sys_auth_record_login(const char *, const char *, const char *, Buffer *);
+# define CUSTOM_SYS_AUTH_GET_LASTLOGIN_MSG
+char *sys_auth_get_lastlogin_msg(const char *, uid_t);
 # define CUSTOM_FAILED_LOGIN 1
 #endif
 
index dff47b6f7ce7e0485aec5ee96c9af8cb02093e92..33bd652fb0b5f2be1dbc079b5986f3742e7fdc79 100644 (file)
@@ -93,6 +93,13 @@ store_lastlog_message(const char *user, uid_t uid)
        if (!options.print_lastlog)
                return;
 
+# ifdef CUSTOM_SYS_AUTH_GET_LASTLOGIN_MSG
+       time_string = sys_auth_get_lastlogin_msg(user, uid);
+       if (time_string != NULL) {
+               buffer_append(&loginmsg, time_string, strlen(time_string));
+               xfree(time_string);
+       }
+# else
        last_login_time = get_last_login_time(uid, user, hostname,
            sizeof(hostname));
 
@@ -107,6 +114,7 @@ store_lastlog_message(const char *user, uid_t uid)
                            time_string, hostname);
                buffer_append(&loginmsg, buf, strlen(buf));
        }
+# endif /* CUSTOM_SYS_AUTH_GET_LASTLOGIN_MSG */
 #endif /* NO_SSH_LASTLOG */
 }
 
This page took 0.040471 seconds and 5 git commands to generate.