summaryrefslogtreecommitdiff
path: root/source4/libnet
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2005-08-02 01:12:58 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:30:17 -0500
commit088166461d11049697f1b8f8fcad2432f23873f7 (patch)
tree374b39f12cb6a9d460040b4833a73906dfe1c343 /source4/libnet
parent168356795b9cb51bd5cbb1f8ace21ab37068bc79 (diff)
downloadsamba-088166461d11049697f1b8f8fcad2432f23873f7.tar.gz
samba-088166461d11049697f1b8f8fcad2432f23873f7.tar.bz2
samba-088166461d11049697f1b8f8fcad2432f23873f7.zip
r8904: Split off the query stage as a separate function.
rafal (This used to be commit bbe7e726af8c61108a7bca1e10e9340bbe37f3ef)
Diffstat (limited to 'source4/libnet')
-rw-r--r--source4/libnet/userman.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/source4/libnet/userman.c b/source4/libnet/userman.c
index f57b5c55f9..59cb804ae9 100644
--- a/source4/libnet/userman.c
+++ b/source4/libnet/userman.c
@@ -591,10 +591,6 @@ static NTSTATUS usermod_open(struct composite_context *c,
c->status = dcerpc_ndr_request_recv(s->req);
NT_STATUS_NOT_OK_RETURN(c->status);
- if (s->stage == USERMOD_QUERY) {
- s->info = *s->queryuser.out.info;
- }
-
/* Prepare UserInfo level and data based on bitmask field */
s->change.fields = usermod_setfields(s, &level, i);
@@ -620,6 +616,35 @@ static NTSTATUS usermod_open(struct composite_context *c,
/**
+ * Stage 2a (optional): Query the user information
+ */
+static NTSTATUS usermod_query(struct composite_context *c,
+ struct usermod_state *s)
+{
+ union samr_UserInfo *i = &s->info;
+ uint16_t level;
+
+ c->status = dcerpc_ndr_request_recv(s->req);
+ NT_STATUS_NOT_OK_RETURN(c->status);
+
+ s->info = *s->queryuser.out.info;
+
+ s->change.fields = usermod_setfields(s, &level, i);
+
+ s->setuser.in.user_handle = &s->user_handle;
+ s->setuser.in.level = level;
+ s->setuser.in.info = i;
+
+ s->req = dcerpc_samr_SetUserInfo_send(s->pipe, c, &s->setuser);
+
+ s->req->async.callback = usermod_handler;
+ s->req->async.private = c;
+
+ return NT_STATUS_OK;
+}
+
+
+/**
* Stage 3: Set new user account data
*/
static NTSTATUS usermod_modify(struct composite_context *c,
@@ -653,10 +678,13 @@ static void usermod_handler(struct rpc_request *req)
break;
case USERMOD_OPEN:
- case USERMOD_QUERY:
c->status = usermod_open(c, s);
break;
+ case USERMOD_QUERY:
+ c->status = usermod_query(c, s);
+ break;
+
case USERMOD_MODIFY:
c->status = usermod_modify(c, s);
break;