Allow defining the login db in config file also when using sqlite.

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@628 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Pasi Kallinen 2011-10-13 16:13:53 +00:00
parent a6ab367469
commit bb5507b983
3 changed files with 13 additions and 9 deletions

View File

@ -2164,7 +2164,7 @@ userexist (char *cname, int isnew)
qbuf = sqlite3_mprintf("select * from dglusers where username like '%q' limit 1", tmpbuf);
ret = sqlite3_open(USE_SQLITE_DB, &db); /* FIXME: use globalconfig->passwd? */
ret = sqlite3_open(globalconfig.passwd, &db);
if (ret) {
sqlite3_close(db);
debug_write("sqlite3_open failed");
@ -2352,7 +2352,7 @@ writefile (int requirenew)
qbuf = sqlite3_mprintf("update dglusers set username='%q', email='%q', env='%q', password='%q', flags=%li where id=%i", me->username, me->email, me->env, me->password, me->flags, me->id);
}
ret = sqlite3_open(USE_SQLITE_DB, &db); /* FIXME: use globalconfig->passwd? */
ret = sqlite3_open(globalconfig.passwd, &db);
if (ret) {
sqlite3_close(db);
debug_write("writefile sqlite3_open failed");

View File

@ -807,7 +807,11 @@ create_config ()
if (!globalconfig.dglroot) globalconfig.dglroot = "/dgldir/";
if (!globalconfig.banner) globalconfig.banner = "/dgl-banner";
#ifndef USE_SQLITE3
if (!globalconfig.passwd) globalconfig.passwd = "/dgl-login";
#else
if (!globalconfig.passwd) globalconfig.passwd = USE_SQLITE_DB;
#endif
if (!globalconfig.lockfile) globalconfig.lockfile = "/dgl-lock";
if (!globalconfig.shed_user && globalconfig.shed_uid == (uid_t)-1)
{

View File

@ -96,13 +96,13 @@ locale = "en_US.UTF-8"
# For setting game idle time, use max_idle_time in the game DEFINE.
# menu_max_idle_time = 1024
# The defaults are usually just fine for this. passwd refers to the file
# that stores the user database, and lockfile is only used internally by
# dgamelaunch.
# passwd doesn't matter if dgl was compiled with SQLite, as the name of
# the sqlite database will be defined at compile time.
passwd = "/dgl-login"
lockfile = "/dgl-lock"
# Passwd refers to the file that stores the user database.
# The default passwd file is "/dgl-login" for flat-text database, and for
# sqlite, whatever value was defined for the sqlite database at compile time.
#passwd = "/dgl-login"
# Lockfile is used only when dgl was compiled without sqlite.
#lockfile = "/dgl-lock"
#
# define some commands that are run when something happens. format is