[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /auth switchserver.pm
raeburn
raeburn at source.lon-capa.org
Sat Aug 3 19:27:39 EDT 2019
raeburn Sat Aug 3 23:27:39 2019 EDT
Modified files: (Branch: version_2_11_X)
/loncom/auth switchserver.pm
Log:
- For 2.11
Backport 1.36, 1.41
Index: loncom/auth/switchserver.pm
diff -u loncom/auth/switchserver.pm:1.35.2.1 loncom/auth/switchserver.pm:1.35.2.2
--- loncom/auth/switchserver.pm:1.35.2.1 Thu Aug 1 15:20:06 2019
+++ loncom/auth/switchserver.pm Sat Aug 3 23:27:39 2019
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Switch Servers Handler
#
-# $Id: switchserver.pm,v 1.35.2.1 2019/08/01 15:20:06 raeburn Exp $
+# $Id: switchserver.pm,v 1.35.2.2 2019/08/03 23:27:39 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -128,6 +128,12 @@
if ($env{'user.name'} eq 'public'
&& $env{'user.domain'} eq 'public') {
my $url = $protocol.'://'.$switch_to.$r->uri;
+ unlink($handle);
+ #expire the cookie
+ my $c = new CGI::Cookie(-name => 'lonPubID',
+ -value => '',
+ -expires => '-10y',);
+ $r->header_out('Set-cookie' => $c);
return &do_redirect($r,$url,1)
}
@@ -178,7 +184,16 @@
}
#remove session env, and log event
- unlink($handle);
+ if (unlink($handle)) {
+ if ($env{'user.linkedenv'} ne '') {
+ my $lonidsdir=$r->dir_config('lonIDsDir');
+ if (($env{'user.linkedenv'} =~ /^[a-f0-9]+_linked$/) &&
+ (-l "$lonidsdir/$env{'user.linkedenv'}.id") &&
+ (readlink("$lonidsdir/$env{'user.linkedenv'}.id") eq $handle)) {
+ unlink("$lonidsdir/$env{'user.linkedenv'}.id");
+ }
+ }
+ }
my %temp=('switchserver' => $now.':'.$env{'form.otherserver'},
$env{'form.role'});
&Apache::lonnet::put('email_status',\%temp);
@@ -194,12 +209,15 @@
&Apache::loncommon::content_type($r,'text/html');
- #expire the cookie
- my $c = new CGI::Cookie(-name => 'lonID',
- -value => '',
- -expires => '-10y',);
- $r->header_out('Set-cookie' => $c);
-
+ #expire the cookies
+ my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
+ foreach my $name (keys(%cookies)) {
+ next unless ($name =~ /^lon(|S|Link|Pub)ID$/);
+ my $c = new CGI::Cookie(-name => $name,
+ -value => '',
+ -expires => '-10y',);
+ $r->headers_out->add('Set-cookie' => $c);
+ }
if ($r->header_only) {
$r->send_http_header;
return OK;
More information about the LON-CAPA-cvs
mailing list