mirror of
https://github.com/paxed/dgamelaunch.git
synced 2025-07-31 01:24:43 +02:00
add USER-authentication support
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@291 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
9937d763bf
commit
1a36469589
@ -1,4 +1,4 @@
|
|||||||
1.4.5 (????/??/??)
|
1.4.5 (2004/06/11)
|
||||||
* Reset offset if necessary to show at least one game to avoid things
|
* Reset offset if necessary to show at least one game to avoid things
|
||||||
like "(15-14 of 14)".
|
like "(15-14 of 14)".
|
||||||
* Provide several examples for dgl-create-chroot.conf.
|
* Provide several examples for dgl-create-chroot.conf.
|
||||||
@ -8,6 +8,8 @@
|
|||||||
* Added ^W for delete word in mygetnstr().
|
* Added ^W for delete word in mygetnstr().
|
||||||
* Begun generalization of code so that someone can get it to work
|
* Begun generalization of code so that someone can get it to work
|
||||||
with stuff like Slash'EM etc. easier.
|
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)
|
1.4.4 (2004/03/07)
|
||||||
* Show total number of games in progress below the list, useful if
|
* Show total number of games in progress below the list, useful if
|
||||||
|
@ -785,6 +785,21 @@ initcurses ()
|
|||||||
|
|
||||||
/* ************************************************************* */
|
/* ************************************************************* */
|
||||||
|
|
||||||
|
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
|
void
|
||||||
loginprompt (int from_ttyplay)
|
loginprompt (int from_ttyplay)
|
||||||
{
|
{
|
||||||
@ -1652,7 +1667,7 @@ int
|
|||||||
main (int argc, char** argv)
|
main (int argc, char** argv)
|
||||||
{
|
{
|
||||||
/* for chroot and program execution */
|
/* for chroot and program execution */
|
||||||
char atrcfilename[81], *spool;
|
char atrcfilename[81], *spool, *auth = getenv("USER");
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
int c;
|
int c;
|
||||||
int nhext = 0, nhauth = 0;
|
int nhext = 0, nhauth = 0;
|
||||||
@ -1760,6 +1775,25 @@ main (int argc, char** argv)
|
|||||||
if (nhauth)
|
if (nhauth)
|
||||||
graceful_exit (authenticate ());
|
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 ();
|
initcurses ();
|
||||||
menuloop();
|
menuloop();
|
||||||
|
|
||||||
|
@ -87,6 +87,7 @@ extern void freefile(void);
|
|||||||
extern void initcurses(void);
|
extern void initcurses(void);
|
||||||
extern void loginprompt(int from_ttyplay);
|
extern void loginprompt(int from_ttyplay);
|
||||||
extern void newuser(void);
|
extern void newuser(void);
|
||||||
|
extern void autologin(char *user, char *pass);
|
||||||
extern int passwordgood(char *cpw);
|
extern int passwordgood(char *cpw);
|
||||||
extern int readfile(int nolock);
|
extern int readfile(int nolock);
|
||||||
extern int userexist(char *cname);
|
extern int userexist(char *cname);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user