summaryrefslogtreecommitdiff
path: root/source4/param/param.i
diff options
context:
space:
mode:
Diffstat (limited to 'source4/param/param.i')
-rw-r--r--source4/param/param.i21
1 files changed, 21 insertions, 0 deletions
diff --git a/source4/param/param.i b/source4/param/param.i
index 353fa3ced6..eeecb0e5b9 100644
--- a/source4/param/param.i
+++ b/source4/param/param.i
@@ -290,3 +290,24 @@ typedef struct param_section {
%rename(default_config) global_loadparm;
struct loadparm_context *global_loadparm;
+
+%{
+
+struct loadparm_context *lp_from_py_object(PyObject *py_obj)
+{
+ struct loadparm_context *lp_ctx;
+ 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;
+}
+
+%}