]> granicus.if.org Git - linux-pam/commitdiff
Relevant BUGIDs: 848325
authorThorsten Kukuk <kukuk@thkukuk.de>
Tue, 25 Nov 2003 09:00:06 +0000 (09:00 +0000)
committerThorsten Kukuk <kukuk@thkukuk.de>
Tue, 25 Nov 2003 09:00:06 +0000 (09:00 +0000)
Purpose of commit:
bugfix

Commit summary:
---------------

Don't use ll_time from utmp struct as argument for ctime/time,
this does not work on new 64bit architectures. Instead use a
temporary copy.

modules/pam_lastlog/pam_lastlog.c

index c86becd872bbbb12da2263751815c7f19fa7cbd9..f9a730bf317cc41bf7c400a5d82a9861c4ddee71 100644 (file)
@@ -254,10 +254,12 @@ static int last_login_date(pam_handle_t *pamh, int announce, uid_t uid)
 
        if (!(announce & LASTLOG_QUIET)) {
            if (last_login.ll_time) {
+               time_t ll_time;
                char *the_time;
                char *remark;
 
-               the_time = ctime(&last_login.ll_time);
+               ll_time = last_login.ll_time;
+               the_time = ctime(&ll_time);
                the_time[-1+strlen(the_time)] = '\0';    /* delete '\n' */
 
                remark = malloc(LASTLOG_MAXSIZE);
@@ -319,13 +321,15 @@ static int last_login_date(pam_handle_t *pamh, int announce, uid_t uid)
 
        /* write latest value */
        {
+           time_t ll_time;
            const char *remote_host=NULL
                , *terminal_line=DEFAULT_TERM;
 
            /* set this login date */
            D(("set the most recent login time"));
 
-           (void) time(&last_login.ll_time);    /* set the time */
+           (void) time(&ll_time);    /* set the time */
+            last_login.ll_time = ll_time;
 
            /* set the remote host */
            (void) pam_get_item(pamh, PAM_RHOST, (const void **)&remote_host);