summaryrefslogtreecommitdiff
path: root/source4/libnet
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2005-04-01 08:14:57 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:22 -0500
commit7288298b65b4040d112f06def3c9836aba9ddbaf (patch)
tree7102622b5744c4e085302ec0598c10a11f5ad5dd /source4/libnet
parentb1e46fde3a3b05baa871240ec173a7cfd5af8a02 (diff)
downloadsamba-7288298b65b4040d112f06def3c9836aba9ddbaf.tar.gz
samba-7288298b65b4040d112f06def3c9836aba9ddbaf.tar.bz2
samba-7288298b65b4040d112f06def3c9836aba9ddbaf.zip
r6164: More comments in the code.
rafal (This used to be commit 01cbed98b32c2050a665aec51a99288e4afb29c1)
Diffstat (limited to 'source4/libnet')
-rw-r--r--source4/libnet/userinfo.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/source4/libnet/userinfo.c b/source4/libnet/userinfo.c
index 67a1710dc8..a61610ed21 100644
--- a/source4/libnet/userinfo.c
+++ b/source4/libnet/userinfo.c
@@ -31,6 +31,10 @@
static void userinfo_handler(struct rpc_request *req);
+/**
+ * Stage 1: Open user policy handle in SAM server.
+ */
+
static NTSTATUS userinfo_openuser(struct composite_context *c,
struct rpc_composite_userinfo *io)
{
@@ -63,6 +67,10 @@ failure:
}
+/**
+ * Stage 2: Get requested user information.
+ */
+
static NTSTATUS userinfo_getuser(struct composite_context *c,
struct rpc_composite_userinfo *io)
{
@@ -93,6 +101,10 @@ static NTSTATUS userinfo_getuser(struct composite_context *c,
}
+/**
+ * Stage3: Close policy handle associated with opened user.
+ */
+
static NTSTATUS userinfo_closeuser(struct composite_context *c,
struct rpc_composite_userinfo *io)
{
@@ -110,11 +122,19 @@ static NTSTATUS userinfo_closeuser(struct composite_context *c,
}
+/**
+ * Event handler for asynchronous request. Handles transition through
+ * intermediate stages of the call.
+ *
+ * @param req rpc call context
+ */
+
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);
-
+
+ /* Stages of the call */
switch (s->stage) {
case USERINFO_OPENUSER:
c->status = userinfo_openuser(c, &s->io);
@@ -140,6 +160,13 @@ static void userinfo_handler(struct rpc_request *req)
}
+/**
+ * Sends asynchronous userinfo request
+ *
+ * @param p dce/rpc call pipe
+ * @param io arguments and results of the call
+ */
+
struct composite_context* rpc_composite_userinfo_send(struct dcerpc_pipe *p,
struct rpc_composite_userinfo *io)
{
@@ -187,12 +214,22 @@ failure:
}
+/**
+ * Waits for and receives result of asynchronous userinfo call
+ *
+ * @param c composite context returned by asynchronous userinfo call
+ * @param mem_ctx memory context of the call
+ * @param io pointer to results (and arguments) of the call
+ * @return nt status code of execution
+ */
+
NTSTATUS rpc_composite_userinfo_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
struct rpc_composite_userinfo *io)
{
NTSTATUS status;
struct userinfo_state *s;
+ /* wait for results of sending request */
status = composite_wait(c);
if (NT_STATUS_IS_OK(status) && io) {
@@ -200,12 +237,22 @@ NTSTATUS rpc_composite_userinfo_recv(struct composite_context *c, TALLOC_CTX *me
talloc_steal(mem_ctx, &s->io.out.info);
io->out.info = s->io.out.info;
}
-
+
+ /* memory context associated to composite context is no longer needed */
talloc_free(c);
return status;
}
+/**
+ * Synchronous version of userinfo call
+ *
+ * @param pipe dce/rpc call pipe
+ * @param mem_ctx memory context for the call
+ * @param io arguments and results of the call
+ * @return nt status code of execution
+ */
+
NTSTATUS rpc_composite_userinfo(struct dcerpc_pipe *pipe,
TALLOC_CTX *mem_ctx,
struct rpc_composite_userinfo *io)