summaryrefslogtreecommitdiff
path: root/openbsd-compat/port-aix.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2009-08-17 09:40:00 +1000
committerDarren Tucker <dtucker@zip.com.au>2009-08-17 09:40:00 +1000
commitb5d5ee1ab0a2df1d5c6aea7ac8dadc4e8782bdd0 (patch)
treecb73f65759a1f3d268015bd8688e6c987b9442e6 /openbsd-compat/port-aix.c
parent83d8f2833611c8bb3646eeae918788e946e4e190 (diff)
- (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.
Diffstat (limited to 'openbsd-compat/port-aix.c')
-rw-r--r--openbsd-compat/port-aix.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/openbsd-compat/port-aix.c b/openbsd-compat/port-aix.c
index 5b1cb738..d9c0876f 100644
--- a/openbsd-compat/port-aix.c
+++ b/openbsd-compat/port-aix.c
@@ -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