summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-11-23 09:19:11 +0100
committerMichael Adam <obnox@samba.org>2012-11-30 17:17:20 +0100
commit813492676c5b876d309bb2db12c794c513fab5c7 (patch)
tree597e0f47e9540024d2de61b1083fc13ec089688c
parentb3486f4e1a2108bd3af7ce760c8410a560c5237d (diff)
downloadsamba-813492676c5b876d309bb2db12c794c513fab5c7.tar.gz
samba-813492676c5b876d309bb2db12c794c513fab5c7.tar.bz2
samba-813492676c5b876d309bb2db12c794c513fab5c7.zip
s4:dsdb/descriptor: add some error checks to descriptor_{add,modify}
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
-rw-r--r--source4/dsdb/samdb/ldb_modules/descriptor.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/descriptor.c b/source4/dsdb/samdb/ldb_modules/descriptor.c
index fb99ab3c23..21a559f678 100644
--- a/source4/dsdb/samdb/ldb_modules/descriptor.c
+++ b/source4/dsdb/samdb/ldb_modules/descriptor.c
@@ -576,7 +576,13 @@ static int descriptor_add(struct ldb_module *module, struct ldb_request *req)
sd = get_new_descriptor(module, dn, req,
objectclass, parent_sd,
user_sd, NULL, sd_flags);
+ if (sd == NULL) {
+ return ldb_operr(ldb);
+ }
msg = ldb_msg_copy_shallow(req, req->op.add.message);
+ if (msg == NULL) {
+ return ldb_oom(ldb);
+ }
if (sd != NULL) {
if (sd_element != NULL) {
sd_element->values[0] = *sd;
@@ -696,7 +702,13 @@ static int descriptor_modify(struct ldb_module *module, struct ldb_request *req)
sd = get_new_descriptor(module, dn, req,
objectclass, parent_sd,
user_sd, old_sd, sd_flags);
+ if (sd == NULL) {
+ return ldb_operr(ldb);
+ }
msg = ldb_msg_copy_shallow(req, req->op.mod.message);
+ if (msg == NULL) {
+ return ldb_oom(ldb);
+ }
if (sd != NULL) {
struct ldb_message_element *sd_element;
if (user_sd != NULL) {