version 1.17, 2002/09/16 13:27:40
|
version 1.19, 2003/02/03 18:03:52
|
Line 1
|
Line 1
|
#!/usr/bin/perl |
#!/usr/bin/perl |
|
|
# The Learning Online Network with CAPA |
# The Learning Online Network with CAPA |
# |
# |
# lcpasswd - LON-CAPA setuid script to synchronously change all |
# lcpasswd - LON-CAPA setuid script to synchronously change all |
# filesystem-related passwords (samba, unix, etc) |
# filesystem-related passwords (samba, unix, etc) |
# |
# |
# YEAR=2000 |
|
# 10/27,10/28,10/29,10/30 Scott Harrison |
|
# |
|
# YEAR=2001 |
|
# 10/22,10/23,11/13,11/15 Scott Harrison |
|
# |
|
# YEAR=2002 |
# YEAR=2002 |
# 02/19 Matthew Hall |
# 02/19 Matthew Hall |
# |
# |
Line 95 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}
|
Line 88 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}
|
# Do not print error messages |
# Do not print error messages |
my $noprint=1; |
my $noprint=1; |
|
|
|
print "In lcpasswd" unless $noprint; |
|
|
# ----------------------------- Make sure this process is running from user=www |
# ----------------------------- Make sure this process is running from user=www |
my $wwwid=getpwnam('www'); |
my $wwwid=getpwnam('www'); |
&disable_root_capability; |
&disable_root_capability; |
Line 155 unless(getpwnam($safeusername)) {
|
Line 150 unless(getpwnam($safeusername)) {
|
unlink('/tmp/lock_lcpasswd'); |
unlink('/tmp/lock_lcpasswd'); |
exit 5; |
exit 5; |
} |
} |
|
|
&enable_root_capability; |
&enable_root_capability; |
($>,$<)=(0,0); |
($>,$<)=(0,0); |
print "Now root, -invoking pwchange with $safeusername $password1" |
|
|
print "Now $> , $< , -invoking pwchange with $safeusername $password1" |
unless $noprint; |
unless $noprint; |
open OUT,"|pwchange $safeusername"; |
open OUT,"|pwchange $safeusername"; |
print OUT $password1; |
print OUT $password1; |
Line 202 exit 0;
|
Line 197 exit 0;
|
# ---------------------------------------------- have setuid script run as root |
# ---------------------------------------------- have setuid script run as root |
sub enable_root_capability { |
sub enable_root_capability { |
if ($wwwid==$>) { |
if ($wwwid==$>) { |
($<,$>)=($>,$<); |
($<,$>)=($>,0); |
($(,$))=($),$(); |
($(,$))=($),0); |
} |
} |
else { |
else { |
# root capability is already enabled |
# root capability is already enabled |