[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm /lonnet/perl lonnet.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Mon, 01 Sep 2008 17:58:32 -0000


raeburn		Mon Sep  1 13:58:32 2008 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Prevent ISE when session is offloaded from a remote server but con_lost is returned when attempting to dump roles.db from user's home server.
  - lonnet::rolesinit() - always return hash ref.
  - loncommon::_add_to_env() - check $env_data (second arg) is a hash ref.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.675 loncom/interface/loncommon.pm:1.676
--- loncom/interface/loncommon.pm:1.675	Wed Aug 27 23:04:41 2008
+++ loncom/interface/loncommon.pm	Mon Sep  1 13:58:29 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.675 2008/08/28 03:04:41 raeburn Exp $
+# $Id: loncommon.pm,v 1.676 2008/09/01 17:58:29 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -9380,9 +9380,11 @@
 
 sub _add_to_env {
     my ($idf,$env_data,$prefix) = @_;
-    while (my ($key,$value) = each(%$env_data)) {
-	$idf->{$prefix.$key} = $value;
-	$env{$prefix.$key}   = $value;
+    if (ref($env_data) eq 'HASH') {
+        while (my ($key,$value) = each(%$env_data)) {
+	    $idf->{$prefix.$key} = $value;
+	    $env{$prefix.$key}   = $value;
+        }
     }
 }
 
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.965 loncom/lonnet/perl/lonnet.pm:1.966
--- loncom/lonnet/perl/lonnet.pm:1.965	Tue Aug 26 22:29:31 2008
+++ loncom/lonnet/perl/lonnet.pm	Mon Sep  1 13:58:30 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.965 2008/08/27 02:29:31 raeburn Exp $
+# $Id: lonnet.pm,v 1.966 2008/09/01 17:58:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3561,12 +3561,13 @@
 
 sub rolesinit {
     my ($domain,$username,$authhost)=@_;
+    my %userroles;
     my $rolesdump=reply("dump:$domain:$username:roles",$authhost);
-    if (($rolesdump eq 'con_lost') || ($rolesdump eq '')) { return ''; }
+    if (($rolesdump eq 'con_lost') || ($rolesdump eq '')) { return \%userroles; }
     my %allroles=();
     my %allgroups=();   
     my $now=time;
-    my %userroles = ('user.login.time' => $now);
+    %userroles = ('user.login.time' => $now);
     my $group_privs;
 
     if ($rolesdump ne '') {