mirror of
https://github.com/samba-team/samba.git
synced 2025-01-27 14:04:05 +03:00
added call to samr_query_groupinfo in enumgroups command (-m option)
(This used to be commit e2a72e2c64d6aad37d0c0f94d36f4fdadd3bd6cc)
This commit is contained in:
parent
42fdd41b1d
commit
501acbba23
@ -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,
|
||||
|
@ -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
|
||||
****************************************************************************/
|
||||
|
@ -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,16 +1440,16 @@ void cmd_sam_enum_users(struct client_info *info)
|
||||
user_rid,
|
||||
info->dom.sam[user_idx].acct_name);
|
||||
|
||||
if (request_user_info)
|
||||
{
|
||||
req_user_info(info, fnum, user_rid);
|
||||
}
|
||||
|
||||
if (request_group_info)
|
||||
{
|
||||
req_group_info(info, fnum, user_rid);
|
||||
}
|
||||
|
||||
if (request_user_info)
|
||||
{
|
||||
req_user_info(info, fnum, user_rid);
|
||||
}
|
||||
|
||||
if (request_alias_info)
|
||||
{
|
||||
req_alias_info(info, fnum, &sid1, user_rid);
|
||||
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user