diff options
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r-- | source4/lib/ldb/common/ldb.c | 6 | ||||
-rw-r--r-- | source4/lib/ldb/common/ldb_modules.c | 32 | ||||
-rw-r--r-- | source4/lib/ldb/common/ldb_msg.c | 5 | ||||
-rw-r--r-- | source4/lib/ldb/config.mk | 2 | ||||
-rw-r--r-- | source4/lib/ldb/include/ldb.h | 2 | ||||
-rw-r--r-- | source4/lib/ldb/include/ldb_private.h | 3 | ||||
-rw-r--r-- | source4/lib/ldb/ldb.i | 93 | ||||
-rw-r--r-- | source4/lib/ldb/ldb.py | 161 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_ildap/config.mk | 4 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_wrap.c | 838 | ||||
-rwxr-xr-x | source4/lib/ldb/tests/python/api.py | 15 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ad2oLschema.c | 3 |
12 files changed, 593 insertions, 571 deletions
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index f687e152d3..87f791cb38 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -126,7 +126,11 @@ int ldb_connect_backend(struct ldb_context *ldb, const char *url, const char *op fn = ldb_find_backend(backend); if (fn == NULL) { - if (ldb_try_load_dso(ldb, backend) == 0) { + int (*init_fn) (void); + + init_fn = ldb_dso_load_symbol(ldb, backend, + "init_module"); + if (init_fn != NULL && init_fn() == 0) { fn = ldb_find_backend(backend); } } diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index 508389e374..72ed969298 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -168,7 +168,7 @@ static const struct ldb_module_ops *ldb_find_module_ops(const char *name) int ldb_global_init(void) { - static int (*static_init_fns[])(void) = STATIC_LIBLDB_MODULES; + int (*static_init_fns[])(void) = STATIC_LIBLDB_MODULES; static int initialized = 0; int ret = 0, i; @@ -203,14 +203,15 @@ int ldb_register_module(const struct ldb_module_ops *ops) return 0; } -int ldb_try_load_dso(struct ldb_context *ldb, const char *name) +void *ldb_dso_load_symbol(struct ldb_context *ldb, const char *name, + const char *symbol) { char *path; void *handle; - int (*init_fn) (void); + void *sym; if (ldb->modules_dir == NULL) - return -1; + return NULL; path = talloc_asprintf(ldb, "%s/%s.%s", ldb->modules_dir, name, SHLIBEXT); @@ -220,19 +221,19 @@ int ldb_try_load_dso(struct ldb_context *ldb, const char *name) handle = dlopen(path, RTLD_NOW); if (handle == NULL) { ldb_debug(ldb, LDB_DEBUG_WARNING, "unable to load %s from %s: %s\n", name, path, dlerror()); - return -1; + return NULL; } - init_fn = (int (*)(void))dlsym(handle, "init_module"); + sym = (int (*)(void))dlsym(handle, symbol); - if (init_fn == NULL) { - ldb_debug(ldb, LDB_DEBUG_ERROR, "no symbol `init_module' found in %s: %s\n", path, dlerror()); - return -1; + if (sym == NULL) { + ldb_debug(ldb, LDB_DEBUG_ERROR, "no symbol `%s' found in %s: %s\n", symbol, path, dlerror()); + return NULL; } talloc_free(path); - return init_fn(); + return sym; } int ldb_load_modules_list(struct ldb_context *ldb, const char **module_list, struct ldb_module *backend, struct ldb_module **out) @@ -248,10 +249,19 @@ int ldb_load_modules_list(struct ldb_context *ldb, const char **module_list, str ops = ldb_find_module_ops(module_list[i]); if (ops == NULL) { - if (ldb_try_load_dso(ldb, module_list[i]) == 0) { + int (*init_fn) (void); + + init_fn = ldb_dso_load_symbol(ldb, module_list[i], + "init_module"); + if (init_fn != NULL && init_fn() == 0) { ops = ldb_find_module_ops(module_list[i]); } } + + if (ops == NULL) { + ops = ldb_dso_load_symbol(ldb, module_list[i], + "ldb_module_ops"); + } if (ops == NULL) { ldb_debug(ldb, LDB_DEBUG_WARNING, "WARNING: Module [%s] not found\n", diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c index 528d1d54f1..c1ea9db56b 100644 --- a/source4/lib/ldb/common/ldb_msg.c +++ b/source4/lib/ldb/common/ldb_msg.c @@ -124,11 +124,6 @@ int ldb_msg_add_empty( struct ldb_message *msg, { struct ldb_message_element *els; - /* FIXME: we should probably leave this to the schema module to check */ - if (! ldb_valid_attr_name(attr_name)) { - return LDB_ERR_OPERATIONS_ERROR; - } - els = talloc_realloc(msg, msg->elements, struct ldb_message_element, msg->num_elements+1); if (!els) { diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index d37cd0d650..a3b10a22d5 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -128,6 +128,7 @@ PRIVATE_DEPENDENCIES = \ [LIBRARY::LIBLDB] VERSION = 0.0.1 SO_VERSION = 0 +OUTPUT_TYPE = SHARED_LIBRARY CFLAGS = -Ilib/ldb/include DESCRIPTION = LDAP-like embedded database library INIT_FUNCTION_TYPE = int (*) (void) @@ -148,7 +149,6 @@ OBJ_FILES = \ PUBLIC_DEPENDENCIES = \ LIBTALLOC PRIVATE_DEPENDENCIES = \ - DYNCONFIG \ SOCKET_WRAPPER MANPAGE = man/ldb.3 PUBLIC_HEADERS = include/ldb.h include/ldb_errors.h diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index 59f5f67fd2..e2ff8c6f98 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -1217,7 +1217,7 @@ char *ldb_casefold(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const char *s); /** Check the attribute name is valid according to rfc2251 - \param s tthe string to check + \param s the string to check \return 1 if the name is ok */ diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h index f88c55664d..d9f2defdc9 100644 --- a/source4/lib/ldb/include/ldb_private.h +++ b/source4/lib/ldb/include/ldb_private.h @@ -159,7 +159,8 @@ void ldb_reset_err_string(struct ldb_context *ldb); int ldb_register_module(const struct ldb_module_ops *); int ldb_register_backend(const char *url_prefix, ldb_connect_fn); -int ldb_try_load_dso(struct ldb_context *ldb, const char *name); +void *ldb_dso_load_symbol(struct ldb_context *ldb, const char *name, + const char *symbol); /* The following definitions come from lib/ldb/common/ldb_debug.c */ void ldb_debug(struct ldb_context *ldb, enum ldb_debug_level level, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4); diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i index aec4e2294f..15a49ec9c5 100644 --- a/source4/lib/ldb/ldb.i +++ b/source4/lib/ldb/ldb.i @@ -25,7 +25,7 @@ License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -%module(package="ldb") ldb +%module ldb %{ @@ -96,37 +96,6 @@ typedef int ldb_error; $result = PyString_FromStringAndSize((const char *)$1.data, $1.length); } -%typemap(in) ldb_msg *add_msg (int dict_pos, int msg_pos, PyObject *key, - PyObject *value, ldb_msg_element *msgel) { - if (PyDict_Check($input)) { - $1 = ldb_msg_new(NULL); - $1->num_elements = PyDict_Size($input) - 1; /* dn isn't in there */ - $1->elements = talloc_zero_array($1, struct ldb_message_element, $1->num_elements+1); - msg_pos = dict_pos = 0; - while (PyDict_Next($input, &dict_pos, &key, &value)) { - if (!strcmp(PyString_AsString(key), "dn")) { - if (ldb_dn_from_pyobject(value, &$1->dn) != 0) - SWIG_exception(SWIG_TypeError, "unable to convert dn"); - } else { - msgel = ldb_msg_element_from_pyobject(value, 0, PyString_AsString(key)); - memcpy(&$1->elements[msg_pos], msgel, sizeof(*msgel)); - msg_pos++; - } - dict_pos++; - } - - if ($1->dn == NULL) - SWIG_exception(SWIG_TypeError, "no dn set"); - } else { - if (SWIG_ConvertPtr($input, (void **)&$1, SWIGTYPE_p_ldb_message, 0) != 0) - return NULL; - } -} - -%typemap(freearg) ldb_msg *add_msg { -//talloc_free($1); -} - /* * Wrap struct ldb_result */ @@ -222,10 +191,16 @@ fail: } ldb_dn; #ifdef SWIGPYTHON -%inline { -int ldb_dn_from_pyobject(PyObject *object, ldb_dn **dn) +%{ +int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object, + struct ldb_context *ldb, ldb_dn **dn) { - return SWIG_ConvertPtr(object, (void **)dn, SWIGTYPE_p_ldb_dn, 0); + if (ldb != NULL && PyString_Check(object)) { + *dn = ldb_dn_new(mem_ctx, ldb, PyString_AsString(object)); + return 0; + } + return SWIG_ConvertPtr(object, (void **)dn, SWIGTYPE_p_ldb_dn, + SWIG_POINTER_EXCEPTION); } ldb_msg_element *ldb_msg_element_from_pyobject(PyObject *set_obj, int flags, @@ -274,7 +249,7 @@ PyObject *ldb_msg_element_to_set(ldb_msg_element *me) return result; } -} +%} #endif /* ldb_message_element */ @@ -450,7 +425,7 @@ PyObject *PyExc_LdbError; * Wrap ldb functions */ -%rename(Ldb) ldb; +%rename(Ldb) ldb_context; /* Top-level ldb operations */ typedef struct ldb_context { %typemap(out) ldb_error { @@ -493,6 +468,48 @@ fail: ldb_error delete(ldb_dn *dn); ldb_error rename(ldb_dn *olddn, ldb_dn *newdn); ldb_error add(ldb_msg *add_msg); + ldb_error add(PyObject *py_msg) + { + ldb_error ret; + int dict_pos, msg_pos; + PyObject *key, *value; + ldb_msg_element *msgel; + ldb_msg *msg = NULL; + if (PyDict_Check(py_msg)) { + msg = ldb_msg_new(NULL); + msg->num_elements = PyDict_Size(py_msg) - 1; /* dn isn't in there */ + msg->elements = talloc_zero_array(msg, struct ldb_message_element, msg->num_elements+1); + msg_pos = dict_pos = 0; + while (PyDict_Next(py_msg, &dict_pos, &key, &value)) { + if (!strcmp(PyString_AsString(key), "dn")) { + if (ldb_dn_from_pyobject(msg, value, $self, &msg->dn) != 0) { + return LDB_ERR_OTHER; + } + } else { + msgel = ldb_msg_element_from_pyobject(value, 0, PyString_AsString(key)); + memcpy(&msg->elements[msg_pos], msgel, sizeof(*msgel)); + msg_pos++; + } + dict_pos++; + } + + if (msg->dn == NULL) { + SWIG_exception(SWIG_TypeError, "no dn set"); + return LDB_ERR_OTHER; + } + } else { + if (SWIG_ConvertPtr(py_msg, (void **)&msg, SWIGTYPE_p_ldb_message, 0) != 0) + return LDB_ERR_OTHER; + } + + ret = ldb_add($self,msg); + + talloc_free(msg); + return ret; + + fail: + return LDB_ERR_OTHER; + } ldb_error modify(ldb_msg *message); ldb_dn *get_config_basedn(); ldb_dn *get_root_basedn(); @@ -535,7 +552,7 @@ fail: } ldb; %nodefault ldb_message; -%nodefault Ldb; +%nodefault ldb_context; %nodefault Dn; %rename(valid_attr_name) ldb_valid_attr_name; diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index b887b21aea..ce4a5ec494 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -2,7 +2,6 @@ # Version 1.3.33 # # Don't modify this file, modify the SWIG interface instead. -# This file is compatible with both classic and new-style classes. import _ldb import new @@ -48,6 +47,16 @@ except AttributeError: del types +def _swig_setattr_nondynamic_method(set): + def set_attr(self,name,value): + if (name == "thisown"): return self.this.own(value) + if hasattr(self,name) or (name == "this"): + set(self,name,value) + else: + raise AttributeError("You cannot add attributes to %s" % self) + return set_attr + + SCOPE_DEFAULT = _ldb.SCOPE_DEFAULT SCOPE_BASE = _ldb.SCOPE_BASE SCOPE_ONELEVEL = _ldb.SCOPE_ONELEVEL @@ -56,51 +65,38 @@ CHANGETYPE_NONE = _ldb.CHANGETYPE_NONE CHANGETYPE_ADD = _ldb.CHANGETYPE_ADD CHANGETYPE_DELETE = _ldb.CHANGETYPE_DELETE CHANGETYPE_MODIFY = _ldb.CHANGETYPE_MODIFY -class Dn(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, Dn, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, Dn, name) +class Dn(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): - this = _ldb.new_Dn(*args, **kwargs) - try: self.this.append(this) - except: self.this = this + _ldb.Dn_swiginit(self,_ldb.new_Dn(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Dn - __del__ = lambda self : None; - def validate(*args, **kwargs): return _ldb.Dn_validate(*args, **kwargs) - def get_casefold(*args, **kwargs): return _ldb.Dn_get_casefold(*args, **kwargs) - def __str__(*args, **kwargs): return _ldb.Dn___str__(*args, **kwargs) - def parent(*args, **kwargs): return _ldb.Dn_parent(*args, **kwargs) - def __cmp__(*args, **kwargs): return _ldb.Dn___cmp__(*args, **kwargs) - def is_valid(*args, **kwargs): return _ldb.Dn_is_valid(*args, **kwargs) - def is_special(*args, **kwargs): return _ldb.Dn_is_special(*args, **kwargs) - def is_null(*args, **kwargs): return _ldb.Dn_is_null(*args, **kwargs) - def check_special(*args, **kwargs): return _ldb.Dn_check_special(*args, **kwargs) - def __len__(*args, **kwargs): return _ldb.Dn___len__(*args, **kwargs) - def add_child(*args, **kwargs): return _ldb.Dn_add_child(*args, **kwargs) - def add_base(*args, **kwargs): return _ldb.Dn_add_base(*args, **kwargs) - def canonical_str(*args, **kwargs): return _ldb.Dn_canonical_str(*args, **kwargs) - def canonical_ex_str(*args, **kwargs): return _ldb.Dn_canonical_ex_str(*args, **kwargs) - def __add__(*args, **kwargs): return _ldb.Dn___add__(*args, **kwargs) +Dn.validate = new_instancemethod(_ldb.Dn_validate,None,Dn) +Dn.get_casefold = new_instancemethod(_ldb.Dn_get_casefold,None,Dn) +Dn.__str__ = new_instancemethod(_ldb.Dn___str__,None,Dn) +Dn.parent = new_instancemethod(_ldb.Dn_parent,None,Dn) +Dn.__cmp__ = new_instancemethod(_ldb.Dn___cmp__,None,Dn) +Dn.is_valid = new_instancemethod(_ldb.Dn_is_valid,None,Dn) +Dn.is_special = new_instancemethod(_ldb.Dn_is_special,None,Dn) +Dn.is_null = new_instancemethod(_ldb.Dn_is_null,None,Dn) +Dn.check_special = new_instancemethod(_ldb.Dn_check_special,None,Dn) +Dn.__len__ = new_instancemethod(_ldb.Dn___len__,None,Dn) +Dn.add_child = new_instancemethod(_ldb.Dn_add_child,None,Dn) +Dn.add_base = new_instancemethod(_ldb.Dn_add_base,None,Dn) +Dn.canonical_str = new_instancemethod(_ldb.Dn_canonical_str,None,Dn) +Dn.canonical_ex_str = new_instancemethod(_ldb.Dn_canonical_ex_str,None,Dn) +Dn.__add__ = new_instancemethod(_ldb.Dn___add__,None,Dn) Dn_swigregister = _ldb.Dn_swigregister Dn_swigregister(Dn) -ldb_dn_from_pyobject = _ldb.ldb_dn_from_pyobject -ldb_msg_element_from_pyobject = _ldb.ldb_msg_element_from_pyobject -ldb_msg_element_to_set = _ldb.ldb_msg_element_to_set -class ldb_msg_element(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, ldb_msg_element, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, ldb_msg_element, name) +class ldb_msg_element(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" __repr__ = _swig_repr - def __iter__(*args, **kwargs): return _ldb.ldb_msg_element___iter__(*args, **kwargs) - def __set__(*args, **kwargs): return _ldb.ldb_msg_element___set__(*args, **kwargs) __swig_destroy__ = _ldb.delete_ldb_msg_element - __del__ = lambda self : None; - def __cmp__(*args, **kwargs): return _ldb.ldb_msg_element___cmp__(*args, **kwargs) +ldb_msg_element.__iter__ = new_instancemethod(_ldb.ldb_msg_element___iter__,None,ldb_msg_element) +ldb_msg_element.__set__ = new_instancemethod(_ldb.ldb_msg_element___set__,None,ldb_msg_element) +ldb_msg_element.__cmp__ = new_instancemethod(_ldb.ldb_msg_element___cmp__,None,ldb_msg_element) ldb_msg_element_swigregister = _ldb.ldb_msg_element_swigregister ldb_msg_element_swigregister(ldb_msg_element) @@ -109,27 +105,19 @@ def MessageElement(*args, **kwargs): return val ldb_msg_list_elements = _ldb.ldb_msg_list_elements -class Message(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, Message, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, Message, name) +class Message(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr - __swig_setmethods__["dn"] = _ldb.Message_dn_set - __swig_getmethods__["dn"] = _ldb.Message_dn_get - if _newclass:dn = _swig_property(_ldb.Message_dn_get, _ldb.Message_dn_set) + dn = _swig_property(_ldb.Message_dn_get, _ldb.Message_dn_set) def __init__(self, *args, **kwargs): - this = _ldb.new_Message(*args, **kwargs) - try: self.this.append(this) - except: self.this = this + _ldb.Message_swiginit(self,_ldb.new_Message(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Message - __del__ = lambda self : None; - def __getitem__(*args, **kwargs): return _ldb.Message___getitem__(*args, **kwargs) - def __setitem__(*args): return _ldb.Message___setitem__(*args) - def __len__(*args, **kwargs): return _ldb.Message___len__(*args, **kwargs) - def keys(*args, **kwargs): return _ldb.Message_keys(*args, **kwargs) - def __iter__(*args, **kwargs): return _ldb.Message___iter__(*args, **kwargs) - def __delitem__(*args, **kwargs): return _ldb.Message___delitem__(*args, **kwargs) +Message.__getitem__ = new_instancemethod(_ldb.Message___getitem__,None,Message) +Message.__setitem__ = new_instancemethod(_ldb.Message___setitem__,None,Message) +Message.__len__ = new_instancemethod(_ldb.Message___len__,None,Message) +Message.keys = new_instancemethod(_ldb.Message_keys,None,Message) +Message.__iter__ = new_instancemethod(_ldb.Message___iter__,None,Message) +Message.__delitem__ = new_instancemethod(_ldb.Message___delitem__,None,Message) Message_swigregister = _ldb.Message_swigregister Message_swigregister(Message) @@ -174,42 +162,35 @@ LDB_ERR_ENTRY_ALREADY_EXISTS = _ldb.LDB_ERR_ENTRY_ALREADY_EXISTS LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED = _ldb.LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED LDB_ERR_AFFECTS_MULTIPLE_DSAS = _ldb.LDB_ERR_AFFECTS_MULTIPLE_DSAS LDB_ERR_OTHER = _ldb.LDB_ERR_OTHER -class ldb(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, ldb, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, ldb, name) - def __init__(self): raise AttributeError, "No constructor defined" +class Ldb(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr - def connect(*args, **kwargs): return _ldb.ldb_connect(*args, **kwargs) - __swig_destroy__ = _ldb.delete_ldb - __del__ = lambda self : None; - def search(*args, **kwargs): return _ldb.ldb_search(*args, **kwargs) - def delete(*args, **kwargs): return _ldb.ldb_delete(*args, **kwargs) - def rename(*args, **kwargs): return _ldb.ldb_rename(*args, **kwargs) - def add(*args, **kwargs): return _ldb.ldb_add(*args, **kwargs) - def modify(*args, **kwargs): return _ldb.ldb_modify(*args, **kwargs) - def get_config_basedn(*args, **kwargs): return _ldb.ldb_get_config_basedn(*args, **kwargs) - def get_root_basedn(*args, **kwargs): return _ldb.ldb_get_root_basedn(*args, **kwargs) - def get_schema_basedn(*args, **kwargs): return _ldb.ldb_get_schema_basedn(*args, **kwargs) - def get_default_basedn(*args, **kwargs): return _ldb.ldb_get_default_basedn(*args, **kwargs) - def errstring(*args, **kwargs): return _ldb.ldb_errstring(*args, **kwargs) - def set_create_perms(*args, **kwargs): return _ldb.ldb_set_create_perms(*args, **kwargs) - def set_modules_dir(*args, **kwargs): return _ldb.ldb_set_modules_dir(*args, **kwargs) - def set_debug(*args, **kwargs): return _ldb.ldb_set_debug(*args, **kwargs) - def set_opaque(*args, **kwargs): return _ldb.ldb_set_opaque(*args, **kwargs) - def get_opaque(*args, **kwargs): return _ldb.ldb_get_opaque(*args, **kwargs) - def transaction_start(*args, **kwargs): return _ldb.ldb_transaction_start(*args, **kwargs) - def transaction_commit(*args, **kwargs): return _ldb.ldb_transaction_commit(*args, **kwargs) - def transaction_cancel(*args, **kwargs): return _ldb.ldb_transaction_cancel(*args, **kwargs) - def __contains__(*args, **kwargs): return _ldb.ldb___contains__(*args, **kwargs) - def parse_ldif(*args, **kwargs): return _ldb.ldb_parse_ldif(*args, **kwargs) -ldb_swigregister = _ldb.ldb_swigregister -ldb_swigregister(ldb) - -def Ldb(*args, **kwargs): - val = _ldb.new_Ldb(*args, **kwargs) - return val + def __init__(self, *args, **kwargs): + _ldb.Ldb_swiginit(self,_ldb.new_Ldb(*args, **kwargs)) + __swig_destroy__ = _ldb.delete_Ldb +Ldb.connect = new_instancemethod(_ldb.Ldb_connect,None,Ldb) +Ldb.search = new_instancemethod(_ldb.Ldb_search,None,Ldb) +Ldb.delete = new_instancemethod(_ldb.Ldb_delete,None,Ldb) +Ldb.rename = new_instancemethod(_ldb.Ldb_rename,None,Ldb) +Ldb.add = new_instancemethod(_ldb.Ldb_add,None,Ldb) +Ldb.modify = new_instancemethod(_ldb.Ldb_modify,None,Ldb) +Ldb.get_config_basedn = new_instancemethod(_ldb.Ldb_get_config_basedn,None,Ldb) +Ldb.get_root_basedn = new_instancemethod(_ldb.Ldb_get_root_basedn,None,Ldb) +Ldb.get_schema_basedn = new_instancemethod(_ldb.Ldb_get_schema_basedn,None,Ldb) +Ldb.get_default_basedn = new_instancemethod(_ldb.Ldb_get_default_basedn,None,Ldb) +Ldb.errstring = new_instancemethod(_ldb.Ldb_errstring,None,Ldb) +Ldb.set_create_perms = new_instancemethod(_ldb.Ldb_set_create_perms,None,Ldb) +Ldb.set_modules_dir = new_instancemethod(_ldb.Ldb_set_modules_dir,None,Ldb) +Ldb.set_debug = new_instancemethod(_ldb.Ldb_set_debug,None,Ldb) +Ldb.set_opaque = new_instancemethod(_ldb.Ldb_set_opaque,None,Ldb) +Ldb.get_opaque = new_instancemethod(_ldb.Ldb_get_opaque,None,Ldb) +Ldb.transaction_start = new_instancemethod(_ldb.Ldb_transaction_start,None,Ldb) +Ldb.transaction_commit = new_instancemethod(_ldb.Ldb_transaction_commit,None,Ldb) +Ldb.transaction_cancel = new_instancemethod(_ldb.Ldb_transaction_cancel,None,Ldb) +Ldb.__contains__ = new_instancemethod(_ldb.Ldb___contains__,None,Ldb) +Ldb.parse_ldif = new_instancemethod(_ldb.Ldb_parse_ldif,None,Ldb) +Ldb_swigregister = _ldb.Ldb_swigregister +Ldb_swigregister(Ldb) valid_attr_name = _ldb.valid_attr_name timestring = _ldb.timestring diff --git a/source4/lib/ldb/ldb_ildap/config.mk b/source4/lib/ldb/ldb_ildap/config.mk index 83c43b6c35..01d9ec88ff 100644 --- a/source4/lib/ldb/ldb_ildap/config.mk +++ b/source4/lib/ldb/ldb_ildap/config.mk @@ -3,8 +3,8 @@ [MODULE::ldb_ildap] SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include -#OUTPUT_TYPE = SHARED_LIBRARY -PRIVATE_DEPENDENCIES = LIBTALLOC LIBCLI_LDAP +OUTPUT_TYPE = SHARED_LIBRARY +PRIVATE_DEPENDENCIES = LIBTALLOC LIBCLI_LDAP CREDENTIALS INIT_FUNCTION = ldb_ildap_init ALIASES = ldapi ldaps ldap OBJ_FILES = \ diff --git a/source4/lib/ldb/ldb_wrap.c b/source4/lib/ldb/ldb_wrap.c index b542fd6b8b..975e91dbe4 100644 --- a/source4/lib/ldb/ldb_wrap.c +++ b/source4/lib/ldb/ldb_wrap.c @@ -9,7 +9,7 @@ * ----------------------------------------------------------------------------- */ #define SWIGPYTHON -#define SWIG_PYTHON_DIRECTOR_NO_VTABLE +#define SWIG_PYTHON_NO_BUILD_NONE /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. @@ -2470,18 +2470,17 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) #define SWIGTYPE_p_ldb_result swig_types[8] #define SWIGTYPE_p_long_long swig_types[9] #define SWIGTYPE_p_p_char swig_types[10] -#define SWIGTYPE_p_p_ldb_dn swig_types[11] -#define SWIGTYPE_p_p_ldb_result swig_types[12] -#define SWIGTYPE_p_short swig_types[13] -#define SWIGTYPE_p_signed_char swig_types[14] -#define SWIGTYPE_p_unsigned_char swig_types[15] -#define SWIGTYPE_p_unsigned_int swig_types[16] -#define SWIGTYPE_p_unsigned_long swig_types[17] -#define SWIGTYPE_p_unsigned_long_long swig_types[18] -#define SWIGTYPE_p_unsigned_short swig_types[19] -#define SWIGTYPE_p_void swig_types[20] -static swig_type_info *swig_types[22]; -static swig_module_info swig_module = {swig_types, 21, 0, 0, 0, 0}; +#define SWIGTYPE_p_p_ldb_result swig_types[11] +#define SWIGTYPE_p_short swig_types[12] +#define SWIGTYPE_p_signed_char swig_types[13] +#define SWIGTYPE_p_unsigned_char swig_types[14] +#define SWIGTYPE_p_unsigned_int swig_types[15] +#define SWIGTYPE_p_unsigned_long swig_types[16] +#define SWIGTYPE_p_unsigned_long_long swig_types[17] +#define SWIGTYPE_p_unsigned_short swig_types[18] +#define SWIGTYPE_p_void swig_types[19] +static swig_type_info *swig_types[21]; +static swig_module_info swig_module = {swig_types, 20, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) @@ -2492,6 +2491,19 @@ static swig_module_info swig_module = {swig_types, 21, 0, 0, 0, 0}; # error "This python version requires swig to be run with the '-classic' option" # endif #endif +#if (PY_VERSION_HEX <= 0x02020000) +# error "This python version requires swig to be run with the '-nomodern' option" +#endif +#if (PY_VERSION_HEX <= 0x02020000) +# error "This python version requires swig to be run with the '-nomodernargs' option" +#endif +#ifndef METH_O +# error "This python version requires swig to be run with the '-nofastunpack' option" +#endif +#ifdef SWIG_TypeQuery +# undef SWIG_TypeQuery +#endif +#define SWIG_TypeQuery SWIG_Python_TypeQuery /*----------------------------------------------- @(target):= _ldb.so @@ -2658,9 +2670,15 @@ SWIGINTERN ldb_dn *ldb_dn___add__(ldb_dn *self,ldb_dn *other){ return ret; } -int ldb_dn_from_pyobject(PyObject *object, ldb_dn **dn) +int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object, + struct ldb_context *ldb, ldb_dn **dn) { - return SWIG_ConvertPtr(object, (void **)dn, SWIGTYPE_p_ldb_dn, 0); + if (ldb != NULL && PyString_Check(object)) { + *dn = ldb_dn_new(mem_ctx, ldb, PyString_AsString(object)); + return 0; + } + return SWIG_ConvertPtr(object, (void **)dn, SWIGTYPE_p_ldb_dn, + SWIG_POINTER_EXCEPTION); } ldb_msg_element *ldb_msg_element_from_pyobject(PyObject *set_obj, int flags, @@ -2710,6 +2728,12 @@ PyObject *ldb_msg_element_to_set(ldb_msg_element *me) } +SWIGINTERN PyObject *ldb_msg_element___iter__(ldb_msg_element *self){ + return PyObject_GetIter(ldb_msg_element_to_set(self)); + } +SWIGINTERN PyObject *ldb_msg_element___set__(ldb_msg_element *self){ + return ldb_msg_element_to_set(self); + } #include <limits.h> #if !defined(SWIG_NO_LLONG_MAX) @@ -2855,12 +2879,6 @@ SWIG_AsVal_int (PyObject * obj, int *val) return res; } -SWIGINTERN PyObject *ldb_msg_element___iter__(ldb_msg_element *self){ - return PyObject_GetIter(ldb_msg_element_to_set(self)); - } -SWIGINTERN PyObject *ldb_msg_element___set__(ldb_msg_element *self){ - return ldb_msg_element_to_set(self); - } SWIGINTERN ldb_msg_element *new_ldb_msg_element(PyObject *set_obj,int flags,char const *name){ return ldb_msg_element_from_pyobject(set_obj, flags, name); } @@ -3025,6 +3043,47 @@ fail: return NULL; } SWIGINTERN void delete_ldb(ldb *self){ talloc_free(self); } +SWIGINTERN ldb_error ldb_add__SWIG_1(ldb *self,PyObject *py_msg){ + ldb_error ret; + int dict_pos, msg_pos; + PyObject *key, *value; + ldb_msg_element *msgel; + ldb_msg *msg = NULL; + if (PyDict_Check(py_msg)) { + msg = ldb_msg_new(NULL); + msg->num_elements = PyDict_Size(py_msg) - 1; /* dn isn't in there */ + msg->elements = talloc_zero_array(msg, struct ldb_message_element, msg->num_elements+1); + msg_pos = dict_pos = 0; + while (PyDict_Next(py_msg, &dict_pos, &key, &value)) { + if (!strcmp(PyString_AsString(key), "dn")) { + if (ldb_dn_from_pyobject(msg, value, self, &msg->dn) != 0) { + return 80; + } + } else { + msgel = ldb_msg_element_from_pyobject(value, 0, PyString_AsString(key)); + memcpy(&msg->elements[msg_pos], msgel, sizeof(*msgel)); + msg_pos++; + } + dict_pos++; + } + + if (msg->dn == NULL) { + SWIG_exception(SWIG_TypeError, "no dn set"); + return 80; + } + } else { + if (SWIG_ConvertPtr(py_msg, (void **)&msg, SWIGTYPE_p_ldb_message, 0) != 0) + return 80; + } + + ret = ldb_add(self,msg); + + talloc_free(msg); + return ret; + + fail: + return 80; + } SWIGINTERN ldb_error ldb___contains__(ldb *self,ldb_dn *dn,struct ldb_result **result_as_bool){ return ldb_search(self, dn, LDB_SCOPE_BASE, NULL, NULL, result_as_bool); @@ -3062,7 +3121,7 @@ SWIGINTERN PyObject *_wrap_new_Dn(PyObject *SWIGUNUSEDPARM(self), PyObject *args PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; char * kwnames[] = { - (char *) "Ldb",(char *) "str", NULL + (char *) "ldb",(char *) "str", NULL }; if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:new_Dn",kwnames,&obj0,&obj1)) SWIG_fail; @@ -3096,10 +3155,11 @@ SWIGINTERN PyObject *_wrap_delete_Dn(PyObject *SWIGUNUSEDPARM(self), PyObject *a ldb_dn *arg1 = (ldb_dn *) 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:delete_Dn",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_dn, SWIG_POINTER_DISOWN | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_dn, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Dn" "', argument " "1"" of type '" "ldb_dn *""'"); } @@ -3119,10 +3179,11 @@ SWIGINTERN PyObject *_wrap_Dn_validate(PyObject *SWIGUNUSEDPARM(self), PyObject bool result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:Dn_validate",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Dn_validate" "', argument " "1"" of type '" "ldb_dn *""'"); } @@ -3141,10 +3202,11 @@ SWIGINTERN PyObject *_wrap_Dn_get_casefold(PyObject *SWIGUNUSEDPARM(self), PyObj char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:Dn_get_casefold",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Dn_get_casefold" "', argument " "1"" of type '" "ldb_dn *""'"); } @@ -3163,10 +3225,11 @@ SWIGINTERN PyObject *_wrap_Dn___str__(PyObject *SWIGUNUSEDPARM(self), PyObject * char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:Dn___str__",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Dn___str__" "', argument " "1"" of type '" "ldb_dn *""'"); } @@ -3185,10 +3248,11 @@ SWIGINTERN PyObject *_wrap_Dn_parent(PyObject *SWIGUNUSEDPARM(self), PyObject *a ldb_dn *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:Dn_parent",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Dn_parent" "', argument " "1"" of type '" "ldb_dn *""'"); } @@ -3241,10 +3305,11 @@ SWIGINTERN PyObject *_wrap_Dn_is_valid(PyObject *SWIGUNUSEDPARM(self), PyObject bool result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:Dn_is_valid",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Dn_is_valid" "', argument " "1"" of type '" "ldb_dn *""'"); } @@ -3263,10 +3328,11 @@ SWIGINTERN PyObject *_wrap_Dn_is_special(PyObject *SWIGUNUSEDPARM(self), PyObjec bool result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:Dn_is_special",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Dn_is_special" "', argument " "1"" of type '" "ldb_dn *""'"); } @@ -3285,10 +3351,11 @@ SWIGINTERN PyObject *_wrap_Dn_is_null(PyObject *SWIGUNUSEDPARM(self), PyObject * bool result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:Dn_is_null",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Dn_is_null" "', argument " "1"" of type '" "ldb_dn *""'"); } @@ -3344,10 +3411,11 @@ SWIGINTERN PyObject *_wrap_Dn___len__(PyObject *SWIGUNUSEDPARM(self), PyObject * int result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:Dn___len__",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Dn___len__" "', argument " "1"" of type '" "ldb_dn *""'"); } @@ -3434,10 +3502,11 @@ SWIGINTERN PyObject *_wrap_Dn_canonical_str(PyObject *SWIGUNUSEDPARM(self), PyOb char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:Dn_canonical_str",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Dn_canonical_str" "', argument " "1"" of type '" "ldb_dn *""'"); } @@ -3456,10 +3525,11 @@ SWIGINTERN PyObject *_wrap_Dn_canonical_ex_str(PyObject *SWIGUNUSEDPARM(self), P char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:Dn_canonical_ex_str",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_dn, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Dn_canonical_ex_str" "', argument " "1"" of type '" "ldb_dn *""'"); } @@ -3508,114 +3578,26 @@ fail: SWIGINTERN PyObject *Dn_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_ldb_dn, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } -SWIGINTERN PyObject *_wrap_ldb_dn_from_pyobject(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - PyObject *arg1 = (PyObject *) 0 ; - ldb_dn **arg2 = (ldb_dn **) 0 ; - int result; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "object",(char *) "dn", NULL - }; - - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ldb_dn_from_pyobject",kwnames,&obj0,&obj1)) SWIG_fail; - arg1 = obj0; - res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_p_ldb_dn, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ldb_dn_from_pyobject" "', argument " "2"" of type '" "ldb_dn **""'"); - } - arg2 = (ldb_dn **)(argp2); - result = (int)ldb_dn_from_pyobject(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ldb_msg_element_from_pyobject(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - PyObject *arg1 = (PyObject *) 0 ; - int arg2 ; - char *arg3 = (char *) 0 ; - ldb_msg_element *result = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - char * kwnames[] = { - (char *) "set_obj",(char *) "flags",(char *) "attr_name", NULL - }; - - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:ldb_msg_element_from_pyobject",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; - arg1 = obj0; - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ldb_msg_element_from_pyobject" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ldb_msg_element_from_pyobject" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - result = (ldb_msg_element *)ldb_msg_element_from_pyobject(arg1,arg2,(char const *)arg3); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ldb_message_element, 0 | 0 ); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ldb_msg_element_to_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { - PyObject *resultobj = 0; - ldb_msg_element *arg1 = (ldb_msg_element *) 0 ; - PyObject *result = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject * obj0 = 0 ; - char * kwnames[] = { - (char *) "me", NULL - }; - - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:ldb_msg_element_to_set",kwnames,&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_message_element, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_msg_element_to_set" "', argument " "1"" of type '" "ldb_msg_element *""'"); - } - arg1 = (ldb_msg_element *)(argp1); - result = (PyObject *)ldb_msg_element_to_set(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; +SWIGINTERN PyObject *Dn_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); } - SWIGINTERN PyObject *_wrap_ldb_msg_element___iter__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; ldb_msg_element *arg1 = (ldb_msg_element *) 0 ; PyObject *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:ldb_msg_element___iter__",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_message_element, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_message_element, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_msg_element___iter__" "', argument " "1"" of type '" "ldb_msg_element *""'"); } @@ -3634,10 +3616,11 @@ SWIGINTERN PyObject *_wrap_ldb_msg_element___set__(PyObject *SWIGUNUSEDPARM(self PyObject *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:ldb_msg_element___set__",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_message_element, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_message_element, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_msg_element___set__" "', argument " "1"" of type '" "ldb_msg_element *""'"); } @@ -3699,10 +3682,11 @@ SWIGINTERN PyObject *_wrap_delete_ldb_msg_element(PyObject *SWIGUNUSEDPARM(self) ldb_msg_element *arg1 = (ldb_msg_element *) 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:delete_ldb_msg_element",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_message_element, SWIG_POINTER_DISOWN | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_message_element, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ldb_msg_element" "', argument " "1"" of type '" "ldb_msg_element *""'"); } @@ -3752,7 +3736,7 @@ fail: SWIGINTERN PyObject *ldb_msg_element_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_ldb_message_element, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } @@ -3795,16 +3779,15 @@ SWIGINTERN PyObject *_wrap_Message_dn_set(PyObject *SWIGUNUSEDPARM(self), PyObje int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:Message_dn_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_message, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"Message_dn_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_message, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_dn_set" "', argument " "1"" of type '" "ldb_msg *""'"); } arg1 = (ldb_msg *)(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_dn, SWIG_POINTER_DISOWN | 0 ); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_ldb_dn, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Message_dn_set" "', argument " "2"" of type '" "ldb_dn *""'"); } @@ -3829,10 +3812,11 @@ SWIGINTERN PyObject *_wrap_Message_dn_get(PyObject *SWIGUNUSEDPARM(self), PyObje ldb_dn *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:Message_dn_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_message, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_message, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_dn_get" "', argument " "1"" of type '" "ldb_msg *""'"); } @@ -3882,10 +3866,11 @@ SWIGINTERN PyObject *_wrap_delete_Message(PyObject *SWIGUNUSEDPARM(self), PyObje ldb_msg *arg1 = (ldb_msg *) 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:delete_Message",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_message, SWIG_POINTER_DISOWN | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_message, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Message" "', argument " "1"" of type '" "ldb_msg *""'"); } @@ -3951,7 +3936,7 @@ fail: } -SWIGINTERN PyObject *_wrap_Message___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Message___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; ldb_msg *arg1 = (ldb_msg *) 0 ; char *arg2 = (char *) 0 ; @@ -3963,22 +3948,19 @@ SWIGINTERN PyObject *_wrap_Message___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM( int alloc2 = 0 ; void *argp3 = 0 ; int res3 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOO:Message___setitem__",&obj0,&obj1,&obj2)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_message, 0 | 0 ); + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_message, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message___setitem__" "', argument " "1"" of type '" "ldb_msg *""'"); } arg1 = (ldb_msg *)(argp1); - res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Message___setitem__" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); - res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_ldb_message_element, 0 | 0 ); + res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_ldb_message_element, 0 | 0 ); if (!SWIG_IsOK(res3)) { SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Message___setitem__" "', argument " "3"" of type '" "ldb_msg_element *""'"); } @@ -3998,7 +3980,7 @@ fail: } -SWIGINTERN PyObject *_wrap_Message___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Message___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; ldb_msg *arg1 = (ldb_msg *) 0 ; char *arg2 = (char *) 0 ; @@ -4008,22 +3990,19 @@ SWIGINTERN PyObject *_wrap_Message___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM( int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - PyObject * obj2 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOO:Message___setitem__",&obj0,&obj1,&obj2)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_message, 0 | 0 ); + if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_message, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message___setitem__" "', argument " "1"" of type '" "ldb_msg *""'"); } arg1 = (ldb_msg *)(argp1); - res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Message___setitem__" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); - arg3 = obj2; + arg3 = swig_obj[2]; { if (arg1 == NULL) SWIG_exception(SWIG_ValueError, @@ -4042,46 +4021,23 @@ fail: SWIGINTERN PyObject *_wrap_Message___setitem__(PyObject *self, PyObject *args) { int argc; PyObject *argv[4]; - int ii; - if (!PyTuple_Check(args)) SWIG_fail; - argc = (int)PyObject_Length(args); - for (ii = 0; (ii < argc) && (ii < 3); ii++) { - argv[ii] = PyTuple_GET_ITEM(args,ii); - } + if (!(argc = SWIG_Python_UnpackTuple(args,"Message___setitem__",0,3,argv))) SWIG_fail; + --argc; if (argc == 3) { - int _v; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_ldb_message, 0); - _v = SWIG_CheckState(res); - if (_v) { - int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); + int _v = 0; + { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_ldb_message_element, 0); _v = SWIG_CheckState(res); - if (_v) { - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_ldb_message_element, 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_Message___setitem____SWIG_0(self, args); - } - } } + if (!_v) goto check_1; + return _wrap_Message___setitem____SWIG_0(self, argc, argv); } +check_1: + if (argc == 3) { - int _v; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_ldb_message, 0); - _v = SWIG_CheckState(res); - if (_v) { - int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0); - _v = SWIG_CheckState(res); - if (_v) { - _v = (argv[2] != 0); - if (_v) { - return _wrap_Message___setitem____SWIG_1(self, args); - } - } - } + return _wrap_Message___setitem____SWIG_1(self, argc, argv); } fail: @@ -4096,10 +4052,11 @@ SWIGINTERN PyObject *_wrap_Message___len__(PyObject *SWIGUNUSEDPARM(self), PyObj unsigned int result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:Message___len__",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_message, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_message, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message___len__" "', argument " "1"" of type '" "ldb_msg *""'"); } @@ -4123,10 +4080,11 @@ SWIGINTERN PyObject *_wrap_Message_keys(PyObject *SWIGUNUSEDPARM(self), PyObject PyObject *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:Message_keys",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_message, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_message, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_keys" "', argument " "1"" of type '" "ldb_msg *""'"); } @@ -4150,10 +4108,11 @@ SWIGINTERN PyObject *_wrap_Message___iter__(PyObject *SWIGUNUSEDPARM(self), PyOb PyObject *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:Message___iter__",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_message, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_message, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message___iter__" "', argument " "1"" of type '" "ldb_msg *""'"); } @@ -4214,11 +4173,15 @@ fail: SWIGINTERN PyObject *Message_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_ldb_message, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *Message_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + SWIGINTERN PyObject *_wrap_ldb_ldif_to_pyobject(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb_ldif *arg1 = (ldb_ldif *) 0 ; @@ -4287,7 +4250,7 @@ SWIGINTERN PyObject *_wrap_new_Ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *arg arg3 = (char **)(argp3); } result = (ldb *)new_ldb((char const *)arg1,arg2,(char const *(*))arg3); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ldb_context, SWIG_POINTER_OWN | 0 ); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ldb_context, SWIG_POINTER_NEW | 0 ); if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return resultobj; fail: @@ -4296,7 +4259,7 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_connect(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Ldb_connect(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; char *arg2 = (char *) 0 ; @@ -4320,28 +4283,28 @@ SWIGINTERN PyObject *_wrap_ldb_connect(PyObject *SWIGUNUSEDPARM(self), PyObject (char *) "self",(char *) "url",(char *) "flags",(char *) "options", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|OO:ldb_connect",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|OO:Ldb_connect",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_connect" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_connect" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ldb_connect" "', argument " "2"" of type '" "char const *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_connect" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); if (obj2) { ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ldb_connect" "', argument " "3"" of type '" "unsigned int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Ldb_connect" "', argument " "3"" of type '" "unsigned int""'"); } arg3 = (unsigned int)(val3); } if (obj3) { res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_p_char, 0 | 0 ); if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ldb_connect" "', argument " "4"" of type '" "char const *[]""'"); + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Ldb_connect" "', argument " "4"" of type '" "char const *[]""'"); } arg4 = (char **)(argp4); } @@ -4366,17 +4329,18 @@ fail: } -SWIGINTERN PyObject *_wrap_delete_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_delete_Ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:delete_ldb",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, SWIG_POINTER_DISOWN | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_context, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ldb" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Ldb" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); { @@ -4393,7 +4357,7 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_search(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Ldb_search(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; ldb_dn *arg2 = (ldb_dn *) NULL ; @@ -4425,30 +4389,30 @@ SWIGINTERN PyObject *_wrap_ldb_search(PyObject *SWIGUNUSEDPARM(self), PyObject * { arg6 = &temp_ldb_result6; } - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:ldb_search",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:Ldb_search",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_search" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_search" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); if (obj1) { res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_dn, 0 | 0 ); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ldb_search" "', argument " "2"" of type '" "ldb_dn *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_search" "', argument " "2"" of type '" "ldb_dn *""'"); } arg2 = (ldb_dn *)(argp2); } if (obj2) { ecode3 = SWIG_AsVal_int(obj2, &val3); if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ldb_search" "', argument " "3"" of type '" "enum ldb_scope""'"); + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Ldb_search" "', argument " "3"" of type '" "enum ldb_scope""'"); } arg3 = (enum ldb_scope)(val3); } if (obj3) { res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4); if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ldb_search" "', argument " "4"" of type '" "char const *""'"); + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Ldb_search" "', argument " "4"" of type '" "char const *""'"); } arg4 = (char *)(buf4); } @@ -4502,7 +4466,7 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Ldb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; ldb_dn *arg2 = (ldb_dn *) 0 ; @@ -4517,15 +4481,15 @@ SWIGINTERN PyObject *_wrap_ldb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject * (char *) "self",(char *) "dn", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ldb_delete",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Ldb_delete",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_delete" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_delete" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_dn, 0 | 0 ); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ldb_delete" "', argument " "2"" of type '" "ldb_dn *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_delete" "', argument " "2"" of type '" "ldb_dn *""'"); } arg2 = (ldb_dn *)(argp2); { @@ -4547,7 +4511,7 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_rename(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Ldb_rename(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; ldb_dn *arg2 = (ldb_dn *) 0 ; @@ -4566,20 +4530,20 @@ SWIGINTERN PyObject *_wrap_ldb_rename(PyObject *SWIGUNUSEDPARM(self), PyObject * (char *) "self",(char *) "olddn",(char *) "newdn", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:ldb_rename",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Ldb_rename",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_rename" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_rename" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_dn, 0 | 0 ); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ldb_rename" "', argument " "2"" of type '" "ldb_dn *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_rename" "', argument " "2"" of type '" "ldb_dn *""'"); } arg2 = (ldb_dn *)(argp2); res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_ldb_dn, 0 | 0 ); if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ldb_rename" "', argument " "3"" of type '" "ldb_dn *""'"); + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Ldb_rename" "', argument " "3"" of type '" "ldb_dn *""'"); } arg3 = (ldb_dn *)(argp3); { @@ -4601,55 +4565,27 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_add(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Ldb_add__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; ldb_msg *arg2 = (ldb_msg *) 0 ; ldb_error result; void *argp1 = 0 ; int res1 = 0 ; - int dict_pos2 ; - int msg_pos2 ; - PyObject *key2 ; - PyObject *value2 ; - ldb_msg_element *msgel2 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - char * kwnames[] = { - (char *) "self",(char *) "add_msg", NULL - }; + void *argp2 = 0 ; + int res2 = 0 ; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ldb_add",kwnames,&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_add" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_add" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); - { - if (PyDict_Check(obj1)) { - arg2 = ldb_msg_new(NULL); - arg2->num_elements = PyDict_Size(obj1) - 1; /* dn isn't in there */ - arg2->elements = talloc_zero_array(arg2, struct ldb_message_element, arg2->num_elements+1); - msg_pos2 = dict_pos2 = 0; - while (PyDict_Next(obj1, &dict_pos2, &key2, &value2)) { - if (!strcmp(PyString_AsString(key2), "dn")) { - if (ldb_dn_from_pyobject(value2, &arg2->dn) != 0) - SWIG_exception(SWIG_TypeError, "unable to convert dn"); - } else { - msgel2 = ldb_msg_element_from_pyobject(value2, 0, PyString_AsString(key2)); - memcpy(&arg2->elements[msg_pos2], msgel2, sizeof(*msgel2)); - msg_pos2++; - } - dict_pos2++; - } - - if (arg2->dn == NULL) - SWIG_exception(SWIG_TypeError, "no dn set"); - } else { - if (SWIG_ConvertPtr(obj1, (void **)&arg2, SWIGTYPE_p_ldb_message, 0) != 0) - return NULL; - } + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_ldb_message, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_add" "', argument " "2"" of type '" "ldb_msg *""'"); } + arg2 = (ldb_msg *)(argp2); { if (arg1 == NULL) SWIG_exception(SWIG_ValueError, @@ -4668,19 +4604,75 @@ SWIGINTERN PyObject *_wrap_ldb_add(PyObject *SWIGUNUSEDPARM(self), PyObject *arg } resultobj = Py_None; } + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Ldb_add__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) { + PyObject *resultobj = 0; + ldb *arg1 = (ldb *) 0 ; + PyObject *arg2 = (PyObject *) 0 ; + ldb_error result; + void *argp1 = 0 ; + int res1 = 0 ; + + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_add" "', argument " "1"" of type '" "ldb *""'"); + } + arg1 = (ldb *)(argp1); + arg2 = swig_obj[1]; + { + if (arg1 == NULL) + SWIG_exception(SWIG_ValueError, + "ldb context must be non-NULL"); + } + result = ldb_add__SWIG_1(arg1,arg2); { - //talloc_free(arg2); + if (result != 0) { + PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result))); + SWIG_fail; + } + resultobj = Py_None; } return resultobj; fail: - { - //talloc_free(arg2); + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Ldb_add(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[3]; + + if (!(argc = SWIG_Python_UnpackTuple(args,"Ldb_add",0,2,argv))) SWIG_fail; + --argc; + if (argc == 2) { + int _v = 0; + { + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_ldb_message, 0); + _v = SWIG_CheckState(res); + } + if (!_v) goto check_1; + return _wrap_Ldb_add__SWIG_0(self, argc, argv); + } +check_1: + + if (argc == 2) { + return _wrap_Ldb_add__SWIG_1(self, argc, argv); } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Ldb_add'.\n Possible C/C++ prototypes are:\n"" add(ldb *,ldb_msg *)\n"" add(ldb *,PyObject *)\n"); return NULL; } -SWIGINTERN PyObject *_wrap_ldb_modify(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Ldb_modify(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; ldb_msg *arg2 = (ldb_msg *) 0 ; @@ -4695,15 +4687,15 @@ SWIGINTERN PyObject *_wrap_ldb_modify(PyObject *SWIGUNUSEDPARM(self), PyObject * (char *) "self",(char *) "message", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ldb_modify",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Ldb_modify",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_modify" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_modify" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_message, 0 | 0 ); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ldb_modify" "', argument " "2"" of type '" "ldb_msg *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_modify" "', argument " "2"" of type '" "ldb_msg *""'"); } arg2 = (ldb_msg *)(argp2); { @@ -4730,18 +4722,19 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_get_config_basedn(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Ldb_get_config_basedn(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; ldb_dn *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:ldb_get_config_basedn",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_get_config_basedn" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_get_config_basedn" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); { @@ -4757,18 +4750,19 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_get_root_basedn(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Ldb_get_root_basedn(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; ldb_dn *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:ldb_get_root_basedn",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_get_root_basedn" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_get_root_basedn" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); { @@ -4784,18 +4778,19 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_get_schema_basedn(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Ldb_get_schema_basedn(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; ldb_dn *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:ldb_get_schema_basedn",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_get_schema_basedn" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_get_schema_basedn" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); { @@ -4811,18 +4806,19 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_get_default_basedn(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Ldb_get_default_basedn(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; ldb_dn *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:ldb_get_default_basedn",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_get_default_basedn" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_get_default_basedn" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); { @@ -4838,18 +4834,19 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_errstring(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Ldb_errstring(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:ldb_errstring",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_errstring" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_errstring" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); { @@ -4865,7 +4862,7 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_set_create_perms(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Ldb_set_create_perms(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; unsigned int arg2 ; @@ -4879,15 +4876,15 @@ SWIGINTERN PyObject *_wrap_ldb_set_create_perms(PyObject *SWIGUNUSEDPARM(self), (char *) "self",(char *) "perms", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ldb_set_create_perms",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Ldb_set_create_perms",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_set_create_perms" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_set_create_perms" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2); if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ldb_set_create_perms" "', argument " "2"" of type '" "unsigned int""'"); + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Ldb_set_create_perms" "', argument " "2"" of type '" "unsigned int""'"); } arg2 = (unsigned int)(val2); { @@ -4903,7 +4900,7 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_set_modules_dir(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Ldb_set_modules_dir(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; char *arg2 = (char *) 0 ; @@ -4918,15 +4915,15 @@ SWIGINTERN PyObject *_wrap_ldb_set_modules_dir(PyObject *SWIGUNUSEDPARM(self), P (char *) "self",(char *) "path", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ldb_set_modules_dir",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Ldb_set_modules_dir",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_set_modules_dir" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_set_modules_dir" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ldb_set_modules_dir" "', argument " "2"" of type '" "char const *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_set_modules_dir" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); { @@ -4944,7 +4941,7 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_set_debug(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Ldb_set_debug(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; void (*arg2)(void *,enum ldb_debug_level,char const *,va_list) = (void (*)(void *,enum ldb_debug_level,char const *,va_list)) 0 ; @@ -4958,10 +4955,10 @@ SWIGINTERN PyObject *_wrap_ldb_set_debug(PyObject *SWIGUNUSEDPARM(self), PyObjec (char *) "self",(char *) "debug", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ldb_set_debug",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Ldb_set_debug",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_set_debug" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_set_debug" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); { @@ -4990,7 +4987,7 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_set_opaque(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Ldb_set_opaque(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; char *arg2 = (char *) 0 ; @@ -5009,20 +5006,20 @@ SWIGINTERN PyObject *_wrap_ldb_set_opaque(PyObject *SWIGUNUSEDPARM(self), PyObje (char *) "self",(char *) "name",(char *) "value", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:ldb_set_opaque",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Ldb_set_opaque",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_set_opaque" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_set_opaque" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ldb_set_opaque" "', argument " "2"" of type '" "char const *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_set_opaque" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0); if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ldb_set_opaque" "', argument " "3"" of type '" "void *""'"); + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Ldb_set_opaque" "', argument " "3"" of type '" "void *""'"); } { if (arg1 == NULL) @@ -5045,7 +5042,7 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_get_opaque(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Ldb_get_opaque(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; char *arg2 = (char *) 0 ; @@ -5061,15 +5058,15 @@ SWIGINTERN PyObject *_wrap_ldb_get_opaque(PyObject *SWIGUNUSEDPARM(self), PyObje (char *) "self",(char *) "name", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ldb_get_opaque",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Ldb_get_opaque",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_get_opaque" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_get_opaque" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ldb_get_opaque" "', argument " "2"" of type '" "char const *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_get_opaque" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); { @@ -5087,18 +5084,19 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_transaction_start(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Ldb_transaction_start(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; ldb_error result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:ldb_transaction_start",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_transaction_start" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_transaction_start" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); { @@ -5120,18 +5118,19 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_transaction_commit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Ldb_transaction_commit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; ldb_error result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:ldb_transaction_commit",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_transaction_commit" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_transaction_commit" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); { @@ -5153,18 +5152,19 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_transaction_cancel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *_wrap_Ldb_transaction_cancel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; ldb_error result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:ldb_transaction_cancel",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_transaction_cancel" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_transaction_cancel" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); { @@ -5186,7 +5186,7 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Ldb___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; ldb_dn *arg2 = (ldb_dn *) 0 ; @@ -5206,15 +5206,15 @@ SWIGINTERN PyObject *_wrap_ldb___contains__(PyObject *SWIGUNUSEDPARM(self), PyOb { arg3 = &tmp3; } - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ldb___contains__",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Ldb___contains__",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb___contains__" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb___contains__" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_dn, 0 | 0 ); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ldb___contains__" "', argument " "2"" of type '" "ldb_dn *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb___contains__" "', argument " "2"" of type '" "ldb_dn *""'"); } arg2 = (ldb_dn *)(argp2); { @@ -5245,7 +5245,7 @@ fail: } -SWIGINTERN PyObject *_wrap_ldb_parse_ldif(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_Ldb_parse_ldif(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; char *arg2 = (char *) 0 ; @@ -5261,15 +5261,15 @@ SWIGINTERN PyObject *_wrap_ldb_parse_ldif(PyObject *SWIGUNUSEDPARM(self), PyObje (char *) "self",(char *) "s", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ldb_parse_ldif",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Ldb_parse_ldif",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_parse_ldif" "', argument " "1"" of type '" "ldb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_parse_ldif" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ldb_parse_ldif" "', argument " "2"" of type '" "char const *""'"); + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_parse_ldif" "', argument " "2"" of type '" "char const *""'"); } arg2 = (char *)(buf2); { @@ -5287,13 +5287,17 @@ fail: } -SWIGINTERN PyObject *ldb_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { +SWIGINTERN PyObject *Ldb_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_ldb_context, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *Ldb_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + SWIGINTERN PyObject *_wrap_valid_attr_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; char *arg1 = (char *) 0 ; @@ -5377,69 +5381,69 @@ fail: static PyMethodDef SwigMethods[] = { { (char *)"new_Dn", (PyCFunction) _wrap_new_Dn, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"delete_Dn", _wrap_delete_Dn, METH_VARARGS, NULL}, - { (char *)"Dn_validate", _wrap_Dn_validate, METH_VARARGS, NULL}, - { (char *)"Dn_get_casefold", _wrap_Dn_get_casefold, METH_VARARGS, NULL}, - { (char *)"Dn___str__", _wrap_Dn___str__, METH_VARARGS, NULL}, - { (char *)"Dn_parent", _wrap_Dn_parent, METH_VARARGS, NULL}, + { (char *)"delete_Dn", (PyCFunction)_wrap_delete_Dn, METH_O, NULL}, + { (char *)"Dn_validate", (PyCFunction)_wrap_Dn_validate, METH_O, NULL}, + { (char *)"Dn_get_casefold", (PyCFunction)_wrap_Dn_get_casefold, METH_O, NULL}, + { (char *)"Dn___str__", (PyCFunction)_wrap_Dn___str__, METH_O, NULL}, + { (char *)"Dn_parent", (PyCFunction)_wrap_Dn_parent, METH_O, NULL}, { (char *)"Dn___cmp__", (PyCFunction) _wrap_Dn___cmp__, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"Dn_is_valid", _wrap_Dn_is_valid, METH_VARARGS, NULL}, - { (char *)"Dn_is_special", _wrap_Dn_is_special, METH_VARARGS, NULL}, - { (char *)"Dn_is_null", _wrap_Dn_is_null, METH_VARARGS, NULL}, + { (char *)"Dn_is_valid", (PyCFunction)_wrap_Dn_is_valid, METH_O, NULL}, + { (char *)"Dn_is_special", (PyCFunction)_wrap_Dn_is_special, METH_O, NULL}, + { (char *)"Dn_is_null", (PyCFunction)_wrap_Dn_is_null, METH_O, NULL}, { (char *)"Dn_check_special", (PyCFunction) _wrap_Dn_check_special, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"Dn___len__", _wrap_Dn___len__, METH_VARARGS, NULL}, + { (char *)"Dn___len__", (PyCFunction)_wrap_Dn___len__, METH_O, NULL}, { (char *)"Dn_add_child", (PyCFunction) _wrap_Dn_add_child, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Dn_add_base", (PyCFunction) _wrap_Dn_add_base, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"Dn_canonical_str", _wrap_Dn_canonical_str, METH_VARARGS, NULL}, - { (char *)"Dn_canonical_ex_str", _wrap_Dn_canonical_ex_str, METH_VARARGS, NULL}, + { (char *)"Dn_canonical_str", (PyCFunction)_wrap_Dn_canonical_str, METH_O, NULL}, + { (char *)"Dn_canonical_ex_str", (PyCFunction)_wrap_Dn_canonical_ex_str, METH_O, NULL}, { (char *)"Dn___add__", (PyCFunction) _wrap_Dn___add__, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Dn_swigregister", Dn_swigregister, METH_VARARGS, NULL}, - { (char *)"ldb_dn_from_pyobject", (PyCFunction) _wrap_ldb_dn_from_pyobject, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ldb_msg_element_from_pyobject", (PyCFunction) _wrap_ldb_msg_element_from_pyobject, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ldb_msg_element_to_set", (PyCFunction) _wrap_ldb_msg_element_to_set, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ldb_msg_element___iter__", _wrap_ldb_msg_element___iter__, METH_VARARGS, NULL}, - { (char *)"ldb_msg_element___set__", _wrap_ldb_msg_element___set__, METH_VARARGS, NULL}, + { (char *)"Dn_swiginit", Dn_swiginit, METH_VARARGS, NULL}, + { (char *)"ldb_msg_element___iter__", (PyCFunction)_wrap_ldb_msg_element___iter__, METH_O, NULL}, + { (char *)"ldb_msg_element___set__", (PyCFunction)_wrap_ldb_msg_element___set__, METH_O, NULL}, { (char *)"new_MessageElement", (PyCFunction) _wrap_new_MessageElement, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"delete_ldb_msg_element", _wrap_delete_ldb_msg_element, METH_VARARGS, NULL}, + { (char *)"delete_ldb_msg_element", (PyCFunction)_wrap_delete_ldb_msg_element, METH_O, NULL}, { (char *)"ldb_msg_element___cmp__", (PyCFunction) _wrap_ldb_msg_element___cmp__, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"ldb_msg_element_swigregister", ldb_msg_element_swigregister, METH_VARARGS, NULL}, { (char *)"ldb_msg_list_elements", (PyCFunction) _wrap_ldb_msg_list_elements, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Message_dn_set", _wrap_Message_dn_set, METH_VARARGS, NULL}, - { (char *)"Message_dn_get", _wrap_Message_dn_get, METH_VARARGS, NULL}, + { (char *)"Message_dn_get", (PyCFunction)_wrap_Message_dn_get, METH_O, NULL}, { (char *)"new_Message", (PyCFunction) _wrap_new_Message, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"delete_Message", _wrap_delete_Message, METH_VARARGS, NULL}, + { (char *)"delete_Message", (PyCFunction)_wrap_delete_Message, METH_O, NULL}, { (char *)"Message___getitem__", (PyCFunction) _wrap_Message___getitem__, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Message___setitem__", _wrap_Message___setitem__, METH_VARARGS, NULL}, - { (char *)"Message___len__", _wrap_Message___len__, METH_VARARGS, NULL}, - { (char *)"Message_keys", _wrap_Message_keys, METH_VARARGS, NULL}, - { (char *)"Message___iter__", _wrap_Message___iter__, METH_VARARGS, NULL}, + { (char *)"Message___len__", (PyCFunction)_wrap_Message___len__, METH_O, NULL}, + { (char *)"Message_keys", (PyCFunction)_wrap_Message_keys, METH_O, NULL}, + { (char *)"Message___iter__", (PyCFunction)_wrap_Message___iter__, METH_O, NULL}, { (char *)"Message___delitem__", (PyCFunction) _wrap_Message___delitem__, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Message_swigregister", Message_swigregister, METH_VARARGS, NULL}, + { (char *)"Message_swiginit", Message_swiginit, METH_VARARGS, NULL}, { (char *)"ldb_ldif_to_pyobject", (PyCFunction) _wrap_ldb_ldif_to_pyobject, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"new_Ldb", (PyCFunction) _wrap_new_Ldb, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ldb_connect", (PyCFunction) _wrap_ldb_connect, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"delete_ldb", _wrap_delete_ldb, METH_VARARGS, NULL}, - { (char *)"ldb_search", (PyCFunction) _wrap_ldb_search, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ldb_delete", (PyCFunction) _wrap_ldb_delete, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ldb_rename", (PyCFunction) _wrap_ldb_rename, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ldb_add", (PyCFunction) _wrap_ldb_add, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ldb_modify", (PyCFunction) _wrap_ldb_modify, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ldb_get_config_basedn", _wrap_ldb_get_config_basedn, METH_VARARGS, NULL}, - { (char *)"ldb_get_root_basedn", _wrap_ldb_get_root_basedn, METH_VARARGS, NULL}, - { (char *)"ldb_get_schema_basedn", _wrap_ldb_get_schema_basedn, METH_VARARGS, NULL}, - { (char *)"ldb_get_default_basedn", _wrap_ldb_get_default_basedn, METH_VARARGS, NULL}, - { (char *)"ldb_errstring", _wrap_ldb_errstring, METH_VARARGS, NULL}, - { (char *)"ldb_set_create_perms", (PyCFunction) _wrap_ldb_set_create_perms, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ldb_set_modules_dir", (PyCFunction) _wrap_ldb_set_modules_dir, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ldb_set_debug", (PyCFunction) _wrap_ldb_set_debug, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ldb_set_opaque", (PyCFunction) _wrap_ldb_set_opaque, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ldb_get_opaque", (PyCFunction) _wrap_ldb_get_opaque, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ldb_transaction_start", _wrap_ldb_transaction_start, METH_VARARGS, NULL}, - { (char *)"ldb_transaction_commit", _wrap_ldb_transaction_commit, METH_VARARGS, NULL}, - { (char *)"ldb_transaction_cancel", _wrap_ldb_transaction_cancel, METH_VARARGS, NULL}, - { (char *)"ldb___contains__", (PyCFunction) _wrap_ldb___contains__, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ldb_parse_ldif", (PyCFunction) _wrap_ldb_parse_ldif, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"ldb_swigregister", ldb_swigregister, METH_VARARGS, NULL}, + { (char *)"Ldb_connect", (PyCFunction) _wrap_Ldb_connect, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"delete_Ldb", (PyCFunction)_wrap_delete_Ldb, METH_O, NULL}, + { (char *)"Ldb_search", (PyCFunction) _wrap_Ldb_search, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Ldb_delete", (PyCFunction) _wrap_Ldb_delete, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Ldb_rename", (PyCFunction) _wrap_Ldb_rename, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Ldb_add", _wrap_Ldb_add, METH_VARARGS, NULL}, + { (char *)"Ldb_modify", (PyCFunction) _wrap_Ldb_modify, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Ldb_get_config_basedn", (PyCFunction)_wrap_Ldb_get_config_basedn, METH_O, NULL}, + { (char *)"Ldb_get_root_basedn", (PyCFunction)_wrap_Ldb_get_root_basedn, METH_O, NULL}, + { (char *)"Ldb_get_schema_basedn", (PyCFunction)_wrap_Ldb_get_schema_basedn, METH_O, NULL}, + { (char *)"Ldb_get_default_basedn", (PyCFunction)_wrap_Ldb_get_default_basedn, METH_O, NULL}, + { (char *)"Ldb_errstring", (PyCFunction)_wrap_Ldb_errstring, METH_O, NULL}, + { (char *)"Ldb_set_create_perms", (PyCFunction) _wrap_Ldb_set_create_perms, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Ldb_set_modules_dir", (PyCFunction) _wrap_Ldb_set_modules_dir, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Ldb_set_debug", (PyCFunction) _wrap_Ldb_set_debug, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Ldb_set_opaque", (PyCFunction) _wrap_Ldb_set_opaque, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Ldb_get_opaque", (PyCFunction) _wrap_Ldb_get_opaque, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Ldb_transaction_start", (PyCFunction)_wrap_Ldb_transaction_start, METH_O, NULL}, + { (char *)"Ldb_transaction_commit", (PyCFunction)_wrap_Ldb_transaction_commit, METH_O, NULL}, + { (char *)"Ldb_transaction_cancel", (PyCFunction)_wrap_Ldb_transaction_cancel, METH_O, NULL}, + { (char *)"Ldb___contains__", (PyCFunction) _wrap_Ldb___contains__, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Ldb_parse_ldif", (PyCFunction) _wrap_Ldb_parse_ldif, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Ldb_swigregister", Ldb_swigregister, METH_VARARGS, NULL}, + { (char *)"Ldb_swiginit", Ldb_swiginit, METH_VARARGS, NULL}, { (char *)"valid_attr_name", (PyCFunction) _wrap_valid_attr_name, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"timestring", (PyCFunction) _wrap_timestring, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"string_to_time", (PyCFunction) _wrap_string_to_time, METH_VARARGS | METH_KEYWORDS, NULL}, @@ -5460,7 +5464,6 @@ static swig_type_info _swigt__p_ldb_message_element = {"_p_ldb_message_element", static swig_type_info _swigt__p_ldb_result = {"_p_ldb_result", "struct ldb_result *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_p_ldb_dn = {"_p_p_ldb_dn", "struct ldb_dn **|ldb_dn **", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_ldb_result = {"_p_p_ldb_result", "struct ldb_result **", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0}; @@ -5483,7 +5486,6 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_ldb_result, &_swigt__p_long_long, &_swigt__p_p_char, - &_swigt__p_p_ldb_dn, &_swigt__p_p_ldb_result, &_swigt__p_short, &_swigt__p_signed_char, @@ -5506,7 +5508,6 @@ static swig_cast_info _swigc__p_ldb_message_element[] = { {&_swigt__p_ldb_messa static swig_cast_info _swigc__p_ldb_result[] = { {&_swigt__p_ldb_result, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_long_long[] = { {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_p_ldb_dn[] = { {&_swigt__p_p_ldb_dn, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_p_ldb_result[] = { {&_swigt__p_p_ldb_result, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}}; @@ -5529,7 +5530,6 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_ldb_result, _swigc__p_long_long, _swigc__p_p_char, - _swigc__p_p_ldb_dn, _swigc__p_p_ldb_result, _swigc__p_short, _swigc__p_signed_char, diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py index b140bfc599..b6d6170ec2 100755 --- a/source4/lib/ldb/tests/python/api.py +++ b/source4/lib/ldb/tests/python/api.py @@ -1,8 +1,11 @@ #!/usr/bin/python -# Simple tests for the ldb python API +# Simple tests for the ldb python bindings. # Copyright (C) 2007 Jelmer Vernooij <jelmer@samba.org> + import sys import unittest + +# Required for the standalone LDB build sys.path.append("swig") sys.path.append("build/lib.linux-i686-2.4") @@ -116,6 +119,16 @@ class SimpleLdb(unittest.TestCase): finally: l.delete(ldb.Dn(l, "dc=foo")) + def test_add_dict_string_dn(self): + l = ldb.Ldb("foo.tdb") + m = {"dn": "dc=foo", "bla": "bla"} + self.assertEquals(len(l.search()), 1) + l.add(m) + try: + self.assertEquals(len(l.search()), 2) + finally: + l.delete(ldb.Dn(l, "dc=foo")) + def test_rename(self): l = ldb.Ldb("foo.tdb") m = ldb.Message() diff --git a/source4/lib/ldb/tools/ad2oLschema.c b/source4/lib/ldb/tools/ad2oLschema.c index 5fcf752578..c8974d7e7d 100644 --- a/source4/lib/ldb/tools/ad2oLschema.c +++ b/source4/lib/ldb/tools/ad2oLschema.c @@ -37,6 +37,7 @@ #include "tools/cmdline.h" #include "tools/convert.h" #include "param/param.h" +#include "lib/cmdline/popt_common.h" struct schema_conv { int count; @@ -677,7 +678,7 @@ static struct schema_conv process_convert(struct ldb_context *ldb, enum convert_ } } - target_str = lp_parm_string(global_loadparm, NULL, "convert", "target"); + target_str = lp_parm_string(cmdline_lp_ctx, NULL, "convert", "target"); if (!target_str || strcasecmp(target_str, "openldap") == 0) { target = TARGET_OPENLDAP; |