summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/lib/ldb/common/ldb_attributes.c2
-rw-r--r--source4/lib/ldb/common/ldb_ldif.c6
-rw-r--r--source4/lib/ldb/common/ldb_msg.c2
3 files changed, 8 insertions, 2 deletions
diff --git a/source4/lib/ldb/common/ldb_attributes.c b/source4/lib/ldb/common/ldb_attributes.c
index a915666d78..3973fc515c 100644
--- a/source4/lib/ldb/common/ldb_attributes.c
+++ b/source4/lib/ldb/common/ldb_attributes.c
@@ -66,7 +66,7 @@ static int ldb_default_copy(struct ldb_context *ldb,
{
*out = ldb_val_dup(mem_ctx, in);
- if (out->length == 0) {
+ if (out->data == NULL && in->data != NULL) {
return -1;
}
diff --git a/source4/lib/ldb/common/ldb_ldif.c b/source4/lib/ldb/common/ldb_ldif.c
index 38866d7031..a5768b9796 100644
--- a/source4/lib/ldb/common/ldb_ldif.c
+++ b/source4/lib/ldb/common/ldb_ldif.c
@@ -590,6 +590,12 @@ struct ldb_ldif *ldb_ldif_read(struct ldb_context *ldb,
msg->dn = ldb_dn_explode(msg, value.data);
+ if (msg->dn == NULL) {
+ ldb_debug(ldb, LDB_DEBUG_ERROR, "Error: Unable to parse dn '%s'\n",
+ value.data);
+ goto failed;
+ }
+
while (next_attr(ldif, &s, &attr, &value) == 0) {
const struct ldb_attrib_handler *h;
struct ldb_message_element *el;
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index 197c42ddb5..f65c944eab 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -99,7 +99,7 @@ struct ldb_val ldb_val_dup(void *mem_ctx, const struct ldb_val *v)
{
struct ldb_val v2;
v2.length = v->length;
- if (v->length == 0) {
+ if (v->data == NULL) {
v2.data = NULL;
return v2;
}