From dd36f1332028a2278d2f20bc1df45cca53d9ea08 Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Sun, 3 Jul 2005 13:58:47 +0000 Subject: r8094: Fix compiler warnings. rafal (This used to be commit cca6d792945477b86b2dd91f3c90152b69ee2a15) --- source4/torture/libnet/libnet_lookup.c | 42 ++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 9 deletions(-) (limited to 'source4/torture/libnet') 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; } -- cgit