[LON-CAPA-cvs] cvs: loncom(version_2_1_X) /lonnet/perl lonnet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 06 Apr 2006 19:19:14 -0000
albertel Thu Apr 6 15:19:14 2006 EDT
Modified files: (Branch: version_2_1_X)
/loncom/lonnet/perl lonnet.pm
Log:
- backpor 1.726
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.683.2.19 loncom/lonnet/perl/lonnet.pm:1.683.2.20
--- loncom/lonnet/perl/lonnet.pm:1.683.2.19 Mon Mar 6 14:56:57 2006
+++ loncom/lonnet/perl/lonnet.pm Thu Apr 6 15:19:11 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.683.2.19 2006/03/06 19:56:57 albertel Exp $
+# $Id: lonnet.pm,v 1.683.2.20 2006/04/06 19:19:11 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -272,6 +272,8 @@
for ($envi=0;$envi<=$#profile;$envi++) {
chomp($profile[$envi]);
my ($envname,$envvalue)=split(/=/,$profile[$envi],2);
+ $envname=&unescape($envname);
+ $envvalue=&unescape($envvalue);
$env{$envname} = $envvalue;
if (my ($key,$time) = ($envname =~ /^(cgi\.(\d+)_\d+\.)/)) {
if ($time < time-300) {
@@ -324,6 +326,8 @@
chomp($oldenv[$i]);
if ($oldenv[$i] ne '') {
my ($name,$value)=split(/=/,$oldenv[$i],2);
+ $name=&unescape($name);
+ $value=&unescape($value);
unless (defined($newenv{$name})) {
$newenv{$name}=$value;
}
@@ -336,7 +340,7 @@
}
my $newname;
foreach $newname (keys %newenv) {
- print $fh "$newname=$newenv{$newname}\n";
+ print $fh &escape($newname).'='.&escape($newenv{$newname})."\n";
}
close($fh);
}
@@ -348,7 +352,6 @@
sub delenv {
my $delthis=shift;
- my %newenv=();
if (($delthis=~/user\.role/) || ($delthis=~/user\.priv/)) {
&logthis("<font color=\"blue\">WARNING: ".
"Attempt to delete from environment ".$delthis);
@@ -380,12 +383,14 @@
close($fh);
return 'error: '.$!;
}
- foreach (@oldenv) {
- if ($_=~/^$delthis/) {
- my ($key,undef) = split('=',$_,2);
+ foreach my $cur_key (@oldenv) {
+ my $unescaped_cur_key = &unescape($cur_key);
+ if ($unescaped_cur_key=~/^$delthis/) {
+ my ($key) = split('=',$cur_key,2);
+ $key = &unescape($key);
delete($env{$key});
} else {
- print $fh $_;
+ print $fh $cur_key;
}
}
close($fh);