[SCM] Samba Shared Repository - branch master updated
Jelmer Vernooij
jelmer at samba.org
Sun Jan 2 18:35:02 MST 2011
The branch, master has been updated
via 22b7cb3 pyldb: Fix memory reference error.
via 9fc2e6c Use TestCase.get_credentials() where possible.
via 0346f51 pyldb: Always return -1, 0, or 1 in tp_compare functions.
via fdb0aa2 Revert broken destructor changes.
via 027e6b2 pyldb: Fix memory context, add more OOM checks.
via 50a2c83 pyldb: Some more OOM checks.
via 2533a50 Make all functions in pyldb.c private, as they can't be used anyway.
via 8bf5356 s4-python: Add missing prototypes.
via e31224e pyldb: Use pytalloc-util.
via b63f9c1 ldb: Remove duplicate definition of check_special, use PyObject_New.
via cbf504b s4-python: Properly call PyObject_Del from all destructors.
via b320cc7 Fix some formatting.
via 320fd69 Use fail_on_null.
from 4d5c0c3 s4: Happy New Year 2011
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 22b7cb3f2905375b5a9d88d9309062ceec658540
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Mon Jan 3 01:43:51 2011 +0100
pyldb: Fix memory reference error.
Autobuild-User: Jelmer Vernooij <jelmer at samba.org>
Autobuild-Date: Mon Jan 3 02:34:05 CET 2011 on sn-devel-104
commit 9fc2e6c352726d9b14afb5defaee399d20cf9b23
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Mon Jan 3 01:13:09 2011 +0100
Use TestCase.get_credentials() where possible.
commit 0346f5163227f52d8656a923b86099770609dff4
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jan 2 22:34:26 2011 +0100
pyldb: Always return -1, 0, or 1 in tp_compare functions.
commit fdb0aa2b04a5be5f13c39fd42818f898b839ef0f
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sat Jan 1 06:55:54 2011 +0100
Revert broken destructor changes.
commit 027e6b2b22d4938ea0581b8c80372421a31b67ff
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Thu Dec 30 20:11:59 2010 +0100
pyldb: Fix memory context, add more OOM checks.
commit 50a2c83908a29dce64e6375fd09fa5471921a175
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Thu Dec 30 19:59:01 2010 +0100
pyldb: Some more OOM checks.
commit 2533a504719246682308f30f859c7bab1ebea272
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Thu Dec 30 19:39:14 2010 +0100
Make all functions in pyldb.c private, as they can't be used anyway.
commit 8bf53569581c2e7677f7e698fe749f595117bc86
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Thu Dec 30 19:30:09 2010 +0100
s4-python: Add missing prototypes.
commit e31224e27c94b36af1d33d3b571d8320121ef22a
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Thu Dec 30 18:10:49 2010 +0100
pyldb: Use pytalloc-util.
commit b63f9c199659fafa2525ef24525b22e339f97f93
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Thu Dec 30 03:43:23 2010 +0100
ldb: Remove duplicate definition of check_special, use PyObject_New.
commit cbf504b0c5e08ccf9776f079ef2d4a0c2258241b
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Wed Dec 29 15:58:12 2010 +0100
s4-python: Properly call PyObject_Del from all destructors.
commit b320cc799096fb07870c5e5d6d69d485cb1d1ea5
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Dec 28 16:30:47 2010 +0100
Fix some formatting.
commit 320fd69923cf4a647869a89453d01acf81f479e0
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Mon Dec 27 14:32:48 2010 +0100
Use fail_on_null.
-----------------------------------------------------------------------
Summary of changes:
pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 6 +-
pidl/lib/Parse/Pidl/Samba4/Python.pm | 2 +-
source4/dsdb/pydsdb.c | 2 +
source4/lib/ldb/pyldb.c | 121 +++++++++++++++++---------
source4/lib/ldb/pyldb.h | 7 +--
source4/lib/ldb/tests/python/api.py | 4 +
source4/lib/ldb/wscript | 2 +-
source4/libnet/py_net.c | 2 +
source4/torture/drs/python/delete_object.py | 2 +-
source4/torture/drs/python/fsmo.py | 2 +-
source4/torture/drs/python/repl_schema.py | 2 +-
source4/torture/libnet/python/samr-test.py | 7 +-
12 files changed, 99 insertions(+), 60 deletions(-)
Changeset truncated at 500 lines:
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 732aa98..5802f9b 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -206,11 +206,11 @@ sub ParseArrayPushHeader($$$$$$)
if ((!$l->{IS_SURROUNDING}) and $l->{IS_CONFORMANT}) {
$self->pidl("NDR_CHECK(ndr_push_uint3264($ndr, NDR_SCALARS, $size));");
}
-
+
if ($l->{IS_VARYING}) {
$self->pidl("NDR_CHECK(ndr_push_uint3264($ndr, NDR_SCALARS, 0));"); # array offset
$self->pidl("NDR_CHECK(ndr_push_uint3264($ndr, NDR_SCALARS, $length));");
- }
+ }
return $length;
}
@@ -1194,7 +1194,7 @@ sub ParsePtrPull($$$$$)
$self->pidl("\tNDR_PULL_ALLOC($ndr, $var_name);");
$self->pidl("}");
}
-
+
return;
} elsif ($l->{POINTER_TYPE} eq "ref" and $l->{LEVEL} eq "EMBEDDED") {
$self->pidl("NDR_CHECK(ndr_pull_ref_ptr($ndr, &_ptr_$e->{NAME}));");
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 70289e1..60352ae 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -1065,7 +1065,7 @@ sub ConvertObjectFromPythonLevel($$$$$$$$)
my $union_type = mapTypeName($nl->{DATA_TYPE});
$self->pidl("$union_type *$switch_ptr;");
$self->pidl("$switch_ptr = py_export_" . $nl->{DATA_TYPE} . "($mem_ctx, $switch, $py_var);");
- $self->pidl("if ($switch_ptr == NULL) { $fail }");
+ $self->fail_on_null($switch_ptr, $fail);
$self->assign($var_name, "$switch_ptr");
$self->deindent;
$self->pidl("}");
diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c
index 1a51b86..895bd9a 100644
--- a/source4/dsdb/pydsdb.c
+++ b/source4/dsdb/pydsdb.c
@@ -29,6 +29,8 @@
#include "librpc/rpc/pyrpc_util.h"
#include "lib/policy/policy.h"
+void initdsdb(void);
+
/* There's no Py_ssize_t in 2.4, apparently */
#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5
typedef int Py_ssize_t;
diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c
index 354e83d..c2d75b4 100644
--- a/source4/lib/ldb/pyldb.c
+++ b/source4/lib/ldb/pyldb.c
@@ -27,10 +27,27 @@
*/
#include <Python.h>
+#include <pytalloc.h>
#include "ldb_private.h"
#include "pyldb.h"
void initldb(void);
+static PyObject *PyLdbMessage_FromMessage(struct ldb_message *msg);
+static PyObject *PyExc_LdbError;
+
+staticforward PyTypeObject PyLdbMessage;
+staticforward PyTypeObject PyLdbModule;
+staticforward PyTypeObject PyLdbDn;
+staticforward PyTypeObject PyLdb;
+staticforward PyTypeObject PyLdbMessageElement;
+staticforward PyTypeObject PyLdbTree;
+static PyObject *PyLdb_FromLdbContext(struct ldb_context *ldb_ctx);
+static PyObject *PyLdbModule_FromModule(struct ldb_module *mod);
+static struct ldb_message_element *PyObject_AsMessageElement(
+ TALLOC_CTX *mem_ctx,
+ PyObject *set_obj,
+ int flags,
+ const char *attr_name);
/* There's no Py_ssize_t in 2.4, apparently */
#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5
@@ -43,6 +60,8 @@ typedef intargfunc ssizeargfunc;
#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
#endif
+#define SIGN(a) (((a) == 0)?0:((a) < 0?-1:1))
+
static void PyErr_SetLdbError(PyObject *error, int ret, struct ldb_context *ldb_ctx)
{
if (ret == LDB_ERR_PYTHON_EXCEPTION)
@@ -53,17 +72,6 @@ static void PyErr_SetLdbError(PyObject *error, int ret, struct ldb_context *ldb_
ldb_ctx == NULL?ldb_strerror(ret):ldb_errstring(ldb_ctx)));
}
-static PyObject *PyExc_LdbError;
-
-extern PyTypeObject PyLdbMessage;
-extern PyTypeObject PyLdbModule;
-extern PyTypeObject PyLdbDn;
-extern PyTypeObject PyLdb;
-staticforward PyTypeObject PyLdbMessageElement;
-extern PyTypeObject PyLdbTree;
-
-static PyObject *PyLdb_FromLdbContext(struct ldb_context *ldb_ctx);
-
static PyObject *PyObject_FromLdbValue(struct ldb_context *ldb_ctx,
struct ldb_message_element *el,
struct ldb_val *val)
@@ -269,8 +277,6 @@ static PyMethodDef py_ldb_dn_methods[] = {
{ "canonical_ex_str", (PyCFunction)py_ldb_dn_canonical_ex_str, METH_NOARGS,
"S.canonical_ex_str() -> string\n"
"Canonical version of this DN (like a posix path, with terminating newline)." },
- { "check_special", (PyCFunction)py_ldb_dn_is_special, METH_VARARGS,
- NULL },
{ "parent", (PyCFunction)py_ldb_dn_get_parent, METH_NOARGS,
"S.parent() -> dn\n"
"Get the parent for this DN." },
@@ -281,7 +287,8 @@ static PyMethodDef py_ldb_dn_methods[] = {
"S.add_base(dn) -> None\n"
"Add a base DN to this DN." },
{ "check_special", (PyCFunction)py_ldb_dn_check_special, METH_VARARGS,
- NULL },
+ "S.check_special(name) -> bool\n\n"
+ "Check if name is a special DN name"},
{ NULL }
};
@@ -363,7 +370,7 @@ static void py_ldb_dn_dealloc(PyLdbDnObject *self)
PyObject_Del(self);
}
-PyTypeObject PyLdbDn = {
+static PyTypeObject PyLdbDn = {
.tp_name = "ldb.Dn",
.tp_methods = py_ldb_dn_methods,
.tp_str = (reprfunc)py_ldb_dn_get_linearized,
@@ -499,6 +506,11 @@ static const char **PyList_AsStringList(TALLOC_CTX *mem_ctx, PyObject *list,
return NULL;
}
ret = talloc_array(NULL, const char *, PyList_Size(list)+1);
+ if (ret == NULL) {
+ PyErr_NoMemory();
+ return NULL;
+ }
+
for (i = 0; i < PyList_Size(list); i++) {
PyObject *item = PyList_GetItem(list, i);
if (!PyString_Check(item)) {
@@ -1423,7 +1435,7 @@ static PyMethodDef py_ldb_methods[] = {
{ NULL },
};
-PyObject *PyLdbModule_FromModule(struct ldb_module *mod)
+static PyObject *PyLdbModule_FromModule(struct ldb_module *mod)
{
PyLdbModuleObject *ret;
@@ -1505,7 +1517,7 @@ static void py_ldb_dealloc(PyLdbObject *self)
self->ob_type->tp_free(self);
}
-PyTypeObject PyLdb = {
+static PyTypeObject PyLdb = {
.tp_name = "ldb.Ldb",
.tp_methods = py_ldb_methods,
.tp_repr = (reprfunc)py_ldb_repr,
@@ -1699,7 +1711,7 @@ static void py_ldb_module_dealloc(PyLdbModuleObject *self)
PyObject_Del(self);
}
-PyTypeObject PyLdbModule = {
+static PyTypeObject PyLdbModule = {
.tp_name = "ldb.LdbModule",
.tp_methods = py_ldb_module_methods,
.tp_repr = (reprfunc)py_ldb_module_repr,
@@ -1724,7 +1736,8 @@ PyTypeObject PyLdbModule = {
* @param attr_name Name of the attribute
* @return New ldb_message_element, allocated as child of mem_ctx
*/
-struct ldb_message_element *PyObject_AsMessageElement(TALLOC_CTX *mem_ctx,
+static struct ldb_message_element *PyObject_AsMessageElement(
+ TALLOC_CTX *mem_ctx,
PyObject *set_obj,
int flags,
const char *attr_name)
@@ -1733,7 +1746,8 @@ struct ldb_message_element *PyObject_AsMessageElement(TALLOC_CTX *mem_ctx,
if (PyLdbMessageElement_Check(set_obj)) {
PyLdbMessageElementObject *set_obj_as_me = (PyLdbMessageElementObject *)set_obj;
- /* We have to talloc_reference() the memory context, not the pointer which may not actually be it's own context */
+ /* We have to talloc_reference() the memory context, not the pointer
+ * which may not actually be it's own context */
if (talloc_reference(mem_ctx, set_obj_as_me->mem_ctx)) {
return PyLdbMessageElement_AsMessageElement(set_obj);
}
@@ -1741,6 +1755,10 @@ struct ldb_message_element *PyObject_AsMessageElement(TALLOC_CTX *mem_ctx,
}
me = talloc(mem_ctx, struct ldb_message_element);
+ if (me == NULL) {
+ PyErr_NoMemory();
+ return NULL;
+ }
me->name = talloc_strdup(me, attr_name);
me->flags = flags;
@@ -1807,9 +1825,7 @@ static PyObject *py_ldb_msg_element_get(PyLdbMessageElementObject *self, PyObjec
static PyObject *py_ldb_msg_element_flags(PyLdbMessageElementObject *self, PyObject *args)
{
- struct ldb_message_element *el;
-
- el = PyLdbMessageElement_AsMessageElement(self);
+ struct ldb_message_element *el = PyLdbMessageElement_AsMessageElement(self);
return PyInt_FromLong(el->flags);
}
@@ -1854,8 +1870,9 @@ static PySequenceMethods py_ldb_msg_element_seq = {
static int py_ldb_msg_element_cmp(PyLdbMessageElementObject *self, PyLdbMessageElementObject *other)
{
- return ldb_msg_element_compare(PyLdbMessageElement_AsMessageElement(self),
- PyLdbMessageElement_AsMessageElement(other));
+ int ret = ldb_msg_element_compare(PyLdbMessageElement_AsMessageElement(self),
+ PyLdbMessageElement_AsMessageElement(other));
+ return SIGN(ret);
}
static PyObject *py_ldb_msg_element_iter(PyLdbMessageElementObject *self)
@@ -1863,10 +1880,10 @@ static PyObject *py_ldb_msg_element_iter(PyLdbMessageElementObject *self)
return PyObject_GetIter(ldb_msg_element_to_set(NULL, PyLdbMessageElement_AsMessageElement(self)));
}
-PyObject *PyLdbMessageElement_FromMessageElement(struct ldb_message_element *el, TALLOC_CTX *mem_ctx)
+static PyObject *PyLdbMessageElement_FromMessageElement(struct ldb_message_element *el, TALLOC_CTX *mem_ctx)
{
PyLdbMessageElementObject *ret;
- ret = (PyLdbMessageElementObject *)PyLdbMessageElement.tp_alloc(&PyLdbMessageElement, 0);
+ ret = PyObject_New(PyLdbMessageElementObject, &PyLdbMessageElement);
if (ret == NULL) {
PyErr_NoMemory();
return NULL;
@@ -1902,20 +1919,39 @@ static PyObject *py_ldb_msg_element_new(PyTypeObject *type, PyObject *args, PyOb
}
el = talloc_zero(mem_ctx, struct ldb_message_element);
+ if (el == NULL) {
+ PyErr_NoMemory();
+ talloc_free(mem_ctx);
+ return NULL;
+ }
if (py_elements != NULL) {
Py_ssize_t i;
if (PyString_Check(py_elements)) {
el->num_values = 1;
el->values = talloc_array(el, struct ldb_val, 1);
+ if (el->values == NULL) {
+ talloc_free(mem_ctx);
+ PyErr_NoMemory();
+ return NULL;
+ }
el->values[0].length = PyString_Size(py_elements);
- el->values[0].data = talloc_memdup(el,
+ el->values[0].data = talloc_memdup(el->values,
(uint8_t *)PyString_AsString(py_elements), el->values[0].length+1);
} else if (PySequence_Check(py_elements)) {
el->num_values = PySequence_Size(py_elements);
el->values = talloc_array(el, struct ldb_val, el->num_values);
+ if (el->values == NULL) {
+ talloc_free(mem_ctx);
+ PyErr_NoMemory();
+ return NULL;
+ }
for (i = 0; i < el->num_values; i++) {
PyObject *item = PySequence_GetItem(py_elements, i);
+ if (item == NULL) {
+ talloc_free(mem_ctx);
+ return NULL;
+ }
if (!PyString_Check(item)) {
PyErr_Format(PyExc_TypeError,
"Expected string as element %zd in list", i);
@@ -1923,7 +1959,7 @@ static PyObject *py_ldb_msg_element_new(PyTypeObject *type, PyObject *args, PyOb
return NULL;
}
el->values[i].length = PyString_Size(item);
- el->values[i].data = talloc_memdup(el,
+ el->values[i].data = talloc_memdup(el,
(uint8_t *)PyString_AsString(item), el->values[i].length+1);
}
} else {
@@ -1937,9 +1973,8 @@ static PyObject *py_ldb_msg_element_new(PyTypeObject *type, PyObject *args, PyOb
el->flags = flags;
el->name = talloc_strdup(el, name);
- ret = (PyLdbMessageElementObject *)PyLdbMessageElement.tp_alloc(&PyLdbMessageElement, 0);
+ ret = PyObject_New(PyLdbMessageElementObject, type);
if (ret == NULL) {
- PyErr_NoMemory();
talloc_free(mem_ctx);
return NULL;
}
@@ -2124,7 +2159,9 @@ static PyObject *py_ldb_msg_items(PyLdbMessageObject *self)
j++;
}
for (i = 0; i < msg->num_elements; i++, j++) {
- PyList_SetItem(l, j, Py_BuildValue("(sO)", msg->elements[i].name, PyLdbMessageElement_FromMessageElement(&msg->elements[i], msg->elements)));
+ PyObject *py_el = PyLdbMessageElement_FromMessageElement(&msg->elements[i], msg->elements);
+ PyObject *value = Py_BuildValue("(sO)", msg->elements[i].name, py_el);
+ PyList_SetItem(l, j, value);
}
return l;
}
@@ -2143,14 +2180,14 @@ static PyObject *py_ldb_msg_elements(PyLdbMessageObject *self)
static PyObject *py_ldb_msg_add(PyLdbMessageObject *self, PyObject *args)
{
struct ldb_message *msg = PyLdbMessage_AsMessage(self);
- PyObject *py_element;
+ PyLdbMessageElementObject *py_element;
int ret;
struct ldb_message_element *el;
if (!PyArg_ParseTuple(args, "O!", &PyLdbMessageElement, &py_element))
return NULL;
- el = talloc_reference(msg, PyLdbMessageElement_AsMessageElement(py_element));
+ el = talloc_reference(msg, py_element->el);
if (el == NULL) {
PyErr_NoMemory();
return NULL;
@@ -2274,7 +2311,7 @@ static PyObject *py_ldb_msg_new(PyTypeObject *type, PyObject *args, PyObject *kw
return (PyObject *)py_ret;
}
-PyObject *PyLdbMessage_FromMessage(struct ldb_message *msg)
+static PyObject *PyLdbMessage_FromMessage(struct ldb_message *msg)
{
PyLdbMessageObject *ret;
@@ -2338,33 +2375,33 @@ static int py_ldb_msg_compare(PyLdbMessageObject *py_msg1,
if ((msg1->dn != NULL) || (msg2->dn != NULL)) {
ret = ldb_dn_compare(msg1->dn, msg2->dn);
if (ret != 0) {
- return ret;
+ return SIGN(ret);
}
}
ret = msg1->num_elements - msg2->num_elements;
if (ret != 0) {
- return ret;
+ return SIGN(ret);
}
for (i = 0; i < msg1->num_elements; i++) {
ret = ldb_msg_element_compare_name(&msg1->elements[i],
&msg2->elements[i]);
if (ret != 0) {
- return ret;
+ return SIGN(ret);
}
ret = ldb_msg_element_compare(&msg1->elements[i],
&msg2->elements[i]);
if (ret != 0) {
- return ret;
+ return SIGN(ret);
}
}
return 0;
}
-PyTypeObject PyLdbMessage = {
+static PyTypeObject PyLdbMessage = {
.tp_name = "ldb.Message",
.tp_methods = py_ldb_msg_methods,
.tp_getset = py_ldb_msg_getset,
@@ -2378,7 +2415,7 @@ PyTypeObject PyLdbMessage = {
.tp_compare = (cmpfunc)py_ldb_msg_compare,
};
-PyObject *PyLdbTree_FromTree(struct ldb_parse_tree *tree)
+static PyObject *PyLdbTree_FromTree(struct ldb_parse_tree *tree)
{
PyLdbTreeObject *ret;
@@ -2399,7 +2436,7 @@ static void py_ldb_tree_dealloc(PyLdbTreeObject *self)
PyObject_Del(self);
}
-PyTypeObject PyLdbTree = {
+static PyTypeObject PyLdbTree = {
.tp_name = "ldb.Tree",
.tp_basicsize = sizeof(PyLdbTreeObject),
.tp_dealloc = (destructor)py_ldb_tree_dealloc,
diff --git a/source4/lib/ldb/pyldb.h b/source4/lib/ldb/pyldb.h
index 211789c..c0cace2 100644
--- a/source4/lib/ldb/pyldb.h
+++ b/source4/lib/ldb/pyldb.h
@@ -53,7 +53,6 @@ typedef struct {
TALLOC_CTX *mem_ctx;
struct ldb_message *msg;
} PyLdbMessageObject;
-PyObject *PyLdbMessage_FromMessage(struct ldb_message *message);
#define PyLdbMessage_Check(ob) PyObject_TypeCheck(ob, &PyLdbMessage)
#define PyLdbMessage_AsMessage(pyobj) ((PyLdbMessageObject *)pyobj)->msg
@@ -62,16 +61,13 @@ typedef struct {
TALLOC_CTX *mem_ctx;
struct ldb_module *mod;
} PyLdbModuleObject;
-PyObject *PyLdbModule_FromModule(struct ldb_module *mod);
#define PyLdbModule_AsModule(pyobj) ((PyLdbModuleObject *)pyobj)->mod
typedef struct {
- PyObject_HEAD
+ PyObject_HEAD
TALLOC_CTX *mem_ctx;
struct ldb_message_element *el;
} PyLdbMessageElementObject;
-struct ldb_message_element *PyObject_AsMessageElement(TALLOC_CTX *mem_ctx, PyObject *obj, int flags, const char *name);
-PyObject *PyLdbMessageElement_FromMessageElement(struct ldb_message_element *, TALLOC_CTX *mem_ctx);
#define PyLdbMessageElement_AsMessageElement(pyobj) ((PyLdbMessageElementObject *)pyobj)->el
#define PyLdbMessageElement_Check(ob) PyObject_TypeCheck(ob, &PyLdbMessageElement)
@@ -80,7 +76,6 @@ typedef struct {
TALLOC_CTX *mem_ctx;
struct ldb_parse_tree *tree;
} PyLdbTreeObject;
-PyObject *PyLdbTree_FromTree(struct ldb_parse_tree *);
#define PyLdbTree_AsTree(pyobj) ((PyLdbTreeObject *)pyobj)->tree
#define PyErr_LDB_ERROR_IS_ERR_RAISE(err,ret,ldb) \
diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py
index cd9651e..016ccc3 100755
--- a/source4/lib/ldb/tests/python/api.py
+++ b/source4/lib/ldb/tests/python/api.py
@@ -607,6 +607,10 @@ class MessageElementTests(unittest.TestCase):
y = ldb.MessageElement(["foo"])
self.assertEquals(y, x)
+ def test_extended(self):
+ el = ldb.MessageElement(["456"], ldb.FLAG_MOD_ADD, "bla")
+ self.assertEquals("MessageElement(['456'])", repr(el))
+
class ModuleTests(unittest.TestCase):
diff --git a/source4/lib/ldb/wscript b/source4/lib/ldb/wscript
index a7e93f6..54ecc00 100644
--- a/source4/lib/ldb/wscript
+++ b/source4/lib/ldb/wscript
@@ -104,7 +104,7 @@ def build(bld):
if not bld.CONFIG_SET('USING_SYSTEM_PYLDB_UTIL'):
bld.SAMBA_LIBRARY('pyldb-util',
- deps='ldb',
+ deps='ldb pytalloc-util',
source='pyldb_util.c',
public_headers='pyldb.h',
vnum=VERSION,
diff --git a/source4/libnet/py_net.c b/source4/libnet/py_net.c
index 514f9df..b7f7d9e 100644
--- a/source4/libnet/py_net.c
+++ b/source4/libnet/py_net.c
@@ -32,6 +32,8 @@
#include "libcli/finddc.h"
#include "libcli/resolve/resolve.h"
+void initnet(void);
+
typedef struct {
PyObject_HEAD
TALLOC_CTX *mem_ctx;
diff --git a/source4/torture/drs/python/delete_object.py b/source4/torture/drs/python/delete_object.py
index 1762d8f..0693898 100644
--- a/source4/torture/drs/python/delete_object.py
+++ b/source4/torture/drs/python/delete_object.py
@@ -130,7 +130,7 @@ class DrsDeleteObjectTestCase(samba.tests.TestCase):
# find out where is net command
samba_tool_cmd = os.path.abspath("./bin/samba-tool")
# make command line credentials string
- creds = samba.tests.cmdline_credentials
+ creds = self.get_credentials()
cmd_line_auth = "-U%s/%s%%%s" % (creds.get_domain(),
creds.get_username(), creds.get_password())
# bin/samba-tool drs replicate <Dest_DC_NAME> <Src_DC_NAME> <Naming Context>
diff --git a/source4/torture/drs/python/fsmo.py b/source4/torture/drs/python/fsmo.py
index 880c8db..cdee7ab 100644
--- a/source4/torture/drs/python/fsmo.py
+++ b/source4/torture/drs/python/fsmo.py
@@ -92,7 +92,7 @@ class DrsFsmoTestCase(samba.tests.TestCase):
# find out where is samba-tool command
net_cmd = os.path.abspath("./bin/samba-tool")
--
Samba Shared Repository
More information about the samba-cvs
mailing list