From ae272acbdba5a8682dcdac98a59636863c129c8a Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Thu, 18 Nov 2010 10:44:52 +0100 Subject: s4:repl_meta_data LDB module - allow also special DNs to be renamed correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do always escape RDN values - this fixes bug #7794 Autobuild-User: Matthias Dieter Wallnöfer Autobuild-Date: Thu Nov 18 10:43:40 UTC 2010 on sn-devel-104 --- source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 2 +- source4/dsdb/tests/python/sam.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 3db1fe9590..f05d83ebaa 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -2609,7 +2609,7 @@ static int replmd_delete(struct ldb_module *module, struct ldb_request *req) /* Add a formatted child */ retb = ldb_dn_add_child_fmt(new_dn, "%s=%s\\0ADEL:%s", rdn_name, - rdn_value->data, + ldb_dn_escape_value(tmp_ctx, *rdn_value), GUID_string(tmp_ctx, &guid)); if (!retb) { DEBUG(0,(__location__ ": Unable to add a formatted child to dn: %s", diff --git a/source4/dsdb/tests/python/sam.py b/source4/dsdb/tests/python/sam.py index b64cce1c3f..c3490dae67 100755 --- a/source4/dsdb/tests/python/sam.py +++ b/source4/dsdb/tests/python/sam.py @@ -92,6 +92,7 @@ class SamTests(unittest.TestCase): self.delete_force(self.ldb, "cn=ldaptestuser,cn=users," + self.base_dn) self.delete_force(self.ldb, "cn=ldaptestuser2,cn=users," + self.base_dn) + self.delete_force(self.ldb, "cn=ldaptest\,specialuser,cn=users," + self.base_dn) self.delete_force(self.ldb, "cn=ldaptestcomputer,cn=computers," + self.base_dn) self.delete_force(self.ldb, "cn=ldaptestgroup,cn=users," + self.base_dn) self.delete_force(self.ldb, "cn=ldaptestgroup2,cn=users," + self.base_dn) @@ -595,6 +596,12 @@ class SamTests(unittest.TestCase): self.delete_force(self.ldb, "cn=ldaptestgroup,cn=users," + self.base_dn) self.delete_force(self.ldb, "cn=ldaptestgroup2,cn=users," + self.base_dn) + # Make also a small test for accounts with special DNs ("," in this case) + ldb.add({ + "dn": "cn=ldaptest\,specialuser,cn=users," + self.base_dn, + "objectclass": "user"}) + self.delete_force(self.ldb, "cn=ldaptest\,specialuser,cn=users," + self.base_dn) + def test_sam_attributes(self): """Test the behaviour of special attributes of SAM objects""" print "Testing the behaviour of special attributes of SAM objects\n""" -- cgit