s4:dns_server: allocate substructures of struct dns_request_state on the correct...
authorStefan Metzmacher <metze@samba.org>
Tue, 14 Oct 2014 07:34:29 +0000 (09:34 +0200)
committerAmitay Isaacs <amitay@samba.org>
Tue, 18 Nov 2014 03:17:09 +0000 (04:17 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
source4/dns_server/dns_crypto.c
source4/dns_server/dns_query.c
source4/dns_server/dns_server.c
source4/dns_server/dns_server.h

index aba906dedb6287f50605625f5002d5d09996a9f9..3f199de3344ac4429bfe136a92cc16cbc97ffcae 100644 (file)
@@ -131,7 +131,7 @@ WERROR dns_verify_tsig(struct dns_server *dns,
        /* We got a TSIG, so we need to sign our reply */
        state->sign = true;
 
-       state->tsig = talloc_zero(mem_ctx, struct dns_res_rec);
+       state->tsig = talloc_zero(state->mem_ctx, struct dns_res_rec);
        if (state->tsig == NULL) {
                return WERR_NOMEM;
        }
@@ -226,7 +226,7 @@ WERROR dns_verify_tsig(struct dns_server *dns,
        }
 
        state->authenticated = true;
-       state->key_name = talloc_strdup(mem_ctx, tkey->name);
+       state->key_name = talloc_strdup(state->mem_ctx, tkey->name);
        if (state->key_name == NULL) {
                return WERR_NOMEM;
        }
index 16e14c1b86b31b88c6e777d02ad788800484750f..4e3c6ccd7dfc1e6f7f27c0f2e02a8d4bdda17a5b 100644 (file)
@@ -529,7 +529,7 @@ static WERROR handle_tkey(struct dns_server *dns,
                                                                reply.data,
                                                                reply.length);
                        state->sign = true;
-                       state->key_name = talloc_strdup(mem_ctx, tkey->name);
+                       state->key_name = talloc_strdup(state->mem_ctx, tkey->name);
                        if (state->key_name == NULL) {
                                return WERR_NOMEM;
                        }
index 7ea70dbcf21cb1d846eefcd309e20ed414bfe2e5..f1a4c4c747f7ddfd509d221e4241df5447505fae 100644 (file)
@@ -125,6 +125,7 @@ static struct tevent_req *dns_process_send(TALLOC_CTX *mem_ctx,
        if (req == NULL) {
                return NULL;
        }
+       state->state.mem_ctx = state;
        state->in = in;
 
        state->dns = dns;
index 19fd7a9a807fc20362fd438c49e02e4141d299c8..3423ee03593a85d4f488807130bc21f0a5de433e 100644 (file)
@@ -60,6 +60,7 @@ struct dns_server {
 };
 
 struct dns_request_state {
+       TALLOC_CTX *mem_ctx;
        uint16_t flags;
        bool authenticated;
        bool sign;