]> andersk Git - openssh.git/commitdiff
- (dtucker) [loginrec.c openbsd-compat/port-aix.c openbsd-compat/port-aix.h]
authordtucker <dtucker>
Sat, 14 Aug 2004 14:09:11 +0000 (14:09 +0000)
committerdtucker <dtucker>
Sat, 14 Aug 2004 14:09:11 +0000 (14:09 +0000)
   Plug AIX login recording into login_write so logins will be recorded for
   all auth types.

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

index ffe0d0277cb241030c73ee6f281b698547961dc1..50b003bbe6fbe44bb319f6de8874327b24d6e878 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@
    Explicitly set umask for mkstemp; ok djm@
  - (dtucker) [includes.h] Undef _INCLUDE__STDC__ on HP-UX, otherwise
    prot.h and shadow.h provide conflicting declarations of getspnam.  ok djm@
+ - (dtucker) [loginrec.c openbsd-compat/port-aix.c openbsd-compat/port-aix.h]
+   Plug AIX login recording into login_write so logins will be recorded for
+   all auth types.
 
 20040813
  - (dtucker) [openbsd-compat/bsd-misc.c] Typo in #ifdef; from vinschen at
index 897921c633d5c00e45a764a427189cffde8ac913..ef525fb526b29be5aa152a7a6d8b52e503294510 100644 (file)
@@ -434,6 +434,11 @@ login_write (struct logininfo *li)
 #endif
 #ifdef USE_WTMPX
        wtmpx_write_entry(li);
+#endif
+#ifdef CUSTOM_SYS_AUTH_RECORD_LOGIN
+       if (li->type == LTYPE_LOGIN && 
+          !sys_auth_record_login(li->username,li->hostname,li->line))
+               logit("Writing login record failed for %s", li->username);
 #endif
        return 0;
 }
index d0c9a49e8ad6cba1a6015a9bb564f6df64076123..78f4faea3b3b61780393f5d5a7e16b7610ad0350 100644 (file)
@@ -101,7 +101,7 @@ aix_remove_embedded_newlines(char *p)
 int
 sys_auth_passwd(Authctxt *ctxt, const char *password)
 {
-       char *authmsg = NULL, *host, *msg, *name = ctxt->pw->pw_name;
+       char *authmsg = NULL, *msg, *name = ctxt->pw->pw_name;
        int authsuccess = 0, expired, reenter, result;
 
        do {
@@ -115,20 +115,11 @@ sys_auth_passwd(Authctxt *ctxt, const char *password)
        if (result == 0) {
                authsuccess = 1;
 
-               host = (char *)get_canonical_hostname(options.use_dns);
-
                /*
                 * Record successful login.  We don't have a pty yet, so just
                 * label the line as "ssh"
                 */
                aix_setauthdb(name);
-               if (loginsuccess((char *)name, (char *)host, "ssh", &msg) == 0) {
-                       if (msg != NULL) {
-                               debug("%s: msg %s", __func__, msg);
-                               buffer_append(&loginmsg, msg, strlen(msg));
-                               xfree(msg);
-                       }
-               }
 
                /*
                 * Check if the user's password is expired.
@@ -208,6 +199,25 @@ sys_auth_allowed_user(struct passwd *pw)
        return permitted;
 }
 
+int
+sys_auth_record_login(const char *user, const char *host, const char *ttynm)
+{
+       char *msg;
+       int success = 0;
+
+       aix_setauthdb(user);
+       if (loginsuccess((char *)user, host, ttynm, &msg) == 0) {
+               success = 1;
+               if (msg != NULL) {
+                       debug("AIX/loginsuccess: msg %s", __func__, msg);
+                       buffer_append(&loginmsg, msg, strlen(msg));
+                       xfree(msg);
+               }
+       }
+       aix_restoreauthdb();
+       return (success);
+}
+
 #  ifdef CUSTOM_FAILED_LOGIN
 /*
  * record_failed_login: generic "login failed" interface function
index 6d9716dd57a41998dfe82539f813a199c2ab9bf3..891fa8aa17324446b723ed62108694a24e8aa232 100644 (file)
@@ -65,6 +65,8 @@ void aix_usrinfo(struct passwd *);
 # define CUSTOM_SYS_AUTH_PASSWD 1
 # define CUSTOM_SYS_AUTH_ALLOWED_USER 1
 int sys_auth_allowed_user(struct passwd *);
+# define CUSTOM_SYS_AUTH_RECORD_LOGIN 1
+int sys_auth_record_login(const char *, const char *, const char *);
 # define CUSTOM_FAILED_LOGIN 1
 void record_failed_login(const char *, const char *);
 #endif
This page took 0.102162 seconds and 5 git commands to generate.