--- loncom/lonnet/perl/lonnet.pm 2017/08/27 17:49:49 1.1354 +++ loncom/lonnet/perl/lonnet.pm 2017/09/25 00:36:35 1.1355 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.1354 2017/08/27 17:49:49 raeburn Exp $ +# $Id: lonnet.pm,v 1.1355 2017/09/25 00:36:35 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -650,7 +650,7 @@ sub transfer_profile_to_env { # ---------------------------------------------------- Check for valid session sub check_for_valid_session { - my ($r,$name,$userhashref) = @_; + my ($r,$name,$userhashref,$domref) = @_; my %cookies=CGI::Cookie->parse($r->header_in('Cookie')); my ($linkname,$pubname); if ($name eq '') { @@ -678,7 +678,16 @@ sub check_for_valid_session { } else { $lonidsdir=$r->dir_config('lonIDsDir'); } - return undef if (!-e "$lonidsdir/$handle.id"); + if (!-e "$lonidsdir/$handle.id") { + if ((ref($domref)) && ($name eq 'lonID') && + ($handle =~ /^($match_username)\_\d+\_($match_domain)\_(.+)$/)) { + my ($possuname,$possudom,$possuhome) = ($1,$2,$3); + if ((&domain($possudom) ne '') && (&homeserver($possuname,$possudom) eq $possuhome)) { + $$domref = $possudom; + } + } + return undef; + } my $opened = open(my $idf,'+<',"$lonidsdir/$handle.id"); return undef if (!$opened);