version 1.1377, 2018/05/28 23:26:21
|
version 1.1378, 2018/07/04 16:58:29
|
Line 652 sub transfer_profile_to_env {
|
Line 652 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')); |
my ($linkname,$pubname); |
my ($lonidsdir,$linkname,$pubname,$secure,$lonid); |
if ($name eq '') { |
if ($name eq 'lonDAV') { |
$name = 'lonID'; |
$lonidsdir=$r->dir_config('lonDAVsessDir'); |
|
} else { |
|
$lonidsdir=$r->dir_config('lonIDsDir'); |
|
if ($name eq '') { |
|
$name = 'lonID'; |
|
} |
|
} |
|
if ($name eq 'lonID') { |
|
$secure = 'lonSID'; |
$linkname = 'lonLinkID'; |
$linkname = 'lonLinkID'; |
$pubname = 'lonPubID'; |
$pubname = 'lonPubID'; |
} |
if (exists($cookies{$secure})) { |
my $lonid=$cookies{$name}; |
$lonid=$cookies{$secure}; |
if (!$lonid) { |
} elsif (exists($cookies{$name})) { |
if (($name eq 'lonID') && ($ENV{'SERVER_PORT'} != 443) && ($linkname)) { |
$lonid=$cookies{$name}; |
|
} elsif (exists($cookies{$linkname})) { |
$lonid=$cookies{$linkname}; |
$lonid=$cookies{$linkname}; |
|
} elsif (exists($cookies{$pubname})) { |
|
$lonid=$cookies{$pubname}; |
} |
} |
if (!$lonid) { |
} else { |
if (($name eq 'lonID') && ($pubname)) { |
$lonid=$cookies{$name}; |
$lonid=$cookies{$pubname}; |
|
} |
|
} |
|
} |
} |
return undef if (!$lonid); |
return undef if (!$lonid); |
|
|
my $handle=&LONCAPA::clean_handle($lonid->value); |
my $handle=&LONCAPA::clean_handle($lonid->value); |
my $lonidsdir; |
if (-l "$lonidsdir/$handle.id") { |
if ($name eq 'lonDAV') { |
my $link = readlink("$lonidsdir/$handle.id"); |
$lonidsdir=$r->dir_config('lonDAVsessDir'); |
if ((-e $link) && ($link =~ m{^\Q$lonidsdir\E/(.+)\.id$})) { |
} else { |
$handle = $1; |
$lonidsdir=$r->dir_config('lonIDsDir'); |
} |
} |
} |
if (!-e "$lonidsdir/$handle.id") { |
if (!-e "$lonidsdir/$handle.id") { |
if ((ref($domref)) && ($name eq 'lonID') && |
if ((ref($domref)) && ($name eq 'lonID') && |