Server option PrintLastLog does not work on AIX

miguel.sanders at arcelormittal.com miguel.sanders at arcelormittal.com
Mon May 4 02:20:11 EST 2009


Hi

Apparently, the server option "PrintLastLog" does not work on AIX.
The last login time is always displayed, disregarding the option.
When browsing the code, I found out there are several functions in loginrec.c which solely handle the processing of the last login info (login_get_lastlog, getlast_entry).
Since AIX does not provide such a function natively, the configure script sets the DISABLE_LASTLOG define. 
A small code snippet from getlast_entry in loginrec.c shows this

#if defined(DISABLE_LASTLOG)
        /* On some systems we shouldn't even try to obtain last login
         * time, e.g. AIX */
        return (0);

On the other hand, when issuing the AIX loginsuccess() call (which writes a new login record), the last login record can be retrieved by that very same call.
If we look at port-aix.c, we can see the following:

if (loginsuccess((char *)user, (char *)host, (char *)ttynm, &msg) == 0) {
	success = 1;
            if (msg != NULL && loginmsg != NULL && !msg_done) {
                     debug("AIX/loginsuccess: msg %s", msg);
                     buffer_append(loginmsg, msg, strlen(msg));
                     xfree(msg);
                     msg_done = 1;
            }
 }


The pointer "msg" points to the new last login info for the user and it always appended to the loginmsg buffer. 
The buffer_append call should only be called if options.print_lastlog is set.
Bugzilla item # 1595 was created to address this issue.

Met vriendelijke groet
Best regards
Bien à vous

Miguel SANDERS
ArcelorMittal Gent

UNIX Systems & Storage
IT Supply Western Europe | John Kennedylaan 51
B-9042 Gent

T +32 9 347 3538 | F +32 9 347 4901 | M +32478 805 023
E miguel.sanders at arcelormittal.com
www.arcelormittal.com/gent


**** 
This message and any attachment are confidential, intended solely for the use of the individual or entity to whom it is addressed and may be protected by professional secrecy or intellectual property rights. 
If you have received it by mistake, or are not the named recipient(s), please immediately notify the sender and delete the message. You are hereby notified that any unauthorized use, copying or dissemination of any or all information contained in this message is prohibited. 
Arcelormittal shall not be liable for the message if altered, falsified, or in case of error in the recipient. 
This message does not constitute any right or commitment for ArcelorMittal except when expressly agreed otherwise in writing in a separate agreement.  
****  



More information about the openssh-unix-dev mailing list