--- loncom/pwchange 2002/02/19 21:51:09 1.6 +++ loncom/pwchange 2002/09/16 13:27:40 1.7 @@ -10,10 +10,11 @@ # YEAR=2002 # 02/19 Matthew Hall # -# $Id: pwchange,v 1.6 2002/02/19 21:51:09 matthew Exp $ +# $Id: pwchange,v 1.7 2002/09/16 13:27:40 foxr Exp $ ### use strict; +my $noprint = 1; # ------------------------------------------------------------------ Untainting $ENV{'PATH'}='/bin:/usr/bin'; # Nullify path information. @@ -22,10 +23,12 @@ delete @ENV{qw(IFS CDPATH ENV BASH_ENV)} # ---------------------------- Make sure this process is running from user=root my $wwwid=getpwnam('www'); if (0!=$<) { + print "Username not www" unless $noprint; exit 1; } # ----------------------------------------------- If not running setuid as root if ($>!=0) { + print "Not setuid to root" unless $noprint; exit 1; } @@ -33,12 +36,14 @@ if ($>!=0) { my $user=shift @ARGV; $user=~/^(\w+)$/; my $safe=$1; +print "Save user = $safe" unless $noprint; + my $pword=<>; chomp $pword; unless (length($safe) and ($user eq $safe) and ($safe=~/^[A-Za-z]/)) { exit 2; } - +print "Password = $pword" unless $noprint; my $pbad=0; foreach (split(//,$pword)) {if ((ord($_)<32)||(ord($_)>126)){$pbad=1;}} exit 3 if $pbad;