Update of /cvsroot/netrek/server/Vanilla/ntserv
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21188/ntserv

Modified Files:
	main.c ntscmds.c socket.c 
Log Message:
misc working updates

Index: ntscmds.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/ntscmds.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ntscmds.c	27 Sep 2005 12:26:37 -0000	1.3
+++ ntscmds.c	10 Apr 2006 04:24:51 -0000	1.4
@@ -576,7 +576,7 @@
     bounce(from, "%s is %s (%s)", me->p_mapchars, me->p_name, me->p_login);
   } else {
     bounce(from, "%s is %s (%s@%s)", me->p_mapchars, me->p_name, me->p_login, me->p_full_hostname);
-    bounce(from, "%s at %s (ip)", me->p_mapchars, inet_ntoa(remoteaddr));
+    bounce(from, "%s at %s (ip)", me->p_mapchars, me->p_ip);
   }
   return 1;
 }

Index: main.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/main.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- main.c	27 Sep 2005 12:26:37 -0000	1.3
+++ main.c	10 Apr 2006 04:24:51 -0000	1.4
@@ -14,6 +14,7 @@
 #include <fcntl.h>
 #include <string.h>
 #include <sys/types.h>
+#include <arpa/inet.h>
 #include "defs.h"
 #include INC_STRINGS
 #include INC_UNISTD
@@ -264,6 +265,10 @@
 	for (i = 0; i < MAXPLAYER; i++) ignored[i] = 0;
     }
 
+    /* store client IP address from socket peer obtained by checkSocket() */
+    if (remoteaddr != -1)
+      strcpy(me->p_ip, inet_ntoa(remoteaddr));
+
 #ifdef REVERSED_HOSTNAMES
     if (strlen(host) >= NAME_LEN) {
       STRNCPY(me->p_monitor, host + (strlen(host) - NAME_LEN + 1), NAME_LEN);

Index: socket.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/socket.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- socket.c	27 Sep 2005 12:26:37 -0000	1.3
+++ socket.c	10 Apr 2006 04:24:51 -0000	1.4
@@ -384,8 +384,8 @@
     addr.sin_family = AF_INET;
     addr.sin_port = htons(port);
 
-    if (remoteaddr!=-1) {
-	addr.sin_addr.s_addr=remoteaddr;
+    if (remoteaddr != -1) {
+	addr.sin_addr.s_addr = remoteaddr;
     } else if ((addr.sin_addr.s_addr = inet_addr(machine)) == -1) {
 	if ((hp = gethostbyname(machine)) == NULL) {
 	    ERROR(1,("%s: gethostbyname() failed, %s\n", whoami(), 
@@ -396,7 +396,7 @@
 	    addr.sin_addr.s_addr = *(U_LONG *) hp->h_addr;
 	}
     }
-    remoteaddr=addr.sin_addr.s_addr;
+    remoteaddr = addr.sin_addr.s_addr;
 
     /* 18th Feb 1999, cameron at stl.dec.com, suspect this is where the large
        delay is for a ghostbusted slot, assuming usual PPP dial-in user, this
@@ -488,15 +488,11 @@
 void checkSocket(void)
 {
     struct sockaddr_in sin;
-    int length;
-
-    length=sizeof(sin);
-    if (getpeername(sock, (struct sockaddr *) &sin, &length) < 0) {
-	/* A bad thing. */
+    int len = sizeof(sin);
+    if (getpeername(sock, (struct sockaddr *) &sin, &len) < 0) {
 	return;
     }
-
-    remoteaddr=sin.sin_addr.s_addr;
+    remoteaddr = sin.sin_addr.s_addr;
 }
 
 void initClientData(void)