s4-param Remove 'modules dir'
authorAndrew Bartlett <abartlet@samba.org>
Mon, 6 Jun 2011 04:39:19 +0000 (14:39 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 6 Jun 2011 07:37:51 +0000 (17:37 +1000)
The Samba waf build ensures that dyn_MODULESDIR is always correct
(even for in-tree binaries), so we don't need to allow the user to
configure this at run time.

Andrew Bartlett

source4/param/loadparm.c
source4/param/pyparam.c
source4/scripting/python/samba/__init__.py

index 6a173b1afca708e283b41c7fce27e7f8565e191c..2e60ef93b207f676ef5a6f634dbc114bc5a44cd7 100644 (file)
@@ -88,7 +88,6 @@ struct loadparm_global
        char *unix_charset;
        char *display_charset;
        char *szLockDir;
-       char *szModulesDir;
        char *szPidDir;
        char *szServerString;
        char *szAutoServices;
@@ -467,7 +466,6 @@ static struct parm_struct parm_table[] = {
        {"auto services", P_STRING, P_GLOBAL, GLOBAL_VAR(szAutoServices), NULL, NULL},
        {"lock dir", P_STRING, P_GLOBAL, GLOBAL_VAR(szLockDir), NULL, NULL}, 
        {"lock directory", P_STRING, P_GLOBAL, GLOBAL_VAR(szLockDir), NULL, NULL},
-       {"modules dir", P_STRING, P_GLOBAL, GLOBAL_VAR(szModulesDir), NULL, NULL},
        {"pid directory", P_STRING, P_GLOBAL, GLOBAL_VAR(szPidDir), NULL, NULL}, 
 
        {"socket address", P_STRING, P_GLOBAL, GLOBAL_VAR(szSocketAddress), NULL, NULL},
@@ -700,7 +698,6 @@ FN_GLOBAL_BOOL(idmap_trusted_only, bIdmapTrustedOnly)
 FN_GLOBAL_STRING(private_dir, szPrivateDir)
 FN_GLOBAL_STRING(serverstring, szServerString)
 FN_GLOBAL_STRING(lockdir, szLockDir)
-FN_GLOBAL_STRING(modulesdir, szModulesDir)
 FN_GLOBAL_STRING(ncalrpc_dir, ncalrpc_dir)
 FN_GLOBAL_STRING(dos_charset, dos_charset)
 FN_GLOBAL_STRING(unix_charset, unix_charset)
@@ -2489,7 +2486,6 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
 
        lpcfg_do_global_parameter(lp_ctx, "pid directory", dyn_PIDDIR);
        lpcfg_do_global_parameter(lp_ctx, "lock dir", dyn_LOCKDIR);
-       lpcfg_do_global_parameter(lp_ctx, "modules dir", dyn_MODULESDIR);
        lpcfg_do_global_parameter(lp_ctx, "ncalrpc dir", dyn_NCALRPCDIR);
 
        lpcfg_do_global_parameter(lp_ctx, "socket address", "");
index 998eb9d325b206884fc4c7e146f68e5f7c637877..e1ba18415d3a90ecbc7f7dba47a4e8d2f44afcef 100644 (file)
@@ -440,11 +440,18 @@ static PyObject *py_setup_dir(PyObject *self)
     return PyString_FromString(dyn_SETUPDIR);
 }
 
+static PyObject *py_modules_dir(PyObject *self)
+{
+    return PyString_FromString(dyn_MODULESDIR);
+}
+
 static PyMethodDef pyparam_methods[] = {
     { "default_path", (PyCFunction)py_default_path, METH_NOARGS, 
         "Returns the default smb.conf path." },
     { "setup_dir", (PyCFunction)py_setup_dir, METH_NOARGS,
         "Returns the compiled in location of provision tempates." },
+    { "modules_dir", (PyCFunction)py_modules_dir, METH_NOARGS,
+        "Returns the compiled in location of modules." },
     { NULL }
 };
 
index dac69e7f62add3ced1e6638f7d1e58e77ddd9087..76eb44ce928650cbb39b8e1062d107b845b5d356 100644 (file)
@@ -26,6 +26,7 @@ __docformat__ = "restructuredText"
 
 import os
 import sys
+import samba.param
 
 def source_tree_topdir():
     '''return the top level directory (the one containing the source4 directory)'''
@@ -77,8 +78,8 @@ class Ldb(_Ldb):
 
         if modules_dir is not None:
             self.set_modules_dir(modules_dir)
-        elif lp is not None:
-            self.set_modules_dir(os.path.join(lp.get("modules dir"), "ldb"))
+        else:
+            self.set_modules_dir(os.path.join(samba.param.modules_dir(), "ldb"))
 
         if session_info is not None:
             self.set_session_info(session_info)