From 70f1f33af8e6e82506d0ee9ff6cc7e0923a7d0a1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 11 Dec 2007 22:23:20 +0100 Subject: r26402: Require a talloc context in libnetif. (This used to be commit a35e51871bbf1ab33fc316fa59e597b722769c50) --- source4/lib/socket/interface.c | 21 +++++++++++---------- source4/lib/socket/testsuite.c | 4 ++-- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/socket/interface.c b/source4/lib/socket/interface.c index d21923d972..241fcbff5e 100644 --- a/source4/lib/socket/interface.c +++ b/source4/lib/socket/interface.c @@ -63,7 +63,7 @@ static struct interface *iface_find(struct interface *interfaces, /**************************************************************************** add an interface to the linked list of interfaces ****************************************************************************/ -static void add_interface(struct in_addr ip, struct in_addr nmask, struct interface **interfaces) +static void add_interface(TALLOC_CTX *mem_ctx, struct in_addr ip, struct in_addr nmask, struct interface **interfaces) { struct interface *iface; struct in_addr bcast; @@ -73,7 +73,7 @@ static void add_interface(struct in_addr ip, struct in_addr nmask, struct interf return; } - iface = talloc(*interfaces == NULL ? talloc_autofree_context() : *interfaces, struct interface); + iface = talloc(*interfaces == NULL ? mem_ctx : *interfaces, struct interface); if (iface == NULL) return; @@ -110,7 +110,8 @@ This handles the following different forms: 4) ip/mask 5) bcast/mask **/ -static void interpret_interface(const char *token, +static void interpret_interface(TALLOC_CTX *mem_ctx, + const char *token, struct iface_struct *probed_ifaces, int total_probed, struct interface **local_interfaces) @@ -125,7 +126,7 @@ static void interpret_interface(const char *token, /* first check if it is an interface name */ for (i=0;ilp_ctx), &ifaces); + load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces); status = socket_create("ip", SOCKET_TYPE_DGRAM, &sock1, 0); torture_assert_ntstatus_ok(tctx, status, "creating DGRAM IP socket 1"); @@ -135,7 +135,7 @@ static bool test_tcp(struct torture_context *tctx) torture_assert_ntstatus_ok(tctx, status, "creating IP stream socket 1"); talloc_steal(mem_ctx, sock2); - load_interfaces(lp_interfaces(tctx->lp_ctx), &ifaces); + load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces); localhost = socket_address_from_strings(sock1, sock1->backend_name, iface_best_ip(ifaces, "127.0.0.1"), 0); torture_assert(tctx, localhost, "Localhost not found"); -- cgit