diff --git a/config.y b/config.y index 6947459..bd81374 100644 --- a/config.y +++ b/config.y @@ -170,8 +170,8 @@ KeyPair: KeyType '=' TYPE_VALUE { break; case TYPE_PATH_PASSWD: - if (myconfig[ncnf]->passwd) free(myconfig[ncnf]->passwd); - myconfig[ncnf]->passwd = strdup($3); + if (globalconfig.passwd) free(globalconfig.passwd); + globalconfig.passwd = strdup($3); break; case TYPE_PATH_SAVEFILEFMT: diff --git a/dgamelaunch.c b/dgamelaunch.c index 15246cd..a253480 100644 --- a/dgamelaunch.c +++ b/dgamelaunch.c @@ -1108,7 +1108,7 @@ readfile (int nolock) graceful_exit (114); } - fp = fopen (myconfig[0]->passwd, "r"); + fp = fopen (globalconfig.passwd, "r"); if (!fp) graceful_exit (106); @@ -1331,7 +1331,7 @@ writefile (int requirenew) freefile (); readfile (1); - fp = fopen (myconfig[0]->passwd, "w"); + fp = fopen (globalconfig.passwd, "w"); if (!fp) { sigprocmask(SIG_SETMASK, &oldmask, NULL); @@ -1972,7 +1972,7 @@ main (int argc, char** argv) printf("game:'%s'\n", myconfig[userchoice]->game_name); printf("dglroot:'%s'\n", globalconfig.dglroot); printf("lockfile:'%s'\n", myconfig[userchoice]->lockfile); - printf("passwd:'%s'\n", myconfig[userchoice]->passwd); + printf("passwd:'%s'\n", globalconfig.passwd); printf("banner:'%s'\n", globalconfig.banner); printf("rcfile:'%s'\n", myconfig[userchoice]->rcfile); printf("spool:'%s'\n", myconfig[userchoice]->spool); diff --git a/dgamelaunch.h b/dgamelaunch.h index c82169d..7318daa 100644 --- a/dgamelaunch.h +++ b/dgamelaunch.h @@ -47,7 +47,6 @@ struct dg_config char* game_name; char* chdir; char* lockfile; - char* passwd; char* rcfile; char* spool; char* savefilefmt; @@ -68,6 +67,7 @@ struct dg_globalconfig char* shed_group; uid_t shed_uid; gid_t shed_gid; + char* passwd; }; /* Global variables */ diff --git a/dgl-common.c b/dgl-common.c index f3f8e75..d7d2794 100644 --- a/dgl-common.c +++ b/dgl-common.c @@ -24,7 +24,7 @@ struct dg_config defconfig = { /* chdir = */ NULL, /* dglroot = *//* "/dgldir/",*/ /* lockfile = */ "/dgl-lock", - /* passwd = */ "/dgl-login", + /* passwd = */ /*"/dgl-login",*/ /* banner = */ /*"/dgl-banner",*/ /* rcfile = */ NULL, /*"/dgl-default-rcfile",*/ /* spool = */ "/var/mail/", @@ -328,7 +328,6 @@ create_config () if (!myconfig[tmp]->game_name) myconfig[tmp]->game_name = defconfig.game_name; if (!myconfig[tmp]->rcfile) myconfig[tmp]->rcfile = defconfig.rcfile; if (!myconfig[tmp]->spool) myconfig[tmp]->spool = defconfig.spool; - if (!myconfig[tmp]->passwd) myconfig[tmp]->passwd = defconfig.passwd; if (!myconfig[tmp]->lockfile) myconfig[tmp]->lockfile = defconfig.lockfile; if (!myconfig[tmp]->savefilefmt) myconfig[tmp]->savefilefmt = defconfig.savefilefmt; if (!myconfig[tmp]->inprogressdir) myconfig[tmp]->inprogressdir = defconfig.inprogressdir; @@ -342,6 +341,8 @@ create_config () if (!globalconfig.dglroot) globalconfig.dglroot = "/dgldir/"; if (!globalconfig.banner) globalconfig.banner = "/dgl-banner"; + if (!globalconfig.passwd) globalconfig.passwd = "/dgl-login"; + if (!globalconfig.shed_user && globalconfig.shed_uid == (uid_t)-1) { struct passwd *pw;