2 # Functions for SCO openserver 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, 4 for AIX (/etc/passwd &
8 # /etc/security/passwd), and 5 for SCO (/etc/passwd and short /etc/shadow)
15 # Returns 0 for normal group file (/etc/group only) and 2 for shadowed
16 # (/etc/group and /etc/gshadow)
22 # open_last_command(handle, user)
25 local ($fh, $user) = @_;
26 open($fh, "last $user |");
29 # read_last_line(handle)
30 # Parses a line of output from last into an array of
31 # user, tty, host, login, logout, period
37 if (!$line) { return (); }
38 if ($line =~ /system boot/) { next; }
39 if ($line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+)\s+\-\s+(\d+:\d+)\s+\((\d+:\d+)\)/) {
40 return ($1, $2, $3, $4, $5, $6);
42 elsif ($line =~ /^(\S+)\s+(\S+)\s+(\S+)?\s+(\S+\s+\S+\s+\d+\s+\d+:\d+)\s+still/) {
43 return ($1, $2, $3, $4);