summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/ldb.i87
-rw-r--r--source4/lib/ldb/ldb.py3
-rw-r--r--source4/lib/ldb/ldb_wrap.c296
-rwxr-xr-xsource4/lib/ldb/tests/python/api.py10
4 files changed, 197 insertions, 199 deletions
diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i
index 97cc16806d..15a49ec9c5 100644
--- a/source4/lib/ldb/ldb.i
+++ b/source4/lib/ldb/ldb.i
@@ -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 */
@@ -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();
diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py
index 10f42b0f83..ce4a5ec494 100644
--- a/source4/lib/ldb/ldb.py
+++ b/source4/lib/ldb/ldb.py
@@ -89,9 +89,6 @@ 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):
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"
diff --git a/source4/lib/ldb/ldb_wrap.c b/source4/lib/ldb/ldb_wrap.c
index 39ecaf62ed..975e91dbe4 100644
--- a/source4/lib/ldb/ldb_wrap.c
+++ b/source4/lib/ldb/ldb_wrap.c
@@ -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)
@@ -2671,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,
@@ -2723,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)
@@ -2868,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);
}
@@ -3038,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);
@@ -3541,99 +3587,6 @@ SWIGINTERN PyObject *Dn_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
return SWIG_Python_InitShadowInstance(args);
}
-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 *_wrap_ldb_msg_element___iter__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
ldb_msg_element *arg1 = (ldb_msg_element *) 0 ;
@@ -4612,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 *""'");
}
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,
@@ -4679,14 +4604,70 @@ 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];
{
- //talloc_free(arg2);
+ if (arg1 == NULL)
+ SWIG_exception(SWIG_ValueError,
+ "ldb context must be non-NULL");
+ }
+ result = ldb_add__SWIG_1(arg1,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;
}
@@ -5418,9 +5399,6 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"Dn___add__", (PyCFunction) _wrap_Dn___add__, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Dn_swigregister", Dn_swigregister, METH_VARARGS, NULL},
{ (char *)"Dn_swiginit", Dn_swiginit, 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__", (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},
@@ -5447,7 +5425,7 @@ static PyMethodDef SwigMethods[] = {
{ (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_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},
@@ -5486,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};
@@ -5509,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,
@@ -5532,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}};
@@ -5555,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 3b4de044b0..b6d6170ec2 100755
--- a/source4/lib/ldb/tests/python/api.py
+++ b/source4/lib/ldb/tests/python/api.py
@@ -119,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()