From cf2bb28014b2687bc5d971bf47f57aeb75b600c0 Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Sun, 22 Nov 2009 17:48:32 +0200 Subject: s4/schema: Handle Object(OR-Name) syntax in extended_dn_out module Windows displays attribute values with Object(OR-Name) syntax in plain DN format when queried through LDAP. Hence, we need to post-process such values specially in extended_dn_out.c module so they are always shown as plain DN, no matter what controls are passed for search request. --- source4/dsdb/samdb/ldb_modules/extended_dn_out.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'source4') diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn_out.c b/source4/dsdb/samdb/ldb_modules/extended_dn_out.c index 1249a9cdfa..c52953c206 100644 --- a/source4/dsdb/samdb/ldb_modules/extended_dn_out.c +++ b/source4/dsdb/samdb/ldb_modules/extended_dn_out.c @@ -398,6 +398,7 @@ static int extended_callback(struct ldb_request *req, struct ldb_reply *ares, /* Walk the retruned elements (but only if we have a schema to interpret the list with) */ for (i = 0; ac->schema && i < msg->num_elements; i++) { + bool make_extended_dn; const struct dsdb_attribute *attribute; attribute = dsdb_attribute_by_lDAPDisplayName(ac->schema, msg->elements[i].name); if (!attribute) { @@ -425,6 +426,13 @@ static int extended_callback(struct ldb_request *req, struct ldb_reply *ares, continue; } + make_extended_dn = ac->inject; + + /* Always show plain DN in case of Object(OR-Name) syntax */ + if (make_extended_dn) { + make_extended_dn = (strcmp(attribute->syntax->ldap_oid, DSDB_SYNTAX_OR_NAME) != 0); + } + for (j = 0; j < msg->elements[i].num_values; j++) { const char *dn_str; struct ldb_dn *dn; @@ -470,12 +478,12 @@ static int extended_callback(struct ldb_request *req, struct ldb_reply *ares, } } - if (!ac->inject) { + if (make_extended_dn) { + dn_str = dsdb_dn_get_extended_linearized(msg->elements[i].values, + dsdb_dn, ac->extended_type); + } else { dn_str = dsdb_dn_get_linearized(msg->elements[i].values, dsdb_dn); - } else { - dn_str = dsdb_dn_get_extended_linearized(msg->elements[i].values, - dsdb_dn, ac->extended_type); } if (!dn_str) { -- cgit