Do the ADD/MOD early, don't risk dereferencing msg without assignment.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
return ldb_oom(ldb);
}
- if (req->operation == LDB_MODIFY) {
+ switch (req->operation) {
+ case LDB_MODIFY:
msg = req->op.mod.message;
- } else if (req->operation == LDB_ADD) {
+ break;
+ case LDB_ADD:
msg = req->op.add.message;
+ break;
+ default:
+ talloc_free(tmp_ctx);
+ return LDB_ERR_OPERATIONS_ERROR;
}
if (implicit_validated_write_control != NULL) {
}
search_res = acl_res->msgs[0];
- } else if (req->operation == LDB_ADD) {
- search_res = msg;
} else {
- talloc_free(tmp_ctx);
- return LDB_ERR_OPERATIONS_ERROR;
+ search_res = msg;
}
/* Check if the account has objectclass 'computer' or 'server'. */