mirror of
https://github.com/samba-team/samba.git
synced 2025-02-22 05:57:43 +03:00
r25215: replace talloc_append_string() with talloc_strdup_append_buffer()
metze
This commit is contained in:
parent
32bb276920
commit
8f2db3c130
@ -1279,6 +1279,7 @@ static char *ldb_dn_canonical(void *mem_ctx, struct ldb_dn *dn, int ex_format) {
|
|||||||
int i;
|
int i;
|
||||||
TALLOC_CTX *tmpctx;
|
TALLOC_CTX *tmpctx;
|
||||||
char *cracked = NULL;
|
char *cracked = NULL;
|
||||||
|
const char *format = (ex_format ? "\n" : "/" );
|
||||||
|
|
||||||
if ( ! ldb_dn_validate(dn)) {
|
if ( ! ldb_dn_validate(dn)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1305,32 +1306,23 @@ static char *ldb_dn_canonical(void *mem_ctx, struct ldb_dn *dn, int ex_format) {
|
|||||||
|
|
||||||
/* Only domain components? Finish here */
|
/* Only domain components? Finish here */
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
if (ex_format) {
|
cracked = talloc_strdup_append_buffer(cracked, format);
|
||||||
cracked = talloc_append_string(tmpctx, cracked, "\n");
|
|
||||||
} else {
|
|
||||||
cracked = talloc_append_string(tmpctx, cracked, "/");
|
|
||||||
}
|
|
||||||
talloc_steal(mem_ctx, cracked);
|
talloc_steal(mem_ctx, cracked);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now walk backwards appending remaining components */
|
/* Now walk backwards appending remaining components */
|
||||||
for (; i > 0; i--) {
|
for (; i > 0; i--) {
|
||||||
cracked = talloc_asprintf_append(cracked, "/%s",
|
cracked = talloc_asprintf_append_buffer(cracked, "/%s",
|
||||||
ldb_dn_escape_value(tmpctx, dn->components[i].value));
|
ldb_dn_escape_value(tmpctx, dn->components[i].value));
|
||||||
if (!cracked) {
|
if (!cracked) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Last one, possibly a newline for the 'ex' format */
|
/* Last one, possibly a newline for the 'ex' format */
|
||||||
if (ex_format) {
|
cracked = talloc_asprintf_append_buffer(cracked, "%s%s", format,
|
||||||
cracked = talloc_asprintf_append(cracked, "\n%s",
|
ldb_dn_escape_value(tmpctx, dn->components[i].value));
|
||||||
ldb_dn_escape_value(tmpctx, dn->components[i].value));
|
|
||||||
} else {
|
|
||||||
cracked = talloc_asprintf_append(cracked, "/%s",
|
|
||||||
ldb_dn_escape_value(tmpctx, dn->components[i].value));
|
|
||||||
}
|
|
||||||
|
|
||||||
talloc_steal(mem_ctx, cracked);
|
talloc_steal(mem_ctx, cracked);
|
||||||
done:
|
done:
|
||||||
|
@ -145,7 +145,7 @@ struct TDB_DATA ltdb_key(struct ldb_module *module, struct ldb_dn *dn)
|
|||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
key_str = talloc_append_string(ldb, key_str, dn_folded);
|
key_str = talloc_strdup_append_buffer(key_str, dn_folded);
|
||||||
if (!key_str) {
|
if (!key_str) {
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user