[PATCH 1/3] dsdb: Set syntax of userParameters to binary string, not unicode string
abartlet at samba.org
abartlet at samba.org
Wed Jun 18 23:13:14 MDT 2014
From: Andrew Bartlett <abartlet at samba.org>
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
Change-Id: I10bb6aaecc381194e3c0ce6b9163f961acbdcee1
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=8077
---
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 cac6f98..457d986 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;
--
2.0.0
More information about the samba-technical
mailing list