Author: mimir Date: 2006-07-09 12:57:40 +0000 (Sun, 09 Jul 2006) New Revision: 16896
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16896 Log: Allow to use both binding and unc string to specify host name being looked up. 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:54:56 UTC (rev 16895) +++ branches/SAMBA_4_0/source/torture/libnet/libnet_lookup.c 2006-07-09 12:57:40 UTC (rev 16896) @@ -23,6 +23,7 @@ #include "lib/cmdline/popt_common.h" #include "libnet/libnet.h" #include "librpc/gen_ndr/nbt.h" +#include "librpc/rpc/dcerpc.h" #include "torture/torture.h" @@ -33,6 +34,8 @@ TALLOC_CTX *mem_ctx; struct libnet_context *ctx; struct libnet_Lookup lookup; + struct dcerpc_binding *bind; + const char *bindstr; const char *address; mem_ctx = talloc_init("test_lookup"); @@ -43,6 +46,14 @@ 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"); + status = dcerpc_parse_binding(mem_ctx, bindstr, &bind); + if (NT_STATUS_IS_OK(status)) { + lookup.in.hostname = bind->host; + } + } + lookup.in.type = NBT_NAME_CLIENT; lookup.in.methods = NULL; lookup.out.address = &address; @@ -70,6 +81,8 @@ TALLOC_CTX *mem_ctx; struct libnet_context *ctx; struct libnet_Lookup lookup; + struct dcerpc_binding *bind; + const char *bindstr; const char *address; mem_ctx = talloc_init("test_lookup_host"); @@ -80,6 +93,14 @@ 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"); + status = dcerpc_parse_binding(mem_ctx, bindstr, &bind); + if (NT_STATUS_IS_OK(status)) { + lookup.in.hostname = bind->host; + } + } + lookup.in.methods = NULL; lookup.out.address = &address;
