summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2006-07-09 13:18:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:57 -0500
commit82f1374d2b6923e0e42e35aa5095cc4855848263 (patch)
treefa4c739705b062010074160140dec35e0a5e05b3
parent304c8fbfbe69f939565e38320fa27c112a1bf63c (diff)
downloadsamba-82f1374d2b6923e0e42e35aa5095cc4855848263.tar.gz
samba-82f1374d2b6923e0e42e35aa5095cc4855848263.tar.bz2
samba-82f1374d2b6923e0e42e35aa5095cc4855848263.zip
r16897: Don't pass allocated buffer for returned string as the lookup
function allocates it using memory context. Also, give nicer output of the result of lookup performed. rafal (This used to be commit 1bd5661258dffc01afdb11da50f2da8f0b0b9046)
-rw-r--r--source4/torture/libnet/libnet_lookup.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/source4/torture/libnet/libnet_lookup.c b/source4/torture/libnet/libnet_lookup.c
index 12f3863afb..c8e25817fc 100644
--- a/source4/torture/libnet/libnet_lookup.c
+++ b/source4/torture/libnet/libnet_lookup.c
@@ -43,8 +43,6 @@ BOOL torture_lookup(struct torture_context *torture)
ctx = libnet_context_init(NULL);
ctx->cred = cmdline_credentials;
- address = talloc_array(ctx, const char, 16);
-
lookup.in.hostname = lp_parm_string(-1, "torture", "host");
if (lookup.in.hostname == NULL) {
bindstr = lp_parm_string(-1, "torture", "binding");
@@ -56,7 +54,7 @@ BOOL torture_lookup(struct torture_context *torture)
lookup.in.type = NBT_NAME_CLIENT;
lookup.in.methods = NULL;
- lookup.out.address = &address;
+ lookup.out.address = NULL;
status = libnet_Lookup(ctx, mem_ctx, &lookup);
@@ -68,6 +66,8 @@ BOOL torture_lookup(struct torture_context *torture)
ret = True;
+ printf("Name [%s] found at adrress: %s.\n", lookup.in.hostname, *lookup.out.address);
+
done:
talloc_free(mem_ctx);
return ret;
@@ -83,15 +83,12 @@ BOOL torture_lookup_host(struct torture_context *torture)
struct libnet_Lookup lookup;
struct dcerpc_binding *bind;
const char *bindstr;
- 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_parm_string(-1, "torture", "host");
if (lookup.in.hostname == NULL) {
bindstr = lp_parm_string(-1, "torture", "binding");
@@ -102,7 +99,7 @@ BOOL torture_lookup_host(struct torture_context *torture)
}
lookup.in.methods = NULL;
- lookup.out.address = &address;
+ lookup.out.address = NULL;
status = libnet_LookupHost(ctx, mem_ctx, &lookup);
@@ -114,6 +111,8 @@ BOOL torture_lookup_host(struct torture_context *torture)
ret = True;
+ printf("Host [%s] found at adrress: %s.\n", lookup.in.hostname, *lookup.out.address);
+
done:
talloc_free(mem_ctx);
return ret;