1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-12 20:58:37 +03:00

ldb: check return values

Signed-off-by: Andrej Gessel <Andrej.Gessel@janztec.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Andrej Gessel 2018-06-15 11:02:15 +02:00 committed by Jeremy Allison
parent 97eaeea6a1
commit 6b52d21e60
2 changed files with 11 additions and 1 deletions

View File

@ -450,6 +450,10 @@ normal_index:
list->count = el->values[0].length / LTDB_GUID_SIZE;
list->dn = talloc_array(list, struct ldb_val, list->count);
if (list->dn == NULL) {
talloc_free(msg);
return LDB_ERR_OPERATIONS_ERROR;
}
/*
* The actual data is on msg, due to
@ -715,6 +719,9 @@ static int ltdb_dn_list_store(struct ldb_module *module, struct ldb_dn *dn,
}
key.dptr = discard_const_p(unsigned char, ldb_dn_get_linearized(dn));
if (key.dptr == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
key.dsize = strlen((char *)key.dptr);
rec = tdb_fetch(ltdb->idxptr->itdb, key);

View File

@ -102,8 +102,11 @@ static int msg_add_distinguished_name(struct ldb_message *msg)
el.values = &val;
el.flags = 0;
val.data = (uint8_t *)ldb_dn_alloc_linearized(msg, msg->dn);
if (val.data == NULL) {
return -1;
}
val.length = strlen((char *)val.data);
ret = msg_add_element(msg, &el, 1);
return ret;
}