s4:dsdb/descriptor: add some error checks to descriptor_{add,modify}
authorStefan Metzmacher <metze@samba.org>
Fri, 23 Nov 2012 08:19:11 +0000 (09:19 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 30 Nov 2012 16:17:20 +0000 (17:17 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source4/dsdb/samdb/ldb_modules/descriptor.c

index fb99ab3c23edd877a113685054a30e714e622716..21a559f678669f9d3ab9d04c280b3a4d53e16ca5 100644 (file)
@@ -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) {