summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/port-aix.c19
-rw-r--r--openbsd-compat/port-aix.h4
2 files changed, 17 insertions, 6 deletions
diff --git a/openbsd-compat/port-aix.c b/openbsd-compat/port-aix.c
index 5b1cb7387..d9c0876f3 100644
--- a/openbsd-compat/port-aix.c
+++ b/openbsd-compat/port-aix.c
@@ -57,6 +57,8 @@
57 57
58#include "port-aix.h" 58#include "port-aix.h"
59 59
60static char *lastlogin_msg = NULL;
61
60# ifdef HAVE_SETAUTHDB 62# ifdef HAVE_SETAUTHDB
61static char old_registry[REGISTRY_SIZE] = ""; 63static char old_registry[REGISTRY_SIZE] = "";
62# endif 64# endif
@@ -276,23 +278,30 @@ sys_auth_record_login(const char *user, const char *host, const char *ttynm,
276 Buffer *loginmsg) 278 Buffer *loginmsg)
277{ 279{
278 char *msg = NULL; 280 char *msg = NULL;
279 static int msg_done = 0;
280 int success = 0; 281 int success = 0;
281 282
282 aix_setauthdb(user); 283 aix_setauthdb(user);
283 if (loginsuccess((char *)user, (char *)host, (char *)ttynm, &msg) == 0) { 284 if (loginsuccess((char *)user, (char *)host, (char *)ttynm, &msg) == 0) {
284 success = 1; 285 success = 1;
285 if (msg != NULL && loginmsg != NULL && !msg_done) { 286 if (msg != NULL) {
286 debug("AIX/loginsuccess: msg %s", msg); 287 debug("AIX/loginsuccess: msg %s", msg);
287 buffer_append(loginmsg, msg, strlen(msg)); 288 if (lastlogin_msg == NULL)
288 xfree(msg); 289 lastlogin_msg = msg;
289 msg_done = 1;
290 } 290 }
291 } 291 }
292 aix_restoreauthdb(); 292 aix_restoreauthdb();
293 return (success); 293 return (success);
294} 294}
295 295
296char *
297sys_auth_get_lastlogin_msg(const char *user, uid_t uid)
298{
299 char *msg = lastlogin_msg;
300
301 lastlogin_msg = NULL;
302 return msg;
303}
304
296# ifdef CUSTOM_FAILED_LOGIN 305# ifdef CUSTOM_FAILED_LOGIN
297/* 306/*
298 * record_failed_login: generic "login failed" interface function 307 * record_failed_login: generic "login failed" interface function
diff --git a/openbsd-compat/port-aix.h b/openbsd-compat/port-aix.h
index ecb9feae8..967bc7235 100644
--- a/openbsd-compat/port-aix.h
+++ b/openbsd-compat/port-aix.h
@@ -1,4 +1,4 @@
1/* $Id: port-aix.h,v 1.29 2008/03/09 05:36:55 dtucker Exp $ */ 1/* $Id: port-aix.h,v 1.30 2009/08/16 23:40:00 dtucker Exp $ */
2 2
3/* 3/*
4 * 4 *
@@ -87,6 +87,8 @@ void aix_usrinfo(struct passwd *);
87int sys_auth_allowed_user(struct passwd *, Buffer *); 87int sys_auth_allowed_user(struct passwd *, Buffer *);
88# define CUSTOM_SYS_AUTH_RECORD_LOGIN 1 88# define CUSTOM_SYS_AUTH_RECORD_LOGIN 1
89int sys_auth_record_login(const char *, const char *, const char *, Buffer *); 89int sys_auth_record_login(const char *, const char *, const char *, Buffer *);
90# define CUSTOM_SYS_AUTH_GET_LASTLOGIN_MSG
91char *sys_auth_get_lastlogin_msg(const char *, uid_t);
90# define CUSTOM_FAILED_LOGIN 1 92# define CUSTOM_FAILED_LOGIN 1
91#endif 93#endif
92 94