--- loncom/lcpasswd 2001/10/23 03:42:30 1.12 +++ loncom/lcpasswd 2001/11/15 18:34:57 1.13 @@ -1,13 +1,18 @@ #!/usr/bin/perl + +# The Learning Online Network with CAPA +# +# lcpasswd - LON-CAPA setuid script to synchronously change all +# filesystem-related passwords (samba, unix, etc) # -# lcpasswd +# YEAR=2000 +# 10/27,10/28,10/29,10/30 Scott Harrison # -# Scott Harrison -# SH: October 27, 2000 -# SH: October 28, 2000 -# SH: October 29, 2000 # YEAR=2001 -# Scott Harrison 10/22 +# 10/22,10/23,11/13,11/15 Scott Harrison +# +# $Id: lcpasswd,v 1.13 2001/11/15 18:34:57 harris41 Exp $ +### ############################################################################### ## ## @@ -82,7 +87,7 @@ use strict; # Security $ENV{'PATH'}='/bin:/usr/bin:/usr/local/sbin:/home/httpd/perl'; # Nullify path # information -$ENV{'BASH_ENV'}=''; # Nullify shell environment information. +delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # nullify potential taints # Do not print error messages my $noprint=1; @@ -161,7 +166,7 @@ if ($?) { } my $userid=getpwnam($safeusername); -unless (-e '/usr/bin/smbpasswd') { +if (-e '/usr/bin/smbpasswd') { ($>,$<)=(0,0); # fool smbpasswd here to think this is not a setuid # environment @@ -187,7 +192,8 @@ unless (-e '/usr/bin/smbpasswd') { close OUT; } - open(OUT,"|/usr/bin/smbpasswd -s $safeusername>/dev/null"); + open(OUT,"|/usr/bin/smbpasswd -s $safeusername>/dev/null") or + die('cannot run smbpasswd'); print OUT $password2; print OUT "\n"; print OUT $password2; print OUT "\n"; close OUT; @@ -258,3 +264,32 @@ sub try_to_lock { close LOCK; return 1; } + +=head1 NAME + +lcpasswd - LON-CAPA setuid script to synchronously change all + filesystem-related passwords (samba, unix, etc) + +=head1 DESCRIPTION + +LON-CAPA setuid script to synchronously change all +filesystem-related passwords (samba, unix, etc) + +=head1 README + +LON-CAPA setuid script to synchronously change all +filesystem-related passwords (samba, unix, etc) + +=head1 PREREQUISITES + +=head1 COREQUISITES + +=pod OSNAMES + +linux + +=pod SCRIPT CATEGORIES + +LONCAPA/Administrative + +=cut