[SCM] Samba Shared Repository - branch master updated

Matthieu Patou mat at samba.org
Sun Mar 20 05:14:02 MDT 2011


The branch, master has been updated
       via  def1fcb pyldb: minor fixup, fix a memory leak
       via  88d9071 pyldb: add more tests for control manipulation
       via  4a15c7e dsdb: read acl, sd can be null and ret == LDB_SUCCESS
       via  cbb0f88 dsdb: acl_read fix a missed talloc_steal
       via  d2e976e upgradeprovision: Fix typo
       via  d4c78b6 ldb:fix control parsing for dirsync
       via  d772b8e ldapcli: allocate control value on the control object not on the control container
      from  4828fed s3: Fix early tldap_search cancels

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


- Log -----------------------------------------------------------------
commit def1fcb089d222cca44c016d976df38680539a0d
Author: Matthieu Patou <mat at matws.net>
Date:   Sat Feb 26 21:35:27 2011 +0300

    pyldb: minor fixup, fix a memory leak
    
    Autobuild-User: Matthieu Patou <mat at samba.org>
    Autobuild-Date: Sun Mar 20 12:13:50 CET 2011 on sn-devel-104

commit 88d907189ce00a5ab509bdbe8a528ab493a4f6f8
Author: Matthieu Patou <mat at matws.net>
Date:   Sat Feb 26 21:34:43 2011 +0300

    pyldb: add more tests for control manipulation

commit 4a15c7e7502e174a5ecb47f85c327d12a367056d
Author: Matthieu Patou <mat at matws.net>
Date:   Tue Mar 8 01:03:16 2011 +0300

    dsdb: read acl, sd can be null and ret == LDB_SUCCESS

commit cbb0f881ac50fd8704769de45e1dd66a0e2ff6a9
Author: Matthieu Patou <mat at matws.net>
Date:   Sat Mar 5 22:22:00 2011 +0300

    dsdb: acl_read fix a missed talloc_steal

commit d2e976e32c552ba44596973628e3061f61a267b5
Author: Matthieu Patou <mat at matws.net>
Date:   Sun Feb 27 12:16:43 2011 +0300

    upgradeprovision: Fix typo

commit d4c78b66c275700fe7c75180b7febe33eba15e93
Author: Matthieu Patou <mat at matws.net>
Date:   Sat Mar 5 00:03:12 2011 +0300

    ldb:fix control parsing for dirsync

commit d772b8e78006755444d14dc7a4efbdcdb8e0db47
Author: Matthieu Patou <mat at matws.net>
Date:   Sat Feb 26 21:07:51 2011 +0300

    ldapcli: allocate control value on the control object not on the control container

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

Summary of changes:
 libcli/ldap/ldap_message.c                       |    4 ++--
 source4/dsdb/samdb/ldb_modules/acl_read.c        |    3 ++-
 source4/dsdb/tests/python/ldap.py                |    4 ++++
 source4/lib/ldb/common/ldb_controls.c            |    5 +++--
 source4/lib/ldb/pyldb.c                          |    5 +++--
 source4/scripting/python/samba/upgradehelpers.py |    2 +-
 6 files changed, 15 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/ldap/ldap_message.c b/libcli/ldap/ldap_message.c
index 7756e73..0f54230 100644
--- a/libcli/ldap/ldap_message.c
+++ b/libcli/ldap/ldap_message.c
@@ -1572,11 +1572,11 @@ _PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data,
 				return NT_STATUS_LDAP(LDAP_OPERATIONS_ERROR);
 			}
 
-			if (!ldap_decode_control_wrapper(ctrl, data, ctrl[i], &value)) {
+			if (!ldap_decode_control_wrapper(ctrl[i], data, ctrl[i], &value)) {
 				return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);
 			}
 			
-			if (!ldap_decode_control_value(ctrl, value,
+			if (!ldap_decode_control_value(ctrl[i], value,
 						       control_handlers,
 						       ctrl[i])) {
 				if (ctrl[i]->critical) {
diff --git a/source4/dsdb/samdb/ldb_modules/acl_read.c b/source4/dsdb/samdb/ldb_modules/acl_read.c
index 4ed057c..cde6d11 100644
--- a/source4/dsdb/samdb/ldb_modules/acl_read.c
+++ b/source4/dsdb/samdb/ldb_modules/acl_read.c
@@ -88,7 +88,7 @@ static int aclread_callback(struct ldb_request *req, struct ldb_reply *ares)
 	 case LDB_REPLY_ENTRY:
 		 msg = ares->message;
 		 ret = dsdb_get_sd_from_ldb_message(ldb, tmp_ctx, msg, &sd);
-		 if (ret != LDB_SUCCESS) {
+		 if (ret != LDB_SUCCESS || sd == NULL ) {
 			 DEBUG(10, ("acl_read: cannot get descriptor\n"));
 			 ret = LDB_ERR_OPERATIONS_ERROR;
 			 goto fail;
@@ -192,6 +192,7 @@ static int aclread_callback(struct ldb_request *req, struct ldb_reply *ares)
 				 bool to_remove = aclread_is_inaccessible(&msg->elements[i]);
 				 if (!to_remove) {
 					 ret_msg->elements[k] = msg->elements[i];
+					 talloc_steal(ret_msg->elements, msg->elements[i].name);
 					 talloc_steal(ret_msg->elements, msg->elements[i].values);
 					 k++;
 				 }
diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py
index 1a9be96..a49dbf0 100755
--- a/source4/dsdb/tests/python/ldap.py
+++ b/source4/dsdb/tests/python/ldap.py
@@ -2658,6 +2658,10 @@ nTSecurityDescriptor:: """ + desc_base64
                               controls=["paged_result:1:10"])
         self.assertEquals(len(res.controls), 1)
         self.assertEquals(res.controls[0].oid, "1.2.840.113556.1.4.319")
+        try:
+            s = str(res.controls[0])
+        except:
+            self.assertFalse(True)
 
     def test_operational(self):
         """Tests operational attributes"""
diff --git a/source4/lib/ldb/common/ldb_controls.c b/source4/lib/ldb/common/ldb_controls.c
index 5a86bde..5048b6d 100644
--- a/source4/lib/ldb/common/ldb_controls.c
+++ b/source4/lib/ldb/common/ldb_controls.c
@@ -465,11 +465,12 @@ struct ldb_control *ldb_parse_control_from_string(struct ldb_context *ldb, TALLO
 		struct ldb_dirsync_control *control;
 		const char *p;
 		char cookie[1024];
-		int crit, flags, max_attrs, ret;
+		int crit, max_attrs, ret;
+		uint32_t flags;
 		
 		cookie[0] = '\0';
 		p = &(control_strings[sizeof(LDB_CONTROL_DIRSYNC_NAME)]);
-		ret = sscanf(p, "%d:%d:%d:%1023[^$]", &crit, &flags, &max_attrs, cookie);
+		ret = sscanf(p, "%d:%u:%d:%1023[^$]", &crit, &flags, &max_attrs, cookie);
 
 		if ((ret < 3) || (crit < 0) || (crit > 1) || (flags < 0) || (max_attrs < 0)) {
 			error_string = talloc_asprintf(mem_ctx, "invalid dirsync control syntax\n");
diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c
index d14487b..5fcc5a6 100644
--- a/source4/lib/ldb/pyldb.c
+++ b/source4/lib/ldb/pyldb.c
@@ -85,6 +85,7 @@ static void py_ldb_control_dealloc(PyLdbControlObject *self)
 	if (self->mem_ctx != NULL) {
 		talloc_free(self->mem_ctx);
 	}
+	self->data = NULL;
 	self->ob_type->tp_free(self);
 }
 
@@ -111,7 +112,6 @@ static PyObject *py_ldb_control_set_critical(PyLdbControlObject *self, PyObject
 static PyObject *py_ldb_control_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
 {
 	char *data = NULL;
-	const char *array[2];
 	const char * const kwnames[] = { "ldb", "data", NULL };
 	struct ldb_control *parsed_controls;
 	PyLdbControlObject *ret;
@@ -148,7 +148,7 @@ static PyObject *py_ldb_control_new(PyTypeObject *type, PyObject *args, PyObject
 
 	ret->mem_ctx = mem_ctx;
 
-	ret->data = talloc_steal(mem_ctx, parsed_controls);
+	ret->data = talloc_move(mem_ctx, &parsed_controls);
 	if (ret->data == NULL) {
 		Py_DECREF(ret);
 		PyErr_NoMemory();
@@ -209,6 +209,7 @@ static PyObject *PyLdbControl_FromControl(struct ldb_control *control)
 
 	ctrl = (PyLdbControlObject *)PyLdbControl.tp_alloc(&PyLdbControl, 0);
 	if (ctrl == NULL) {
+		talloc_free(ctl_ctx);
 		PyErr_NoMemory();
 		return NULL;
 	}
diff --git a/source4/scripting/python/samba/upgradehelpers.py b/source4/scripting/python/samba/upgradehelpers.py
index 3a7dfb3..48f492a 100755
--- a/source4/scripting/python/samba/upgradehelpers.py
+++ b/source4/scripting/python/samba/upgradehelpers.py
@@ -21,7 +21,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-"""Helers used for upgrading between different database formats."""
+"""Helpers used for upgrading between different database formats."""
 
 import os
 import string


-- 
Samba Shared Repository


More information about the samba-cvs mailing list