mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
r10980: Use ldb_attr_cmp and ldb_dn_escape_value
Andrew Bartlett
(This used to be commit 2b1c88f628
)
This commit is contained in:
parent
9dff4c464a
commit
1f9703de40
@ -853,15 +853,15 @@ static char *ldb_dn_canonical(void *mem_ctx, const struct ldb_dn *dn, int ex_for
|
||||
|
||||
/* Walk backwards down the DN, grabbing 'dc' components at first */
|
||||
for (i = dn->comp_num - 1 ; i >= 0; i--) {
|
||||
if (strcasecmp(dn->components[i].name, "dc") != 0) {
|
||||
if (ldb_attr_cmp(dn->components[i].name, "dc") != 0) {
|
||||
break;
|
||||
}
|
||||
if (cracked) {
|
||||
cracked = talloc_asprintf(mem_ctx, "%s.%s",
|
||||
(const char *)dn->components[i].value.data,
|
||||
ldb_dn_escape_value(mem_ctx, dn->components[i].value),
|
||||
cracked);
|
||||
} else {
|
||||
cracked = talloc_strdup(mem_ctx, (const char *)dn->components[i].value.data);
|
||||
cracked = ldb_dn_escape_value(mem_ctx, dn->components[i].value);
|
||||
}
|
||||
if (!cracked) {
|
||||
return NULL;
|
||||
@ -881,7 +881,7 @@ static char *ldb_dn_canonical(void *mem_ctx, const struct ldb_dn *dn, int ex_for
|
||||
/* Now walk backwards appending remaining components */
|
||||
for (; i > 0; i--) {
|
||||
cracked = talloc_asprintf(mem_ctx, "%s/%s", cracked,
|
||||
dn->components[i].value.data);
|
||||
ldb_dn_escape_value(mem_ctx, dn->components[i].value));
|
||||
if (!cracked) {
|
||||
return NULL;
|
||||
}
|
||||
@ -890,10 +890,10 @@ static char *ldb_dn_canonical(void *mem_ctx, const struct ldb_dn *dn, int ex_for
|
||||
/* Last one, possibly a newline for the 'ex' format */
|
||||
if (ex_format) {
|
||||
cracked = talloc_asprintf(mem_ctx, "%s\n%s", cracked,
|
||||
dn->components[i].value.data);
|
||||
ldb_dn_escape_value(mem_ctx, dn->components[i].value));
|
||||
} else {
|
||||
cracked = talloc_asprintf(mem_ctx, "%s/%s", cracked,
|
||||
dn->components[i].value.data);
|
||||
ldb_dn_escape_value(mem_ctx, dn->components[i].value));
|
||||
}
|
||||
return cracked;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user