--- loncom/pwchange 2002/09/19 02:02:59 1.8 +++ loncom/pwchange 2009/07/17 02:20:59 1.10 @@ -5,12 +5,11 @@ # pwchange - setuid script to change unix passwords # # YEAR=2001 -# 10/23,11/13,11/15 Scott Harrison # # YEAR=2002 # 02/19 Matthew Hall # -# $Id: pwchange,v 1.8 2002/09/19 02:02:59 foxr Exp $ +# $Id: pwchange,v 1.10 2009/07/17 02:20:59 raeburn Exp $ ### use strict; @@ -53,10 +52,20 @@ foreach (split(//,$pword)) {if ((ord($_) exit 3 if $pbad; # --------------------------------------------------------- Call system command -open OUT,"|passwd --stdin $safe >/dev/null"; -print OUT $pword; -print OUT "\n"; -close OUT; +my $distro; +if (open(PIPE,"perl distprobe|")) { + $distro = ; + close(PIPE); +} +if ($distro =~ /^ubuntu|debian/) { + open(OUT,"|/usr/sbin/usermod -p `mkpasswd $pword` $safe"); + close(OUT); +} else { + open(OUT,"|passwd --stdin $safe >/dev/null"); + print OUT $pword; + print OUT "\n"; + close(OUT); +} # --------------------------------------- exit with status of command execution exit $?/256;