replmd: treat a zero GUID as not present in get_parsed_dns
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 2 Feb 2017 03:37:58 +0000 (16:37 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Thu, 9 Feb 2017 02:17:16 +0000 (03:17 +0100)
This roughly follows the pattern in the 2009 commit
0d5d7f58473c989bff4 by the Andrews Tridgell and Bartlett, which dealt
with zero GUIDs in replmd_add_fix_la(). That function is about to use
get_parsed_dns() [see next commit], and the other users of
get_parsed_dns don't really want to see zero guids, so it is simpler
to test here.

This makes hitting the GUID_all_zero branch of parsed_dn_find() even
more unlikely.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Pair-programmed-with: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/samdb/ldb_modules/repl_meta_data.c

index dbdcb102928e75e62f455b75f446d9409f6b0392..41c8eb2304b387b83d7462fb98a1fc60b2cb43f5 100644 (file)
@@ -2012,7 +2012,8 @@ static int get_parsed_dns(struct ldb_module *module, TALLOC_CTX *mem_ctx,
                dn = p->dsdb_dn->dn;
 
                status = dsdb_get_extended_dn_guid(dn, &p->guid, "GUID");
-               if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
+               if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND) ||
+                   unlikely(GUID_all_zero(&p->guid))) {
                        /* we got a DN without a GUID - go find the GUID */
                        int ret = dsdb_module_guid_by_dn(module, dn, &p->guid, parent);
                        if (ret != LDB_SUCCESS) {