diff options
-rw-r--r-- | source4/libnet/userinfo.c | 24 | ||||
-rw-r--r-- | source4/libnet/userman.c | 8 | ||||
-rw-r--r-- | source4/torture/libnet/userinfo.c | 14 | ||||
-rw-r--r-- | source4/torture/libnet/userman.c | 6 |
4 files changed, 43 insertions, 9 deletions
diff --git a/source4/libnet/userinfo.c b/source4/libnet/userinfo.c index 7fb6a83a06..def9c87147 100644 --- a/source4/libnet/userinfo.c +++ b/source4/libnet/userinfo.c @@ -28,6 +28,7 @@ #include "libcli/composite/monitor.h" #include "librpc/gen_ndr/ndr_samr.h" #include "libnet/composite.h" +#include "libnet/userinfo.h" static void userinfo_handler(struct rpc_request *req); @@ -129,26 +130,41 @@ static void userinfo_handler(struct rpc_request *req) struct composite_context *c = req->async.private; struct userinfo_state *s = talloc_get_type(c->private, struct userinfo_state); struct monitor_msg msg; + struct msg_rpc_open_user *msg_open; + struct msg_rpc_query_user *msg_query; + struct msg_rpc_close_user *msg_close; /* Stages of the call */ switch (s->stage) { case USERINFO_OPENUSER: c->status = userinfo_openuser(c, s); + msg.type = rpc_open_user; - msg.data.rpc_open_user.rid = s->openuser.in.rid; - msg.data.rpc_open_user.access_mask = s->openuser.in.access_mask; + msg_open = talloc(s, struct msg_rpc_open_user); + msg_open->rid = s->openuser.in.rid; + msg_open->access_mask = s->openuser.in.access_mask; + msg.data = (void*)msg_open; + msg.data_size = sizeof(*msg_open); break; case USERINFO_GETUSER: c->status = userinfo_getuser(c, s); + msg.type = rpc_query_user; - msg.data.rpc_query_user.level = s->queryuserinfo.in.level; + msg_query = talloc(s, struct msg_rpc_query_user); + msg_query->level = s->queryuserinfo.in.level; + msg.data = (void*)msg_query; + msg.data_size = sizeof(*msg_query); break; case USERINFO_CLOSEUSER: c->status = userinfo_closeuser(c, s); + msg.type = rpc_close_user; - msg.data.rpc_close_user.rid = s->openuser.in.rid; + msg_close = talloc(s, struct msg_rpc_close_user); + msg_close->rid = s->openuser.in.rid; + msg.data = (void*)msg_close; + msg.data_size = sizeof(*msg_close); break; } diff --git a/source4/libnet/userman.c b/source4/libnet/userman.c index c3d1435dfe..1a40b74352 100644 --- a/source4/libnet/userman.c +++ b/source4/libnet/userman.c @@ -28,6 +28,7 @@ #include "libcli/composite/monitor.h" #include "librpc/gen_ndr/ndr_samr.h" #include "libnet/composite.h" +#include "libnet/userman.h" /* * Composite user add function @@ -73,12 +74,17 @@ static void useradd_handler(struct rpc_request *req) struct composite_context *c = req->async.private; struct useradd_state *s = talloc_get_type(c->private, struct useradd_state); struct monitor_msg msg; + struct msg_rpc_create_user *rpc_create; switch (s->stage) { case USERADD_CREATE: c->status = useradd_create(c, s); + msg.type = rpc_create_user; - msg.data.rpc_create_user.rid = *s->createuser.out.rid; + rpc_create = talloc(s, struct msg_rpc_create_user); + rpc_create->rid = *s->createuser.out.rid; + msg.data = (void*)rpc_create; + msg.data_size = sizeof(*rpc_create); break; } diff --git a/source4/torture/libnet/userinfo.c b/source4/torture/libnet/userinfo.c index 2dd60b02f1..aa1e64301a 100644 --- a/source4/torture/libnet/userinfo.c +++ b/source4/torture/libnet/userinfo.c @@ -22,6 +22,7 @@ #include "includes.h" #include "librpc/gen_ndr/ndr_samr.h" #include "libnet/composite.h" +#include "libnet/userinfo.h" #include "libcli/composite/monitor.h" #define TEST_USERNAME "libnetuserinfotest" @@ -206,16 +207,23 @@ static BOOL test_userinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, static void msg_handler(struct monitor_msg *m) { + struct msg_rpc_open_user *msg_open; + struct msg_rpc_query_user *msg_query; + struct msg_rpc_close_user *msg_close; + switch (m->type) { case rpc_open_user: + msg_open = (struct msg_rpc_open_user*)m->data; printf("monitor_msg: user opened (rid=%d, access_mask=0x%08x)\n", - m->data.rpc_open_user.rid, m->data.rpc_open_user.access_mask); + msg_open->rid, msg_open->access_mask); break; case rpc_query_user: - printf("monitor_msg: user queried (level=%d)\n", m->data.rpc_query_user.level); + msg_query = (struct msg_rpc_query_user*)m->data; + printf("monitor_msg: user queried (level=%d)\n", msg_query->level); break; case rpc_close_user: - printf("monitor_msg: user closed (rid=%d)\n", m->data.rpc_close_user.rid); + msg_close = (struct msg_rpc_close_user*)m->data; + printf("monitor_msg: user closed (rid=%d)\n", msg_close->rid); break; } } diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c index 1da57e2b35..0441a99a54 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 "libnet/userman.h" #include "libcli/composite/monitor.h" #define TEST_USERNAME "libnetusermantest" @@ -103,9 +104,12 @@ static BOOL test_useradd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, static void msg_handler(struct monitor_msg *m) { + struct msg_rpc_create_user *msg_create; + switch (m->type) { case rpc_create_user: - printf("monitor_msg: user created (rid=%d)\n", m->data.rpc_create_user.rid); + msg_create = (struct msg_rpc_create_user*)m->data; + printf("monitor_msg: user created (rid=%d)\n", msg_create->rid); break; } } |