Fix problem with people entering initial blank password.

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@77 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Joshua Kwan 2004-01-04 12:16:05 +00:00
parent 58d70cd5e3
commit 5a623c9d44
2 changed files with 12 additions and 5 deletions

View File

@ -440,7 +440,7 @@ inprogressmenu ()
/* ************************************************************* */ /* ************************************************************* */
void int
changepw () changepw ()
{ {
char buf[21]; char buf[21];
@ -480,7 +480,7 @@ changepw ()
echo (); /* Putting echo back on just for safety and because it can't hurt. */ echo (); /* Putting echo back on just for safety and because it can't hurt. */
if (buf && *buf == '\0') if (buf && *buf == '\0')
return; return 0;
if (strchr (buf, ':') != NULL) if (strchr (buf, ':') != NULL)
graceful_exit (112); graceful_exit (112);
@ -500,6 +500,8 @@ changepw ()
me->password = strdup (crypt (buf, buf)); me->password = strdup (crypt (buf, buf));
writefile (0); writefile (0);
return 1;
} }
/* ************************************************************* */ /* ************************************************************* */
@ -781,7 +783,7 @@ newuser ()
for (i = 0; i < strlen (buf); i++) for (i = 0; i < strlen (buf); i++)
{ {
if (!isalnum(buf)) if (!isalnum(buf[i]))
error = 1; error = 1;
} }
@ -798,7 +800,12 @@ newuser ()
clear (); clear ();
changepw (); /* Calling changepw instead to prompt twice. */ if (!changepw ()) /* Calling changepw instead to prompt twice. */
{
free(me);
me = NULL;
return;
}
/* email step */ /* email step */

View File

@ -57,7 +57,7 @@ extern void loadbanner (struct dg_banner *ban);
extern void drawbanner (unsigned int start_line, unsigned int howmany); extern void drawbanner (unsigned int start_line, unsigned int howmany);
extern struct dg_game **populate_games (int *l); extern struct dg_game **populate_games (int *l);
extern void inprogressmenu (void); extern void inprogressmenu (void);
extern void changepw (void); extern int changepw (void);
extern void domailuser (char *username); extern void domailuser (char *username);
extern void drawmenu (void); extern void drawmenu (void);
extern void freefile (void); extern void freefile (void);