summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/torture/libnet/libnet_lookup.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/source4/torture/libnet/libnet_lookup.c b/source4/torture/libnet/libnet_lookup.c
index 42baacc1cb..320b3c11cc 100644
--- a/source4/torture/libnet/libnet_lookup.c
+++ b/source4/torture/libnet/libnet_lookup.c
@@ -29,17 +29,20 @@
BOOL torture_lookup(void)
{
+ BOOL ret;
NTSTATUS status;
TALLOC_CTX *mem_ctx;
struct libnet_context *ctx;
struct libnet_Lookup lookup;
- const char address[16];
+ const char *address;
mem_ctx = talloc_init("test_lookup");
ctx = libnet_context_init(NULL);
ctx->cred = cmdline_credentials;
+ address = talloc_array(ctx, const char, 16);
+
lookup.in.hostname = lp_netbios_name();
lookup.in.methods = lp_name_resolve_order();
lookup.in.type = NBT_NAME_CLIENT;
@@ -49,26 +52,34 @@ BOOL torture_lookup(void)
if (!NT_STATUS_IS_OK(status)) {
printf("Couldn't lookup name %s: %s\n", lookup.in.hostname, nt_errstr(status));
- return False;
+ ret = False;
+ goto done;
}
- return True;
+ ret = True;
+
+done:
+ talloc_free(mem_ctx);
+ return ret;
}
BOOL torture_lookup_host(void)
{
+ BOOL ret;
NTSTATUS status;
TALLOC_CTX *mem_ctx;
struct libnet_context *ctx;
struct libnet_Lookup lookup;
- const char address[16];
+ const char *address;
mem_ctx = talloc_init("test_lookup_host");
ctx = libnet_context_init(NULL);
ctx->cred = cmdline_credentials;
+ address = talloc_array(mem_ctx, const char, 16);
+
lookup.in.hostname = lp_netbios_name();
lookup.in.methods = lp_name_resolve_order();
lookup.out.address = &address;
@@ -77,26 +88,34 @@ BOOL torture_lookup_host(void)
if (!NT_STATUS_IS_OK(status)) {
printf("Couldn't lookup host %s: %s\n", lookup.in.hostname, nt_errstr(status));
- return False;
+ ret = False;
+ goto done;
}
- return True;
+ ret = True;
+
+done:
+ talloc_free(mem_ctx);
+ return ret;
}
BOOL torture_lookup_pdc(void)
{
+ BOOL ret;
NTSTATUS status;
TALLOC_CTX *mem_ctx;
struct libnet_context *ctx;
struct libnet_Lookup lookup;
- const char address[16];
+ const char *address;
mem_ctx = talloc_init("test_lookup_pdc");
ctx = libnet_context_init(NULL);
ctx->cred = cmdline_credentials;
+ address = talloc_array(mem_ctx, const char, 16);
+
lookup.in.hostname = lp_workgroup();
lookup.in.methods = lp_name_resolve_order();
lookup.out.address = &address;
@@ -105,8 +124,13 @@ BOOL torture_lookup_pdc(void)
if (!NT_STATUS_IS_OK(status)) {
printf("Couldn't lookup pdc %s: %s\n", lookup.in.hostname, nt_errstr(status));
- return False;
+ ret = False;
+ goto done;
}
- return True;
+ ret = True;
+
+done:
+ talloc_free(mem_ctx);
+ return ret;
}