version 1.5, 2000/10/29 22:50:56
|
version 1.7, 2000/10/29 23:14:16
|
Line 20 use strict;
|
Line 20 use strict;
|
# Second line is PASSWORD |
# Second line is PASSWORD |
# Third line is PASSWORD |
# Third line is PASSWORD |
|
|
|
# Valid passwords must consist of the |
|
# ascii characters within the inclusive |
|
# range of 0x20 (32) to 0x7E (126). |
|
# These characters are: |
|
# SPACE and |
|
# !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO |
|
# PQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ |
|
|
|
# Valid user names must consist of ascii |
|
# characters that are alphabetical characters |
|
# (A-Z,a-z), numeric (0-9), or the underscore |
|
# mark (_). (Essentially, the perl regex \w). |
|
|
# Command-line arguments [USERNAME] [PASSWORD] [PASSWORD] |
# Command-line arguments [USERNAME] [PASSWORD] [PASSWORD] |
# Yes, but be very careful here (don't pass shell commands) |
# Yes, but be very careful here (don't pass shell commands) |
# and this is only supported to allow perl-system calls. |
# and this is only supported to allow perl-system calls. |
Line 87 my ($username,$password1,$password2)=@in
|
Line 100 my ($username,$password1,$password2)=@in
|
$username=~/^(\w+)$/; |
$username=~/^(\w+)$/; |
my $safeusername=$1; |
my $safeusername=$1; |
|
|
|
# Only add user if we can create a brand new home directory (/home/username). |
|
if (-e "/home/$safeusername") { |
|
print "Error. User already exists.\n" unless $noprint; |
|
unlink('/tmp/lock_lcpasswd'); |
|
exit 8; |
|
} |
|
|
|
# Only add user if the two password arguments match. |
if ($password1 ne $password2) { |
if ($password1 ne $password2) { |
print "Error. Password mismatch.\n"; |
print "Error. Password mismatch.\n" unless $noprint; |
unlink('/tmp/lock_lcpasswd'); |
unlink('/tmp/lock_lcpasswd'); |
exit 7; |
exit 7; |
} |
} |
Line 99 if ($password1 ne $password2) {
|
Line 120 if ($password1 ne $password2) {
|
# a way that www is a member of the user-specific group |
# a way that www is a member of the user-specific group |
|
|
if (system('/usr/sbin/useradd','-c','LON-CAPA user',$safeusername)) { |
if (system('/usr/sbin/useradd','-c','LON-CAPA user',$safeusername)) { |
print "Error. Something went wrong with the addition of user \"$safeusername\".\n"; |
print "Error. Something went wrong with the addition of user \"$safeusername\".\n" unless $noprint; |
unlink('/tmp/lock_lcpasswd'); |
unlink('/tmp/lock_lcpasswd'); |
exit 5; |
exit 5; |
} |
} |
|
|
|
# Make www a member of that user group. |
if (system('/usr/sbin/usermod','-G',$safeusername,'www')) { |
if (system('/usr/sbin/usermod','-G',$safeusername,'www')) { |
print "Error. Could not make www a member of the group \"$safeusername\".\n"; |
print "Error. Could not make www a member of the group \"$safeusername\".\n" unless $noprint; |
unlink('/tmp/lock_lcpasswd'); |
unlink('/tmp/lock_lcpasswd'); |
exit 6; |
exit 6; |
} |
} |
Line 116 if (system('/usr/sbin/usermod','-G',$saf
|
Line 139 if (system('/usr/sbin/usermod','-G',$saf
|
|
|
|
|
|
|
|
|
# ----------------------------------------------------------- have setuid script run as root |
# ----------------------------------------------------------- have setuid script run as root |
sub enable_root_capability { |
sub enable_root_capability { |
if ($wwwid==$>) { |
if ($wwwid==$>) { |