--- loncom/lond 2004/03/16 20:48:49 1.184 +++ loncom/lond 2004/04/07 10:02:11 1.186 @@ -2,7 +2,7 @@ # The LearningOnline Network # lond "LON Daemon" Server (port "LOND" 5663) # -# $Id: lond,v 1.184 2004/03/16 20:48:49 raeburn Exp $ +# $Id: lond,v 1.186 2004/04/07 10:02:11 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -53,7 +53,7 @@ my $DEBUG = 0; # Non zero to ena my $status=''; my $lastlog=''; -my $VERSION='$Revision: 1.184 $'; #' stupid emacs +my $VERSION='$Revision: 1.186 $'; #' stupid emacs my $remoteVERSION; my $currenthostid; my $currentdomainid; @@ -1828,14 +1828,14 @@ sub make_new_child { } elsif ($userinput =~ /^fetchuserfile/) { # Client clear or enc. if(isClient) { my ($cmd,$fname)=split(/:/,$userinput); - my ($udom,$uname,$ufile) = ($fname =~ /^([^\/]+)\/([^\/]+)\/(.+)$/); + my ($udom,$uname,$ufile) = ($fname =~ m|^([^/]+)/([^/]+)/(.+)$|); my $udir=propath($udom,$uname).'/userfiles'; unless (-e $udir) { mkdir($udir,0770); } if (-e $udir) { $ufile=~s/^[\.\~]+//; my $path = $udir; - if ($ufile =~/(.+)\/([^\/]+)$/) { - my @parts=split(/\//,$1); + if ($ufile =~m|(.+)/([^/]+)$|) { + my @parts=split('/',$1); foreach my $part (@parts) { $path .= '/'.$part; if ((-e $path)!=1) { @@ -1881,7 +1881,7 @@ sub make_new_child { if (open(ENVIN,$perlvar{'lonIDsDir'}.'/'. $session.'.id')) { while (my $line=) { - if ($line=~ m|userfile\.$fname\=|) { $reply='ok'; } + if ($line=~ m|userfile\.\Q$fname\E\=|) { $reply='ok'; } } close(ENVIN); print $client $reply."\n"; @@ -3141,6 +3141,16 @@ sub make_passwd_file { } } elsif ($umode eq 'unix') { { + # + # Don't allow the creation of privileged accounts!!! that would + # be real bad!!! + # + my $uid = getpwnam($uname); + if((defined $uid) && ($uid == 0)) { + &logthis(">>>Attempted to create privilged account blocked"); + return "no_priv_account_error\n"; + } + my $execpath="$perlvar{'lonDaemons'}/"."lcuseradd"; { &Debug("Executing external: ".$execpath);