summaryrefslogtreecommitdiff
path: root/source3/rpc_client/cli_samr.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-11-18 19:29:08 +0000
committerLuke Leighton <lkcl@samba.org>1999-11-18 19:29:08 +0000
commite3b2f276e04bce6365dfb1a7e0b904b7c788c364 (patch)
treecde4610ae1e2d3ac6c635fd9a2f8cc4599c17ad1 /source3/rpc_client/cli_samr.c
parenta394a4a8fa2c4c0ff03fbc5bc4ea925245ec1fed (diff)
downloadsamba-e3b2f276e04bce6365dfb1a7e0b904b7c788c364.tar.gz
samba-e3b2f276e04bce6365dfb1a7e0b904b7c788c364.tar.bz2
samba-e3b2f276e04bce6365dfb1a7e0b904b7c788c364.zip
added samuserset2 rpcclient command to test ACB_XXX bit-setting on
samr opcode 0x25. _yet_ another failed attempt to get nt5rc2 to join a samba domain. what _is_ it with this stuff, dammit? (This used to be commit c3913f8ae272c496fc4519141accf01ee9f1e49e)
Diffstat (limited to 'source3/rpc_client/cli_samr.c')
-rw-r--r--source3/rpc_client/cli_samr.c97
1 files changed, 93 insertions, 4 deletions
diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c
index d16098247f..d25b6e2305 100644
--- a/source3/rpc_client/cli_samr.c
+++ b/source3/rpc_client/cli_samr.c
@@ -307,6 +307,41 @@ BOOL get_samr_query_aliasmem(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR set user info
****************************************************************************/
+BOOL set_samr_set_userinfo2(struct cli_state *cli, uint16 fnum,
+ POLICY_HND *pol_open_domain,
+ uint32 info_level,
+ uint32 user_rid, void *usr)
+{
+ POLICY_HND pol_open_user;
+ BOOL ret = True;
+
+ if (pol_open_domain == NULL || usr == NULL) return False;
+
+ /* send open domain (on user sid) */
+ if (!samr_open_user(cli, fnum,
+ pol_open_domain,
+ 0x000601b4, user_rid,
+ &pol_open_user))
+ {
+ return False;
+ }
+
+ /* send user info query */
+ if (!samr_set_userinfo2(cli, fnum,
+ &pol_open_user,
+ info_level, usr))
+ {
+ DEBUG(5,("samr_set_userinfo: error in query user info, level 0x%x\n",
+ info_level));
+ ret = False;
+ }
+
+ return samr_close(cli, fnum,&pol_open_user) && ret;
+}
+
+/****************************************************************************
+do a SAMR set user info
+****************************************************************************/
BOOL set_samr_set_userinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
uint32 info_level,
@@ -345,15 +380,13 @@ do a SAMR query user info
BOOL get_samr_query_userinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol_open_domain,
uint32 info_level,
- uint32 user_rid, SAM_USER_INFO_21 *usr)
+ uint32 user_rid, void *usr)
{
POLICY_HND pol_open_user;
BOOL ret = True;
if (pol_open_domain == NULL || usr == NULL) return False;
- bzero(usr, sizeof(*usr));
-
/* send open domain (on user sid) */
if (!samr_open_user(cli, fnum,
pol_open_domain,
@@ -366,7 +399,7 @@ BOOL get_samr_query_userinfo(struct cli_state *cli, uint16 fnum,
/* send user info query */
if (!samr_query_userinfo(cli, fnum,
&pol_open_user,
- info_level, (void*)usr))
+ info_level, usr))
{
DEBUG(5,("samr_query_userinfo: error in query user info, level 0x%x\n",
info_level));
@@ -2559,6 +2592,62 @@ BOOL samr_query_groupinfo(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Set User Info
****************************************************************************/
+BOOL samr_set_userinfo2(struct cli_state *cli, uint16 fnum,
+ POLICY_HND *pol, uint16 switch_value,
+ void* usr)
+{
+ prs_struct data;
+ prs_struct rdata;
+
+ SAMR_Q_SET_USERINFO2 q_o;
+ BOOL valid_query = False;
+
+ DEBUG(4,("SAMR Set User Info 2. level: %d\n", switch_value));
+
+ if (pol == NULL || usr == NULL || switch_value == 0) return False;
+
+ /* create and send a MSRPC command with api SAMR_SET_USERINFO2 */
+
+ prs_init(&data , 1024, 4, SAFETY_MARGIN, False);
+ prs_init(&rdata, 0 , 4, SAFETY_MARGIN, True );
+
+ /* store the parameters */
+ make_samr_q_set_userinfo2(&q_o, pol, switch_value, usr);
+
+ /* turn parameters into data stream */
+ samr_io_q_set_userinfo2("", &q_o, &data, 0);
+
+ /* send the data on \PIPE\ */
+ if (rpc_api_pipe_req(cli, fnum, SAMR_SET_USERINFO2, &data, &rdata))
+ {
+ SAMR_R_SET_USERINFO2 r_o;
+ BOOL p;
+
+ samr_io_r_set_userinfo2("", &r_o, &rdata, 0);
+ p = rdata.offset != 0;
+
+ if (p && r_o.status != 0)
+ {
+ /* report error code */
+ DEBUG(4,("SAMR_R_QUERY_USERINFO2: %s\n", get_nt_error_msg(r_o.status)));
+ p = False;
+ }
+
+ if (p)
+ {
+ valid_query = True;
+ }
+ }
+
+ prs_mem_free(&data );
+ prs_mem_free(&rdata );
+
+ return valid_query;
+}
+
+/****************************************************************************
+do a SAMR Set User Info
+****************************************************************************/
BOOL samr_set_userinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *pol, uint16 switch_value, void* usr)
{