summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/rpc_client/cli_samr.c57
-rw-r--r--source3/rpcclient/cmd_samr.c45
3 files changed, 98 insertions, 6 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index f9e91b4644..fa225da960 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1909,6 +1909,8 @@ BOOL samr_create_dom_user(struct cli_state *cli, uint16 fnum,
BOOL samr_create_dom_alias(struct cli_state *cli, uint16 fnum,
POLICY_HND *domain_pol, const char *acct_name,
POLICY_HND *alias_pol, uint32 *rid);
+BOOL samr_get_aliasinfo(struct cli_state *cli, uint16 fnum,
+ POLICY_HND *alias_pol, ALIAS_INFO_CTR *ctr);
BOOL samr_set_aliasinfo(struct cli_state *cli, uint16 fnum,
POLICY_HND *alias_pol, ALIAS_INFO_CTR *ctr);
BOOL samr_open_group(struct cli_state *cli, uint16 fnum,
diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c
index 5e381ba523..7cc2dff6b4 100644
--- a/source3/rpc_client/cli_samr.c
+++ b/source3/rpc_client/cli_samr.c
@@ -1266,6 +1266,63 @@ BOOL samr_create_dom_alias(struct cli_state *cli, uint16 fnum,
return valid_pol;
}
+#if 0
+/****************************************************************************
+do a SAMR Get Alias Info
+****************************************************************************/
+BOOL samr_get_aliasinfo(struct cli_state *cli, uint16 fnum,
+ POLICY_HND *alias_pol, ALIAS_INFO_CTR *ctr)
+{
+ prs_struct data;
+ prs_struct rdata;
+
+ SAMR_Q_GET_ALIASINFO q_o;
+ BOOL valid_pol = False;
+
+ if (alias_pol == NULL || ctr == NULL) return False;
+
+ /* create and send a MSRPC command with api SAMR_GET_ALIASINFO */
+
+ prs_init(&data , 1024, 4, SAFETY_MARGIN, False);
+ prs_init(&rdata, 0 , 4, SAFETY_MARGIN, True );
+
+ DEBUG(4,("SAMR Get Alias Info\n"));
+
+ /* store the parameters */
+ make_samr_q_get_aliasinfo(&q_o, alias_pol, ctr);
+
+ /* turn parameters into data stream */
+ samr_io_q_get_aliasinfo("", &q_o, &data, 0);
+
+ /* send the data on \PIPE\ */
+ if (rpc_api_pipe_req(cli, fnum, SAMR_GET_ALIASINFO, &data, &rdata))
+ {
+ SAMR_R_GET_ALIASINFO r_o;
+ BOOL p;
+
+ samr_io_r_get_aliasinfo("", &r_o, &rdata, 0);
+ p = rdata.offset != 0;
+
+ if (p && r_o.status != 0)
+ {
+ /* report error code */
+ DEBUG(0,("SAMR_R_GET_ALIASINFO: %s\n", get_nt_error_msg(r_o.status)));
+ p = False;
+ }
+
+ if (p)
+ {
+ valid_pol = True;
+ }
+ }
+
+ prs_mem_free(&data );
+ prs_mem_free(&rdata );
+
+ return valid_pol;
+}
+#endif
+
/****************************************************************************
do a SAMR Set Alias Info
****************************************************************************/
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index 045160f78c..e4113f4b5d 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -1207,6 +1207,24 @@ static void req_user_info(struct client_info *info, uint16 fnum,
}
}
+static void query_groupinfo(struct client_info *info, uint16 fnum,
+ uint32 group_rid)
+{
+ GROUP_INFO_CTR ctr;
+
+ /* send group info query */
+ if (get_samr_query_groupinfo(smb_cli, fnum,
+ &info->dom.samr_pol_open_domain,
+ group_rid, 1, &ctr))
+ {
+#if 0
+ display_samr_groupinfo(out_hnd, ACTION_HEADER , &ctr);
+ display_samr_groupinfo(out_hnd, ACTION_ENUMERATE, &ctr);
+ display_samr_groupinfo(out_hnd, ACTION_FOOTER , &ctr);
+#endif
+ }
+}
+
static void req_group_info(struct client_info *info, uint16 fnum,
uint32 user_rid)
{
@@ -1422,14 +1440,14 @@ void cmd_sam_enum_users(struct client_info *info)
user_rid,
info->dom.sam[user_idx].acct_name);
- if (request_user_info)
+ if (request_group_info)
{
- req_user_info(info, fnum, user_rid);
+ req_group_info(info, fnum, user_rid);
}
- if (request_group_info)
+ if (request_user_info)
{
- req_group_info(info, fnum, user_rid);
+ req_user_info(info, fnum, user_rid);
}
if (request_alias_info)
@@ -1863,9 +1881,11 @@ void cmd_sam_enum_groups(struct client_info *info)
DOM_SID sid1;
BOOL res = True;
BOOL request_member_info = False;
+ BOOL request_group_info = False;
uint32 ace_perms = 0x02000000; /* access control permissions. */
fstring tmp;
uint32 group_idx;
+ int i;
sid_copy(&sid1, &info->dom.level5_sid);
@@ -1883,9 +1903,18 @@ void cmd_sam_enum_groups(struct client_info *info)
strupper(srv_name);
/* a bad way to do token parsing... */
- if (next_token(NULL, tmp, NULL, sizeof(tmp)))
+ for (i = 0; i < 2; i++)
{
- request_member_info |= strequal(tmp, "-m");
+ /* a bad way to do token parsing... */
+ if (next_token(NULL, tmp, NULL, sizeof(tmp)))
+ {
+ request_member_info |= strequal(tmp, "-m");
+ request_group_info |= strequal(tmp, "-g");
+ }
+ else
+ {
+ break;
+ }
}
fprintf(out_hnd, "SAM Enumerate Groups\n");
@@ -1928,6 +1957,10 @@ void cmd_sam_enum_groups(struct client_info *info)
group_rid,
info->dom.sam[group_idx].acct_name);
+ if (request_group_info)
+ {
+ query_groupinfo(info, fnum, group_rid);
+ }
if (request_member_info)
{
req_groupmem_info(info, fnum, group_rid);