2 Unix SMB/CIFS implementation.
4 Copyright (C) Rafal Szczesniak 2005
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 a composite functions for user management operations (add/del/chg)
25 #include "libcli/composite/composite.h"
26 #include "libnet/composite.h"
27 #include "libnet/userman.h"
28 #include "libnet/userinfo.h"
29 #include "librpc/gen_ndr/ndr_samr_c.h"
30 #include "libnet/libnet_proto.h"
33 * Composite USER ADD functionality
36 struct useradd_state {
37 struct dcerpc_pipe *pipe;
38 struct rpc_request *req;
39 struct policy_handle domain_handle;
40 struct samr_CreateUser createuser;
41 struct policy_handle user_handle;
44 /* information about the progress */
45 void (*monitor_fn)(struct monitor_msg *);
49 static void continue_useradd_create(struct rpc_request *req);
53 * Stage 1 (and the only one for now): Create user account.
55 static void continue_useradd_create(struct rpc_request *req)
57 struct composite_context *c;
58 struct useradd_state *s;
60 c = talloc_get_type(req->async.private_data, struct composite_context);
61 s = talloc_get_type(c->private_data, struct useradd_state);
63 /* check rpc layer status code */
64 c->status = dcerpc_ndr_request_recv(s->req);
65 if (!composite_is_ok(c)) return;
67 /* check create user call status code */
68 c->status = s->createuser.out.result;
70 /* get created user account data */
71 s->user_handle = *s->createuser.out.user_handle;
72 s->user_rid = *s->createuser.out.rid;
74 /* issue a monitor message */
76 struct monitor_msg msg;
77 struct msg_rpc_create_user rpc_create;
79 rpc_create.rid = *s->createuser.out.rid;
81 msg.type = mon_SamrCreateUser;
82 msg.data = (void*)&rpc_create;
83 msg.data_size = sizeof(rpc_create);
93 * Sends asynchronous useradd request
95 * @param p dce/rpc call pipe
96 * @param io arguments and results of the call
97 * @param monitor monitor function for providing information about the progress
100 struct composite_context *libnet_rpc_useradd_send(struct dcerpc_pipe *p,
101 struct libnet_rpc_useradd *io,
102 void (*monitor)(struct monitor_msg*))
104 struct composite_context *c;
105 struct useradd_state *s;
107 if (!p || !io) return NULL;
109 /* composite allocation and setup */
110 c = composite_create(p, dcerpc_event_context(p));
111 if (c == NULL) return NULL;
113 s = talloc_zero(c, struct useradd_state);
114 if (composite_nomem(s, c)) return c;
118 /* put passed arguments to the state structure */
119 s->domain_handle = io->in.domain_handle;
121 s->monitor_fn = monitor;
123 /* preparing parameters to send rpc request */
124 s->createuser.in.domain_handle = &io->in.domain_handle;
126 s->createuser.in.account_name = talloc_zero(c, struct lsa_String);
127 if (composite_nomem(s->createuser.in.account_name, c)) return c;
129 s->createuser.in.account_name->string = talloc_strdup(c, io->in.username);
130 if (composite_nomem(s->createuser.in.account_name->string, c)) return c;
132 s->createuser.out.user_handle = &s->user_handle;
133 s->createuser.out.rid = &s->user_rid;
135 /* send the request */
136 s->req = dcerpc_samr_CreateUser_send(p, c, &s->createuser);
137 if (composite_nomem(s->req, c)) return c;
139 composite_continue_rpc(c, s->req, continue_useradd_create, c);
145 * Waits for and receives result of asynchronous useradd call
147 * @param c composite context returned by asynchronous useradd call
148 * @param mem_ctx memory context of the call
149 * @param io pointer to results (and arguments) of the call
150 * @return nt status code of execution
153 NTSTATUS libnet_rpc_useradd_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
154 struct libnet_rpc_useradd *io)
157 struct useradd_state *s;
159 status = composite_wait(c);
161 if (NT_STATUS_IS_OK(status) && io) {
162 /* get and return result of the call */
163 s = talloc_get_type(c->private_data, struct useradd_state);
164 io->out.user_handle = s->user_handle;
173 * Synchronous version of useradd call
175 * @param pipe dce/rpc call pipe
176 * @param mem_ctx memory context for the call
177 * @param io arguments and results of the call
178 * @return nt status code of execution
181 NTSTATUS libnet_rpc_useradd(struct dcerpc_pipe *p,
183 struct libnet_rpc_useradd *io)
185 struct composite_context *c = libnet_rpc_useradd_send(p, io, NULL);
186 return libnet_rpc_useradd_recv(c, mem_ctx, io);
192 * Composite USER DELETE functionality
196 struct userdel_state {
197 struct dcerpc_pipe *pipe;
198 struct policy_handle domain_handle;
199 struct policy_handle user_handle;
200 struct samr_LookupNames lookupname;
201 struct samr_OpenUser openuser;
202 struct samr_DeleteUser deleteuser;
204 /* information about the progress */
205 void (*monitor_fn)(struct monitor_msg *);
209 static void continue_userdel_name_found(struct rpc_request *req);
210 static void continue_userdel_user_opened(struct rpc_request* req);
211 static void continue_userdel_deleted(struct rpc_request *req);
215 * Stage 1: Lookup the user name and resolve it to rid
217 static void continue_userdel_name_found(struct rpc_request *req)
219 struct composite_context *c;
220 struct userdel_state *s;
221 struct rpc_request *openuser_req;
222 struct monitor_msg msg;
224 c = talloc_get_type(req->async.private_data, struct composite_context);
225 s = talloc_get_type(c->private_data, struct userdel_state);
227 /* receive samr_LookupNames result */
228 c->status = dcerpc_ndr_request_recv(req);
229 if (!composite_is_ok(c)) return;
231 c->status = s->lookupname.out.result;
232 if (!NT_STATUS_IS_OK(c->status)) {
233 composite_error(c, c->status);
237 /* what to do when there's no user account to delete
238 and what if there's more than one rid resolved */
239 if (!s->lookupname.out.rids.count) {
240 c->status = NT_STATUS_NO_SUCH_USER;
241 composite_error(c, c->status);
244 } else if (!s->lookupname.out.rids.count > 1) {
245 c->status = NT_STATUS_INVALID_ACCOUNT_NAME;
246 composite_error(c, c->status);
250 /* issue a monitor message */
252 struct msg_rpc_lookup_name msg_lookup;
254 msg_lookup.rid = s->lookupname.out.rids.ids;
255 msg_lookup.count = s->lookupname.out.rids.count;
257 msg.type = mon_SamrLookupName;
258 msg.data = (void*)&msg_lookup;
259 msg.data_size = sizeof(msg_lookup);
263 /* prepare the arguments for rpc call */
264 s->openuser.in.domain_handle = &s->domain_handle;
265 s->openuser.in.rid = s->lookupname.out.rids.ids[0];
266 s->openuser.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
267 s->openuser.out.user_handle = &s->user_handle;
269 /* send rpc request */
270 openuser_req = dcerpc_samr_OpenUser_send(s->pipe, c, &s->openuser);
271 if (composite_nomem(openuser_req, c)) return;
273 composite_continue_rpc(c, openuser_req, continue_userdel_user_opened, c);
278 * Stage 2: Open user account.
280 static void continue_userdel_user_opened(struct rpc_request* req)
282 struct composite_context *c;
283 struct userdel_state *s;
284 struct rpc_request *deluser_req;
285 struct monitor_msg msg;
287 c = talloc_get_type(req->async.private_data, struct composite_context);
288 s = talloc_get_type(c->private_data, struct userdel_state);
290 /* receive samr_OpenUser result */
291 c->status = dcerpc_ndr_request_recv(req);
292 if (!composite_is_ok(c)) return;
294 c->status = s->openuser.out.result;
295 if (!NT_STATUS_IS_OK(c->status)) {
296 composite_error(c, c->status);
300 /* issue a monitor message */
302 struct msg_rpc_open_user msg_open;
304 msg_open.rid = s->openuser.in.rid;
305 msg_open.access_mask = s->openuser.in.access_mask;
307 msg.type = mon_SamrOpenUser;
308 msg.data = (void*)&msg_open;
309 msg.data_size = sizeof(msg_open);
313 /* prepare the final rpc call arguments */
314 s->deleteuser.in.user_handle = &s->user_handle;
315 s->deleteuser.out.user_handle = &s->user_handle;
317 /* send rpc request */
318 deluser_req = dcerpc_samr_DeleteUser_send(s->pipe, c, &s->deleteuser);
319 if (composite_nomem(deluser_req, c)) return;
321 /* callback handler setup */
322 composite_continue_rpc(c, deluser_req, continue_userdel_deleted, c);
327 * Stage 3: Delete user account
329 static void continue_userdel_deleted(struct rpc_request *req)
331 struct composite_context *c;
332 struct userdel_state *s;
333 struct monitor_msg msg;
335 c = talloc_get_type(req->async.private_data, struct composite_context);
336 s = talloc_get_type(c->private_data, struct userdel_state);
338 /* receive samr_DeleteUser result */
339 c->status = dcerpc_ndr_request_recv(req);
340 if (!composite_is_ok(c)) return;
342 /* return the actual function call status */
343 c->status = s->deleteuser.out.result;
344 if (!NT_STATUS_IS_OK(c->status)) {
345 composite_error(c, c->status);
349 /* issue a monitor message */
351 msg.type = mon_SamrDeleteUser;
362 * Sends asynchronous userdel request
364 * @param p dce/rpc call pipe
365 * @param io arguments and results of the call
366 * @param monitor monitor function for providing information about the progress
369 struct composite_context *libnet_rpc_userdel_send(struct dcerpc_pipe *p,
370 struct libnet_rpc_userdel *io,
371 void (*monitor)(struct monitor_msg*))
373 struct composite_context *c;
374 struct userdel_state *s;
375 struct rpc_request *lookup_req;
377 /* composite context allocation and setup */
378 c = composite_create(p, dcerpc_event_context(p));
379 if (c == NULL) return NULL;
381 s = talloc_zero(c, struct userdel_state);
382 if (composite_nomem(s, c)) return c;
386 /* store function parameters in the state structure */
388 s->domain_handle = io->in.domain_handle;
389 s->monitor_fn = monitor;
391 /* preparing parameters to send rpc request */
392 s->lookupname.in.domain_handle = &io->in.domain_handle;
393 s->lookupname.in.num_names = 1;
394 s->lookupname.in.names = talloc_zero(s, struct lsa_String);
395 s->lookupname.in.names->string = io->in.username;
397 /* send the request */
398 lookup_req = dcerpc_samr_LookupNames_send(p, c, &s->lookupname);
399 if (composite_nomem(lookup_req, c)) return c;
401 /* set the next stage */
402 composite_continue_rpc(c, lookup_req, continue_userdel_name_found, c);
408 * Waits for and receives results of asynchronous userdel call
410 * @param c composite context returned by asynchronous userdel call
411 * @param mem_ctx memory context of the call
412 * @param io pointer to results (and arguments) of the call
413 * @return nt status code of execution
416 NTSTATUS libnet_rpc_userdel_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
417 struct libnet_rpc_userdel *io)
420 struct userdel_state *s;
422 status = composite_wait(c);
424 if (NT_STATUS_IS_OK(status) && io) {
425 s = talloc_get_type(c->private_data, struct userdel_state);
426 io->out.user_handle = s->user_handle;
435 * Synchronous version of userdel call
437 * @param pipe dce/rpc call pipe
438 * @param mem_ctx memory context for the call
439 * @param io arguments and results of the call
440 * @return nt status code of execution
443 NTSTATUS libnet_rpc_userdel(struct dcerpc_pipe *p,
445 struct libnet_rpc_userdel *io)
447 struct composite_context *c = libnet_rpc_userdel_send(p, io, NULL);
448 return libnet_rpc_userdel_recv(c, mem_ctx, io);
453 * USER MODIFY functionality
456 static void continue_usermod_name_found(struct rpc_request *req);
457 static void continue_usermod_user_opened(struct rpc_request *req);
458 static void continue_usermod_user_queried(struct rpc_request *req);
459 static void continue_usermod_user_changed(struct rpc_request *req);
462 struct usermod_state {
463 struct dcerpc_pipe *pipe;
464 struct policy_handle domain_handle;
465 struct policy_handle user_handle;
466 struct usermod_change change;
467 union samr_UserInfo info;
468 struct samr_LookupNames lookupname;
469 struct samr_OpenUser openuser;
470 struct samr_SetUserInfo setuser;
471 struct samr_QueryUserInfo queryuser;
473 /* information about the progress */
474 void (*monitor_fn)(struct monitor_msg *);
479 * Step 1: Lookup user name
481 static void continue_usermod_name_found(struct rpc_request *req)
483 struct composite_context *c;
484 struct usermod_state *s;
485 struct rpc_request *openuser_req;
486 struct monitor_msg msg;
488 c = talloc_get_type(req->async.private_data, struct composite_context);
489 s = talloc_get_type(c->private_data, struct usermod_state);
491 /* receive samr_LookupNames result */
492 c->status = dcerpc_ndr_request_recv(req);
493 if (!composite_is_ok(c)) return;
495 c->status = s->lookupname.out.result;
496 if (!NT_STATUS_IS_OK(c->status)) {
497 composite_error(c, c->status);
501 /* what to do when there's no user account to delete
502 and what if there's more than one rid resolved */
503 if (!s->lookupname.out.rids.count) {
504 c->status = NT_STATUS_NO_SUCH_USER;
505 composite_error(c, c->status);
508 } else if (!s->lookupname.out.rids.count > 1) {
509 c->status = NT_STATUS_INVALID_ACCOUNT_NAME;
510 composite_error(c, c->status);
514 /* issue a monitor message */
516 struct msg_rpc_lookup_name msg_lookup;
518 msg_lookup.rid = s->lookupname.out.rids.ids;
519 msg_lookup.count = s->lookupname.out.rids.count;
521 msg.type = mon_SamrLookupName;
522 msg.data = (void*)&msg_lookup;
523 msg.data_size = sizeof(msg_lookup);
527 /* prepare the next rpc call */
528 s->openuser.in.domain_handle = &s->domain_handle;
529 s->openuser.in.rid = s->lookupname.out.rids.ids[0];
530 s->openuser.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
531 s->openuser.out.user_handle = &s->user_handle;
533 /* send the rpc request */
534 openuser_req = dcerpc_samr_OpenUser_send(s->pipe, c, &s->openuser);
535 if (composite_nomem(openuser_req, c)) return;
537 composite_continue_rpc(c, openuser_req, continue_usermod_user_opened, c);
542 * Choose a proper level of samr_UserInfo structure depending on required
543 * change specified by means of flags field. Subsequent calls of this
544 * function are made until there's no flags set meaning that all of the
545 * changes have been made.
547 static bool usermod_setfields(struct usermod_state *s, uint16_t *level,
548 union samr_UserInfo *i, bool queried)
550 if (s->change.fields == 0) return s->change.fields;
554 if ((s->change.fields & USERMOD_FIELD_ACCOUNT_NAME) &&
555 (*level == 0 || *level == 7)) {
557 i->info7.account_name.string = s->change.account_name;
559 s->change.fields ^= USERMOD_FIELD_ACCOUNT_NAME;
562 if ((s->change.fields & USERMOD_FIELD_FULL_NAME) &&
563 (*level == 0 || *level == 8)) {
565 i->info8.full_name.string = s->change.full_name;
567 s->change.fields ^= USERMOD_FIELD_FULL_NAME;
570 if ((s->change.fields & USERMOD_FIELD_DESCRIPTION) &&
571 (*level == 0 || *level == 13)) {
573 i->info13.description.string = s->change.description;
575 s->change.fields ^= USERMOD_FIELD_DESCRIPTION;
578 if ((s->change.fields & USERMOD_FIELD_COMMENT) &&
579 (*level == 0 || *level == 2)) {
583 /* the user info is obtained, so now set the required field */
584 i->info2.comment.string = s->change.comment;
585 s->change.fields ^= USERMOD_FIELD_COMMENT;
588 /* we need to query the user info before setting one field in it */
593 if ((s->change.fields & USERMOD_FIELD_LOGON_SCRIPT) &&
594 (*level == 0 || *level == 11)) {
596 i->info11.logon_script.string = s->change.logon_script;
598 s->change.fields ^= USERMOD_FIELD_LOGON_SCRIPT;
601 if ((s->change.fields & USERMOD_FIELD_PROFILE_PATH) &&
602 (*level == 0 || *level == 12)) {
604 i->info12.profile_path.string = s->change.profile_path;
606 s->change.fields ^= USERMOD_FIELD_PROFILE_PATH;
609 if ((s->change.fields & USERMOD_FIELD_HOME_DIRECTORY) &&
610 (*level == 0 || *level == 10)) {
614 i->info10.home_directory.string = s->change.home_directory;
615 s->change.fields ^= USERMOD_FIELD_HOME_DIRECTORY;
621 if ((s->change.fields & USERMOD_FIELD_HOME_DRIVE) &&
622 (*level == 0 || *level == 10)) {
626 i->info10.home_drive.string = s->change.home_drive;
627 s->change.fields ^= USERMOD_FIELD_HOME_DRIVE;
633 if ((s->change.fields & USERMOD_FIELD_ACCT_EXPIRY) &&
634 (*level == 0 || *level == 17)) {
636 i->info17.acct_expiry = timeval_to_nttime(s->change.acct_expiry);
638 s->change.fields ^= USERMOD_FIELD_ACCT_EXPIRY;
641 if ((s->change.fields & USERMOD_FIELD_ACCT_FLAGS) &&
642 (*level == 0 || *level == 16)) {
644 i->info16.acct_flags = s->change.acct_flags;
646 s->change.fields ^= USERMOD_FIELD_ACCT_FLAGS;
649 /* We're going to be here back again soon unless all fields have been set */
654 static NTSTATUS usermod_change(struct composite_context *c,
655 struct usermod_state *s)
657 struct rpc_request *query_req, *setuser_req;
659 union samr_UserInfo *i = &s->info;
661 /* set the level to invalid value, so that unless setfields routine
662 gives it a valid value we report the error correctly */
665 /* prepare UserInfo level and data based on bitmask field */
666 do_set = usermod_setfields(s, &level, i, false);
668 if (level < 1 || level > 26) {
669 /* apparently there's a field that the setfields routine
670 does not know how to set */
671 return NT_STATUS_INVALID_PARAMETER;
674 /* If some specific level is used to set user account data and the change
675 itself does not cover all fields then we need to query the user info
676 first, right before changing the data. Otherwise we could set required
677 fields and accidentally reset the others.
680 s->queryuser.in.user_handle = &s->user_handle;
681 s->queryuser.in.level = level;
683 /* send query user info request to retrieve complete data of
684 a particular info level */
685 query_req = dcerpc_samr_QueryUserInfo_send(s->pipe, c, &s->queryuser);
686 composite_continue_rpc(c, query_req, continue_usermod_user_queried, c);
689 s->setuser.in.user_handle = &s->user_handle;
690 s->setuser.in.level = level;
691 s->setuser.in.info = i;
693 /* send set user info request after making required change */
694 setuser_req = dcerpc_samr_SetUserInfo_send(s->pipe, c, &s->setuser);
695 composite_continue_rpc(c, setuser_req, continue_usermod_user_changed, c);
703 * Stage 2: Open user account
705 static void continue_usermod_user_opened(struct rpc_request *req)
707 struct composite_context *c;
708 struct usermod_state *s;
710 c = talloc_get_type(req->async.private_data, struct composite_context);
711 s = talloc_get_type(c->private_data, struct usermod_state);
713 c->status = dcerpc_ndr_request_recv(req);
714 if (!composite_is_ok(c)) return;
716 c->status = s->openuser.out.result;
717 if (!NT_STATUS_IS_OK(c->status)) {
718 composite_error(c, c->status);
722 c->status = usermod_change(c, s);
727 * Stage 2a (optional): Query the user information
729 static void continue_usermod_user_queried(struct rpc_request *req)
731 struct composite_context *c;
732 struct usermod_state *s;
733 union samr_UserInfo *i;
735 struct rpc_request *setuser_req;
737 c = talloc_get_type(req->async.private_data, struct composite_context);
738 s = talloc_get_type(c->private_data, struct usermod_state);
742 /* receive samr_QueryUserInfo result */
743 c->status = dcerpc_ndr_request_recv(req);
744 if (!composite_is_ok(c)) return;
746 c->status = s->queryuser.out.result;
747 if (!NT_STATUS_IS_OK(c->status)) {
748 composite_error(c, c->status);
752 /* get returned user data and make a change (potentially one
754 s->info = *s->queryuser.out.info;
756 usermod_setfields(s, &level, i, true);
758 /* prepare rpc call arguments */
759 s->setuser.in.user_handle = &s->user_handle;
760 s->setuser.in.level = level;
761 s->setuser.in.info = i;
763 /* send the rpc request */
764 setuser_req = dcerpc_samr_SetUserInfo_send(s->pipe, c, &s->setuser);
765 composite_continue_rpc(c, setuser_req, continue_usermod_user_changed, c);
770 * Stage 3: Set new user account data
772 static void continue_usermod_user_changed(struct rpc_request *req)
774 struct composite_context *c;
775 struct usermod_state *s;
777 c = talloc_get_type(req->async.private_data, struct composite_context);
778 s = talloc_get_type(c->private_data, struct usermod_state);
780 /* receive samr_SetUserInfo result */
781 c->status = dcerpc_ndr_request_recv(req);
782 if (!composite_is_ok(c)) return;
784 /* return the actual function call status */
785 c->status = s->setuser.out.result;
786 if (!NT_STATUS_IS_OK(c->status)) {
787 composite_error(c, c->status);
791 if (s->change.fields == 0) {
792 /* all fields have been set - we're done */
796 /* something's still not changed - repeat the procedure */
797 c->status = usermod_change(c, s);
803 * Sends asynchronous usermod request
805 * @param p dce/rpc call pipe
806 * @param io arguments and results of the call
807 * @param monitor monitor function for providing information about the progress
810 struct composite_context *libnet_rpc_usermod_send(struct dcerpc_pipe *p,
811 struct libnet_rpc_usermod *io,
812 void (*monitor)(struct monitor_msg*))
814 struct composite_context *c;
815 struct usermod_state *s;
816 struct rpc_request *lookup_req;
818 /* composite context allocation and setup */
819 c = composite_create(p, dcerpc_event_context(p));
820 if (c == NULL) return NULL;
821 s = talloc_zero(c, struct usermod_state);
822 if (composite_nomem(s, c)) return c;
826 /* store parameters in the call structure */
828 s->domain_handle = io->in.domain_handle;
829 s->change = io->in.change;
830 s->monitor_fn = monitor;
832 /* prepare rpc call arguments */
833 s->lookupname.in.domain_handle = &io->in.domain_handle;
834 s->lookupname.in.num_names = 1;
835 s->lookupname.in.names = talloc_zero(s, struct lsa_String);
836 s->lookupname.in.names->string = io->in.username;
838 /* send the rpc request */
839 lookup_req = dcerpc_samr_LookupNames_send(p, c, &s->lookupname);
840 if (composite_nomem(lookup_req, c)) return c;
842 /* callback handler setup */
843 composite_continue_rpc(c, lookup_req, continue_usermod_name_found, c);
849 * Waits for and receives results of asynchronous usermod call
851 * @param c composite context returned by asynchronous usermod call
852 * @param mem_ctx memory context of the call
853 * @param io pointer to results (and arguments) of the call
854 * @return nt status code of execution
857 NTSTATUS libnet_rpc_usermod_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
858 struct libnet_rpc_usermod *io)
862 status = composite_wait(c);
870 * Synchronous version of usermod call
872 * @param pipe dce/rpc call pipe
873 * @param mem_ctx memory context for the call
874 * @param io arguments and results of the call
875 * @return nt status code of execution
878 NTSTATUS libnet_rpc_usermod(struct dcerpc_pipe *p,
880 struct libnet_rpc_usermod *io)
882 struct composite_context *c = libnet_rpc_usermod_send(p, io, NULL);
883 return libnet_rpc_usermod_recv(c, mem_ctx, io);