diff options
Diffstat (limited to 'openbsd-compat/port-aix.c')
-rw-r--r-- | openbsd-compat/port-aix.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/openbsd-compat/port-aix.c b/openbsd-compat/port-aix.c index 81d8124e0..b9fabf61f 100644 --- a/openbsd-compat/port-aix.c +++ b/openbsd-compat/port-aix.c | |||
@@ -25,16 +25,36 @@ | |||
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | #include "includes.h" | 27 | #include "includes.h" |
28 | |||
29 | #include "xmalloc.h" | ||
30 | #include "buffer.h" | ||
31 | #include "key.h" | ||
32 | #include "hostfile.h" | ||
28 | #include "auth.h" | 33 | #include "auth.h" |
29 | #include "ssh.h" | 34 | #include "ssh.h" |
30 | #include "log.h" | 35 | #include "log.h" |
31 | #include "xmalloc.h" | ||
32 | #include "buffer.h" | ||
33 | 36 | ||
34 | #ifdef _AIX | 37 | #ifdef _AIX |
35 | 38 | ||
39 | #include <errno.h> | ||
40 | #if defined(HAVE_NETDB_H) | ||
41 | # include <netdb.h> | ||
42 | #endif | ||
36 | #include <uinfo.h> | 43 | #include <uinfo.h> |
44 | #include <stdarg.h> | ||
45 | #include <string.h> | ||
46 | #include <unistd.h> | ||
37 | #include <sys/socket.h> | 47 | #include <sys/socket.h> |
48 | |||
49 | #ifdef WITH_AIXAUTHENTICATE | ||
50 | # include <login.h> | ||
51 | # include <userpw.h> | ||
52 | # if defined(HAVE_SYS_AUDIT_H) && defined(AIX_LOGINFAILED_4ARG) | ||
53 | # include <sys/audit.h> | ||
54 | # endif | ||
55 | # include <usersec.h> | ||
56 | #endif | ||
57 | |||
38 | #include "port-aix.h" | 58 | #include "port-aix.h" |
39 | 59 | ||
40 | # ifdef HAVE_SETAUTHDB | 60 | # ifdef HAVE_SETAUTHDB |
@@ -256,15 +276,17 @@ sys_auth_record_login(const char *user, const char *host, const char *ttynm, | |||
256 | Buffer *loginmsg) | 276 | Buffer *loginmsg) |
257 | { | 277 | { |
258 | char *msg = NULL; | 278 | char *msg = NULL; |
279 | static int msg_done = 0; | ||
259 | int success = 0; | 280 | int success = 0; |
260 | 281 | ||
261 | aix_setauthdb(user); | 282 | aix_setauthdb(user); |
262 | if (loginsuccess((char *)user, (char *)host, (char *)ttynm, &msg) == 0) { | 283 | if (loginsuccess((char *)user, (char *)host, (char *)ttynm, &msg) == 0) { |
263 | success = 1; | 284 | success = 1; |
264 | if (msg != NULL) { | 285 | if (msg != NULL && loginmsg != NULL && !msg_done) { |
265 | debug("AIX/loginsuccess: msg %s", msg); | 286 | debug("AIX/loginsuccess: msg %s", msg); |
266 | buffer_append(loginmsg, msg, strlen(msg)); | 287 | buffer_append(loginmsg, msg, strlen(msg)); |
267 | xfree(msg); | 288 | xfree(msg); |
289 | msg_done = 1; | ||
268 | } | 290 | } |
269 | } | 291 | } |
270 | aix_restoreauthdb(); | 292 | aix_restoreauthdb(); |