diff --git a/useradmin/linux-lib.pl b/useradmin/linux-lib.pl index 84839b546..8c8e44c2f 100755 --- a/useradmin/linux-lib.pl +++ b/useradmin/linux-lib.pl @@ -21,7 +21,8 @@ return &password_file($config{'gshadow_file'}) ? 2 : 0; sub open_last_command { local ($fh, $user) = @_; -open($fh, "last $user |"); +local $quser = quotemeta($user); +open($fh, "(last -F $quser || last $quser) |"); } # read_last_line(handle) @@ -35,9 +36,15 @@ while(1) { if (!$line) { return (); } if ($line =~ /system boot/) { next; } if ($line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+)\s+\-\s+(\S+)\s+\((\d+:\d+)\)/) { + # jcameron pts/0 fudu Thu Feb 22 09:47 - 10:15 + return ($1, $2, $3, $4, $5 eq "down" ? "Shutdown" : $5, $6); + } + elsif ($line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+:\d+\s+\d+)\s+\-\s+(\S+\s+\S+\s+\d+\s+\d+:\d+:\d+\s+\d+)\s+\((\d+:\d+)\)/) { + # jcameron pts/0 fudu Thu Feb 22 09:47 - 10:15 return ($1, $2, $3, $4, $5 eq "down" ? "Shutdown" : $5, $6); } elsif ($line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+)\s+still/) { + # root pts/0 fudu Fri Feb 23 18:46 still logged in return ($1, $2, $3, $4); } } diff --git a/useradmin/list_logins.cgi b/useradmin/list_logins.cgi index 017baa282..c48044796 100755 --- a/useradmin/list_logins.cgi +++ b/useradmin/list_logins.cgi @@ -27,12 +27,14 @@ elsif ($access{'logins'} ne "*") { foreach $l (&list_last_logins($u, $config{'last_count'})) { $tm = defined(&mailboxes::parse_mail_date) ? &mailboxes::parse_mail_date($l->[3]) : undef; + $tm2 = defined(&mailboxes::parse_mail_date) ? + &mailboxes::parse_mail_date($l->[4]) : undef; push(@table, [ $u ? ( ) : ( "".&html_escape($l->[0])."" ), &html_escape($l->[2]) || $text{'logins_local'}, &html_escape($l->[1]), &html_escape($tm ? &make_date($tm) : $l->[3]), - $l->[4] ? ( &html_escape($l->[4]), + $l->[4] ? ( &html_escape($tm2 ? &make_date($tm2) : $l->[4]), &html_escape($l->[5]) ) : ( "$text{'logins_still'}", "" ), ]);