[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 06 Apr 2006 19:14:51 -0000
albertel Thu Apr 6 15:14:51 2006 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
Log:
- escape the data into the session env
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.725 loncom/lonnet/perl/lonnet.pm:1.726
--- loncom/lonnet/perl/lonnet.pm:1.725 Thu Apr 6 14:04:23 2006
+++ loncom/lonnet/perl/lonnet.pm Thu Apr 6 15:14:50 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.725 2006/04/06 18:04:23 raeburn Exp $
+# $Id: lonnet.pm,v 1.726 2006/04/06 19:14:50 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -279,6 +279,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) {
@@ -331,6 +333,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;
}
@@ -343,7 +347,7 @@
}
my $newname;
foreach $newname (keys %newenv) {
- print $fh "$newname=$newenv{$newname}\n";
+ print $fh &escape($newname).'='.&escape($newenv{$newname})."\n";
}
close($fh);
}
@@ -355,7 +359,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);
@@ -388,8 +391,10 @@
return 'error: '.$!;
}
foreach my $cur_key (@oldenv) {
- if ($cur_key=~/^$delthis/) {
- my ($key,undef) = split('=',$cur_key,2);
+ 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 $cur_key;