summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2005-05-10 18:17:40 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:16:37 -0500
commit84f248ec8401bc5279047de4e16231cf191348ef (patch)
treefb90eb614b760fcf95ab215d33fc25c70844019e /source4
parentb5da6b2c853b2aca572435ef989148adbf2f3ff0 (diff)
downloadsamba-84f248ec8401bc5279047de4e16231cf191348ef.tar.gz
samba-84f248ec8401bc5279047de4e16231cf191348ef.tar.bz2
samba-84f248ec8401bc5279047de4e16231cf191348ef.zip
r6717: - torture test of async useradd function and monitor messages.
- make message handling functions static. rafal (This used to be commit 96446e5e1e53eb519cbfeb64d0dd2f4052d75b0f)
Diffstat (limited to 'source4')
-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;