version 1.915, 2007/10/01 21:06:04
|
version 1.916, 2007/10/01 21:52:57
|
Line 397 sub transfer_profile_to_env {
|
Line 397 sub transfer_profile_to_env {
|
} |
} |
} |
} |
|
|
|
# ---------------------------------------------------- Check for valid session |
|
sub check_for_valid_session { |
|
my ($r) = @_; |
|
my %cookies=CGI::Cookie->parse($r->header_in('Cookie')); |
|
my $lonid=$cookies{'lonID'}; |
|
return undef if (!$lonid); |
|
|
|
my $handle=&LONCAPA::clean_handle($lonid->value); |
|
my $lonidsdir=$r->dir_config('lonIDsDir'); |
|
return undef if (!-e "$lonidsdir/$handle.id"); |
|
|
|
open(my $idf,'+<',"$lonidsdir/$handle.id"); |
|
return undef if (!$idf); |
|
|
|
flock($idf,LOCK_SH); |
|
my %disk_env; |
|
if (!tie(%disk_env,'GDBM_File',"$lonidsdir/$handle.id", |
|
&GDBM_READER(),0640)) { |
|
return undef; |
|
} |
|
|
|
if (!defined($disk_env{'user.name'}) |
|
|| !defined($disk_env{'user.domain'})) { |
|
return undef; |
|
} |
|
return $handle; |
|
} |
|
|
sub timed_flock { |
sub timed_flock { |
my ($file,$lock_type) = @_; |
my ($file,$lock_type) = @_; |
my $failed=0; |
my $failed=0; |