From 3751485c8432c0f6d3955f2b03a81cf4002d7a1b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 25 Feb 2010 12:47:38 +0100 Subject: s4:torture: use a connected CLDAP socket. This is needed because we don't (want) to specify an explicit local address. And the socket family (ipv4 vs. ipv6) needs to be autodetected based on the remote address before the socket() syscall. Otherwise we would try to connect to a ipv4 address through an ipv6only socket. metze --- source4/torture/ldap/cldapbench.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'source4/torture/ldap/cldapbench.c') diff --git a/source4/torture/ldap/cldapbench.c b/source4/torture/ldap/cldapbench.c index f77c0e00da..a63c78944b 100644 --- a/source4/torture/ldap/cldapbench.c +++ b/source4/torture/ldap/cldapbench.c @@ -80,8 +80,8 @@ static bool bench_cldap_netlogon(struct torture_context *tctx, const char *addre state->tctx = tctx; ZERO_STRUCT(search); - search.in.dest_address = address; - search.in.dest_port = lp_cldap_port(tctx->lp_ctx); + search.in.dest_address = NULL; + search.in.dest_port = 0; search.in.acct_control = -1; search.in.version = 6; @@ -147,16 +147,24 @@ static bool bench_cldap_rootdse(struct torture_context *tctx, const char *addres struct cldap_search search; struct bench_state *state; NTSTATUS status; + struct tsocket_address *dest_addr; + int ret; + + ret = tsocket_address_inet_from_strings(tctx, "ip", + address, + lp_cldap_port(tctx->lp_ctx), + &dest_addr); + CHECK_VAL(ret, 0); /* cldap_socket_init should now know about the dest. address */ - status = cldap_socket_init(tctx, tctx->ev, NULL, NULL, &cldap); + status = cldap_socket_init(tctx, tctx->ev, NULL, dest_addr, &cldap); torture_assert_ntstatus_ok(tctx, status, "cldap_socket_init"); state = talloc_zero(tctx, struct bench_state); ZERO_STRUCT(search); - search.in.dest_address = address; - search.in.dest_port = lp_cldap_port(tctx->lp_ctx); + search.in.dest_address = NULL; + search.in.dest_port = 0; search.in.filter = "(objectClass=*)"; search.in.timeout = 2; search.in.retries = 1; -- cgit