--- loncom/pwchange 2001/11/15 18:13:32 1.2 +++ loncom/pwchange 2002/02/19 21:51:09 1.6 @@ -1,26 +1,27 @@ #!/usr/bin/perl -# The Learning Online Network +# The Learning Online Network with CAPA # # pwchange - setuid script to change unix passwords # # YEAR=2001 # 10/23,11/13,11/15 Scott Harrison # -# $Id: pwchange,v 1.2 2001/11/15 18:13:32 harris41 Exp $ +# YEAR=2002 +# 02/19 Matthew Hall +# +# $Id: pwchange,v 1.6 2002/02/19 21:51:09 matthew Exp $ ### use strict; -my $VERSION = 1.1; - # ------------------------------------------------------------------ Untainting $ENV{'PATH'}='/bin:/usr/bin'; # Nullify path information. delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # nullify potential taints -# ----------------------------- Make sure this process is running from user=www +# ---------------------------- Make sure this process is running from user=root my $wwwid=getpwnam('www'); -if ($wwwid!=$<) { +if (0!=$<) { exit 1; } # ----------------------------------------------- If not running setuid as root @@ -39,7 +40,7 @@ unless (length($safe) and ($user eq $saf } my $pbad=0; -map {if (($_<32)&&($_>126)){$pbad=1;}} (split(//,$pword)); +foreach (split(//,$pword)) {if ((ord($_)<32)||(ord($_)>126)){$pbad=1;}} exit 3 if $pbad; # --------------------------------------------------------- Call system command