summaryrefslogtreecommitdiff
path: root/source4/param
diff options
context:
space:
mode:
Diffstat (limited to 'source4/param')
-rw-r--r--source4/param/config.mk31
-rw-r--r--source4/param/param.i35
-rw-r--r--source4/param/param.py76
-rw-r--r--source4/param/param_wrap.c126
-rw-r--r--source4/param/share.c4
-rw-r--r--source4/param/share.h5
-rw-r--r--source4/param/share_classic.c1
-rw-r--r--source4/param/share_ldb.c6
-rw-r--r--source4/param/tests/bindings.py2
-rw-r--r--source4/param/tests/share.c4
10 files changed, 235 insertions, 55 deletions
diff --git a/source4/param/config.mk b/source4/param/config.mk
index 42cb6f3c1c..02474d50b9 100644
--- a/source4/param/config.mk
+++ b/source4/param/config.mk
@@ -3,31 +3,30 @@ PUBLIC_DEPENDENCIES = LIBSAMBA-UTIL
PRIVATE_DEPENDENCIES = DYNCONFIG LIBREPLACE_EXT CHARSET
LIBSAMBA-HOSTCONFIG_VERSION = 0.0.1
-LIBSAMBA-HOSTCONFIG-SOVERSION = 0
+LIBSAMBA-HOSTCONFIG_SOVERSION = 0
-LIBSAMBA-HOSTCONFIG_OBJ_FILES = param/loadparm.o \
- param/generic.o \
- param/util.o \
- lib/version.o
+LIBSAMBA-HOSTCONFIG_OBJ_FILES = $(addprefix $(paramsrcdir)/, \
+ loadparm.o generic.o util.o) lib/version.o
PUBLIC_HEADERS += param/param.h
-PC_FILES += param/samba-hostconfig.pc
+PC_FILES += $(paramsrcdir)/samba-hostconfig.pc
[SUBSYSTEM::PROVISION]
PRIVATE_DEPENDENCIES = LIBPYTHON
-PROVISION_OBJ_FILES = param/provision.o
+PROVISION_OBJ_FILES = $(paramsrcdir)/provision.o
#################################
# Start SUBSYSTEM share
[SUBSYSTEM::share]
-PRIVATE_PROTO_HEADER = share_proto.h
PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL
# End SUBSYSTEM share
#################################
-share_OBJ_FILES = param/share.o
+share_OBJ_FILES = $(paramsrcdir)/share.o
+
+$(eval $(call proto_header_template,$(paramsrcdir)/share_proto.h,$(share_OBJ_FILES:.o=.c)))
PUBLIC_HEADERS += param/share.h
@@ -40,7 +39,7 @@ PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL
# End MODULE share_classic
################################################
-share_classic_OBJ_FILES = param/share_classic.o
+share_classic_OBJ_FILES = $(paramsrcdir)/share_classic.o
################################################
# Start MODULE share_ldb
@@ -51,15 +50,19 @@ PRIVATE_DEPENDENCIES = LIBLDB LDB_WRAP
# End MODULE share_ldb
################################################
-share_ldb_OBJ_FILES = param/share_ldb.o
+share_ldb_OBJ_FILES = $(paramsrcdir)/share_ldb.o
[SUBSYSTEM::SECRETS]
PRIVATE_DEPENDENCIES = LIBLDB TDB_WRAP UTIL_TDB NDR_SECURITY
-SECRETS_OBJ_FILES = param/secrets.o
+SECRETS_OBJ_FILES = $(paramsrcdir)/secrets.o
[PYTHON::param]
-SWIG_FILE = param.i
+LIBRARY_REALNAME = samba/_param.$(SHLIBEXT)
PRIVATE_DEPENDENCIES = LIBSAMBA-HOSTCONFIG
-param_OBJ_FILES = param/param_wrap.o
+param_OBJ_FILES = $(paramsrcdir)/param_wrap.o
+
+$(eval $(call python_py_module_template,samba/param.py,$(paramsrcdir)/param.py))
+
+$(param_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
diff --git a/source4/param/param.i b/source4/param/param.i
index 77d781d6ff..2c15f8f5e3 100644
--- a/source4/param/param.i
+++ b/source4/param/param.i
@@ -50,22 +50,36 @@ typedef struct loadparm_context {
%extend {
loadparm_context(TALLOC_CTX *mem_ctx) { return loadparm_init(mem_ctx); }
struct loadparm_service *default_service() { return lp_default_service($self); }
+ %feature("docstring") load "S.load(filename) -> None\n" \
+ "Load specified file.";
bool load(const char *filename) { return lp_load($self, filename); }
+ %feature("docstring") load_default "S.load_default() -> None\n" \
+ "Load default smb.conf file.";
bool load_default() { return lp_load_default($self); }
#ifdef SWIGPYTHON
int __len__() { return lp_numservices($self); }
struct loadparm_service *__getitem__(const char *name) { return lp_service($self, name); }
#endif
+ %feature("docstring") configfile "S.configfile() -> string\n" \
+ "Return name of last config file that was loaded.";
const char *configfile() { return lp_configfile($self); }
+ %feature("docstring") is_mydomain "S.is_mydomain(domain_name) -> bool\n" \
+ "Check whether the specified name matches our domain name.";
bool is_mydomain(const char *domain) { return lp_is_mydomain($self, domain); }
+ %feature("docstring") is_myname "S.is_myname(netbios_name) -> bool\n" \
+ "Check whether the specified name matches one of our netbios names.";
bool is_myname(const char *name) { return lp_is_myname($self, name); }
int use(struct param_context *param_ctx) { return param_use($self, param_ctx); }
+ %feature("docstring") set "S.set(name, value) -> bool\n" \
+ "Change a parameter.";
bool set(const char *parm_name, const char *parm_value) {
if (parm_value == NULL)
return false;
return lp_set_cmdline($self, parm_name, parm_value);
}
+ %feature("docstring") set "S.get(name, service_name) -> value\n" \
+ "Find specified parameter.";
PyObject *get(const char *param_name, const char *service_name)
{
struct parm_struct *parm = NULL;
@@ -180,7 +194,11 @@ typedef struct loadparm_service {
typedef struct param_context {
%extend {
param(TALLOC_CTX *mem_ctx) { return param_init(mem_ctx); }
+ %feature("docstring") add_section "S.get_section(name) -> section\n"
+ "Get an existing section.";
struct param_section *get_section(const char *name);
+ %feature("docstring") add_section "S.add_section(name) -> section\n"
+ "Add a new section.";
struct param_section *add_section(const char *name);
struct param_opt *get(const char *name, const char *section_name="global");
const char *get_string(const char *name, const char *section_name="global");
@@ -198,10 +216,18 @@ typedef struct param_context {
#endif
+ %feature("docstring") first_section "S.first_section() -> section\n"
+ "Find first section";
struct param_section *first_section() { return $self->sections; }
+ %feature("docstring") next_section "S.next_section(prev) -> section\n"
+ "Find next section";
struct param_section *next_section(struct param_section *s) { return s->next; }
+ %feature("docstring") read "S.read(filename) -> bool\n"
+ "Read a filename.";
int read(const char *fn);
+ %feature("docstring") read "S.write(filename) -> bool\n"
+ "Write this object to a file.";
int write(const char *fn);
}
%pythoncode {
@@ -307,6 +333,15 @@ struct loadparm_context *lp_from_py_object(PyObject *py_obj)
return lp_ctx;
}
+ if (py_obj == Py_None) {
+ lp_ctx = loadparm_init(NULL);
+ if (!lp_load_default(lp_ctx)) {
+ 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.py b/source4/param/param.py
index 025acc6be1..3aebaf0e02 100644
--- a/source4/param/param.py
+++ b/source4/param/param.py
@@ -1,5 +1,5 @@
# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
+# Version 1.3.35
#
# Don't modify this file, modify the SWIG interface instead.
@@ -62,6 +62,48 @@ class LoadParm(object):
__repr__ = _swig_repr
def __init__(self, *args, **kwargs):
_param.LoadParm_swiginit(self,_param.new_LoadParm(*args, **kwargs))
+ def load(*args, **kwargs):
+ """
+ S.load(filename) -> None
+ Load specified file.
+ """
+ return _param.LoadParm_load(*args, **kwargs)
+
+ def load_default(*args, **kwargs):
+ """
+ S.load_default() -> None
+ Load default smb.conf file.
+ """
+ return _param.LoadParm_load_default(*args, **kwargs)
+
+ def configfile(*args, **kwargs):
+ """
+ S.configfile() -> string
+ Return name of last config file that was loaded.
+ """
+ return _param.LoadParm_configfile(*args, **kwargs)
+
+ def is_mydomain(*args, **kwargs):
+ """
+ S.is_mydomain(domain_name) -> bool
+ Check whether the specified name matches our domain name.
+ """
+ return _param.LoadParm_is_mydomain(*args, **kwargs)
+
+ def is_myname(*args, **kwargs):
+ """
+ S.is_myname(netbios_name) -> bool
+ Check whether the specified name matches one of our netbios names.
+ """
+ return _param.LoadParm_is_myname(*args, **kwargs)
+
+ def set(*args, **kwargs):
+ """
+ S.set(name, value) -> bool
+ Change a parameter.
+ """
+ return _param.LoadParm_set(*args, **kwargs)
+
__swig_destroy__ = _param.delete_LoadParm
LoadParm.default_service = new_instancemethod(_param.LoadParm_default_service,None,LoadParm)
LoadParm.load = new_instancemethod(_param.LoadParm_load,None,LoadParm)
@@ -79,7 +121,7 @@ LoadParm_swigregister(LoadParm)
class loadparm_service(object):
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
- def __init__(self): raise AttributeError, "No constructor defined"
+ def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined"
__repr__ = _swig_repr
loadparm_service.volume_label = new_instancemethod(_param.loadparm_service_volume_label,None,loadparm_service)
loadparm_service.printername = new_instancemethod(_param.loadparm_service_printername,None,loadparm_service)
@@ -92,6 +134,34 @@ class ParamFile(object):
__repr__ = _swig_repr
def __init__(self, *args, **kwargs):
_param.ParamFile_swiginit(self,_param.new_ParamFile(*args, **kwargs))
+ def add_section(*args, **kwargs):
+ """
+ S.add_section(name) -> section
+ Add a new section.
+ """
+ return _param.ParamFile_add_section(*args, **kwargs)
+
+ def first_section(*args, **kwargs):
+ """
+ S.first_section() -> section
+ Find first section
+ """
+ return _param.ParamFile_first_section(*args, **kwargs)
+
+ def next_section(*args, **kwargs):
+ """
+ S.next_section(prev) -> section
+ Find next section
+ """
+ return _param.ParamFile_next_section(*args, **kwargs)
+
+ def read(*args, **kwargs):
+ """
+ S.read(filename) -> bool
+ Read a filename.
+ """
+ return _param.ParamFile_read(*args, **kwargs)
+
def __getitem__(self, name):
ret = self.get_section(name)
if ret is None:
@@ -137,7 +207,7 @@ ParamFile_swigregister(ParamFile)
class param_opt(object):
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
- def __init__(self): raise AttributeError, "No constructor defined"
+ def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined"
__repr__ = _swig_repr
key = _swig_property(_param.param_opt_key_get)
value = _swig_property(_param.param_opt_value_get)
diff --git a/source4/param/param_wrap.c b/source4/param/param_wrap.c
index e74f902645..aff239312d 100644
--- a/source4/param/param_wrap.c
+++ b/source4/param/param_wrap.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
+ * Version 1.3.35
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@@ -126,7 +126,7 @@
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
+#define SWIG_RUNTIME_VERSION "4"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
@@ -161,6 +161,7 @@
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
+#define SWIG_CAST_NEW_MEMORY 0x2
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
@@ -301,10 +302,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
extern "C" {
#endif
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
typedef struct swig_type_info {
const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */
@@ -431,8 +432,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}
/*
@@ -856,7 +857,7 @@ SWIG_Python_AddErrorMsg(const char* mesg)
Py_DECREF(old_str);
Py_DECREF(value);
} else {
- PyErr_Format(PyExc_RuntimeError, mesg);
+ PyErr_SetString(PyExc_RuntimeError, mesg);
}
}
@@ -1416,7 +1417,7 @@ PySwigObject_dealloc(PyObject *v)
{
PySwigObject *sobj = (PySwigObject *) v;
PyObject *next = sobj->next;
- if (sobj->own) {
+ if (sobj->own == SWIG_POINTER_OWN) {
swig_type_info *ty = sobj->ty;
PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
PyObject *destroy = data ? data->destroy : 0;
@@ -1434,12 +1435,13 @@ PySwigObject_dealloc(PyObject *v)
res = ((*meth)(mself, v));
}
Py_XDECREF(res);
- } else {
- const char *name = SWIG_TypePrettyName(ty);
+ }
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
- printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
-#endif
+ else {
+ const char *name = SWIG_TypePrettyName(ty);
+ printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
}
+#endif
}
Py_XDECREF(next);
PyObject_DEL(v);
@@ -1944,7 +1946,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
SWIGRUNTIME int
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
- if (own) {
+ if (own == SWIG_POINTER_OWN) {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
if (sobj) {
int oldown = sobj->own;
@@ -1965,6 +1967,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
return SWIG_OK;
} else {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+ if (own)
+ *own = 0;
while (sobj) {
void *vptr = sobj->ptr;
if (ty) {
@@ -1978,7 +1982,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
if (!tc) {
sobj = (PySwigObject *)sobj->next;
} else {
- if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
+ if (ptr) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+ if (newmemory == SWIG_CAST_NEW_MEMORY) {
+ assert(own);
+ if (own)
+ *own = *own | SWIG_CAST_NEW_MEMORY;
+ }
+ }
break;
}
}
@@ -1988,7 +2000,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
}
}
if (sobj) {
- if (own) *own = sobj->own;
+ if (own)
+ *own = *own | sobj->own;
if (flags & SWIG_POINTER_DISOWN) {
sobj->own = 0;
}
@@ -2053,8 +2066,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
}
if (ty) {
swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
- if (!tc) return SWIG_ERROR;
- *ptr = SWIG_TypeCast(tc,vptr);
+ if (tc) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ } else {
+ return SWIG_ERROR;
+ }
} else {
*ptr = vptr;
}
@@ -2504,7 +2522,7 @@ static swig_module_info swig_module = {swig_types, 15, 0, 0, 0, 0};
#define SWIG_name "_param"
-#define SWIGVERSION 0x010333
+#define SWIGVERSION 0x010335
#define SWIG_VERSION SWIGVERSION
@@ -2776,6 +2794,15 @@ struct loadparm_context *lp_from_py_object(PyObject *py_obj)
return lp_ctx;
}
+ if (py_obj == Py_None) {
+ lp_ctx = loadparm_init(NULL);
+ if (!lp_load_default(lp_ctx)) {
+ 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;
@@ -4073,7 +4100,7 @@ SWIGINTERN PyObject *_wrap_new_param_section(PyObject *SWIGUNUSEDPARM(self), PyO
param_section *result = 0 ;
if (!SWIG_Python_UnpackTuple(args,"new_param_section",0,0,0)) SWIG_fail;
- result = (param_section *)(param_section *) calloc(1, sizeof(param_section));
+ result = (param_section *)calloc(1, sizeof(param_section));
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_param_section, SWIG_POINTER_NEW | 0 );
return resultobj;
fail:
@@ -4141,15 +4168,33 @@ SWIGINTERN PyObject *Swig_var_default_config_get(void) {
static PyMethodDef SwigMethods[] = {
{ (char *)"new_LoadParm", (PyCFunction)_wrap_new_LoadParm, METH_NOARGS, NULL},
{ (char *)"LoadParm_default_service", (PyCFunction) _wrap_LoadParm_default_service, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"LoadParm_load", (PyCFunction) _wrap_LoadParm_load, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"LoadParm_load_default", (PyCFunction) _wrap_LoadParm_load_default, METH_VARARGS | METH_KEYWORDS, NULL},
+ { (char *)"LoadParm_load", (PyCFunction) _wrap_LoadParm_load, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+ "S.load(filename) -> None\n"
+ "Load specified file.\n"
+ ""},
+ { (char *)"LoadParm_load_default", (PyCFunction) _wrap_LoadParm_load_default, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+ "S.load_default() -> None\n"
+ "Load default smb.conf file.\n"
+ ""},
{ (char *)"LoadParm___len__", (PyCFunction) _wrap_LoadParm___len__, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"LoadParm___getitem__", (PyCFunction) _wrap_LoadParm___getitem__, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"LoadParm_configfile", (PyCFunction) _wrap_LoadParm_configfile, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"LoadParm_is_mydomain", (PyCFunction) _wrap_LoadParm_is_mydomain, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"LoadParm_is_myname", (PyCFunction) _wrap_LoadParm_is_myname, METH_VARARGS | METH_KEYWORDS, NULL},
+ { (char *)"LoadParm_configfile", (PyCFunction) _wrap_LoadParm_configfile, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+ "S.configfile() -> string\n"
+ "Return name of last config file that was loaded.\n"
+ ""},
+ { (char *)"LoadParm_is_mydomain", (PyCFunction) _wrap_LoadParm_is_mydomain, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+ "S.is_mydomain(domain_name) -> bool\n"
+ "Check whether the specified name matches our domain name.\n"
+ ""},
+ { (char *)"LoadParm_is_myname", (PyCFunction) _wrap_LoadParm_is_myname, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+ "S.is_myname(netbios_name) -> bool\n"
+ "Check whether the specified name matches one of our netbios names.\n"
+ ""},
{ (char *)"LoadParm_use", (PyCFunction) _wrap_LoadParm_use, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"LoadParm_set", (PyCFunction) _wrap_LoadParm_set, METH_VARARGS | METH_KEYWORDS, NULL},
+ { (char *)"LoadParm_set", (PyCFunction) _wrap_LoadParm_set, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+ "S.set(name, value) -> bool\n"
+ "Change a parameter.\n"
+ ""},
{ (char *)"LoadParm_get", (PyCFunction) _wrap_LoadParm_get, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"delete_LoadParm", (PyCFunction) _wrap_delete_LoadParm, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"LoadParm_swigregister", LoadParm_swigregister, METH_VARARGS, NULL},
@@ -4160,14 +4205,26 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"loadparm_service_swigregister", loadparm_service_swigregister, METH_VARARGS, NULL},
{ (char *)"new_ParamFile", (PyCFunction)_wrap_new_ParamFile, METH_NOARGS, NULL},
{ (char *)"ParamFile_get_section", (PyCFunction) _wrap_ParamFile_get_section, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"ParamFile_add_section", (PyCFunction) _wrap_ParamFile_add_section, METH_VARARGS | METH_KEYWORDS, NULL},
+ { (char *)"ParamFile_add_section", (PyCFunction) _wrap_ParamFile_add_section, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+ "S.add_section(name) -> section\n"
+ "Add a new section.\n"
+ ""},
{ (char *)"ParamFile_get", (PyCFunction) _wrap_ParamFile_get, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"ParamFile_get_string", (PyCFunction) _wrap_ParamFile_get_string, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"ParamFile_set_string", (PyCFunction) _wrap_ParamFile_set_string, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"ParamFile_set", (PyCFunction) _wrap_ParamFile_set, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"ParamFile_first_section", (PyCFunction)_wrap_ParamFile_first_section, METH_O, NULL},
- { (char *)"ParamFile_next_section", (PyCFunction) _wrap_ParamFile_next_section, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"ParamFile_read", (PyCFunction) _wrap_ParamFile_read, METH_VARARGS | METH_KEYWORDS, NULL},
+ { (char *)"ParamFile_first_section", (PyCFunction)_wrap_ParamFile_first_section, METH_O, (char *)"\n"
+ "S.first_section() -> section\n"
+ "Find first section\n"
+ ""},
+ { (char *)"ParamFile_next_section", (PyCFunction) _wrap_ParamFile_next_section, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+ "S.next_section(prev) -> section\n"
+ "Find next section\n"
+ ""},
+ { (char *)"ParamFile_read", (PyCFunction) _wrap_ParamFile_read, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+ "S.read(filename) -> bool\n"
+ "Read a filename.\n"
+ ""},
{ (char *)"ParamFile_write", (PyCFunction) _wrap_ParamFile_write, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"delete_ParamFile", (PyCFunction)_wrap_delete_ParamFile, METH_O, NULL},
{ (char *)"ParamFile_swigregister", ParamFile_swigregister, METH_VARARGS, NULL},
@@ -4325,7 +4382,7 @@ SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
size_t i;
swig_module_info *module_head, *iter;
- int found;
+ int found, init;
clientdata = clientdata;
@@ -4335,6 +4392,9 @@ SWIG_InitializeModule(void *clientdata) {
swig_module.type_initial = swig_type_initial;
swig_module.cast_initial = swig_cast_initial;
swig_module.next = &swig_module;
+ init = 1;
+ } else {
+ init = 0;
}
/* Try and load any already created modules */
@@ -4363,6 +4423,12 @@ SWIG_InitializeModule(void *clientdata) {
module_head->next = &swig_module;
}
+ /* When multiple interpeters are used, a module could have already been initialized in
+ a different interpreter, but not yet have a pointer in this interpreter.
+ In this case, we do not want to continue adding types... everything should be
+ set up already */
+ if (init == 0) return;
+
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: size %d\n", swig_module.size);
diff --git a/source4/param/share.c b/source4/param/share.c
index 51134d8970..47aea55751 100644
--- a/source4/param/share.c
+++ b/source4/param/share.c
@@ -21,7 +21,6 @@
#include "includes.h"
#include "param/share.h"
-#include "build.h"
#include "param/param.h"
const char *share_string_option(struct share_config *scfg, const char *opt_name, const char *defval)
@@ -127,6 +126,7 @@ NTSTATUS share_register(const struct share_ops *ops)
}
NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, const char *backend_name,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct share_context **ctx)
{
@@ -138,7 +138,7 @@ NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, const char *backend_name
return NT_STATUS_INTERNAL_ERROR;
}
- return ops->init(mem_ctx, ops, lp_ctx, ctx);
+ return ops->init(mem_ctx, ops, event_ctx, lp_ctx, ctx);
}
/*
diff --git a/source4/param/share.h b/source4/param/share.h
index 9f9cbdce5b..2a85fd4fbb 100644
--- a/source4/param/share.h
+++ b/source4/param/share.h
@@ -47,9 +47,12 @@ struct share_info {
void *value;
};
+struct event_context;
+
struct share_ops {
const char *name;
- NTSTATUS (*init)(TALLOC_CTX *, const struct share_ops*, struct loadparm_context *lp_ctx,
+ NTSTATUS (*init)(TALLOC_CTX *, const struct share_ops*, struct event_context *ev_ctx,
+ struct loadparm_context *lp_ctx,
struct share_context **);
const char *(*string_option)(struct share_config *, const char *, const char *);
int (*int_option)(struct share_config *, const char *, int);
diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c
index c3adc4473c..bac1aac2d7 100644
--- a/source4/param/share_classic.c
+++ b/source4/param/share_classic.c
@@ -25,6 +25,7 @@
static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx,
const struct share_ops *ops,
+ struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct share_context **ctx)
{
diff --git a/source4/param/share_ldb.c b/source4/param/share_ldb.c
index fb40f1e9bf..eba1665cc9 100644
--- a/source4/param/share_ldb.c
+++ b/source4/param/share_ldb.c
@@ -27,7 +27,9 @@
#include "param/share.h"
#include "param/param.h"
-static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, struct loadparm_context *lp_ctx,
+static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops,
+ struct event_context *ev_ctx,
+ struct loadparm_context *lp_ctx,
struct share_context **ctx)
{
struct ldb_context *sdb;
@@ -38,7 +40,7 @@ static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, stru
return NT_STATUS_NO_MEMORY;
}
- sdb = ldb_wrap_connect(*ctx, lp_ctx,
+ sdb = ldb_wrap_connect(*ctx, ev_ctx, lp_ctx,
private_path(*ctx, lp_ctx, "share.ldb"),
system_session(*ctx, lp_ctx),
NULL, 0, NULL);
diff --git a/source4/param/tests/bindings.py b/source4/param/tests/bindings.py
index 0dd186b9df..d1d71e4485 100644
--- a/source4/param/tests/bindings.py
+++ b/source4/param/tests/bindings.py
@@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-import param
+from samba import param
import unittest
class LoadParmTestCase(unittest.TestCase):
diff --git a/source4/param/tests/share.c b/source4/param/tests/share.c
index 6d03b4e049..c64b5c607a 100644
--- a/source4/param/tests/share.c
+++ b/source4/param/tests/share.c
@@ -182,12 +182,12 @@ static void tcase_add_share_tests(struct torture_tcase *tcase)
static bool setup_ldb(struct torture_context *tctx, void **data)
{
- return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "ldb", tctx->lp_ctx, (struct share_context **)data));
+ return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "ldb", tctx->ev, tctx->lp_ctx, (struct share_context **)data));
}
static bool setup_classic(struct torture_context *tctx, void **data)
{
- return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "classic", tctx->lp_ctx, (struct share_context **)data));
+ return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "classic", tctx->ev, tctx->lp_ctx, (struct share_context **)data));
}
static bool teardown(struct torture_context *tctx, void *data)