summaryrefslogtreecommitdiff
path: root/source3/rpc_client/cli_samr.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_client/cli_samr.c')
-rw-r--r--source3/rpc_client/cli_samr.c225
1 files changed, 112 insertions, 113 deletions
diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c
index 97e218b1b3..44425b5358 100644
--- a/source3/rpc_client/cli_samr.c
+++ b/source3/rpc_client/cli_samr.c
@@ -31,11 +31,29 @@
extern int DEBUGLEVEL;
+#if 0
+ if (p)
+ {
+ /* ok, at last: we're happy. return the policy handle */
+ memcpy(hnd, r_o.pol.data, sizeof(hnd->data));
+ valid_pol = register_policy_hnd(hnd) &&
+ set_policy_cli_state(hnd, cli, fnum,
+ cli_state_free);
+ }
+
+ struct cli_state *cli = NULL;
+ uint16 fnum = 0xffff;
+
+ if (!cli_state_get(connect_pol, &cli, &fnum))
+ {
+ return False;
+ }
+#endif
/****************************************************************************
do a SAMR change user password command
****************************************************************************/
-BOOL samr_chgpasswd_user(struct cli_state *cli, uint16 fnum,
+BOOL samr_chgpasswd_user( struct cli_state *cli, uint16 fnum,
char *srv_name, char *user_name,
char nt_newpass[516], uchar nt_oldhash[16],
char lm_newpass[516], uchar lm_oldhash[16])
@@ -86,6 +104,8 @@ BOOL samr_chgpasswd_user(struct cli_state *cli, uint16 fnum,
prs_mem_free(&data );
prs_mem_free(&rdata );
+ cli_state_free(cli, fnum);
+
return valid_pwc;
}
@@ -145,8 +165,7 @@ BOOL samr_unknown_38(struct cli_state *cli, uint16 fnum, char *srv_name)
/****************************************************************************
do a SAMR unknown 0x8 command
****************************************************************************/
-BOOL samr_query_dom_info(struct cli_state *cli, uint16 fnum,
- POLICY_HND *domain_pol, uint16 switch_value,
+BOOL samr_query_dom_info( POLICY_HND *domain_pol, uint16 switch_value,
SAM_UNK_CTR *ctr)
{
prs_struct data;
@@ -171,7 +190,7 @@ BOOL samr_query_dom_info(struct cli_state *cli, uint16 fnum,
samr_io_q_query_dom_info("", &q_e, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_QUERY_DOMAIN_INFO, &data, &rdata))
+ if (rpc_hnd_pipe_req(domain_pol, SAMR_QUERY_DOMAIN_INFO, &data, &rdata))
{
SAMR_R_QUERY_DOMAIN_INFO r_e;
BOOL p;
@@ -202,8 +221,7 @@ BOOL samr_query_dom_info(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR enumerate Domains
****************************************************************************/
-uint32 samr_enum_domains(struct cli_state *cli, uint16 fnum,
- POLICY_HND *pol,
+uint32 samr_enum_domains( POLICY_HND *pol,
uint32 *start_idx, uint32 size,
struct acct_info **sam,
uint32 *num_sam_domains)
@@ -233,7 +251,7 @@ uint32 samr_enum_domains(struct cli_state *cli, uint16 fnum,
samr_io_q_enum_domains("", &q_e, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_ENUM_DOMAINS, &data, &rdata))
+ if (rpc_hnd_pipe_req(pol, SAMR_ENUM_DOMAINS, &data, &rdata))
{
SAMR_R_ENUM_DOMAINS r_e;
BOOL p;
@@ -304,8 +322,7 @@ uint32 samr_enum_domains(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR enumerate groups
****************************************************************************/
-uint32 samr_enum_dom_groups(struct cli_state *cli, uint16 fnum,
- POLICY_HND *pol,
+uint32 samr_enum_dom_groups( POLICY_HND *pol,
uint32 *start_idx, uint32 size,
struct acct_info **sam,
uint32 *num_sam_groups)
@@ -335,7 +352,7 @@ uint32 samr_enum_dom_groups(struct cli_state *cli, uint16 fnum,
samr_io_q_enum_dom_groups("", &q_e, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_ENUM_DOM_GROUPS, &data, &rdata))
+ if (rpc_hnd_pipe_req(pol, SAMR_ENUM_DOM_GROUPS, &data, &rdata))
{
SAMR_R_ENUM_DOM_GROUPS r_e;
BOOL p;
@@ -406,8 +423,7 @@ uint32 samr_enum_dom_groups(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR enumerate aliases
****************************************************************************/
-uint32 samr_enum_dom_aliases(struct cli_state *cli, uint16 fnum,
- POLICY_HND *pol,
+uint32 samr_enum_dom_aliases( POLICY_HND *pol,
uint32 *start_idx, uint32 size,
struct acct_info **sam,
uint32 *num_sam_aliases)
@@ -437,7 +453,7 @@ uint32 samr_enum_dom_aliases(struct cli_state *cli, uint16 fnum,
samr_io_q_enum_dom_aliases("", &q_e, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_ENUM_DOM_ALIASES, &data, &rdata))
+ if (rpc_hnd_pipe_req(pol, SAMR_ENUM_DOM_ALIASES, &data, &rdata))
{
SAMR_R_ENUM_DOM_ALIASES r_e;
BOOL p;
@@ -507,8 +523,7 @@ uint32 samr_enum_dom_aliases(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR enumerate users
****************************************************************************/
-uint32 samr_enum_dom_users(struct cli_state *cli, uint16 fnum,
- POLICY_HND *pol, uint32 *start_idx,
+uint32 samr_enum_dom_users( POLICY_HND *pol, uint32 *start_idx,
uint16 acb_mask, uint16 unk_1, uint32 size,
struct acct_info **sam,
uint32 *num_sam_users)
@@ -539,7 +554,7 @@ uint32 samr_enum_dom_users(struct cli_state *cli, uint16 fnum,
samr_io_q_enum_dom_users("", &q_e, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_ENUM_DOM_USERS, &data, &rdata))
+ if (rpc_hnd_pipe_req(pol, SAMR_ENUM_DOM_USERS, &data, &rdata))
{
SAMR_R_ENUM_DOM_USERS r_e;
BOOL p;
@@ -615,8 +630,7 @@ uint32 samr_enum_dom_users(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Connect
****************************************************************************/
-BOOL samr_connect(struct cli_state *cli, uint16 fnum,
- const char *srv_name, uint32 unknown_0,
+BOOL samr_connect( const char *srv_name, uint32 unknown_0,
POLICY_HND *connect_pol)
{
prs_struct data;
@@ -625,6 +639,14 @@ BOOL samr_connect(struct cli_state *cli, uint16 fnum,
SAMR_Q_CONNECT q_o;
BOOL valid_pol = False;
+ struct cli_state *cli = NULL;
+ uint16 fnum = 0xffff;
+
+ if (!cli_state_init(srv_name, PIPE_SAMR, &cli, &fnum))
+ {
+ return False;
+ }
+
DEBUG(4,("SAMR Open Policy server:%s undoc value:%x\n",
srv_name, unknown_0));
@@ -660,7 +682,9 @@ BOOL samr_connect(struct cli_state *cli, uint16 fnum,
if (p)
{
memcpy(connect_pol, &r_o.connect_pol, sizeof(r_o.connect_pol));
- valid_pol = True;
+ valid_pol = register_policy_hnd(connect_pol) &&
+ set_policy_cli_state(connect_pol, cli, fnum,
+ cli_state_free);
}
}
@@ -673,8 +697,7 @@ BOOL samr_connect(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Open User
****************************************************************************/
-BOOL samr_open_user(struct cli_state *cli, uint16 fnum,
- const POLICY_HND *pol,
+BOOL samr_open_user( const POLICY_HND *pol,
uint32 unk_0, uint32 rid,
POLICY_HND *user_pol)
{
@@ -701,7 +724,7 @@ BOOL samr_open_user(struct cli_state *cli, uint16 fnum,
samr_io_q_open_user("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_OPEN_USER, &data, &rdata))
+ if (rpc_hnd_pipe_req(pol, SAMR_OPEN_USER, &data, &rdata))
{
SAMR_R_OPEN_USER r_o;
BOOL p;
@@ -719,7 +742,7 @@ BOOL samr_open_user(struct cli_state *cli, uint16 fnum,
if (p)
{
memcpy(user_pol, &r_o.user_pol, sizeof(r_o.user_pol));
- valid_pol = True;
+ valid_pol = cli_pol_link(user_pol, pol);
}
}
@@ -732,8 +755,7 @@ BOOL samr_open_user(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Open Alias
****************************************************************************/
-BOOL samr_open_alias(struct cli_state *cli, uint16 fnum,
- const POLICY_HND *domain_pol,
+BOOL samr_open_alias( const POLICY_HND *domain_pol,
uint32 flags, uint32 rid,
POLICY_HND *alias_pol)
{
@@ -759,7 +781,7 @@ BOOL samr_open_alias(struct cli_state *cli, uint16 fnum,
samr_io_q_open_alias("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_OPEN_ALIAS, &data, &rdata))
+ if (rpc_hnd_pipe_req(domain_pol, SAMR_OPEN_ALIAS, &data, &rdata))
{
SAMR_R_OPEN_ALIAS r_o;
BOOL p;
@@ -777,7 +799,7 @@ BOOL samr_open_alias(struct cli_state *cli, uint16 fnum,
if (p)
{
memcpy(alias_pol, &r_o.pol, sizeof(r_o.pol));
- valid_pol = True;
+ valid_pol = cli_pol_link(alias_pol, domain_pol);
}
}
@@ -790,8 +812,7 @@ BOOL samr_open_alias(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Delete Alias Member
****************************************************************************/
-BOOL samr_del_aliasmem(struct cli_state *cli, uint16 fnum,
- POLICY_HND *alias_pol, DOM_SID *sid)
+BOOL samr_del_aliasmem( POLICY_HND *alias_pol, DOM_SID *sid)
{
prs_struct data;
prs_struct rdata;
@@ -815,7 +836,7 @@ BOOL samr_del_aliasmem(struct cli_state *cli, uint16 fnum,
samr_io_q_del_aliasmem("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_DEL_ALIASMEM, &data, &rdata))
+ if (rpc_hnd_pipe_req(alias_pol, SAMR_DEL_ALIASMEM, &data, &rdata))
{
SAMR_R_DEL_ALIASMEM r_o;
BOOL p;
@@ -845,8 +866,7 @@ BOOL samr_del_aliasmem(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Add Alias Member
****************************************************************************/
-BOOL samr_add_aliasmem(struct cli_state *cli, uint16 fnum,
- POLICY_HND *alias_pol, DOM_SID *sid)
+BOOL samr_add_aliasmem( POLICY_HND *alias_pol, DOM_SID *sid)
{
prs_struct data;
prs_struct rdata;
@@ -870,7 +890,7 @@ BOOL samr_add_aliasmem(struct cli_state *cli, uint16 fnum,
samr_io_q_add_aliasmem("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_ADD_ALIASMEM, &data, &rdata))
+ if (rpc_hnd_pipe_req(alias_pol, SAMR_ADD_ALIASMEM, &data, &rdata))
{
SAMR_R_ADD_ALIASMEM r_o;
BOOL p;
@@ -900,8 +920,7 @@ BOOL samr_add_aliasmem(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Delete Domain Alias
****************************************************************************/
-BOOL samr_delete_dom_alias(struct cli_state *cli, uint16 fnum,
- POLICY_HND *alias_pol)
+BOOL samr_delete_dom_alias( POLICY_HND *alias_pol)
{
prs_struct data;
prs_struct rdata;
@@ -925,7 +944,7 @@ BOOL samr_delete_dom_alias(struct cli_state *cli, uint16 fnum,
samr_io_q_delete_dom_alias("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_DELETE_DOM_ALIAS, &data, &rdata))
+ if (rpc_hnd_pipe_req(alias_pol, SAMR_DELETE_DOM_ALIAS, &data, &rdata))
{
SAMR_R_DELETE_DOM_ALIAS r_o;
BOOL p;
@@ -955,8 +974,7 @@ BOOL samr_delete_dom_alias(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Create Domain User
****************************************************************************/
-BOOL samr_create_dom_user(struct cli_state *cli, uint16 fnum,
- POLICY_HND *domain_pol, const char *acct_name,
+BOOL samr_create_dom_user( POLICY_HND *domain_pol, const char *acct_name,
uint32 unk_0, uint32 unk_1,
POLICY_HND *user_pol, uint32 *rid)
{
@@ -982,7 +1000,7 @@ BOOL samr_create_dom_user(struct cli_state *cli, uint16 fnum,
samr_io_q_create_user("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_CREATE_USER, &data, &rdata))
+ if (rpc_hnd_pipe_req(domain_pol, SAMR_CREATE_USER, &data, &rdata))
{
SAMR_R_CREATE_USER r_o;
BOOL p;
@@ -1001,7 +1019,7 @@ BOOL samr_create_dom_user(struct cli_state *cli, uint16 fnum,
{
memcpy(user_pol, &r_o.user_pol, sizeof(r_o.user_pol));
*rid = r_o.user_rid;
- valid_pol = True;
+ valid_pol = cli_pol_link(user_pol, domain_pol);
}
}
@@ -1014,8 +1032,7 @@ BOOL samr_create_dom_user(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Create Domain Alias
****************************************************************************/
-BOOL samr_create_dom_alias(struct cli_state *cli, uint16 fnum,
- POLICY_HND *domain_pol, const char *acct_name,
+BOOL samr_create_dom_alias( POLICY_HND *domain_pol, const char *acct_name,
POLICY_HND *alias_pol, uint32 *rid)
{
prs_struct data;
@@ -1040,7 +1057,7 @@ BOOL samr_create_dom_alias(struct cli_state *cli, uint16 fnum,
samr_io_q_create_dom_alias("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_CREATE_DOM_ALIAS, &data, &rdata))
+ if (rpc_hnd_pipe_req(domain_pol, SAMR_CREATE_DOM_ALIAS, &data, &rdata))
{
SAMR_R_CREATE_DOM_ALIAS r_o;
BOOL p;
@@ -1059,7 +1076,7 @@ BOOL samr_create_dom_alias(struct cli_state *cli, uint16 fnum,
{
memcpy(alias_pol, &r_o.alias_pol, sizeof(r_o.alias_pol));
*rid = r_o.rid;
- valid_pol = True;
+ valid_pol = cli_pol_link(alias_pol, domain_pol);
}
}
@@ -1072,8 +1089,7 @@ BOOL samr_create_dom_alias(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Get Alias Info
****************************************************************************/
-BOOL samr_query_aliasinfo(struct cli_state *cli, uint16 fnum,
- POLICY_HND *alias_pol, uint16 switch_value,
+BOOL samr_query_aliasinfo( POLICY_HND *alias_pol, uint16 switch_value,
ALIAS_INFO_CTR *ctr)
{
prs_struct data;
@@ -1098,7 +1114,7 @@ BOOL samr_query_aliasinfo(struct cli_state *cli, uint16 fnum,
samr_io_q_query_aliasinfo("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_QUERY_ALIASINFO, &data, &rdata))
+ if (rpc_hnd_pipe_req(alias_pol, SAMR_QUERY_ALIASINFO, &data, &rdata))
{
SAMR_R_QUERY_ALIASINFO r_o;
BOOL p;
@@ -1131,8 +1147,7 @@ BOOL samr_query_aliasinfo(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Set Alias Info
****************************************************************************/
-BOOL samr_set_aliasinfo(struct cli_state *cli, uint16 fnum,
- POLICY_HND *alias_pol, ALIAS_INFO_CTR *ctr)
+BOOL samr_set_aliasinfo( POLICY_HND *alias_pol, ALIAS_INFO_CTR *ctr)
{
prs_struct data;
prs_struct rdata;
@@ -1156,7 +1171,7 @@ BOOL samr_set_aliasinfo(struct cli_state *cli, uint16 fnum,
samr_io_q_set_aliasinfo("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_SET_ALIASINFO, &data, &rdata))
+ if (rpc_hnd_pipe_req(alias_pol, SAMR_SET_ALIASINFO, &data, &rdata))
{
SAMR_R_SET_ALIASINFO r_o;
BOOL p;
@@ -1186,8 +1201,7 @@ BOOL samr_set_aliasinfo(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Open Group
****************************************************************************/
-BOOL samr_open_group(struct cli_state *cli, uint16 fnum,
- const POLICY_HND *domain_pol,
+BOOL samr_open_group( const POLICY_HND *domain_pol,
uint32 flags, uint32 rid,
POLICY_HND *group_pol)
{
@@ -1213,7 +1227,7 @@ BOOL samr_open_group(struct cli_state *cli, uint16 fnum,
samr_io_q_open_group("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_OPEN_GROUP, &data, &rdata))
+ if (rpc_hnd_pipe_req(domain_pol, SAMR_OPEN_GROUP, &data, &rdata))
{
SAMR_R_OPEN_GROUP r_o;
BOOL p;
@@ -1231,7 +1245,7 @@ BOOL samr_open_group(struct cli_state *cli, uint16 fnum,
if (p)
{
memcpy(group_pol, &r_o.pol, sizeof(r_o.pol));
- valid_pol = True;
+ valid_pol = cli_pol_link(group_pol, domain_pol);
}
}
@@ -1244,8 +1258,7 @@ BOOL samr_open_group(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Delete Group Member
****************************************************************************/
-BOOL samr_del_groupmem(struct cli_state *cli, uint16 fnum,
- POLICY_HND *group_pol, uint32 rid)
+BOOL samr_del_groupmem( POLICY_HND *group_pol, uint32 rid)
{
prs_struct data;
prs_struct rdata;
@@ -1269,7 +1282,7 @@ BOOL samr_del_groupmem(struct cli_state *cli, uint16 fnum,
samr_io_q_del_groupmem("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_DEL_GROUPMEM, &data, &rdata))
+ if (rpc_hnd_pipe_req(group_pol, SAMR_DEL_GROUPMEM, &data, &rdata))
{
SAMR_R_DEL_GROUPMEM r_o;
BOOL p;
@@ -1299,8 +1312,7 @@ BOOL samr_del_groupmem(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Add Group Member
****************************************************************************/
-BOOL samr_add_groupmem(struct cli_state *cli, uint16 fnum,
- POLICY_HND *group_pol, uint32 rid)
+BOOL samr_add_groupmem( POLICY_HND *group_pol, uint32 rid)
{
prs_struct data;
prs_struct rdata;
@@ -1324,7 +1336,7 @@ BOOL samr_add_groupmem(struct cli_state *cli, uint16 fnum,
samr_io_q_add_groupmem("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_ADD_GROUPMEM, &data, &rdata))
+ if (rpc_hnd_pipe_req(group_pol, SAMR_ADD_GROUPMEM, &data, &rdata))
{
SAMR_R_ADD_GROUPMEM r_o;
BOOL p;
@@ -1354,7 +1366,7 @@ BOOL samr_add_groupmem(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Delete Domain Group
****************************************************************************/
-BOOL samr_delete_dom_group(struct cli_state *cli, uint16 fnum, POLICY_HND *group_pol)
+BOOL samr_delete_dom_group( POLICY_HND *group_pol)
{
prs_struct data;
prs_struct rdata;
@@ -1378,7 +1390,7 @@ BOOL samr_delete_dom_group(struct cli_state *cli, uint16 fnum, POLICY_HND *group
samr_io_q_delete_dom_group("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_DELETE_DOM_GROUP, &data, &rdata))
+ if (rpc_hnd_pipe_req(group_pol, SAMR_DELETE_DOM_GROUP, &data, &rdata))
{
SAMR_R_DELETE_DOM_GROUP r_o;
BOOL p;
@@ -1408,8 +1420,7 @@ BOOL samr_delete_dom_group(struct cli_state *cli, uint16 fnum, POLICY_HND *group
/****************************************************************************
do a SAMR Create Domain Group
****************************************************************************/
-BOOL samr_create_dom_group(struct cli_state *cli, uint16 fnum,
- POLICY_HND *domain_pol, const char *acct_name,
+BOOL samr_create_dom_group( POLICY_HND *domain_pol, const char *acct_name,
POLICY_HND *group_pol, uint32 *rid)
{
prs_struct data;
@@ -1434,7 +1445,7 @@ BOOL samr_create_dom_group(struct cli_state *cli, uint16 fnum,
samr_io_q_create_dom_group("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_CREATE_DOM_GROUP, &data, &rdata))
+ if (rpc_hnd_pipe_req(domain_pol, SAMR_CREATE_DOM_GROUP, &data, &rdata))
{
SAMR_R_CREATE_DOM_GROUP r_o;
BOOL p;
@@ -1453,7 +1464,7 @@ BOOL samr_create_dom_group(struct cli_state *cli, uint16 fnum,
{
memcpy(group_pol, &r_o.pol, sizeof(r_o.pol));
*rid = r_o.rid;
- valid_pol = True;
+ valid_pol = cli_pol_link(group_pol, domain_pol);
}
}
@@ -1466,8 +1477,7 @@ BOOL samr_create_dom_group(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Set Group Info
****************************************************************************/
-BOOL samr_set_groupinfo(struct cli_state *cli, uint16 fnum,
- POLICY_HND *group_pol, GROUP_INFO_CTR *ctr)
+BOOL samr_set_groupinfo( POLICY_HND *group_pol, GROUP_INFO_CTR *ctr)
{
prs_struct data;
prs_struct rdata;
@@ -1491,7 +1501,7 @@ BOOL samr_set_groupinfo(struct cli_state *cli, uint16 fnum,
samr_io_q_set_groupinfo("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_SET_GROUPINFO, &data, &rdata))
+ if (rpc_hnd_pipe_req(group_pol, SAMR_SET_GROUPINFO, &data, &rdata))
{
SAMR_R_SET_GROUPINFO r_o;
BOOL p;
@@ -1521,8 +1531,7 @@ BOOL samr_set_groupinfo(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Open Domain
****************************************************************************/
-BOOL samr_open_domain(struct cli_state *cli, uint16 fnum,
- const POLICY_HND *connect_pol,
+BOOL samr_open_domain( const POLICY_HND *connect_pol,
uint32 ace_perms,
const DOM_SID *sid,
POLICY_HND *domain_pol)
@@ -1555,7 +1564,7 @@ BOOL samr_open_domain(struct cli_state *cli, uint16 fnum,
samr_io_q_open_domain("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_OPEN_DOMAIN, &data, &rdata))
+ if (rpc_hnd_pipe_req(connect_pol, SAMR_OPEN_DOMAIN, &data, &rdata))
{
SAMR_R_OPEN_DOMAIN r_o;
BOOL p;
@@ -1573,7 +1582,7 @@ BOOL samr_open_domain(struct cli_state *cli, uint16 fnum,
if (p)
{
memcpy(domain_pol, &r_o.domain_pol, sizeof(r_o.domain_pol));
- valid_pol = True;
+ valid_pol = cli_pol_link(domain_pol, connect_pol);
}
}
@@ -1586,8 +1595,7 @@ BOOL samr_open_domain(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Query Lookup Domain
****************************************************************************/
-BOOL samr_query_lookup_domain(struct cli_state *cli, uint16 fnum,
- POLICY_HND *pol, const char *dom_name,
+BOOL samr_query_lookup_domain( POLICY_HND *pol, const char *dom_name,
DOM_SID *dom_sid)
{
prs_struct data;
@@ -1612,7 +1620,7 @@ BOOL samr_query_lookup_domain(struct cli_state *cli, uint16 fnum,
samr_io_q_lookup_domain("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_LOOKUP_DOMAIN, &data, &rdata))
+ if (rpc_hnd_pipe_req(pol, SAMR_LOOKUP_DOMAIN, &data, &rdata))
{
SAMR_R_LOOKUP_DOMAIN r_o;
BOOL p;
@@ -1643,8 +1651,7 @@ BOOL samr_query_lookup_domain(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Query Lookup Names
****************************************************************************/
-BOOL samr_query_lookup_names(struct cli_state *cli, uint16 fnum,
- POLICY_HND *pol, uint32 flags,
+BOOL samr_query_lookup_names( POLICY_HND *pol, uint32 flags,
uint32 num_names, char **names,
uint32 *num_rids,
uint32 rid[MAX_LOOKUP_SIDS],
@@ -1673,7 +1680,7 @@ BOOL samr_query_lookup_names(struct cli_state *cli, uint16 fnum,
samr_io_q_lookup_names("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_LOOKUP_NAMES, &data, &rdata))
+ if (rpc_hnd_pipe_req(pol, SAMR_LOOKUP_NAMES, &data, &rdata))
{
SAMR_R_LOOKUP_NAMES r_o;
BOOL p;
@@ -1728,8 +1735,7 @@ BOOL samr_query_lookup_names(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Query Lookup RIDS
****************************************************************************/
-BOOL samr_query_lookup_rids(struct cli_state *cli, uint16 fnum,
- const POLICY_HND *pol, uint32 flags,
+BOOL samr_query_lookup_rids( const POLICY_HND *pol, uint32 flags,
uint32 num_rids, uint32 *rids,
uint32 *num_names,
char ***names,
@@ -1758,7 +1764,7 @@ BOOL samr_query_lookup_rids(struct cli_state *cli, uint16 fnum,
samr_io_q_lookup_rids("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_LOOKUP_RIDS, &data, &rdata))
+ if (rpc_hnd_pipe_req(pol, SAMR_LOOKUP_RIDS, &data, &rdata))
{
SAMR_R_LOOKUP_RIDS r_o;
BOOL p;
@@ -1827,8 +1833,7 @@ BOOL samr_query_lookup_rids(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Query Alias Members
****************************************************************************/
-BOOL samr_query_aliasmem(struct cli_state *cli, uint16 fnum,
- const POLICY_HND *alias_pol,
+BOOL samr_query_aliasmem( const POLICY_HND *alias_pol,
uint32 *num_mem, DOM_SID2 *sid)
{
prs_struct data;
@@ -1853,7 +1858,7 @@ BOOL samr_query_aliasmem(struct cli_state *cli, uint16 fnum,
samr_io_q_query_aliasmem("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_QUERY_ALIASMEM, &data, &rdata))
+ if (rpc_hnd_pipe_req(alias_pol, SAMR_QUERY_ALIASMEM, &data, &rdata))
{
SAMR_R_QUERY_ALIASMEM r_o;
BOOL p;
@@ -1888,8 +1893,7 @@ BOOL samr_query_aliasmem(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Query User Aliases
****************************************************************************/
-BOOL samr_query_useraliases(struct cli_state *cli, uint16 fnum,
- const POLICY_HND *pol,
+BOOL samr_query_useraliases( const POLICY_HND *pol,
uint32 *ptr_sid, DOM_SID2 *sid,
uint32 *num_aliases, uint32 **rid)
{
@@ -1916,7 +1920,7 @@ BOOL samr_query_useraliases(struct cli_state *cli, uint16 fnum,
samr_io_q_query_useraliases("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_QUERY_USERALIASES, &data, &rdata))
+ if (rpc_hnd_pipe_req(pol, SAMR_QUERY_USERALIASES, &data, &rdata))
{
SAMR_R_QUERY_USERALIASES r_o;
BOOL p;
@@ -1951,8 +1955,7 @@ BOOL samr_query_useraliases(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Query Group Members
****************************************************************************/
-BOOL samr_query_groupmem(struct cli_state *cli, uint16 fnum,
- POLICY_HND *group_pol,
+BOOL samr_query_groupmem( POLICY_HND *group_pol,
uint32 *num_mem, uint32 **rid, uint32 **attr)
{
prs_struct data;
@@ -1977,7 +1980,7 @@ BOOL samr_query_groupmem(struct cli_state *cli, uint16 fnum,
samr_io_q_query_groupmem("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_QUERY_GROUPMEM, &data, &rdata))
+ if (rpc_hnd_pipe_req(group_pol, SAMR_QUERY_GROUPMEM, &data, &rdata))
{
SAMR_R_QUERY_GROUPMEM r_o;
BOOL p;
@@ -2016,8 +2019,7 @@ BOOL samr_query_groupmem(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Query User Groups
****************************************************************************/
-BOOL samr_query_usergroups(struct cli_state *cli, uint16 fnum,
- POLICY_HND *pol, uint32 *num_groups,
+BOOL samr_query_usergroups( POLICY_HND *pol, uint32 *num_groups,
DOM_GID **gid)
{
prs_struct data;
@@ -2042,7 +2044,7 @@ BOOL samr_query_usergroups(struct cli_state *cli, uint16 fnum,
samr_io_q_query_usergroups("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_QUERY_USERGROUPS, &data, &rdata))
+ if (rpc_hnd_pipe_req(pol, SAMR_QUERY_USERGROUPS, &data, &rdata))
{
SAMR_R_QUERY_USERGROUPS r_o;
BOOL p;
@@ -2078,8 +2080,7 @@ BOOL samr_query_usergroups(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Query Group Info
****************************************************************************/
-BOOL samr_query_groupinfo(struct cli_state *cli, uint16 fnum,
- POLICY_HND *pol,
+BOOL samr_query_groupinfo( POLICY_HND *pol,
uint16 switch_value, GROUP_INFO_CTR* ctr)
{
prs_struct data;
@@ -2104,7 +2105,7 @@ BOOL samr_query_groupinfo(struct cli_state *cli, uint16 fnum,
samr_io_q_query_groupinfo("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_QUERY_GROUPINFO, &data, &rdata))
+ if (rpc_hnd_pipe_req(pol, SAMR_QUERY_GROUPINFO, &data, &rdata))
{
SAMR_R_QUERY_GROUPINFO r_o;
BOOL p;
@@ -2143,8 +2144,7 @@ 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,
+BOOL samr_set_userinfo2( POLICY_HND *pol, uint16 switch_value,
void* usr)
{
prs_struct data;
@@ -2169,7 +2169,7 @@ BOOL samr_set_userinfo2(struct cli_state *cli, uint16 fnum,
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))
+ if (rpc_hnd_pipe_req(pol, SAMR_SET_USERINFO2, &data, &rdata))
{
SAMR_R_SET_USERINFO2 r_o;
BOOL p;
@@ -2199,8 +2199,7 @@ BOOL samr_set_userinfo2(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Set User Info
****************************************************************************/
-BOOL samr_set_userinfo(struct cli_state *cli, uint16 fnum,
- POLICY_HND *pol, uint16 switch_value, void* usr)
+BOOL samr_set_userinfo( POLICY_HND *pol, uint16 switch_value, void* usr)
{
prs_struct data;
prs_struct rdata;
@@ -2224,7 +2223,7 @@ BOOL samr_set_userinfo(struct cli_state *cli, uint16 fnum,
samr_io_q_set_userinfo("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_SET_USERINFO, &data, &rdata))
+ if (rpc_hnd_pipe_req(pol, SAMR_SET_USERINFO, &data, &rdata))
{
SAMR_R_SET_USERINFO r_o;
BOOL p;
@@ -2254,8 +2253,7 @@ BOOL samr_set_userinfo(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Query User Info
****************************************************************************/
-BOOL samr_query_userinfo(struct cli_state *cli, uint16 fnum,
- POLICY_HND *pol, uint16 switch_value, void* usr)
+BOOL samr_query_userinfo( POLICY_HND *pol, uint16 switch_value, void* usr)
{
prs_struct data;
prs_struct rdata;
@@ -2279,7 +2277,7 @@ BOOL samr_query_userinfo(struct cli_state *cli, uint16 fnum,
samr_io_q_query_userinfo("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_QUERY_USERINFO, &data, &rdata))
+ if (rpc_hnd_pipe_req(pol, SAMR_QUERY_USERINFO, &data, &rdata))
{
SAMR_R_QUERY_USERINFO r_o;
BOOL p;
@@ -2318,7 +2316,7 @@ BOOL samr_query_userinfo(struct cli_state *cli, uint16 fnum,
/****************************************************************************
do a SAMR Close
****************************************************************************/
-BOOL samr_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd)
+BOOL samr_close( POLICY_HND *hnd)
{
prs_struct data;
prs_struct rdata;
@@ -2342,7 +2340,7 @@ BOOL samr_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd)
samr_io_q_close_hnd("", &q_c, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_CLOSE_HND, &data, &rdata))
+ if (rpc_hnd_pipe_req(hnd, SAMR_CLOSE_HND, &data, &rdata))
{
SAMR_R_CLOSE_HND r_c;
BOOL p;
@@ -2381,14 +2379,15 @@ BOOL samr_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd)
prs_mem_free(&data );
prs_mem_free(&rdata );
+ close_policy_hnd(hnd);
+
return valid_close;
}
/****************************************************************************
do a SAMR query display info
****************************************************************************/
-BOOL samr_query_dispinfo(struct cli_state *cli, uint16 fnum,
- POLICY_HND *pol_open_domain, uint16 level,
+BOOL samr_query_dispinfo( POLICY_HND *pol_domain, uint16 level,
uint32 *num_entries,
SAM_DISPINFO_CTR *ctr)
{
@@ -2400,7 +2399,7 @@ BOOL samr_query_dispinfo(struct cli_state *cli, uint16 fnum,
DEBUG(4,("SAMR Query Display Info. level: %d\n", level));
- if (pol_open_domain == NULL || num_entries == NULL || ctr == NULL ||
+ if (pol_domain == NULL || num_entries == NULL || ctr == NULL ||
level == 0)
{
return False;
@@ -2412,13 +2411,13 @@ BOOL samr_query_dispinfo(struct cli_state *cli, uint16 fnum,
prs_init(&rdata, 0 , 4, SAFETY_MARGIN, True );
/* store the parameters */
- make_samr_q_query_dispinfo(&q_o, pol_open_domain, level, 0, 0xffffffff);
+ make_samr_q_query_dispinfo(&q_o, pol_domain, level, 0, 0xffffffff);
/* turn parameters into data stream */
samr_io_q_query_dispinfo("", &q_o, &data, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SAMR_QUERY_DISPINFO, &data, &rdata))
+ if (rpc_hnd_pipe_req(pol_domain, SAMR_QUERY_DISPINFO, &data, &rdata))
{
SAMR_R_QUERY_DISPINFO r_o;
BOOL p;