s4:dsdb 'attrs' must be static (otherwise segv with async)
authorAndrew Bartlett <abartlet@samba.org>
Fri, 23 Oct 2009 03:58:09 +0000 (14:58 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 23 Oct 2009 04:43:03 +0000 (15:43 +1100)
The async code makes this really easy to mess up...

Andrew Bartlett

source4/dsdb/samdb/ldb_modules/new_partition.c

index c497d97aa5dd624d9ceb7cfed1f21ecf838ee592..47394f4e062bd22462c02159f640cd6e798a0046 100644 (file)
@@ -151,7 +151,8 @@ static int new_partition_add(struct ldb_module *module, struct ldb_request *req)
        if (!ldb_msg_find_element(req->op.add.message, "instanceType")) {
                return ldb_next_request(module, req);           
        } else {
-               const char *no_attrs[] = { NULL };
+               /* This needs to be 'static' to ensure it does not move, and is not on the stack */
+               static const char *no_attrs[] = { NULL };
                unsigned int instanceType = ldb_msg_find_attr_as_uint(req->op.add.message, "instanceType", 0);
                if (!(instanceType & INSTANCE_TYPE_IS_NC_HEAD)) {
                        return ldb_next_request(module, req);