[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-799-g46bd227

Jelmer Vernooij jelmer at samba.org
Tue Aug 4 19:45:59 MDT 2009


The branch, master has been updated
       via  46bd2271b24b2b6b68541e867c3e87f7d217267c (commit)
      from  88d206070df8e6f1b9190390ddb13a600b1178e0 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 46bd2271b24b2b6b68541e867c3e87f7d217267c
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Wed Aug 5 03:34:08 2009 +0200

    pyldb: Fix reference counting on ldb_message_elements, add extra type
    check.

-----------------------------------------------------------------------

Summary of changes:
 source4/lib/ldb/pyldb.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c
index 8a061c7..a9425b5 100644
--- a/source4/lib/ldb/pyldb.c
+++ b/source4/lib/ldb/pyldb.c
@@ -1394,7 +1394,8 @@ struct ldb_message_element *PyObject_AsMessageElement(TALLOC_CTX *mem_ctx,
 	struct ldb_message_element *me;
 
 	if (PyLdbMessageElement_Check(set_obj))
-		return PyLdbMessageElement_AsMessageElement(set_obj);
+		return talloc_reference(mem_ctx, 
+								PyLdbMessageElement_AsMessageElement(set_obj));
 
 	me = talloc(mem_ctx, struct ldb_message_element);
 
@@ -1544,6 +1545,13 @@ static PyObject *py_ldb_msg_element_new(PyTypeObject *type, PyObject *args, PyOb
 			el->values = talloc_array(el, struct ldb_val, el->num_values);
 			for (i = 0; i < el->num_values; i++) {
 				PyObject *item = PySequence_GetItem(py_elements, i);
+				if (!PyString_Check(item)) {
+					PyErr_Format(PyExc_TypeError, 
+							"Expected string as element %d in list", 
+							i);
+					talloc_free(mem_ctx);
+					return NULL;
+				}
 				el->values[i].length = PyString_Size(item);
 				el->values[i].data = talloc_memdup(el, 
 					(uint8_t *)PyString_AsString(item), el->values[i].length);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list