s4-schema: don't fill in the extended DN with a zero GUID
authorAndrew Tridgell <tridge@samba.org>
Mon, 21 Dec 2009 10:01:33 +0000 (21:01 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 1 Jan 2010 21:16:52 +0000 (08:16 +1100)
sometimes windows sends us a zero GUID in a DRS DN.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source4/dsdb/schema/schema_syntax.c

index 0873779811412e7ad2e27f05e1e7ae18fcbed4e2..843b65d59d9dda1eca954118a7b49af9d2b0e00c 100644 (file)
@@ -1077,20 +1077,21 @@ WERROR dsdb_syntax_one_DN_drsuapi_to_ldb(TALLOC_CTX *mem_ctx, struct ldb_context
                W_ERROR_HAVE_NO_MEMORY(dn);
        }
 
-       status = GUID_to_ndr_blob(&id3.guid, tmp_ctx, &guid_blob);
-       if (!NT_STATUS_IS_OK(status)) {
-               talloc_free(tmp_ctx);
-               return ntstatus_to_werror(status);
-       }
+       if (!GUID_all_zero(&id3.guid)) {
+               status = GUID_to_ndr_blob(&id3.guid, tmp_ctx, &guid_blob);
+               if (!NT_STATUS_IS_OK(status)) {
+                       talloc_free(tmp_ctx);
+                       return ntstatus_to_werror(status);
+               }
        
-       ret = ldb_dn_set_extended_component(dn, "GUID", &guid_blob);
-       if (ret != LDB_SUCCESS) {
-               talloc_free(tmp_ctx);
-               return WERR_FOOBAR;
+               ret = ldb_dn_set_extended_component(dn, "GUID", &guid_blob);
+               if (ret != LDB_SUCCESS) {
+                       talloc_free(tmp_ctx);
+                       return WERR_FOOBAR;
+               }
+               talloc_free(guid_blob.data);
        }
        
-       talloc_free(guid_blob.data);
-       
        if (id3.__ndr_size_sid) {
                DATA_BLOB sid_blob;
                ndr_err = ndr_push_struct_blob(&sid_blob, tmp_ctx, iconv_convenience, &id3.sid,