svn commit: samba r16897 - in
branches/SAMBA_4_0/source/torture/libnet: .
mimir at samba.org
mimir at samba.org
Sun Jul 9 13:18:15 GMT 2006
Author: mimir
Date: 2006-07-09 13:18:15 +0000 (Sun, 09 Jul 2006)
New Revision: 16897
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16897
Log:
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
Modified:
branches/SAMBA_4_0/source/torture/libnet/libnet_lookup.c
Changeset:
Modified: branches/SAMBA_4_0/source/torture/libnet/libnet_lookup.c
===================================================================
--- branches/SAMBA_4_0/source/torture/libnet/libnet_lookup.c 2006-07-09 12:57:40 UTC (rev 16896)
+++ branches/SAMBA_4_0/source/torture/libnet/libnet_lookup.c 2006-07-09 13:18:15 UTC (rev 16897)
@@ -43,8 +43,6 @@
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 @@
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 @@
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 @@
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 @@
}
lookup.in.methods = NULL;
- lookup.out.address = &address;
+ lookup.out.address = NULL;
status = libnet_LookupHost(ctx, mem_ctx, &lookup);
@@ -114,6 +111,8 @@
ret = True;
+ printf("Host [%s] found at adrress: %s.\n", lookup.in.hostname, *lookup.out.address);
+
done:
talloc_free(mem_ctx);
return ret;
More information about the samba-cvs
mailing list