From fea133b39d5fd5f9813a7ff79400dc039b236bce Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 24 Sep 2013 10:12:24 -0700 Subject: [PATCH] dsdb: Set syntax of userParameters to binary string, not unicode string 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 Signed-off-by: Andrew Bartlett --- source4/dsdb/schema/schema.h | 1 + source4/dsdb/schema/schema_syntax.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/source4/dsdb/schema/schema.h b/source4/dsdb/schema/schema.h index 538b858..8d92815 100644 --- a/source4/dsdb/schema/schema.h +++ b/source4/dsdb/schema/schema.h @@ -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 { diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c index c2e0208..e0b5d42 100644 --- a/source4/dsdb/schema/schema_syntax.c +++ b/source4/dsdb/schema/schema_syntax.c @@ -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,15 @@ 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 ((strcasecmp(attr->lDAPDisplayName, "userParameters") == 0) + && dsdb_syntaxes[i].userParameters) { + return &dsdb_syntaxes[i]; + } if (attr->oMSyntax != dsdb_syntaxes[i].oMSyntax) continue; if (attr->oMObjectClass.length != dsdb_syntaxes[i].oMObjectClass.length) continue; -- 1.8.4.rc3