summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2011-10-21 20:09:37 +0200
committerMatthieu Patou <mat@samba.org>2011-10-22 00:01:59 +0200
commit950f1218b3b5b85d95190083985632a4e1046f10 (patch)
treeffd47e4cd106cf433dc91e336a64202a16ed9bf4 /source4
parent4d2d33ee09941ddb211e21788c01d886730224c2 (diff)
downloadsamba-950f1218b3b5b85d95190083985632a4e1046f10.tar.gz
samba-950f1218b3b5b85d95190083985632a4e1046f10.tar.bz2
samba-950f1218b3b5b85d95190083985632a4e1046f10.zip
s4-cldap: fix cldap_socket_init to always specify the dest if local is NULL
Autobuild-User: Matthieu Patou <mat@samba.org> Autobuild-Date: Sat Oct 22 00:02:00 CEST 2011 on sn-devel-104
Diffstat (limited to 'source4')
-rw-r--r--source4/libcli/finddcs_cldap.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/source4/libcli/finddcs_cldap.c b/source4/libcli/finddcs_cldap.c
index 0643135cae..6df15a9b4e 100644
--- a/source4/libcli/finddcs_cldap.c
+++ b/source4/libcli/finddcs_cldap.c
@@ -27,6 +27,7 @@
#include "libcli/finddc.h"
#include "libcli/security/security.h"
#include "lib/util/tevent_ntstatus.h"
+#include "lib/tsocket/tsocket.h"
#include "libcli/composite/composite.h"
struct finddcs_cldap_state {
@@ -131,10 +132,6 @@ static bool finddcs_cldap_ipaddress(struct finddcs_cldap_state *state, struct fi
}
state->srv_addresses[1] = NULL;
state->srv_address_index = 0;
- status = cldap_socket_init(state, NULL, NULL, &state->cldap);
- if (tevent_req_nterror(state->req, status)) {
- return false;
- }
finddcs_cldap_next_server(state);
return tevent_req_is_nterror(state->req, &status);
@@ -201,6 +198,9 @@ static bool finddcs_cldap_nbt_lookup(struct finddcs_cldap_state *state,
static void finddcs_cldap_next_server(struct finddcs_cldap_state *state)
{
struct tevent_req *subreq;
+ struct tsocket_address *dest;
+ int ret;
+ NTSTATUS status;
if (state->srv_addresses[state->srv_address_index] == NULL) {
tevent_req_nterror(state->req, NT_STATUS_OBJECT_NAME_NOT_FOUND);
@@ -208,14 +208,25 @@ static void finddcs_cldap_next_server(struct finddcs_cldap_state *state)
return;
}
+ /* we should get the port from the SRV response */
+ ret = tsocket_address_inet_from_strings(state, "ip",
+ state->srv_addresses[state->srv_address_index],
+ 389,
+ &dest);
+ if (tevent_req_error(state->req, ret)) {
+ return;
+ }
+
+ status = cldap_socket_init(state, NULL, dest, &state->cldap);
+ if (tevent_req_nterror(state->req, status)) {
+ return;
+ }
+
state->netlogon = talloc_zero(state, struct cldap_netlogon);
if (tevent_req_nomem(state->netlogon, state->req)) {
return;
}
- state->netlogon->in.dest_address = state->srv_addresses[state->srv_address_index];
- /* we should get the port from the SRV response */
- state->netlogon->in.dest_port = 389;
if (strchr(state->domain_name, '.')) {
state->netlogon->in.realm = state->domain_name;
}
@@ -307,11 +318,6 @@ static void finddcs_cldap_name_resolved(struct composite_context *ctx)
state->srv_address_index = 0;
- status = cldap_socket_init(state, NULL, NULL, &state->cldap);
- if (tevent_req_nterror(state->req, status)) {
- return;
- }
-
finddcs_cldap_next_server(state);
}
@@ -338,11 +344,6 @@ static void finddcs_cldap_srv_resolved(struct composite_context *ctx)
state->srv_address_index = 0;
- status = cldap_socket_init(state, NULL, NULL, &state->cldap);
- if (tevent_req_nterror(state->req, status)) {
- return;
- }
-
finddcs_cldap_next_server(state);
}