]> skyeroc.xyz Git - dgamelaunch/commitdiff
Fix problem with people entering initial blank password.
authorJoshua Kwan <joshk@triplehelix.org>
Sun, 4 Jan 2004 12:16:05 +0000 (12:16 +0000)
committerJoshua Kwan <joshk@triplehelix.org>
Sun, 4 Jan 2004 12:16:05 +0000 (12:16 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@77 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

dgamelaunch.c
dgamelaunch.h

index acd136140d313f70bf2bbc28d94a52c778be2504..128047a7bbae324897763cd4eb0c4d1b2e0aaa45 100644 (file)
@@ -440,7 +440,7 @@ inprogressmenu ()
 
 /* ************************************************************* */
 
-void
+int
 changepw ()
 {
   char buf[21];
@@ -480,7 +480,7 @@ changepw ()
       echo ();                  /* Putting echo back on just for safety and because it can't hurt. */
 
       if (buf && *buf == '\0')
-        return;
+        return 0;
 
       if (strchr (buf, ':') != NULL)
         graceful_exit (112);
@@ -500,6 +500,8 @@ changepw ()
 
   me->password = strdup (crypt (buf, buf));
   writefile (0);
+
+  return 1;
 }
 
 /* ************************************************************* */
@@ -781,7 +783,7 @@ newuser ()
 
       for (i = 0; i < strlen (buf); i++)
         {
-          if (!isalnum(buf))
+          if (!isalnum(buf[i]))
             error = 1;
         }
 
@@ -798,7 +800,12 @@ newuser ()
 
   clear ();
 
-  changepw ();                  /* Calling changepw instead to prompt twice. */
+  if (!changepw ())                  /* Calling changepw instead to prompt twice. */
+  {
+    free(me);
+    me = NULL;
+    return;
+  }
 
   /* email step */
 
index 20dd3ad3c62932193953c27fa43eae94a52bfc62..b1eac5606f760bfa057e3b79204f9221a5fbca65 100644 (file)
@@ -57,7 +57,7 @@ extern void loadbanner (struct dg_banner *ban);
 extern void drawbanner (unsigned int start_line, unsigned int howmany);
 extern struct dg_game **populate_games (int *l);
 extern void inprogressmenu (void);
-extern void changepw (void);
+extern int changepw (void);
 extern void domailuser (char *username);
 extern void drawmenu (void);
 extern void freefile (void);