summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/libnet/libnet_lookup.c58
-rw-r--r--source4/torture/torture.c2
2 files changed, 56 insertions, 4 deletions
diff --git a/source4/torture/libnet/libnet_lookup.c b/source4/torture/libnet/libnet_lookup.c
index 058d43574c..b101f62960 100644
--- a/source4/torture/libnet/libnet_lookup.c
+++ b/source4/torture/libnet/libnet_lookup.c
@@ -32,21 +32,71 @@ BOOL torture_lookup(void)
TALLOC_CTX *mem_ctx;
struct libnet_Lookup lookup;
const char address[16];
- const char* methods[] = { "wins", "bcast", NULL };
+ const char** methods = lp_name_resolve_order();
- mem_ctx = talloc_init("test_userinfo");
+ mem_ctx = talloc_init("test_lookup");
lookup.in.hostname = lp_netbios_name();
- lookup.in.methods = NULL;
- lookup.in.type = NBT_NAME_SERVER;
+ lookup.in.methods = lp_name_resolve_order();
+ lookup.in.type = NBT_NAME_CLIENT;
lookup.out.address = (const char**)&address;
status = libnet_Lookup(mem_ctx, &lookup);
if (!NT_STATUS_IS_OK(status)) {
+ printf("Couldn't lookup name %s: %s\n", lookup.in.hostname, nt_errstr(status));
+ return False;
+ }
+
+ return True;
+}
+
+
+BOOL torture_lookup_host(void)
+{
+ NTSTATUS status;
+ TALLOC_CTX *mem_ctx;
+ struct libnet_Lookup lookup;
+ const char address[16];
+ const char** methods = lp_name_resolve_order();
+
+ mem_ctx = talloc_init("test_lookup_host");
+
+ lookup.in.hostname = lp_netbios_name();
+ lookup.in.methods = lp_name_resolve_order();
+ lookup.out.address = (const char**)&address;
+
+ status = libnet_LookupHost(mem_ctx, &lookup);
+
+ if (!NT_STATUS_IS_OK(status)) {
printf("Couldn't lookup host %s: %s\n", lookup.in.hostname, nt_errstr(status));
return False;
}
return True;
}
+
+
+BOOL torture_lookup_pdc(void)
+{
+ NTSTATUS status;
+ TALLOC_CTX *mem_ctx;
+ struct libnet_Lookup lookup;
+ const char address[16];
+ const char** methods = lp_name_resolve_order();
+
+ mem_ctx = talloc_init("test_lookup_pdc");
+
+ lookup.in.hostname = lp_workgroup();
+ lookup.in.methods = lp_name_resolve_order();
+ lookup.out.address = (const char**)&address;
+
+ status = libnet_LookupPdc(mem_ctx, &lookup);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Couldn't lookup pdc %s: %s\n", lookup.in.hostname, nt_errstr(status));
+ return False;
+ }
+
+ return True;
+}
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index 68a0f610fe..2cb9a22bcb 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -2343,6 +2343,8 @@ static struct {
{"NET-USERDEL", torture_userdel, 0},
{"NET-DOMOPEN", torture_domainopen, 0},
{"NET-API-LOOKUP", torture_lookup, 0},
+ {"NET-API-LOOKUPHOST", torture_lookup_host, 0},
+ {"NET-API-LOOKUPPDC", torture_lookup_pdc, 0},
{"NET-API-CREATEUSER", torture_createuser, 0},
{NULL, NULL, 0}};