summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/torture/libnet/userinfo.c2
-rw-r--r--source4/torture/libnet/userman.c58
2 files changed, 59 insertions, 1 deletions
diff --git a/source4/torture/libnet/userinfo.c b/source4/torture/libnet/userinfo.c
index 4efd23f9a7..0c47ef4ae6 100644
--- a/source4/torture/libnet/userinfo.c
+++ b/source4/torture/libnet/userinfo.c
@@ -204,7 +204,7 @@ static BOOL test_userinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
-void msg_handler(struct monitor_msg *m)
+static void msg_handler(struct monitor_msg *m)
{
switch (m->type) {
case rpc_open_user:
diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c
index 6add422320..6a0a41434a 100644
--- a/source4/torture/libnet/userman.c
+++ b/source4/torture/libnet/userman.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_samr.h"
#include "libnet/composite.h"
+#include "libcli/composite/monitor.h"
#define TEST_USERNAME "libnetusermantest"
@@ -88,6 +89,8 @@ static BOOL test_useradd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
user.in.domain_handle = *domain_handle;
user.in.username = name;
+ printf("Testing rpc_composite_useradd\n");
+
status = rpc_composite_useradd(p, mem_ctx, &user);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to call sync rpc_composite_userinfo - %s\n", nt_errstr(status));
@@ -98,6 +101,46 @@ static BOOL test_useradd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
+static void msg_handler(struct monitor_msg *m)
+{
+ switch (m->type) {
+ case rpc_create_user:
+ printf("monitor_msg: user created (rid=%d)\n", m->data.rpc_create_user.rid);
+ break;
+ }
+}
+
+
+static BOOL test_useradd_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle, const char* username)
+{
+ NTSTATUS status;
+ BOOL ret = True;
+ struct composite_context *c;
+ struct rpc_composite_useradd user;
+
+ user.in.domain_handle = *handle;
+ user.in.username = username;
+
+ printf("Testing async rpc_composite_useradd\n");
+
+ c = rpc_composite_useradd_send(p, &user, msg_handler);
+ if (!c) {
+ printf("Failed to call async rpc_composite_useradd\n");
+ return False;
+ }
+
+ status = rpc_composite_useradd_recv(c, mem_ctx, &user);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Calling async rpc_composite_useradd failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ return True;
+
+}
+
+
static BOOL test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *domain_handle, const char *username)
{
@@ -269,6 +312,21 @@ BOOL torture_useradd(void)
goto done;
}
+ if (!test_opendomain(p, mem_ctx, &h, &domain_name)) {
+ ret = False;
+ goto done;
+ }
+
+ if (!test_useradd_async(p, mem_ctx, &h, name)) {
+ ret = False;
+ goto done;
+ }
+
+ if (!test_cleanup(p, mem_ctx, &h, name)) {
+ ret = False;
+ goto done;
+ }
+
done:
talloc_free(mem_ctx);
return ret;