commit f125bc3bbd0613c601444f6d81606f17f1032cf1
Author: Jacob Nevins <0jacobnk.gna@chiark.greenend.org.uk>
Date:   Sun Jul 8 00:36:34 2012 +0100

    Moved install location of database.lua from general Freeciv data path
    to hardcoded sysconfdir (e.g., /usr/local/etc/freeciv/database.lua)
    for security reasons.
    (After this, it will no longer be possible to run the server with a
    --Database argument from a build directory; it must be installed.)
    
    Patch by Marko Lindqvist (cazfi@gna) and myself.
    
    See gna bug #19729.

diff --git configure.ac configure.ac
index 25c07cc..267bb13 100644
--- configure.ac
+++ configure.ac
@@ -1039,6 +1039,8 @@ AC_MSG_CHECKING([for SIGPIPE])
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], [[signal (SIGPIPE, SIG_IGN)]])],[AC_MSG_RESULT([yes])
                 AC_DEFINE(HAVE_SIGPIPE, 1, [sigpipe support])],[AC_MSG_RESULT([no])])
 
+FC_CONF_PATH="$sysconfdir/freeciv"
+
 dnl export where the datadir is going to be installed
 FC_EXPAND_DIR(FREECIV_DATADIR, "$datadir/freeciv")
 
@@ -1051,6 +1053,7 @@ else
   DEFAULT_SAVE_PATH=".:~/.freeciv/saves"
   DEFAULT_SCENARIO_PATH=".:data/scenarios:~/.freeciv/$DATASUBDIR/scenarios:~/.freeciv/scenarios:$datadir/freeciv/scenarios"
 fi
+CPPFLAGS="$CPPFLAGS -DFC_CONF_PATH=\"\\\"$FC_CONF_PATH\\\"\""
 CPPFLAGS="$CPPFLAGS -DDEFAULT_DATA_PATH=\"\\\"$DEFAULT_DATA_PATH\\\"\""
 CPPFLAGS="$CPPFLAGS -DDEFAULT_SAVES_PATH=\"\\\"$DEFAULT_SAVES_PATH\\\"\""
 CPPFLAGS="$CPPFLAGS -DDEFAULT_SCENARIO_PATH=\"\\\"$DEFAULT_SCENARIO_PATH\\\"\""
diff --git data/Makefile.am data/Makefile.am
index 5705d67..9ea0970 100644
--- data/Makefile.am
+++ data/Makefile.am
@@ -1,5 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 
+pkgsysconfdir = $(sysconfdir)/$(PACKAGE)
+
 if CLIENT
 CLIENT_FILES =				\
 	hex2t.tilespec			\
@@ -24,16 +26,20 @@ endif
 
 if SERVER
 SERVER_FILES = \
-	database.lua \
 	civ1.serv \
 	civ2.serv \
 	default.serv \
 	experimental.serv \
 	multiplayer.serv
+
+SERVER_CONF = database.lua
+
 else
 SERVER_FILES =
+SERVER_CONF =
 endif
 
+pkgsysconf_DATA = $(SERVER_CONF)
 pkgdata_DATA = $(SERVER_FILES) $(CLIENT_FILES)
 
 # Freeciv.rc was originally for gui-gtk but is also used by gui-sdl
diff --git doc/README.packaging doc/README.packaging
index b816aae..a53c9fd 100644
--- doc/README.packaging
+++ doc/README.packaging
@@ -33,6 +33,10 @@ Updating from 2.3 to 2.4
 * New tileset cimpletoon. It depends on amplio2 (files) being present,
   and has just units of its own. Unlike units in any other tileset, these
   units have orientation (different gfx depending where unit faces)
+* There's a new script file database.lua, used for authentication,
+  installed into sysconfdir (e.g. /usr/local/etc/freeciv/database.lua).
+  Server operators might want to tweak this, so we recommend it's treated
+  as a configuration file (e.g., conffile in Debian).
 
 ----------------------------------------------------------------------
 Compatibility of modified versions
diff --git server/scripting/script_fcdb.c server/scripting/script_fcdb.c
index 3b5f92e..a292568 100644
--- server/scripting/script_fcdb.c
+++ server/scripting/script_fcdb.c
@@ -189,12 +189,7 @@ bool script_fcdb_init(const char *fcdb_luafile)
 
   if (!fcdb_luafile) {
     /* Use default freeciv database lua file. */
-    fcdb_luafile = fileinfoname(get_data_dirs(), SCRIPT_FCDB_LUA_FILE);
-  }
-
-  if (!fcdb_luafile) {
-    log_error("Freeciv database script '%s' not in data path.", fcdb_luafile);
-    return FALSE;
+    fcdb_luafile = FC_CONF_PATH "/" SCRIPT_FCDB_LUA_FILE;
   }
 
   fcl = luascript_new(NULL);
