diff --git a/dgamelaunch.c b/dgamelaunch.c index eaff799..7562f27 100644 --- a/dgamelaunch.c +++ b/dgamelaunch.c @@ -56,6 +56,11 @@ # include #endif +#ifdef __linux__ +# include +#endif + +#include #include #include #include /* ttyrec */ @@ -680,7 +685,7 @@ loginprompt () getnstr (pw_buf, 20); echo (); - if (passwordgood (user_buf, pw_buf)) + if (passwordgood (pw_buf)) { loggedin = 1; snprintf (rcfilename, 80, "%s%s.nethackrc", LOC_DGLDIR, me->username); @@ -788,8 +793,11 @@ newuser () /* ************************************************************* */ int -passwordgood (char *cname, char *cpw) +passwordgood (char *cpw) { + if (me == NULL) + return 1; + if (!strncmp (crypt (cpw, cpw), me->password, 13)) return 1; if (!strncmp (cpw, me->password, 20)) diff --git a/dgamelaunch.h b/dgamelaunch.h index 9163210..25349f6 100644 --- a/dgamelaunch.h +++ b/dgamelaunch.h @@ -64,7 +64,7 @@ extern void initncurses (void); extern struct dg_user *deep_copy (struct dg_user *src); extern void loginprompt (void); extern void newuser (void); -extern int passwordgood (char *cname, char *cpw); +extern int passwordgood (char *cpw); extern int readfile (int nolock); extern int userexist (char *cname); extern void write_canned_rcfile (char *target);