summaryrefslogtreecommitdiff
path: root/source4/param
diff options
context:
space:
mode:
Diffstat (limited to 'source4/param')
-rw-r--r--source4/param/loadparm.c14
-rw-r--r--source4/param/param.h1
-rw-r--r--source4/param/pyparam.c13
3 files changed, 23 insertions, 5 deletions
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 2d9af33325..c1a012474b 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -2427,13 +2427,19 @@ const char *lp_configfile(struct loadparm_context *lp_ctx)
return lp_ctx->szConfigFile;
}
-bool lp_load_default(struct loadparm_context *lp_ctx)
+const char *lp_default_path(void)
{
- const char *path;
if (getenv("SMB_CONF_PATH"))
- path = getenv("SMB_CONF_PATH");
+ return getenv("SMB_CONF_PATH");
else
- path = dyn_CONFIGFILE;
+ return dyn_CONFIGFILE;
+}
+
+bool lp_load_default(struct loadparm_context *lp_ctx)
+{
+ const char *path;
+
+ path = lp_default_path();
if (!file_exist(path)) {
/* We allow the default smb.conf file to not exist,
diff --git a/source4/param/param.h b/source4/param/param.h
index ba0dbfd0fa..3d257be062 100644
--- a/source4/param/param.h
+++ b/source4/param/param.h
@@ -279,6 +279,7 @@ void lp_killunused(struct loadparm_context *lp_ctx,
struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx);
const char *lp_configfile(struct loadparm_context *lp_ctx);
bool lp_load_default(struct loadparm_context *lp_ctx);
+const char *lp_default_path(void);
/**
* Load the services array from the services file.
diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c
index 0061eadc54..42775908ea 100644
--- a/source4/param/pyparam.c
+++ b/source4/param/pyparam.c
@@ -358,6 +358,17 @@ struct loadparm_context *py_default_loadparm_context(TALLOC_CTX *mem_ctx)
return ret;
}
+static PyObject *py_default_path(PyObject *self)
+{
+ return PyString_FromString(lp_default_path());
+}
+
+static PyMethodDef pyparam_methods[] = {
+ { "default_path", (PyCFunction)py_default_path, METH_NOARGS,
+ "Returns the default smb.conf path." },
+ { NULL }
+};
+
void initparam(void)
{
PyObject *m;
@@ -365,7 +376,7 @@ void initparam(void)
if (PyType_Ready(&PyLoadparmContext) < 0)
return;
- m = Py_InitModule3("param", NULL, "Parsing and writing Samba configuration files.");
+ m = Py_InitModule3("param", pyparam_methods, "Parsing and writing Samba configuration files.");
if (m == NULL)
return;