Annotation of loncom/pwchange, revision 1.1

1.1     ! harris41    1: #!/usr/bin/perl
        !             2: 
        !             3: use strict;
        !             4: 
        !             5: $ENV{'PATH'}='/bin:/usr/bin'; # Nullify path information.
        !             6: $ENV{'BASH_ENV'}=''; # Nullify shell environment information.
        !             7: 
        !             8: if ($>!=0) {
        !             9:     exit 1;
        !            10: }
        !            11: 
        !            12: my $user=shift @ARGV;
        !            13: $user=~/^(\w+)$/;
        !            14: my $safe=$1;
        !            15: my $pword=<>;
        !            16: chomp $pword;
        !            17: unless (length($safe) and ($user eq $safe) and ($safe=~/^[A-Za-z]/)) {
        !            18:     exit 2;
        !            19: }
        !            20: 
        !            21: my $pbad=0;
        !            22: map {if (($_<32)&&($_>126)){$pbad=1;}} (split(//,$pword));
        !            23: exit 3 if $pbad;
        !            24: 
        !            25: open OUT,"|passwd --stdin $safe >/dev/null";
        !            26: print OUT $pword;
        !            27: print OUT "\n";
        !            28: close OUT;
        !            29: 
        !            30: exit $?/256;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>