Date:	Monday November 25, 2002 @ 0:05
Author:	cameron

Update of /home/netrek/cvsroot/Vanilla/ntserv
In directory swashbuckler.real-time.com:/var/tmp/cvs-serv26492/ntserv

Modified Files:
	ntscmds.c getname.c daemonII.c 
Log Message:
fix password command corruption

****************************************

Index: Vanilla/ntserv/ntscmds.c
diff -u Vanilla/ntserv/ntscmds.c:1.25 Vanilla/ntserv/ntscmds.c:1.26
--- Vanilla/ntserv/ntscmds.c:1.25	Thu Oct 10 20:24:46 2002
+++ Vanilla/ntserv/ntscmds.c	Mon Nov 25 00:05:03 2002
@@ -1,4 +1,4 @@
-/* $Id: ntscmds.c,v 1.25 2002/10/11 01:24:46 cameron Exp $
+/* $Id: ntscmds.c,v 1.26 2002/11/25 06:05:03 cameron Exp $
  */
 
 /*
@@ -1150,7 +1150,7 @@
   }
 
   /* change the password */
-  changepassword(&me->p_stats, one);
+  changepassword(one);
 
   /* tell her we changed it */
   pmessage(who, MINDIV, addr, 
Index: Vanilla/ntserv/getname.c
diff -u Vanilla/ntserv/getname.c:1.11 Vanilla/ntserv/getname.c:1.12
--- Vanilla/ntserv/getname.c:1.11	Wed Oct 10 02:36:52 2001
+++ Vanilla/ntserv/getname.c	Mon Nov 25 00:05:03 2002
@@ -222,11 +222,12 @@
     return;
 }
 
-void changepassword (struct statentry *player, char *passPick)
+void changepassword (char *passPick)
 {
   saltbuf sb;
-  strcpy(player->password, (char *) crypt(passPick, salt(player->name, sb)));
-  savepass(player);
+  struct statentry se;
+  strcpy(se.password, (char *) crypt(passPick, salt(me->p_name, sb)));
+  savepass(&se);
 }
 
 static void savepass(const struct statentry* se)
@@ -237,8 +238,7 @@
     fd = open(PlayerFile, O_WRONLY, 0644);
     if (fd >= 0) {
 	lseek(fd, me->p_pos * sizeof(struct statentry) +
-	      offsetof(struct statentry, password),
-	      SEEK_SET);
+	      offsetof(struct statentry, password), SEEK_SET);
 	write(fd, &se->password, sizeof(se->password));
 	close(fd);
     }
@@ -259,8 +259,7 @@
     if (fd >= 0) {
 	me->p_stats.st_lastlogin = time(NULL);
 	lseek(fd, me->p_pos * sizeof(struct statentry) +
-	      offsetof(struct statentry, stats),
-	      SEEK_SET);
+	      offsetof(struct statentry, stats), SEEK_SET);
 	write(fd, (char *) &me->p_stats, sizeof(struct stats));
 	close(fd);
     }
Index: Vanilla/ntserv/daemonII.c
diff -u Vanilla/ntserv/daemonII.c:1.37 Vanilla/ntserv/daemonII.c:1.38
--- Vanilla/ntserv/daemonII.c:1.37	Mon Jun  4 17:06:28 2001
+++ Vanilla/ntserv/daemonII.c	Mon Nov 25 00:05:03 2002
@@ -5,6 +5,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <stddef.h>
 #include <sys/types.h>
 #ifdef AUTOMOTD
 #include <sys/stat.h>
@@ -3740,7 +3741,8 @@
 
     fd = open(PlayerFile, O_WRONLY, 0644);
     if (fd >= 0) {
-        lseek(fd, 32 + victim->p_pos * sizeof(struct statentry) , SEEK_SET);
+        lseek(fd, victim->p_pos * sizeof(struct statentry) + 
+	      offsetof(struct statentry, stats), SEEK_SET);
         write(fd, (char *) &victim->p_stats, sizeof(struct stats));
         close(fd);
     }