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

raeburn raeburn@source.lon-capa.org
Thu, 22 Oct 2009 22:01:47 -0000


raeburn		Thu Oct 22 22:01:47 2009 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Sanity checking of replies from &lonnet::reply(dump:).
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1032 loncom/lonnet/perl/lonnet.pm:1.1033
--- loncom/lonnet/perl/lonnet.pm:1.1032	Tue Oct 20 01:57:46 2009
+++ loncom/lonnet/perl/lonnet.pm	Thu Oct 22 22:01:47 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1032 2009/10/20 01:57:46 raeburn Exp $
+# $Id: lonnet.pm,v 1.1033 2009/10/22 22:01:47 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3802,7 +3802,10 @@
     my ($username,$domain)=@_;
     my $rolesdump=&reply("dump:$domain:$username:roles",
 			&homeserver($username,$domain));
-    if (($rolesdump eq 'con_lost') || ($rolesdump eq '')) { return 0; }
+    if (($rolesdump eq 'con_lost') || ($rolesdump eq '') || 
+        ($rolesdump =~ /^error:/)) {
+        return 0;
+    }
     my $now=time;
     if ($rolesdump ne '') {
         foreach my $entry (split(/&/,$rolesdump)) {
@@ -3832,7 +3835,10 @@
     my ($domain,$username,$authhost)=@_;
     my %userroles;
     my $rolesdump=reply("dump:$domain:$username:roles",$authhost);
-    if (($rolesdump eq 'con_lost') || ($rolesdump eq '')) { return \%userroles; }
+    if (($rolesdump eq 'con_lost') || ($rolesdump eq '') || 
+        ($rolesdump =~ /^error:/)) { 
+        return \%userroles;
+    }
     my %allroles=();
     my %allgroups=();   
     my $now=time;