we do it this way... */
talloc_steal(NULL, ret);
- if (ret == NULL)
+ if (ret == NULL || !ldb_dn_validate(ret))
SWIG_exception(SWIG_ValueError,
"unable to parse dn string");
fail:
SWIGINTERN char *ldb_dn___repr__(ldb_dn *self){
char *dn = ldb_dn_get_linearized(self), *ret;
asprintf(&ret, "Dn('%s')", dn);
- talloc_free(dn);
return ret;
}
SWIGINTERN ldb_dn *ldb_dn___add__(ldb_dn *self,ldb_dn *other){
attrs,
controls,
res,
- ldb_search_default_callback);
+ ldb_search_default_callback,
+ NULL);
if (ret != 0) {
talloc_free(res);
return ret;
}
- ldb_set_timeout(self, req, 0); /* use default timeout */
-
ret = ldb_request(self, req);
if (ret == 0) {
return LDB_SUCCESS;
}
-int py_module_wait(struct ldb_handle *mod, enum ldb_wait_type wait_type)
-{
- PyObject *py_ldb = mod->private_data;
- PyObject *py_result;
-
- py_result = PyObject_CallMethod(py_ldb, "wait", "i", wait_type);
-
- if (py_result == NULL) {
- return LDB_ERR_OPERATIONS_ERROR;
- }
-
- Py_DECREF(py_result);
-
- return LDB_SUCCESS;
-}
-
-int py_module_sequence_number(struct ldb_module *mod, struct ldb_request *req)
-{
- PyObject *py_ldb = mod->private_data;
- PyObject *py_result;
- int ret;
-
- py_result = PyObject_CallMethod(py_ldb, "sequence_number", "ili", req->op.seq_num.type, req->op.seq_num.seq_num, req->op.seq_num.flags);
-
- if (py_result == NULL) {
- return LDB_ERR_OPERATIONS_ERROR;
- }
-
- ret = PyInt_AsLong(py_result);
-
- Py_DECREF(py_result);
-
- return ret;
-}
-
static int py_module_destructor(void *_mod)
{
struct ldb_module *mod = _mod;
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 ;
int alloc2 = 0 ;
unsigned int val3 ;
int ecode3 = 0 ;
- void *argp4 = 0 ;
- int res4 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
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;
}
arg1->start_transaction = py_module_start_transaction;
arg1->end_transaction = py_module_end_transaction;
arg1->del_transaction = py_module_del_transaction;
- arg1->wait = py_module_wait;
- arg1->sequence_number = py_module_sequence_number;
result = ldb_register_module((struct ldb_module_ops const *)arg1);
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue((char *)"(i,s)", result, ldb_strerror(result)));