summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-11-10 12:49:48 +0100
committerAndrew Bartlett <abartlet@samba.org>2009-11-12 16:34:12 +1100
commit1012b806a7d54e8d442bd14573d9c00747a23f74 (patch)
tree61cba32d41b6ab3479ccbb20167d01d83201fa07 /source4
parent2a601719f219686b3a3b38b61b8f549941ecf632 (diff)
downloadsamba-1012b806a7d54e8d442bd14573d9c00747a23f74.tar.gz
samba-1012b806a7d54e8d442bd14573d9c00747a23f74.tar.bz2
samba-1012b806a7d54e8d442bd14573d9c00747a23f74.zip
NET-API-BECOME-DC: resolve the host name to an address before calling
libnet_BecomeDC and libnet_UnbecomeDC() We're supposed to pass in source_dsa_address... metze
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index d990e803be..4b58eed587 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -32,6 +32,7 @@
#include "auth/auth.h"
#include "param/param.h"
#include "param/provision.h"
+#include "libcli/resolve/resolve.h"
struct test_become_dc_state {
struct libnet_context *ctx;
@@ -581,6 +582,8 @@ bool torture_net_become_dc(struct torture_context *torture)
int ldb_ret;
uint32_t i;
char *sam_ldb_path;
+ const char *address;
+ struct nbt_name name;
char *location = NULL;
torture_assert_ntstatus_ok(torture, torture_temp_dir(torture, "libnet_BecomeDC", &location),
@@ -592,6 +595,17 @@ bool torture_net_become_dc(struct torture_context *torture)
s->tctx = torture;
s->lp_ctx = torture->lp_ctx;
+ make_nbt_name_server(&name, torture_setting_string(torture, "host", NULL));
+
+ /* do an initial name resolution to find its IP */
+ status = resolve_name(lp_resolve_context(torture->lp_ctx),
+ &name, torture, &address, torture->ev);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Failed to resolve %s - %s\n",
+ name.name, nt_errstr(status));
+ return false;
+ }
+
s->netbios_name = lp_parm_string(torture->lp_ctx, NULL, "become dc", "smbtorture dc");
if (!s->netbios_name || !s->netbios_name[0]) {
s->netbios_name = "smbtorturedc";
@@ -618,7 +632,7 @@ bool torture_net_become_dc(struct torture_context *torture)
b.in.domain_dns_name = torture_join_dom_dns_name(s->tj);
b.in.domain_netbios_name = torture_join_dom_netbios_name(s->tj);
b.in.domain_sid = torture_join_sid(s->tj);
- b.in.source_dsa_address = torture_setting_string(torture, "host", NULL);
+ b.in.source_dsa_address = address;
b.in.dest_dsa_netbios_name = s->netbios_name;
b.in.callbacks.private_data = s;
@@ -700,7 +714,7 @@ cleanup:
ZERO_STRUCT(u);
u.in.domain_dns_name = torture_join_dom_dns_name(s->tj);
u.in.domain_netbios_name = torture_join_dom_netbios_name(s->tj);
- u.in.source_dsa_address = torture_setting_string(torture, "host", NULL);
+ u.in.source_dsa_address = address;
u.in.dest_dsa_netbios_name = s->netbios_name;
status = libnet_UnbecomeDC(s->ctx, s, &u);