version 1.80, 2006/06/27 14:09:46
|
version 1.82.2.1, 2006/10/06 14:29:44
|
Line 170 sub success {
|
Line 170 sub success {
|
} |
} |
} |
} |
|
|
|
$env{'user.environment'} = "$lonids/$cookie.id"; |
open(my $idf,">$lonids/$cookie.id"); |
open(my $idf,">$lonids/$cookie.id"); |
unless (flock($idf,LOCK_EX)) { |
unless (flock($idf,LOCK_EX)) { |
&Apache::lonnet::logthis("<font color=blue>WARNING: ". |
&Apache::lonnet::logthis("<font color=blue>WARNING: ". |
Line 178 sub success {
|
Line 179 sub success {
|
return 'error: '.$!; |
return 'error: '.$!; |
} |
} |
|
|
while (my ($key,$value) = each(%initial_env)) { |
&add_to_env($idf,\%initial_env); |
print $idf (&escape($key).'='.&escape($value)."\n"); |
&add_to_env($idf,\%userenv,'environment.'); |
} |
&add_to_env($idf,$userroles); |
while (my ($key,$value) = each(%userenv)) { |
&add_to_env($idf,$extra_env); |
print $idf (&escape('environment.'.$key).'='.&escape($value)."\n"); |
|
} |
|
while (my ($key,$value) = each(%{$userroles})) { |
|
print $idf (&escape($key).'='.&escape($value)."\n"); |
|
} |
|
while (my ($key,$value) = each(%{$extra_env})) { |
|
print $idf (&escape($key).'='.&escape($value)."\n"); |
|
} |
|
close($idf); |
close($idf); |
} |
} |
$env{'request.role'}='cm'; |
$env{'request.role'}='cm'; |
Line 256 $end_page
|
Line 249 $end_page
|
ENDSUCCESS |
ENDSUCCESS |
} |
} |
|
|
|
sub add_to_env { |
|
my ($idf,$env_data,$prefix) = @_; |
|
while (my ($key,$value) = each(%$env_data)) { |
|
print $idf (&escape($prefix.$key).'='.&escape($value)."\n"); |
|
$env{$prefix.$key} = $value; |
|
} |
|
} |
|
|
# --------------------------------------------------------------- Failed login! |
# --------------------------------------------------------------- Failed login! |
|
|
sub failed { |
sub failed { |
Line 343 ENDFAILED
|
Line 344 ENDFAILED
|
|
|
|
|
my $buffer; |
my $buffer; |
$r->read($buffer,$r->header_in('Content-length'),0); |
if ($r->header_in('Content-length') > 0) { |
|
$r->read($buffer,$r->header_in('Content-length'),0); |
|
} |
my @pairs=split(/&/,$buffer); |
my @pairs=split(/&/,$buffer); |
my $pair; my $name; my $value; |
my $pair; my $name; my $value; |
undef %FORM; |
undef %FORM; |
Line 449 ENDFAILED
|
Line 452 ENDFAILED
|
&Apache::lonnet::logthis('Non-privileged user attempting switch user'); |
&Apache::lonnet::logthis('Non-privileged user attempting switch user'); |
} |
} |
} |
} |
&success($r,$FORM{'uname'},$FORM{'udom'},$authhost,$firsturl); |
if ($r->dir_config("lonBalancer") eq 'yes') { |
|
&success($r,$FORM{'uname'},$FORM{'udom'},$authhost,'noredirect'); |
|
$r->internal_redirect('/adm/switchserver'); |
|
} else { |
|
&success($r,$FORM{'uname'},$FORM{'udom'},$authhost,$firsturl); |
|
} |
return OK; |
return OK; |
} |
} |
|
|