2 # Functions for aix password file format
5 # Returns 0 for old-style passwords (/etc/passwd only), 1 for FreeBSD-style
6 # (/etc/master.passwd), 2 for SysV (/etc/passwd & /etc/shadow), 3 for
7 # /etc/passwd with update via useradd and 4 for AIX (/etc/passwd &
8 # /etc/security/passwd)
15 # Returns 0 for normal group file (/etc/group only), 2 for shadowed
16 # (/etc/group and /etc/gshadow), and 4 for AIX (/etc/group &
17 # /etc/security/group)
23 # open_last_command(handle, user)
26 local ($fh, $user) = @_;
27 open($fh, "last $user |");
30 # read_last_line(handle)
31 # Parses a line of output from last into an array of
32 # user, tty, host, login, logout, period
38 if (!$line) { return (); }
39 if ($line =~ /system boot/) { next; }
40 if ($line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+)\s+\-\s+(\d+:\d+)\s+\((\d+:\d+)\)/) {
41 return ($1, $2, $3, $4, $5, $6);
43 elsif ($line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+)\s+still/) {
44 return ($1, $2, $3, $4);