s4:Fix regression in dsdb_dn code - all parses of the DN would be rejected
authorAndrew Bartlett <abartlet@samba.org>
Tue, 10 Nov 2009 04:20:07 +0000 (15:20 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 11 Nov 2009 21:11:20 +0000 (08:11 +1100)
This is most likely the cause of the DRS replication failures I
observed with my changes.

Andrew Bartlett

source4/dsdb/schema/schema_syntax.c

index d50044acd078a8cf1bfa9e6eab7c96b1a88606db..41d4e297aa02c423d9b397886887e8a50e86052c 100644 (file)
@@ -1298,7 +1298,11 @@ static WERROR dsdb_syntax_DN_BINARY_drsuapi_to_ldb(struct ldb_context *ldb,
 
                /* set binary stuff */
                dsdb_dn = dsdb_dn_construct(tmp_ctx, dn, id3.binary, attr->syntax->ldap_oid);
-
+               if (!dsdb_dn) {
+                       /* If this fails, it must be out of memory, we know the ldap_oid is valid */
+                       talloc_free(tmp_ctx);
+                       W_ERROR_HAVE_NO_MEMORY(dsdb_dn);
+               }
                out->values[i] = data_blob_string_const(dsdb_dn_get_extended_linearized(out->values, dsdb_dn, 1));
                talloc_free(tmp_ctx);
        }
@@ -1342,7 +1346,7 @@ static WERROR dsdb_syntax_DN_BINARY_ldb_to_drsuapi(struct ldb_context *ldb,
 
                dsdb_dn = dsdb_dn_parse(tmp_ctx, ldb, &in->values[i], attr->syntax->ldap_oid);
 
-               if (dsdb_dn) {
+               if (!dsdb_dn) {
                        talloc_free(tmp_ctx);
                        return ntstatus_to_werror(NT_STATUS_INVALID_PARAMETER);
                }