dsdb/schema: let dsdb_syntax_DN_BINARY_drsuapi_to_ldb return WERR_DS_INVALID_ATTRIBUT...
authorStefan Metzmacher <metze@samba.org>
Mon, 20 Dec 2021 16:48:44 +0000 (17:48 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 12 Jan 2022 03:09:52 +0000 (03:09 +0000)
When Object(OR-Name) uses dsdb_syntax_DN_BINARY_drsuapi_to_ldb() it
should genrate WERR_DS_INVALID_ATTRIBUTE_SYNTAX if the binary part
is not empty.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jan 12 03:09:52 UTC 2022 on sn-devel-184

source4/dsdb/schema/schema_syntax.c

index 82b4290813569dd2c8dc205b5d1b1257ea519ef8..b3df10a0217eb6ff0cacf123fb5ae886ee510ed6 100644 (file)
@@ -2055,7 +2055,15 @@ static WERROR dsdb_syntax_DN_BINARY_drsuapi_to_ldb(const struct dsdb_syntax_ctx
                /* 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 */
+                       if (errno == EINVAL) {
+                               /*
+                                * This might be Object(OR-Name)
+                                * failing because of a non empty
+                                * binary part.
+                                */
+                               talloc_free(tmp_ctx);
+                               return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+                       }
                        talloc_free(tmp_ctx);
                        W_ERROR_HAVE_NO_MEMORY(dsdb_dn);
                }