Diff for /loncom/Attic/lcuseradd between versions 1.26 and 1.28

version 1.26, 2004/08/05 10:56:55 version 1.28, 2004/08/06 10:29:37
Line 5 Line 5
 # lcuseradd - LON-CAPA setuid script to coordinate all actions  # lcuseradd - LON-CAPA setuid script to coordinate all actions
 #             with adding a user with filesystem privileges (e.g. author)  #             with adding a user with filesystem privileges (e.g. author)
 #  #
 # YEAR=2002  
 #   May 19, 2002 Ron Fox  
 #      - Removed creation of the pulic_html directory.  This directory  
 #        can now be added in two ways:  
 #        o The user can add it themselves if they want some local web  
 #          space which may or may not contain construction items.  
 #        o LonCapa will add it if/when the user is granted an Author  
 #          role.  
 #  #
 # $Id$  # $Id$
 ###  ###
Line 155  unless (&try_to_lock("/tmp/lock_lcpasswd Line 147  unless (&try_to_lock("/tmp/lock_lcpasswd
 my @input;  my @input;
 if (@ARGV>=3) {  if (@ARGV>=3) {
     @input=@ARGV;      @input=@ARGV;
 }  } elsif (@ARGV) {
 elsif (@ARGV) {  
     print("Error. This program needs at least 3 command-line arguments (username, ".      print("Error. This program needs at least 3 command-line arguments (username, ".
   "password 1, password 2 [errorfile]).\n") unless $noprint;    "password 1, password 2 [errorfile]).\n") unless $noprint;
     unlink('/tmp/lock_lcpasswd');      unlink('/tmp/lock_lcpasswd');
     &Exit(2);      &Exit(2);
 }  } else {
 else {  
     @input=<>;      @input=<>;
     if (@input < 3) {      if (@input < 3) {
  print("Error. At least three lines should be entered into standard input.\n")   print("Error. At least three lines should be entered into standard input.\n")
Line 216  if($error_file) { Line 206  if($error_file) {
     Exit(14);      Exit(14);
  }   }
   
     }       } else {
     else {  
  $error_file="";   $error_file="";
  print "Invalid error filename\n" unless $noprint;   print "Invalid error filename\n" unless $noprint;
  Exit(14);   Exit(14);
Line 258  if ($status) { Line 247  if ($status) {
 print "Done adding user\n" unless $noprint;  print "Done adding user\n" unless $noprint;
 # Make www a member of that user group.  # Make www a member of that user group.
 my $groups=`/usr/bin/groups www` or &Exit(6);  my $groups=`/usr/bin/groups www` or &Exit(6);
   # untaint
   my ($safegroups)=($groups=~/([\s\w]+)/);
   $groups=$safegroups;
 chomp $groups; $groups=~s/^\S+\s+\:\s+//;  chomp $groups; $groups=~s/^\S+\s+\:\s+//;
 my @grouplist=split(/\s+/,$groups);  my @grouplist=split(/\s+/,$groups);
 my @ugrouplist=grep {!/www|$safeusername/} @grouplist;  my @ugrouplist=grep {!/www|$safeusername/} @grouplist;
Line 324  if (-e '/var/run/httpd.pid') { Line 316  if (-e '/var/run/httpd.pid') {
     open(PID,'/var/run/httpd.pid');      open(PID,'/var/run/httpd.pid');
     my $pid=<PID>;      my $pid=<PID>;
     close(PID);      close(PID);
     $pid=~s/\D+//g;      my ($safepid)=($pid=~s/(\D+)//g);
     if ($pid) {      if ($pid) {
  system('kill','-USR1',"$pid");   system('kill','-USR1',"$safepid");
     }      }
 }  }
 # -------------------------------------------------------- Exit script  # -------------------------------------------------------- Exit script
Line 339  sub enable_root_capability { Line 331  sub enable_root_capability {
     if ($wwwid==$>) {      if ($wwwid==$>) {
  ($<,$>)=($>,0);   ($<,$>)=($>,0);
  ($(,$))=($),0);   ($(,$))=($),0);
     }      } else {
     else {  
  # root capability is already enabled   # root capability is already enabled
     }      }
     return $>;      return $>;
Line 351  sub disable_root_capability { Line 342  sub disable_root_capability {
     if ($wwwid==$<) {      if ($wwwid==$<) {
  ($<,$>)=($>,$<);   ($<,$>)=($>,$<);
  ($(,$))=($),$();   ($(,$))=($),$();
     }      } else {
     else {  
  # root capability is already disabled   # root capability is already disabled
     }      }
 }  }
Line 381  sub try_to_lock { Line 371  sub try_to_lock {
     }      }
     sleep 3;      sleep 3;
     $lastpid=$currentpid;      $lastpid=$currentpid;
  }   } else {
  else {  
     last;      last;
  }   }
  if ($_==10) {   if ($_==10) {

Removed from v.1.26  
changed lines
  Added in v.1.28


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