dsdb: Set syntax of userParameters to binary string, not unicode string
authorAndrew Bartlett <abartlet@samba.org>
Tue, 24 Sep 2013 17:12:24 +0000 (10:12 -0700)
committerStefan Metzmacher <metze@samba.org>
Wed, 9 Jul 2014 06:42:07 +0000 (08:42 +0200)
This means we continue to store the values as given on SAMR, assuming
that the SAMR buffer is little endian.  The syntax for this specific
object is forced to be a binary blob, so that it is not converted on
DRSUAPI.

This commit does not fix existing databases, nor pdb_samba_dsdb (used
by classicupgrade).

Andrew Bartlett

Bug: https://bugzilla.samba.org/show_bug.cgi?id=8077
Change-Id: I10bb6aaecc381194e3c0ce6b9163f961acbdcee1
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
source4/dsdb/schema/schema.h
source4/dsdb/schema/schema_syntax.c

index cac6f98a27e90575bd83f85cf500fd3fd6f0b4c3..457d986e3d02b4df4eabd7d0651b5e16cb0504b7 100644 (file)
@@ -74,6 +74,7 @@ struct dsdb_syntax {
                               const struct dsdb_attribute *attr,
                               const struct ldb_message_element *in);
        bool auto_normalise;
+       bool userParameters; /* Indicates the syntax userParameters should be forced to */
 };
 
 struct dsdb_attribute {
index c2e020825826855e3a40b0af1b860586953dbf37..c9ff588880bf7d6db8bef92598bcdebb5e8aae59 100644 (file)
@@ -2395,6 +2395,7 @@ static const struct dsdb_syntax dsdb_syntaxes[] = {
                .validate_ldb           = dsdb_syntax_DATA_BLOB_validate_ldb,
                .equality               = "octetStringMatch",
                .comment                = "Octet String",
+               .userParameters         = true
        },{
                .name                   = "String(Sid)",
                .ldap_oid               = LDB_SYNTAX_OCTET_STRING,
@@ -2665,6 +2666,16 @@ const struct dsdb_syntax *dsdb_syntax_for_attribute(const struct dsdb_attribute
        unsigned int i;
 
        for (i=0; i < ARRAY_SIZE(dsdb_syntaxes); i++) {
+               /*
+                * We must pretend that userParamters was declared
+                * binary string, so we can store the 'UTF16' (not
+                * really string) structure as given over SAMR to samba
+                */
+               if (dsdb_syntaxes[i].userParameters &&
+                   (strcasecmp(attr->lDAPDisplayName, "userParameters") == 0))
+               {
+                       return &dsdb_syntaxes[i];
+               }
                if (attr->oMSyntax != dsdb_syntaxes[i].oMSyntax) continue;
 
                if (attr->oMObjectClass.length != dsdb_syntaxes[i].oMObjectClass.length) continue;