summaryrefslogtreecommitdiff
path: root/source4/libnet
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-09-14 17:34:55 +1000
committerAndrew Tridgell <tridge@samba.org>2010-09-15 15:39:35 +1000
commit0c447e316f17e64becaf70c91006b90de21887df (patch)
tree18bd4b5a0320b49fe037c16b9e05a4ad49584ff8 /source4/libnet
parentfede78f29d15bb718186122f136cc25f0557773f (diff)
downloadsamba-0c447e316f17e64becaf70c91006b90de21887df.tar.gz
samba-0c447e316f17e64becaf70c91006b90de21887df.tar.bz2
samba-0c447e316f17e64becaf70c91006b90de21887df.zip
s4-libnet: use finddcs_cldap() in libnet_lookup
this may later be changed to do fallback to NBT as well, but for now cldap is sufficient Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/libnet')
-rw-r--r--source4/libnet/libnet_lookup.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/source4/libnet/libnet_lookup.c b/source4/libnet/libnet_lookup.c
index 36c747b951..f8bdc8ff05 100644
--- a/source4/libnet/libnet_lookup.c
+++ b/source4/libnet/libnet_lookup.c
@@ -29,6 +29,7 @@
#include "lib/messaging/messaging.h"
#include "lib/messaging/irpc.h"
#include "libcli/resolve/resolve.h"
+#include "libcli/libcli.h"
#include "libcli/finddcs.h"
#include "libcli/security/security.h"
#include "librpc/gen_ndr/lsa.h"
@@ -191,15 +192,14 @@ struct tevent_req *libnet_LookupDCs_send(struct libnet_context *ctx,
struct libnet_LookupDCs *io)
{
struct tevent_req *req;
- struct messaging_context *msg_ctx =
- messaging_client_init(mem_ctx,
- lpcfg_messaging_path(mem_ctx, ctx->lp_ctx),
- ctx->event_ctx);
-
- req = finddcs_send(mem_ctx, lpcfg_netbios_name(ctx->lp_ctx),
- lpcfg_nbt_port(ctx->lp_ctx), io->in.domain_name,
- io->in.name_type, NULL, ctx->resolve_ctx,
- ctx->event_ctx, msg_ctx);
+ struct finddcs finddcs_io;
+
+ ZERO_STRUCT(finddcs_io);
+ finddcs_io.in.dns_domain_name = lpcfg_realm(ctx->lp_ctx);
+ finddcs_io.in.minimum_dc_flags = NBT_SERVER_LDAP | NBT_SERVER_DS | NBT_SERVER_WRITABLE;
+
+
+ req = finddcs_cldap_send(mem_ctx, &finddcs_io, ctx->resolve_ctx, ctx->event_ctx);
return req;
}
@@ -216,8 +216,14 @@ NTSTATUS libnet_LookupDCs_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
struct libnet_LookupDCs *io)
{
NTSTATUS status;
- status = finddcs_recv(req, mem_ctx, &io->out.num_dcs, &io->out.dcs);
- /* "req" already freed here */
+ struct finddcs finddcs_io;
+ status = finddcs_cldap_recv(req, mem_ctx, &finddcs_io);
+ talloc_free(req);
+ io->out.num_dcs = 1;
+ io->out.dcs = talloc(mem_ctx, struct nbt_dc_name);
+ NT_STATUS_HAVE_NO_MEMORY(io->out.dcs);
+ io->out.dcs[0].address = finddcs_io.out.address;
+ io->out.dcs[0].name = finddcs_io.out.netlogon.data.nt5_ex.pdc_dns_name;
return status;
}