summaryrefslogtreecommitdiff
path: root/source4/libcli/resolve
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-09-19 08:23:03 -0700
committerAndrew Tridgell <tridge@samba.org>2009-09-19 08:23:03 -0700
commit92786aebf1b8aa17612ebaf5dd0ee8cd4abf9616 (patch)
treefdb5fc1bc3ed91981f045d9fed508ccd96bdc65d /source4/libcli/resolve
parent7c542406b192cd72c40778850d92771974d6466c (diff)
downloadsamba-92786aebf1b8aa17612ebaf5dd0ee8cd4abf9616.tar.gz
samba-92786aebf1b8aa17612ebaf5dd0ee8cd4abf9616.tar.bz2
samba-92786aebf1b8aa17612ebaf5dd0ee8cd4abf9616.zip
s4-resolve: fixed a crash bug on timeout
We were creating the name resolution context as a child of lp_ctx, which meant when we gave up on a connection the timer on name resolution kept running, and when it timed out the callback crashed as the socket was already removed.
Diffstat (limited to 'source4/libcli/resolve')
-rw-r--r--source4/libcli/resolve/resolve.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source4/libcli/resolve/resolve.c b/source4/libcli/resolve/resolve.c
index 6a3d5daecc..0ad3a75e89 100644
--- a/source4/libcli/resolve/resolve.c
+++ b/source4/libcli/resolve/resolve.c
@@ -136,6 +136,7 @@ static struct composite_context *setup_next_method(struct composite_context *c)
general name resolution - async send
*/
struct composite_context *resolve_name_all_send(struct resolve_context *ctx,
+ TALLOC_CTX *mem_ctx,
uint32_t flags,
uint16_t port,
struct nbt_name *name,
@@ -148,7 +149,7 @@ struct composite_context *resolve_name_all_send(struct resolve_context *ctx,
return NULL;
}
- c = composite_create(ctx, event_ctx);
+ c = composite_create(mem_ctx, event_ctx);
if (c == NULL) return NULL;
if (composite_nomem(c->event_ctx, c)) return c;
@@ -221,10 +222,11 @@ NTSTATUS resolve_name_all_recv(struct composite_context *c,
}
struct composite_context *resolve_name_send(struct resolve_context *ctx,
+ TALLOC_CTX *mem_ctx,
struct nbt_name *name,
struct tevent_context *event_ctx)
{
- return resolve_name_all_send(ctx, 0, 0, name, event_ctx);
+ return resolve_name_all_send(ctx, mem_ctx, 0, 0, name, event_ctx);
}
NTSTATUS resolve_name_recv(struct composite_context *c,
@@ -253,7 +255,7 @@ NTSTATUS resolve_name(struct resolve_context *ctx,
const char **reply_addr,
struct tevent_context *ev)
{
- struct composite_context *c = resolve_name_send(ctx, name, ev);
+ struct composite_context *c = resolve_name_send(ctx, mem_ctx, name, ev);
return resolve_name_recv(c, mem_ctx, reply_addr);
}