-1.4.5 (????/??/??)
+1.4.5 (2004/06/11)
* Reset offset if necessary to show at least one game to avoid things
like "(15-14 of 14)".
* Provide several examples for dgl-create-chroot.conf.
* Added ^W for delete word in mygetnstr().
* Begun generalization of code so that someone can get it to work
with stuff like Slash'EM etc. easier.
+ * Allow automatic authorization using the USER environment variable
+ that one can auto-set in .telnetrc.
1.4.4 (2004/03/07)
* Show total number of games in progress below the list, useful if
/* ************************************************************* */
+void
+autologin (char* user, char *pass)
+{
+ int me_index = -1;
+ if ((me_index = userexist(user)) != -1)
+ {
+ me = users[me_index];
+ if (passwordgood(pass))
+ {
+ loggedin = 1;
+ snprintf (rcfilename, 80, "%srcfiles/%s.nethackrc", myconfig->dglroot, me->username);
+ }
+ }
+}
+
void
loginprompt (int from_ttyplay)
{
main (int argc, char** argv)
{
/* for chroot and program execution */
- char atrcfilename[81], *spool;
+ char atrcfilename[81], *spool, *auth = getenv("USER");
unsigned int len;
int c;
int nhext = 0, nhauth = 0;
if (nhauth)
graceful_exit (authenticate ());
+ if (auth)
+ {
+ char *user, *pass, *p;
+
+ p = strchr(auth, ':');
+
+ if (p)
+ {
+ pass = p + 1;
+
+ if (pass != '\0')
+ {
+ *p = '\0';
+ user = auth;
+ autologin(user, pass);
+ }
+ }
+ }
+
initcurses ();
menuloop();
extern void initcurses(void);
extern void loginprompt(int from_ttyplay);
extern void newuser(void);
+extern void autologin(char *user, char *pass);
extern int passwordgood(char *cpw);
extern int readfile(int nolock);
extern int userexist(char *cname);