passwd file is global config, not per-game

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@351 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Pasi Kallinen 2007-03-31 21:18:32 +00:00
parent 59254ed4b7
commit 89825b1ca4
4 changed files with 9 additions and 8 deletions

View File

@ -170,8 +170,8 @@ KeyPair: KeyType '=' TYPE_VALUE {
break; break;
case TYPE_PATH_PASSWD: case TYPE_PATH_PASSWD:
if (myconfig[ncnf]->passwd) free(myconfig[ncnf]->passwd); if (globalconfig.passwd) free(globalconfig.passwd);
myconfig[ncnf]->passwd = strdup($3); globalconfig.passwd = strdup($3);
break; break;
case TYPE_PATH_SAVEFILEFMT: case TYPE_PATH_SAVEFILEFMT:

View File

@ -1108,7 +1108,7 @@ readfile (int nolock)
graceful_exit (114); graceful_exit (114);
} }
fp = fopen (myconfig[0]->passwd, "r"); fp = fopen (globalconfig.passwd, "r");
if (!fp) if (!fp)
graceful_exit (106); graceful_exit (106);
@ -1331,7 +1331,7 @@ writefile (int requirenew)
freefile (); freefile ();
readfile (1); readfile (1);
fp = fopen (myconfig[0]->passwd, "w"); fp = fopen (globalconfig.passwd, "w");
if (!fp) if (!fp)
{ {
sigprocmask(SIG_SETMASK, &oldmask, NULL); sigprocmask(SIG_SETMASK, &oldmask, NULL);
@ -1972,7 +1972,7 @@ main (int argc, char** argv)
printf("game:'%s'\n", myconfig[userchoice]->game_name); printf("game:'%s'\n", myconfig[userchoice]->game_name);
printf("dglroot:'%s'\n", globalconfig.dglroot); printf("dglroot:'%s'\n", globalconfig.dglroot);
printf("lockfile:'%s'\n", myconfig[userchoice]->lockfile); 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("banner:'%s'\n", globalconfig.banner);
printf("rcfile:'%s'\n", myconfig[userchoice]->rcfile); printf("rcfile:'%s'\n", myconfig[userchoice]->rcfile);
printf("spool:'%s'\n", myconfig[userchoice]->spool); printf("spool:'%s'\n", myconfig[userchoice]->spool);

View File

@ -47,7 +47,6 @@ struct dg_config
char* game_name; char* game_name;
char* chdir; char* chdir;
char* lockfile; char* lockfile;
char* passwd;
char* rcfile; char* rcfile;
char* spool; char* spool;
char* savefilefmt; char* savefilefmt;
@ -68,6 +67,7 @@ struct dg_globalconfig
char* shed_group; char* shed_group;
uid_t shed_uid; uid_t shed_uid;
gid_t shed_gid; gid_t shed_gid;
char* passwd;
}; };
/* Global variables */ /* Global variables */

View File

@ -24,7 +24,7 @@ struct dg_config defconfig = {
/* chdir = */ NULL, /* chdir = */ NULL,
/* dglroot = *//* "/dgldir/",*/ /* dglroot = *//* "/dgldir/",*/
/* lockfile = */ "/dgl-lock", /* lockfile = */ "/dgl-lock",
/* passwd = */ "/dgl-login", /* passwd = */ /*"/dgl-login",*/
/* banner = */ /*"/dgl-banner",*/ /* banner = */ /*"/dgl-banner",*/
/* rcfile = */ NULL, /*"/dgl-default-rcfile",*/ /* rcfile = */ NULL, /*"/dgl-default-rcfile",*/
/* spool = */ "/var/mail/", /* spool = */ "/var/mail/",
@ -328,7 +328,6 @@ create_config ()
if (!myconfig[tmp]->game_name) myconfig[tmp]->game_name = defconfig.game_name; if (!myconfig[tmp]->game_name) myconfig[tmp]->game_name = defconfig.game_name;
if (!myconfig[tmp]->rcfile) myconfig[tmp]->rcfile = defconfig.rcfile; if (!myconfig[tmp]->rcfile) myconfig[tmp]->rcfile = defconfig.rcfile;
if (!myconfig[tmp]->spool) myconfig[tmp]->spool = defconfig.spool; 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]->lockfile) myconfig[tmp]->lockfile = defconfig.lockfile;
if (!myconfig[tmp]->savefilefmt) myconfig[tmp]->savefilefmt = defconfig.savefilefmt; if (!myconfig[tmp]->savefilefmt) myconfig[tmp]->savefilefmt = defconfig.savefilefmt;
if (!myconfig[tmp]->inprogressdir) myconfig[tmp]->inprogressdir = defconfig.inprogressdir; if (!myconfig[tmp]->inprogressdir) myconfig[tmp]->inprogressdir = defconfig.inprogressdir;
@ -342,6 +341,8 @@ create_config ()
if (!globalconfig.dglroot) globalconfig.dglroot = "/dgldir/"; if (!globalconfig.dglroot) globalconfig.dglroot = "/dgldir/";
if (!globalconfig.banner) globalconfig.banner = "/dgl-banner"; if (!globalconfig.banner) globalconfig.banner = "/dgl-banner";
if (!globalconfig.passwd) globalconfig.passwd = "/dgl-login";
if (!globalconfig.shed_user && globalconfig.shed_uid == (uid_t)-1) if (!globalconfig.shed_user && globalconfig.shed_uid == (uid_t)-1)
{ {
struct passwd *pw; struct passwd *pw;