From 44e6766c6a5281e0073853921540bb27fb2db37b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 17 Oct 2016 10:07:23 -0700 Subject: [PATCH] s3: cldap: cldap_multi_netlogon_send() fails with one bad IPv6 address. Analysis by: Rebecca Gellman Ignore cldap_socket_init() failure when sending multiple cldap netlogon requests. Allow cldap_netlogon_send() to catch the bad address and correctly return through a tevent subreq. Make sure cldap_search_send() copes with cldap parameter == NULL. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12381 Signed-off-by: Jeremy Allison --- libcli/cldap/cldap.c | 4 ++-- source3/libads/cldap.c | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/libcli/cldap/cldap.c b/libcli/cldap/cldap.c index c5977cc..b6f9887 100644 --- a/libcli/cldap/cldap.c +++ b/libcli/cldap/cldap.c @@ -586,7 +586,7 @@ struct tevent_req *cldap_search_send(TALLOC_CTX *mem_ctx, talloc_set_destructor(state, cldap_search_state_destructor); if (io->in.dest_address) { - if (cldap->connected) { + if (cldap != NULL && cldap->connected) { tevent_req_nterror(req, NT_STATUS_PIPE_CONNECTED); goto post; } @@ -600,7 +600,7 @@ struct tevent_req *cldap_search_send(TALLOC_CTX *mem_ctx, goto post; } } else { - if (!cldap->connected) { + if (cldap != NULL && !cldap->connected) { tevent_req_nterror(req, NT_STATUS_INVALID_ADDRESS); goto post; } diff --git a/source3/libads/cldap.c b/source3/libads/cldap.c index bd77943..586a04a 100644 --- a/source3/libads/cldap.c +++ b/source3/libads/cldap.c @@ -117,8 +117,21 @@ struct tevent_req *cldap_multi_netlogon_send( NULL, /* local_addr */ state->servers[i], &state->cldap[i]); - if (tevent_req_nterror(req, status)) { - return tevent_req_post(req, ev); + if (!NT_STATUS_IS_OK(status)) { + /* + * Don't error out all sends just + * because one cldap_socket_init() failed. + * Log it here, and the cldap_netlogon_send() + * will catch it (with in.dest_address == NULL) + * and correctly error out in + * cldap_multi_netlogon_done(). This still allows + * the other requests to be concurrently sent. + */ + DBG_NOTICE("cldap_socket_init failed for %s " + " error %s\n", + tsocket_address_string(state->servers[i], + req), + nt_errstr(status)); } state->ios[i].in.dest_address = NULL; -- 2.8.0.rc3.226.g39d4020