[LON-CAPA-cvs] cvs: loncom / lond

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 08 Mar 2004 20:59:41 -0000


albertel		Mon Mar  8 15:59:41 2004 EDT

  Modified files:              
    /loncom	lond 
  Log:
  - lond has been dieing on my machine, I think due to port probes trying to defend against an invalid connection
  
  
  
Index: loncom/lond
diff -u loncom/lond:1.179 loncom/lond:1.180
--- loncom/lond:1.179	Tue Feb 24 11:53:16 2004
+++ loncom/lond	Mon Mar  8 15:59:41 2004
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.179 2004/02/24 16:53:16 albertel Exp $
+# $Id: lond,v 1.180 2004/03/08 20:59:41 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -53,7 +53,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.179 $'; #' stupid emacs
+my $VERSION='$Revision: 1.180 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid;
 my $currentdomainid;
@@ -1258,8 +1258,18 @@
     #  the pid hash.
     #
     my $caller = getpeername($client);
-    my ($port,$iaddr)=unpack_sockaddr_in($caller);
-    $clientip=inet_ntoa($iaddr);
+    my ($port,$iaddr);
+    if (defined($caller) && length($caller) > 0) {
+	($port,$iaddr)=unpack_sockaddr_in($caller);
+    } else {
+	&logthis("Unable to determine who caller was, getpeername returned nothing");
+    }
+    if (defined($iaddr)) {
+	$clientip=inet_ntoa($iaddr);
+    } else {
+	&logthis("Unable to determine clinetip");
+	$clientip='Unavailable';
+    }
     
     if ($pid) {
         # Parent records the child's birth and returns.