summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/libnet/domain.c19
-rw-r--r--source4/torture/libnet/libnet_rpc.c46
-rw-r--r--source4/torture/libnet/libnet_user.c2
3 files changed, 54 insertions, 13 deletions
diff --git a/source4/torture/libnet/domain.c b/source4/torture/libnet/domain.c
index 79902d1e7c..c3e965f137 100644
--- a/source4/torture/libnet/domain.c
+++ b/source4/torture/libnet/domain.c
@@ -21,22 +21,23 @@
#include "includes.h"
#include "torture/rpc/rpc.h"
+#include "lib/events/events.h"
#include "libnet/libnet.h"
#include "librpc/gen_ndr/ndr_samr_c.h"
-static BOOL test_domainopen(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+static BOOL test_domainopen(struct libnet_context *net_ctx, TALLOC_CTX *mem_ctx,
struct lsa_String *domname,
struct policy_handle *domain_handle)
{
NTSTATUS status;
- struct libnet_rpc_domain_open io;
+ struct libnet_DomainOpen io;
printf("opening domain\n");
io.in.domain_name = talloc_strdup(mem_ctx, domname->string);
io.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
- status = libnet_rpc_domain_open(p, mem_ctx, &io);
+ status = libnet_DomainOpen(net_ctx, mem_ctx, &io);
if (!NT_STATUS_IS_OK(status)) {
printf("Composite domain open failed - %s\n", nt_errstr(status));
return False;
@@ -73,7 +74,8 @@ BOOL torture_domainopen(struct torture_context *torture)
{
NTSTATUS status;
const char *binding;
- struct dcerpc_pipe *p;
+ struct libnet_context *net_ctx;
+ struct event_context *evt_ctx;
TALLOC_CTX *mem_ctx;
BOOL ret = True;
struct policy_handle h;
@@ -82,8 +84,11 @@ BOOL torture_domainopen(struct torture_context *torture)
mem_ctx = talloc_init("test_domain_open");
binding = lp_parm_string(-1, "torture", "binding");
+ evt_ctx = event_context_find(torture);
+ net_ctx = libnet_context_init(evt_ctx);
+
status = torture_rpc_connection(mem_ctx,
- &p,
+ &net_ctx->samr_pipe,
&dcerpc_table_samr);
if (!NT_STATUS_IS_OK(status)) {
@@ -95,12 +100,12 @@ BOOL torture_domainopen(struct torture_context *torture)
/*
* Testing synchronous version
*/
- if (!test_domainopen(p, mem_ctx, &name, &h)) {
+ if (!test_domainopen(net_ctx, mem_ctx, &name, &h)) {
ret = False;
goto done;
}
- if (!test_cleanup(p, mem_ctx, &h)) {
+ if (!test_cleanup(net_ctx->samr_pipe, mem_ctx, &h)) {
ret = False;
goto done;
}
diff --git a/source4/torture/libnet/libnet_rpc.c b/source4/torture/libnet/libnet_rpc.c
index b7d94813a6..39023886ad 100644
--- a/source4/torture/libnet/libnet_rpc.c
+++ b/source4/torture/libnet/libnet_rpc.c
@@ -101,6 +101,36 @@ static BOOL test_samr_connect(struct libnet_context *ctx)
return True;
}
+
+static BOOL test_samr_dcinfo_connect(struct libnet_context *ctx)
+{
+ NTSTATUS status;
+ struct libnet_RpcConnect connect;
+ connect.level = LIBNET_RPC_CONNECT_DC_INFO;
+ connect.in.binding = lp_parm_string(-1, "torture", "binding");
+ connect.in.dcerpc_iface = &dcerpc_table_samr;
+
+ status = libnet_RpcConnect(ctx, ctx, &connect);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Couldn't connect to rpc service %s on %s: %s\n",
+ connect.in.dcerpc_iface->name, connect.in.binding,
+ nt_errstr(status));
+
+ return False;
+ }
+
+ printf("Domain Controller Info:\n");
+ printf("\tDomain Name:\t %s\n", connect.out.domain_name);
+ printf("\tDomain SID:\t %s\n", dom_sid_string(ctx, connect.out.domain_sid));
+ printf("\tRealm:\t\t %s\n", connect.out.realm);
+ printf("\tGUID:\t\t %s\n", GUID_string(ctx, connect.out.guid));
+
+ return True;
+}
+
+
+
BOOL torture_rpc_connect(struct torture_context *torture)
{
struct libnet_context *ctx;
@@ -108,21 +138,27 @@ BOOL torture_rpc_connect(struct torture_context *torture)
ctx = libnet_context_init(NULL);
ctx->cred = cmdline_credentials;
- printf("Testing connection to lsarpc interface\n");
+ printf("Testing connection to LSA interface\n");
if (!test_lsa_connect(ctx)) {
- printf("failed to connect lsarpc interface\n");
+ printf("failed to connect LSA interface\n");
return False;
}
- printf("Testing connection with domain info to lsarpc interface\n");
+ printf("Testing connection with domain info to LSA interface\n");
if (!test_lsa_dcinfo_connect(ctx)) {
- printf("failed to connect lsarpc interface\n");
+ printf("failed to connect LSA interface\n");
return False;
}
printf("Testing connection to SAMR service\n");
if (!test_samr_connect(ctx)) {
- printf("failed to connect samr interface\n");
+ printf("failed to connect SAMR interface\n");
+ return False;
+ }
+
+ printf("Testing connection with domain info to SAMR interface\n");
+ if (!test_samr_dcinfo_connect(ctx)) {
+ printf("failed to connect SAMR interface\n");
return False;
}
diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c
index f577f352d6..8eadc8da9f 100644
--- a/source4/torture/libnet/libnet_user.c
+++ b/source4/torture/libnet/libnet_user.c
@@ -117,7 +117,7 @@ BOOL torture_createuser(struct torture_context *torture)
return False;
}
- if (!test_cleanup(ctx->pipe, mem_ctx, &ctx->domain_handle, TEST_USERNAME)) {
+ if (!test_cleanup(ctx->samr_pipe, mem_ctx, &ctx->domain.handle, TEST_USERNAME)) {
printf("cleanup failed\n");
return False;
}