diff options
author | Andrew Bartlett <abartlet@samba.org> | 2017-08-01 13:18:33 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2017-08-01 07:52:38 +0200 |
commit | d5750f016362ce55a1c905509c419756b523dde6 (patch) | |
tree | 94d79425469c4d1f7fed6b5dece1763ef5d7af43 /python/samba/tests/dsdb.py | |
parent | 5b316a4c7aa830194bf254942daa5aef88a0ed17 (diff) | |
download | samba-d5750f016362ce55a1c905509c419756b523dde6.tar.gz |
dsdb: Fix dsdb_next_callback to correctly use ldb_module_done() etc
If we do not call ldb_module_done() then we do not know that up_req->callback()
has been called, and ldb_next_request() will call the callback again.
If called twice, the new ldb_lock_backend_callback() in ldb 1.2.0 will segfault.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12904
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Aug 1 07:52:38 CEST 2017 on sn-devel-144
Diffstat (limited to 'python/samba/tests/dsdb.py')
-rw-r--r-- | python/samba/tests/dsdb.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/python/samba/tests/dsdb.py b/python/samba/tests/dsdb.py index ce5f5991615..a9f569b6c67 100644 --- a/python/samba/tests/dsdb.py +++ b/python/samba/tests/dsdb.py @@ -23,6 +23,7 @@ from samba.auth import system_session from samba.tests import TestCase from samba.ndr import ndr_unpack, ndr_pack from samba.dcerpc import drsblobs +from samba import dsdb import ldb import os import samba @@ -505,3 +506,25 @@ class DsdbTests(TestCase): backend_filename) backend_path = self.lp.private_path(backend_subpath) self._test_full_db_lock2(backend_path) + + def test_no_error_on_invalid_control(self): + try: + res = self.samdb.search(expression="cn=Administrator", + scope=ldb.SCOPE_SUBTREE, + attrs=["replPropertyMetaData"], + controls=["local_oid:%s:0" + % dsdb.DSDB_CONTROL_INVALID_NOT_IMPLEMENTED]) + except ldb.LdbError as e: + self.fail("Should have not raised an exception") + + def test_error_on_invalid_critical_control(self): + try: + res = self.samdb.search(expression="cn=Administrator", + scope=ldb.SCOPE_SUBTREE, + attrs=["replPropertyMetaData"], + controls=["local_oid:%s:1" + % dsdb.DSDB_CONTROL_INVALID_NOT_IMPLEMENTED]) + except ldb.LdbError as e: + if e[0] != ldb.ERR_UNSUPPORTED_CRITICAL_EXTENSION: + self.fail("Got %s should have got ERR_UNSUPPORTED_CRITICAL_EXTENSION" + % e[1]) |