version 1.81, 2006/08/30 16:50:23
|
version 1.83, 2006/09/19 21:36:24
|
Line 40 use Apache::lonnet;
|
Line 40 use Apache::lonnet;
|
use Apache::lonmenu(); |
use Apache::lonmenu(); |
use Fcntl qw(:flock); |
use Fcntl qw(:flock); |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use GDBM_File; |
my %FORM; |
my %FORM; |
|
|
# ------------------------------------------------------------ Successful login |
# ------------------------------------------------------------ Successful login |
Line 171 sub success {
|
Line 171 sub success {
|
} |
} |
|
|
$env{'user.environment'} = "$lonids/$cookie.id"; |
$env{'user.environment'} = "$lonids/$cookie.id"; |
open(my $idf,">$lonids/$cookie.id"); |
|
unless (flock($idf,LOCK_EX)) { |
if (tie(my %disk_env,'GDBM_File',"$lonids/$cookie.id", |
|
&GDBM_WRCREAT(),0640)) { |
|
&add_to_env(\%disk_env,\%initial_env); |
|
&add_to_env(\%disk_env,\%userenv,'environment.'); |
|
&add_to_env(\%disk_env,$userroles); |
|
&add_to_env(\%disk_env,$extra_env); |
|
untie(%disk_env); |
|
} else { |
&Apache::lonnet::logthis("<font color=blue>WARNING: ". |
&Apache::lonnet::logthis("<font color=blue>WARNING: ". |
'Could not obtain exclusive lock in lonauth: '.$!); |
'Could not create environment storage in lonauth: '.$!); |
close($idf); |
|
return 'error: '.$!; |
return 'error: '.$!; |
} |
} |
|
|
&add_to_env($idf,\%initial_env); |
|
&add_to_env($idf,\%userenv); |
|
&add_to_env($idf,$userroles); |
|
&add_to_env($idf,$extra_env); |
|
close($idf); |
|
} |
} |
$env{'request.role'}='cm'; |
$env{'request.role'}='cm'; |
$env{'request.role.adv'}=$env{'user.adv'}; |
$env{'request.role.adv'}=$env{'user.adv'}; |
Line 250 ENDSUCCESS
|
Line 250 ENDSUCCESS
|
} |
} |
|
|
sub add_to_env { |
sub add_to_env { |
my ($idf,$env_data) = @_; |
my ($idf,$env_data,$prefix) = @_; |
@env{keys(%$env_data)} = @$env_data{keys(%$env_data)}; |
|
while (my ($key,$value) = each(%$env_data)) { |
while (my ($key,$value) = each(%$env_data)) { |
print $idf (&escape($key).'='.&escape($value)."\n"); |
$idf->{$prefix.$key} = $value; |
|
$env{$prefix.$key} = $value; |
} |
} |
} |
} |
|
|