--- loncom/lond 2002/08/09 10:05:00 1.87 +++ loncom/lond 2002/08/13 00:37:18 1.90 @@ -2,7 +2,7 @@ # The LearningOnline Network # lond "LON Daemon" Server (port "LOND" 5663) # -# $Id: lond,v 1.87 2002/08/09 10:05:00 www Exp $ +# $Id: lond,v 1.90 2002/08/13 00:37:18 stredwic Exp $ # # Copyright Michigan State University Board of Trustees # @@ -952,7 +952,7 @@ sub make_new_child { my ($cmd,$fname)=split(/:/,$userinput); my ($udom,$uname,$ufile)=split(/\//,$fname); my $udir=propath($udom,$uname).'/userfiles'; - unless (-e $udir) { mkdir($udir); } + unless (-e $udir) { mkdir($udir,0770); } if (-e $udir) { $ufile=~s/^[\.\~]+//; $ufile=~s/\///g; @@ -1214,10 +1214,12 @@ sub make_new_child { my $proname=propath($udom,$uname); my $qresult=''; if (tie(%hash,'GDBM_File',"$proname/$namespace.db",&GDBM_READER,0640)) { + study($regexp); foreach $key (keys %hash) { - if (eval('$key=~/$regexp/')) { + my $unescapeKey = &unescape($key); + if (eval('$unescapeKey=~/$regexp/')) { $qresult.="$key=$hash{$key}&"; - } + } } if (untie(%hash)) { $qresult=~s/\&$//; @@ -1573,44 +1575,42 @@ sub getchat { my %hash; my $proname=&propath($cdom,$cname); my @entries=(); - if - (tie(%hash,'GDBM_File',"$proname/nohist_chatroom.db",&GDBM_READER(),0640)) - { - @entries=map { $_.':'.$hash{$_} } sort keys %hash; - untie %hash; + if (tie(%hash,'GDBM_File',"$proname/nohist_chatroom.db", + &GDBM_READER(),0640)) { + @entries=map { $_.':'.$hash{$_} } sort keys %hash; + untie %hash; } return @entries; } sub chatadd { - my ($cdom,$cname,$newchat)=@_; - my %hash; - my $proname=&propath($cdom,$cname); - my @entries=(); - if - (tie(%hash,'GDBM_File',"$proname/nohist_chatroom.db",&GDBM_WRCREAT(),0640)) - { - @entries=map { $_.':'.$hash{$_} } sort keys %hash; - my $time=time; - my ($lastid)=($entries[$#entries]=~/^(\w+)\:/); - my ($thentime,$idnum)=split(/\_/,$lastid); - my $newid=$time.'_000000'; - if ($thentime==$time) { - $idnum=~s/^0+//; - $idnum++; - $idnum=substr('000000'.$idnum,-6,6); - $newid=$time.'_'.$idnum; - } - $hash{$newid}=$newchat; - my $expired=$time-3600; - foreach (keys %hash) { - my ($thistime)=($_=~/(\d+)\_/); - if ($thistime<$expired) { - undef $hash{$_}; - } + my ($cdom,$cname,$newchat)=@_; + my %hash; + my $proname=&propath($cdom,$cname); + my @entries=(); + if (tie(%hash,'GDBM_File',"$proname/nohist_chatroom.db", + &GDBM_WRCREAT(),0640)) { + @entries=map { $_.':'.$hash{$_} } sort keys %hash; + my $time=time; + my ($lastid)=($entries[$#entries]=~/^(\w+)\:/); + my ($thentime,$idnum)=split(/\_/,$lastid); + my $newid=$time.'_000000'; + if ($thentime==$time) { + $idnum=~s/^0+//; + $idnum++; + $idnum=substr('000000'.$idnum,-6,6); + $newid=$time.'_'.$idnum; + } + $hash{$newid}=$newchat; + my $expired=$time-3600; + foreach (keys %hash) { + my ($thistime)=($_=~/(\d+)\_/); + if ($thistime<$expired) { + delete $hash{$_}; + } + } + untie %hash; } - untie %hash; - } } sub unsub { 500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.