]> skyeroc.xyz Git - dgamelaunch/commitdiff
Allow defining the login db in config file also when using sqlite.
authorPasi Kallinen <paxed@alt.org>
Thu, 13 Oct 2011 16:13:53 +0000 (16:13 +0000)
committerPasi Kallinen <paxed@alt.org>
Thu, 13 Oct 2011 16:13:53 +0000 (16:13 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@628 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

dgamelaunch.c
dgl-common.c
examples/dgamelaunch.conf

index bc9002e0f84ebd1aa400441630d0efae2d64af18..dd3d887c60a094c5b14754e8f13c1d77d0b84c34 100644 (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");
index 084e0ea7c0c55fd55db9dd37009448b69e468c62..20aff4f35dcd30d98901a4e5102c673da4d22484 100644 (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)
          {
index 9e1eef59601e49c8f7a36f14f8a19a18ced4bb15..a162274a9973211a26644dc36681a7166b6c5da7 100644 (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