summaryrefslogtreecommitdiff
path: root/source3/rpc_client
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-11-21 17:09:20 +0000
committerLuke Leighton <lkcl@samba.org>1999-11-21 17:09:20 +0000
commit4629acd6f509acd0b3761d49f42173bd2ba676b2 (patch)
tree24621d908af39ffddae41773835bb1bd2d9d17cf /source3/rpc_client
parent387cc182e6a8a500fe4e0115b33230c6acca8084 (diff)
downloadsamba-4629acd6f509acd0b3761d49f42173bd2ba676b2.tar.gz
samba-4629acd6f509acd0b3761d49f42173bd2ba676b2.tar.bz2
samba-4629acd6f509acd0b3761d49f42173bd2ba676b2.zip
moving create user function into msrpc_samr.c
(This used to be commit e885027eb705ab13c2800b8995661accad841643)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r--source3/rpc_client/msrpc_samr.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/source3/rpc_client/msrpc_samr.c b/source3/rpc_client/msrpc_samr.c
index 76d6d8932c..02ffede615 100644
--- a/source3/rpc_client/msrpc_samr.c
+++ b/source3/rpc_client/msrpc_samr.c
@@ -1425,3 +1425,59 @@ BOOL get_samr_query_aliasinfo(struct cli_state *cli, uint16 fnum,
return samr_close(cli, fnum,&pol_open_alias) && ret;
}
+/****************************************************************************
+SAM create domain user.
+****************************************************************************/
+BOOL msrpc_sam_create_dom_user(struct cli_state *cli, DOM_SID *sid1,
+ char *acct_name, uint16 acb_info,
+ uint32 *rid)
+{
+ uint16 fnum;
+ fstring srv_name;
+ BOOL res = True;
+ BOOL res1 = True;
+ BOOL res2 = True;
+ uint32 ace_perms = 0x02000000; /* absolutely no idea. */
+ uint32 user_rid;
+ POLICY_HND sam_pol;
+ POLICY_HND pol_dom;
+
+ fstrcpy(srv_name, "\\\\");
+ fstrcat(srv_name, cli->desthost);
+ strupper(srv_name);
+
+ /* open SAMR session. negotiate credentials */
+ res = res ? cli_nt_session_open(cli, PIPE_SAMR, &fnum) : False;
+
+ /* establish a connection. */
+ res = res ? samr_connect(cli, fnum,
+ srv_name, 0x02000000,
+ &sam_pol) : False;
+
+ /* connect to the domain */
+ res1 = res ? samr_open_domain(cli, fnum,
+ &sam_pol, ace_perms, sid1,
+ &pol_dom) : False;
+
+ /* create a domain user */
+ res2 = res1 ? create_samr_domain_user(cli, fnum,
+ &pol_dom,
+ acct_name, acb_info, &user_rid) : False;
+
+ res1 = res1 ? samr_close(cli, fnum, &pol_dom) : False;
+ res = res ? samr_close(cli, fnum, &sam_pol) : False;
+
+ /* close the session */
+ cli_nt_session_close(cli, fnum);
+
+ if (res2)
+ {
+ DEBUG(5,("cmd_sam_create_dom_user: succeeded\n"));
+ }
+ else
+ {
+ DEBUG(5,("cmd_sam_create_dom_user: failed\n"));
+ }
+
+ return res2;
+}