diff options
author | Andrew Tridgell <tridge@samba.org> | 2008-11-06 14:02:40 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2008-11-06 14:02:40 +1100 |
commit | 30eff4f31b497ac94d8ee02ee2ec24bc8865ce0d (patch) | |
tree | fd1bac1a63ff9cb3c62187c091d474174f475b65 /source4/lib/ldb/ldb_wrap.c | |
parent | 41a1c882d4adec957a1ed180b53fd6874d9524f2 (diff) | |
download | samba-30eff4f31b497ac94d8ee02ee2ec24bc8865ce0d.tar.gz samba-30eff4f31b497ac94d8ee02ee2ec24bc8865ce0d.tar.bz2 samba-30eff4f31b497ac94d8ee02ee2ec24bc8865ce0d.zip |
fixed options argument to ldb connect in python
The options argument to ldb connect() needs to be marked for the same
special handling as attrs in search
Diffstat (limited to 'source4/lib/ldb/ldb_wrap.c')
-rw-r--r-- | source4/lib/ldb/ldb_wrap.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/source4/lib/ldb/ldb_wrap.c b/source4/lib/ldb/ldb_wrap.c index bc9266a306..194b562c30 100644 --- a/source4/lib/ldb/ldb_wrap.c +++ b/source4/lib/ldb/ldb_wrap.c @@ -4823,7 +4823,7 @@ SWIGINTERN PyObject *_wrap_Ldb_connect(PyObject *SWIGUNUSEDPARM(self), PyObject ldb *arg1 = (ldb *) 0 ; char *arg2 = (char *) 0 ; unsigned int arg3 = (unsigned int) 0 ; - char **arg4 = (char **) (char **)NULL ; + char **arg4 = (char **) NULL ; void *argp1 = 0 ; int res1 = 0 ; int res2 ; @@ -4831,8 +4831,6 @@ SWIGINTERN PyObject *_wrap_Ldb_connect(PyObject *SWIGUNUSEDPARM(self), PyObject int alloc2 = 0 ; unsigned int val3 ; int ecode3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -4861,25 +4859,33 @@ SWIGINTERN PyObject *_wrap_Ldb_connect(PyObject *SWIGUNUSEDPARM(self), PyObject 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 *[]""'"); - } - arg4 = (char **)(argp4); + if (obj3 == Py_None) { + arg4 = NULL; + } else if (PySequence_Check(obj3)) { + int i; + arg4 = talloc_array(NULL, char *, PySequence_Size(obj3)+1); + for(i = 0; i < PySequence_Size(obj3); i++) + arg4[i] = PyString_AsString(PySequence_GetItem(obj3, i)); + arg4[i] = NULL; + } else { + SWIG_exception(SWIG_TypeError, "expected sequence"); + } } if (arg1 == NULL) SWIG_exception(SWIG_ValueError, "ldb context must be non-NULL"); - result = ldb_connect(arg1,(char const *)arg2,arg3,(char const *(*))arg4); + result = ldb_connect(arg1,(char const *)arg2,arg3,(char const *const *)arg4); if (result != 0) { PyErr_SetObject(PyExc_LdbError, Py_BuildValue((char *)"(i,s)", result, ldb_errstring(arg1))); SWIG_fail; } resultobj = Py_None; if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); + talloc_free(arg4); return resultobj; fail: if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); + talloc_free(arg4); return NULL; } |