version 1.1172.2.107, 2019/08/01 19:13:26
|
version 1.1172.2.108, 2019/08/03 23:36:09
|
Line 604 sub transfer_profile_to_env {
|
Line 604 sub transfer_profile_to_env {
|
sub check_for_valid_session { |
sub check_for_valid_session { |
my ($r,$name,$userhashref,$domref) = @_; |
my ($r,$name,$userhashref,$domref) = @_; |
my %cookies=CGI::Cookie->parse($r->header_in('Cookie')); |
my %cookies=CGI::Cookie->parse($r->header_in('Cookie')); |
if ($name eq '') { |
my ($lonidsdir,$linkname,$pubname,$secure,$lonid); |
$name = 'lonID'; |
|
} |
|
my $lonid=$cookies{$name}; |
|
return undef if (!$lonid); |
|
|
|
my $handle=&LONCAPA::clean_handle($lonid->value); |
|
my $lonidsdir; |
|
if ($name eq 'lonDAV') { |
if ($name eq 'lonDAV') { |
$lonidsdir=$r->dir_config('lonDAVsessDir'); |
$lonidsdir=$r->dir_config('lonDAVsessDir'); |
} else { |
} else { |
$lonidsdir=$r->dir_config('lonIDsDir'); |
$lonidsdir=$r->dir_config('lonIDsDir'); |
|
if ($name eq '') { |
|
$name = 'lonID'; |
|
} |
|
} |
|
if ($name eq 'lonID') { |
|
$secure = 'lonSID'; |
|
$linkname = 'lonLinkID'; |
|
$pubname = 'lonPubID'; |
|
if (exists($cookies{$secure})) { |
|
$lonid=$cookies{$secure}; |
|
} elsif (exists($cookies{$name})) { |
|
$lonid=$cookies{$name}; |
|
} elsif ((exists($cookies{$linkname})) && ($ENV{'SERVER_PORT'} != 443)) { |
|
$lonid=$cookies{$linkname}; |
|
} elsif (exists($cookies{$pubname})) { |
|
$lonid=$cookies{$pubname}; |
|
} |
|
} else { |
|
$lonid=$cookies{$name}; |
|
} |
|
return undef if (!$lonid); |
|
|
|
my $handle=&LONCAPA::clean_handle($lonid->value); |
|
if (-l "$lonidsdir/$handle.id") { |
|
my $link = readlink("$lonidsdir/$handle.id"); |
|
if ((-e $link) && ($link =~ m{^\Q$lonidsdir\E/(.+)\.id$})) { |
|
$handle = $1; |
|
} |
} |
} |
if (!-e "$lonidsdir/$handle.id") { |
if (!-e "$lonidsdir/$handle.id") { |
if ((ref($domref)) && ($name eq 'lonID') && |
if ((ref($domref)) && ($name eq 'lonID') && |