summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-01-14 16:11:36 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-01-14 19:53:07 +0100
commit251457264bf862e3048414ef0d77c133be1bd3d0 (patch)
tree987f57482d93649c5ff02e02fbe8c7bcd73407cd /source4
parent035599fa651409502a6894179d5cd8a026110ba1 (diff)
downloadsamba-251457264bf862e3048414ef0d77c133be1bd3d0.tar.gz
samba-251457264bf862e3048414ef0d77c133be1bd3d0.tar.bz2
samba-251457264bf862e3048414ef0d77c133be1bd3d0.zip
python: Accept loadparm filename rather than loadparm object, too.
(This used to be commit 7e583a7ec4196982bd13cb679d741f37ef7decdb)
Diffstat (limited to 'source4')
-rw-r--r--source4/param/param.i11
-rw-r--r--source4/param/param_wrap.c11
2 files changed, 20 insertions, 2 deletions
diff --git a/source4/param/param.i b/source4/param/param.i
index fdc9de233f..eeecb0e5b9 100644
--- a/source4/param/param.i
+++ b/source4/param/param.i
@@ -296,7 +296,16 @@ struct loadparm_context *global_loadparm;
struct loadparm_context *lp_from_py_object(PyObject *py_obj)
{
struct loadparm_context *lp_ctx;
- if (SWIG_ConvertPtr(py_obj, &lp_ctx, SWIGTYPE_p_loadparm_context, 0 | 0 ) < 0)
+ if (PyString_Check(py_obj)) {
+ lp_ctx = loadparm_init(NULL);
+ if (!lp_load(lp_ctx, PyString_AsString(py_obj))) {
+ talloc_free(lp_ctx);
+ return NULL;
+ }
+ return lp_ctx;
+ }
+
+ if (SWIG_ConvertPtr(py_obj, (void *)&lp_ctx, SWIGTYPE_p_loadparm_context, 0 | 0 ) < 0)
return NULL;
return lp_ctx;
}
diff --git a/source4/param/param_wrap.c b/source4/param/param_wrap.c
index e9fe8a3df5..d8be725c5e 100644
--- a/source4/param/param_wrap.c
+++ b/source4/param/param_wrap.c
@@ -2765,7 +2765,16 @@ SWIGINTERN struct param_opt *param_section_next_parameter(param_section *self,st
struct loadparm_context *lp_from_py_object(PyObject *py_obj)
{
struct loadparm_context *lp_ctx;
- if (SWIG_ConvertPtr(py_obj, &lp_ctx, SWIGTYPE_p_loadparm_context, 0 | 0 ) < 0)
+ if (PyString_Check(py_obj)) {
+ lp_ctx = loadparm_init(NULL);
+ if (!lp_load(lp_ctx, PyString_AsString(py_obj))) {
+ talloc_free(lp_ctx);
+ return NULL;
+ }
+ return lp_ctx;
+ }
+
+ if (SWIG_ConvertPtr(py_obj, (void *)&lp_ctx, SWIGTYPE_p_loadparm_context, 0 | 0 ) < 0)
return NULL;
return lp_ctx;
}