summaryrefslogtreecommitdiff
path: root/source4/torture/libnet
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2006-07-09 12:57:40 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:57 -0500
commit304c8fbfbe69f939565e38320fa27c112a1bf63c (patch)
tree4d281218f1661e4c7a27b75ccb4e07e9a9e43f6f /source4/torture/libnet
parent861ec810488fc6c25fc7e6287ed27e82fe526fa0 (diff)
downloadsamba-304c8fbfbe69f939565e38320fa27c112a1bf63c.tar.gz
samba-304c8fbfbe69f939565e38320fa27c112a1bf63c.tar.bz2
samba-304c8fbfbe69f939565e38320fa27c112a1bf63c.zip
r16896: Allow to use both binding and unc string to specify host name
being looked up. rafal (This used to be commit e597e9867f50f495a338bed05cee76ff84fd38b6)
Diffstat (limited to 'source4/torture/libnet')
-rw-r--r--source4/torture/libnet/libnet_lookup.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source4/torture/libnet/libnet_lookup.c b/source4/torture/libnet/libnet_lookup.c
index 5d347cd049..12f3863afb 100644
--- a/source4/torture/libnet/libnet_lookup.c
+++ b/source4/torture/libnet/libnet_lookup.c
@@ -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 @@ BOOL torture_lookup(struct torture_context *torture)
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 @@ BOOL torture_lookup(struct torture_context *torture)
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 @@ BOOL torture_lookup_host(struct torture_context *torture)
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 @@ BOOL torture_lookup_host(struct torture_context *torture)
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;