summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2010-01-30 02:57:33 -0500
committerSimo Sorce <idra@samba.org>2010-01-30 02:57:33 -0500
commit772d808ac862862330dd792ba8e83ba2b3c785b3 (patch)
tree4f5bc79d0ca4655ce336353a4df25cf0f869ba2d
parentdf7be036d7b4e08b18bd03399847dad41b78be50 (diff)
downloadsamba-772d808ac862862330dd792ba8e83ba2b3c785b3.tar.gz
samba-772d808ac862862330dd792ba8e83ba2b3c785b3.tar.bz2
samba-772d808ac862862330dd792ba8e83ba2b3c785b3.zip
s4:ldb Fix check made conditional by mistake
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index 568fc2a5a6..edc0215fbe 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -659,6 +659,13 @@ int ltdb_modify_internal(struct ldb_module *module,
switch (msg->elements[i].flags & LDB_FLAG_MOD_MASK) {
case LDB_FLAG_MOD_ADD:
+ if (el->num_values == 0) {
+ ldb_asprintf_errstring(ldb, "attribute %s on %s specified, but with 0 values (illigal)",
+ el->name, ldb_dn_get_linearized(msg2->dn));
+ ret = LDB_ERR_CONSTRAINT_VIOLATION;
+ goto done;
+ }
+
/* make a copy of the array so that a permissive
* control can remove duplicates without changing the
* original values, but do not copy data as we do not
@@ -673,16 +680,13 @@ int ltdb_modify_internal(struct ldb_module *module,
el->name = msg->elements[i].name;
el->num_values = msg->elements[i].num_values;
el->values = talloc_array(el, struct ldb_val, el->num_values);
+ if (el->values == NULL) {
+ ret = LDB_ERR_OTHER;
+ goto done;
+ }
for (j = 0; j < el->num_values; j++) {
el->values[j] = msg->elements[i].values[j];
}
-
- if (el->num_values == 0) {
- ldb_asprintf_errstring(ldb, "attribute %s on %s specified, but with 0 values (illigal)",
- el->name, ldb_dn_get_linearized(msg2->dn));
- ret = LDB_ERR_CONSTRAINT_VIOLATION;
- goto done;
- }
}
if (a && a->flags & LDB_ATTR_FLAG_SINGLE_VALUE) {