[LON-CAPA-cvs] cvs: loncom / lchtmldir lcuseradd

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 02 Sep 2004 18:59:24 -0000


albertel		Thu Sep  2 14:59:24 2004 EDT

  Modified files:              
    /loncom	lchtmldir lcuseradd 
  Log:
  - actualy parse the result of the groups command correctly
  
  
Index: loncom/lchtmldir
diff -u loncom/lchtmldir:1.7 loncom/lchtmldir:1.8
--- loncom/lchtmldir:1.7	Thu Aug  5 16:35:55 2004
+++ loncom/lchtmldir	Thu Sep  2 14:59:24 2004
@@ -268,7 +268,7 @@
 
     my $groups = `/usr/bin/groups www`;
     # untaint
-    my ($safegroups)=($groups=~/([\s\w]+)/);
+    my ($safegroups)=($groups=~/:\s+([\s\w]+)/);
     $groups=$safegroups;
     chomp $groups; $groups=~s/^\S+\s+\:\s+//;
     my @grouplist=split(/\s+/,$groups);
Index: loncom/lcuseradd
diff -u loncom/lcuseradd:1.28 loncom/lcuseradd:1.29
--- loncom/lcuseradd:1.28	Fri Aug  6 06:29:37 2004
+++ loncom/lcuseradd	Thu Sep  2 14:59:24 2004
@@ -6,7 +6,7 @@
 #             with adding a user with filesystem privileges (e.g. author)
 #
 #
-# $Id: lcuseradd,v 1.28 2004/08/06 10:29:37 foxr Exp $
+# $Id: lcuseradd,v 1.29 2004/09/02 18:59:24 albertel Exp $
 ###
 
 ###############################################################################
@@ -247,8 +247,9 @@
 print "Done adding user\n" unless $noprint;
 # Make www a member of that user group.
 my $groups=`/usr/bin/groups www` or &Exit(6);
+print "groups $groups\n";
 # untaint
-my ($safegroups)=($groups=~/([\s\w]+)/);
+my ($safegroups)=($groups=~/:\s*([\s\w]+)/);
 $groups=$safegroups;
 chomp $groups; $groups=~s/^\S+\s+\:\s+//;
 my @grouplist=split(/\s+/,$groups);