summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/common/ldb_dn.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c
index dc440ef3de..0649626d61 100644
--- a/source4/lib/ldb/common/ldb_dn.c
+++ b/source4/lib/ldb/common/ldb_dn.c
@@ -988,7 +988,11 @@ bool ldb_dn_add_base(struct ldb_dn *dn, struct ldb_dn *base)
}
if (dn->casefold && s) {
- t = talloc_asprintf(dn, "%s,%s", dn->casefold, s);
+ if (*dn->casefold) {
+ t = talloc_asprintf(dn, "%s,%s", dn->casefold, s);
+ } else {
+ t = talloc_strdup(dn, s);
+ }
LDB_FREE(dn->casefold);
dn->casefold = t;
}
@@ -1001,7 +1005,11 @@ bool ldb_dn_add_base(struct ldb_dn *dn, struct ldb_dn *base)
return false;
}
- t = talloc_asprintf(dn, "%s,%s", dn->linearized, s);
+ if (*dn->linearized) {
+ t = talloc_asprintf(dn, "%s,%s", dn->linearized, s);
+ } else {
+ t = talloc_strdup(dn, s);
+ }
if ( ! t) {
dn->invalid = true;
return false;