#!/usr/local/bin/perl # # $Id: lock.bad 356 2011-09-24 23:25:47Z svnuser $ # # $Log: lock.bad,v $ # Revision 1.1 1998/05/24 05:23:39 merlin # First version checked in CVS # # $SIG{'TSTP'}='IGNORE'; $SIG{'INT'}='IGNORE'; $SIG{'HUP'}='IGNORE'; $SIG{'QUIT'}='IGNORE'; chomp ($USER=`whoami`); open(PW, "/etc/passwd") || die "can't open /etc/passwd: $!\n"; while(($_=) && (($name, $pw, $full, $full, $full) = split (/:/)) && ($name ne $USER)) { /^root/ && ($rpw = $pw); } $rpw=$pw unless defined($rpw); do { $root && print "\nWrong password, try again\n\n"; print "Please $full, type your password to unlock: "; system "stty -echo"; chop ($pass = ); system "stty echo"; } until ((($root=1) && (crypt($pass,substr($pw,0,2)) eq $pw)) || (($root=2) && (crypt($pass,substr($rpw,0,2)) eq $rpw))); if ($root == 1) { print "\nYou can go on $full\n"; } else { print "\nYou can override this account, operator\n"; }