summaryrefslogtreecommitdiff
path: root/source4/libnet/userinfo.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-09-26 11:47:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:57 -0500
commitab4d635b92b116b02b88843b4ec4f5b7517bab1a (patch)
tree63c3ee12153b629071d2ba0209a0a31b134c449e /source4/libnet/userinfo.c
parent0d46be147a1e755bdd6f21a5ddc83b5c39585529 (diff)
downloadsamba-ab4d635b92b116b02b88843b4ec4f5b7517bab1a.tar.gz
samba-ab4d635b92b116b02b88843b4ec4f5b7517bab1a.tar.bz2
samba-ab4d635b92b116b02b88843b4ec4f5b7517bab1a.zip
r10504: - seperate implementation specific stuff, from the generic composite
stuff. - don't use SMBCLI_REQUEST_* state's in the genreic composite stuff - move monitor_fn to libnet. NOTE: I have maybe found some bugs, in code that is dirrectly in DONE or ERROR state in the _send() function. I haven't fixed this bugs in this commit! We may need some composite_trigger_*() functions or so. And maybe some other generic helper functions... metze (This used to be commit 4527815a0a9b96e460f301cb1f0c0b3964c166fc)
Diffstat (limited to 'source4/libnet/userinfo.c')
-rw-r--r--source4/libnet/userinfo.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/source4/libnet/userinfo.c b/source4/libnet/userinfo.c
index def9c87147..378bc814bd 100644
--- a/source4/libnet/userinfo.c
+++ b/source4/libnet/userinfo.c
@@ -23,9 +23,7 @@
*/
#include "includes.h"
-#include "libcli/raw/libcliraw.h"
#include "libcli/composite/composite.h"
-#include "libcli/composite/monitor.h"
#include "librpc/gen_ndr/ndr_samr.h"
#include "libnet/composite.h"
#include "libnet/userinfo.h"
@@ -44,6 +42,8 @@ struct userinfo_state {
struct samr_QueryUserInfo queryuserinfo;
struct samr_Close samrclose;
union samr_UserInfo *info;
+ /* information about the progress */
+ void (*monitor_fn)(struct monitor_msg *);
};
@@ -113,7 +113,7 @@ static NTSTATUS userinfo_closeuser(struct composite_context *c,
c->status = dcerpc_ndr_request_recv(s->req);
NT_STATUS_NOT_OK_RETURN(c->status);
- c->state = SMBCLI_REQUEST_DONE;
+ c->state = COMPOSITE_STATE_DONE;
return NT_STATUS_OK;
}
@@ -128,7 +128,7 @@ static NTSTATUS userinfo_closeuser(struct composite_context *c,
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 userinfo_state *s = talloc_get_type(c->private_data, struct userinfo_state);
struct monitor_msg msg;
struct msg_rpc_open_user *msg_open;
struct msg_rpc_query_user *msg_query;
@@ -169,14 +169,14 @@ static void userinfo_handler(struct rpc_request *req)
}
if (!NT_STATUS_IS_OK(c->status)) {
- c->state = SMBCLI_REQUEST_ERROR;
+ c->state = COMPOSITE_STATE_ERROR;
}
- if (c->monitor_fn) {
- c->monitor_fn(&msg);
+ if (s->monitor_fn) {
+ s->monitor_fn(&msg);
}
- if (c->state >= SMBCLI_REQUEST_DONE &&
+ if (c->state >= COMPOSITE_STATE_DONE &&
c->async.fn) {
c->async.fn(c);
}
@@ -207,13 +207,13 @@ struct composite_context *libnet_rpc_userinfo_send(struct dcerpc_pipe *p,
s->level = io->in.level;
s->pipe = p;
+ s->monitor_fn = monitor;
sid = dom_sid_parse_talloc(s, io->in.sid);
if (sid == NULL) goto failure;
- c->state = SMBCLI_REQUEST_SEND;
- c->private = s;
+ c->state = COMPOSITE_STATE_IN_PROGRESS;
+ c->private_data= s;
c->event_ctx = dcerpc_event_context(p);
- c->monitor_fn = monitor;
/* preparing parameters to send rpc request */
s->openuser.in.domain_handle = &io->in.domain_handle;
@@ -256,7 +256,7 @@ NTSTATUS libnet_rpc_userinfo_recv(struct composite_context *c, TALLOC_CTX *mem_c
status = composite_wait(c);
if (NT_STATUS_IS_OK(status) && io) {
- s = talloc_get_type(c->private, struct userinfo_state);
+ s = talloc_get_type(c->private_data, struct userinfo_state);
talloc_steal(mem_ctx, s->info);
io->out.info = *s->info;
}