[LON-CAPA-cvs] cvs: loncom(version_2_11_X) / lond

raeburn raeburn at source.lon-capa.org
Tue Dec 14 09:16:13 EST 2021


raeburn		Tue Dec 14 14:16:13 2021 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom	lond 
  Log:
  - For 2.11
    Backport 1.569
  
  
Index: loncom/lond
diff -u loncom/lond:1.489.2.41 loncom/lond:1.489.2.42
--- loncom/lond:1.489.2.41	Sun Jun 20 16:24:09 2021
+++ loncom/lond	Tue Dec 14 14:16:13 2021
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.489.2.41 2021/06/20 16:24:09 raeburn Exp $
+# $Id: lond,v 1.489.2.42 2021/12/14 14:16:13 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -63,7 +63,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.489.2.41 $'; #' stupid emacs
+my $VERSION='$Revision: 1.489.2.42 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid="default";
 my $currentdomainid;
@@ -5118,15 +5118,23 @@
     }
     my ($id,$store);
     $tmpsnum++;
-    if (($context eq 'resetpw') || ($context eq 'createaccount')) {
-        $id = &md5_hex(&md5_hex(time.{}.rand().$$));
+    my $numtries = 0;
+    my $execdir=$perlvar{'lonDaemons'};
+    if (($context eq 'resetpw') || ($context eq 'createaccount') ||
+        ($context eq 'sso') || ($context eq 'link') || ($context eq 'retry')) {
+        $id = &md5_hex(&md5_hex(time.{}.rand().$$.$tmpsnum));
+        while ((-e "$execdir/tmp/$id.tmp") && ($numtries <10)) {
+            undef($id);
+            $id = &md5_hex(&md5_hex(time.{}.rand().$$.$tmpsnum));
+            $numtries ++;
+        }
     } else {
         $id = $$.'_'.$clientip.'_'.$tmpsnum;
     }
     $id=~s/\W/\_/g;
     $record=~s/\n//g;
-    my $execdir=$perlvar{'lonDaemons'};
-    if ($store=IO::File->new(">$execdir/tmp/$id.tmp")) {
+    if (($id ne '') &&
+        ($store=IO::File->new(">$execdir/tmp/$id.tmp"))) {
 	print $store $record;
 	close $store;
 	&Reply($client, \$id, $userinput);
@@ -7358,7 +7366,7 @@
 		Debug("Main: Got $user_input\n");
 		$keep_going = &process_request($user_input);
 		alarm(0);
-		&status('Listening to '.$clientname." ($keymode)");	   
+		&status('Listening to '.$clientname." ($keymode)");
 	    }
 
 # --------------------------------------------- client unknown or fishy, refuse
@@ -7374,8 +7382,8 @@
     
     &logthis("<font color='red'>CRITICAL: "
 	     ."Disconnect from $clientip ($clientname)</font>");    
-    
-    
+
+
     # this exit is VERY important, otherwise the child will become
     # a producer of more and more children, forking yourself into
     # process death.




More information about the LON-CAPA-cvs mailing list