mirror of
https://github.com/samba-team/samba.git
synced 2024-12-28 07:21:54 +03:00
improved "dominfo" rpcclient command
This commit is contained in:
parent
7a383a2a02
commit
65a54b6e16
@ -1871,7 +1871,8 @@ BOOL samr_chgpasswd_user(struct cli_state *cli, uint16 fnum,
|
||||
char lm_newpass[516], uchar lm_oldhash[16]);
|
||||
BOOL samr_unknown_38(struct cli_state *cli, uint16 fnum, char *srv_name);
|
||||
BOOL samr_query_dom_info(struct cli_state *cli, uint16 fnum,
|
||||
POLICY_HND *domain_pol, uint16 switch_value);
|
||||
POLICY_HND *domain_pol, uint16 switch_value,
|
||||
SAM_UNK_CTR *ctr);
|
||||
BOOL samr_enum_dom_groups(struct cli_state *cli, uint16 fnum,
|
||||
POLICY_HND *pol, uint32 size,
|
||||
struct acct_info **sam,
|
||||
@ -3285,6 +3286,10 @@ void display_sam_sync(FILE *out_hnd, enum action_type action,
|
||||
SAM_DELTA_HDR *deltas,
|
||||
SAM_DELTA_CTR *ctr,
|
||||
uint32 num);
|
||||
void display_sam_unk_info_2(FILE *out_hnd, enum action_type action,
|
||||
SAM_UNK_INFO_2 *info2);
|
||||
void display_sam_unk_ctr(FILE *out_hnd, enum action_type action,
|
||||
uint32 switch_value, SAM_UNK_CTR *ctr);
|
||||
|
||||
/*The following definitions come from rpcclient/rpcclient.c */
|
||||
|
||||
|
@ -490,7 +490,8 @@ 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)
|
||||
POLICY_HND *domain_pol, uint16 switch_value,
|
||||
SAM_UNK_CTR *ctr)
|
||||
{
|
||||
prs_struct data;
|
||||
prs_struct rdata;
|
||||
@ -519,6 +520,7 @@ BOOL samr_query_dom_info(struct cli_state *cli, uint16 fnum,
|
||||
SAMR_R_QUERY_DOMAIN_INFO r_e;
|
||||
BOOL p;
|
||||
|
||||
r_e.ctr = ctr;
|
||||
samr_io_r_query_dom_info("", &r_e, &rdata, 0);
|
||||
|
||||
p = rdata.offset != 0;
|
||||
|
@ -988,7 +988,7 @@ void cmd_sam_add_groupmem(struct client_info *info)
|
||||
fstrcat(srv_name, info->dest_host);
|
||||
strupper(srv_name);
|
||||
|
||||
res = next_token(NULL, group_name, NULL, sizeof(group_name)) != NULL;
|
||||
res = next_token(NULL, group_name, NULL, sizeof(group_name));
|
||||
group_names[0] = group_name;
|
||||
|
||||
while (res && next_token(NULL, tmp, NULL, sizeof(tmp)))
|
||||
@ -1054,7 +1054,8 @@ void cmd_sam_add_groupmem(struct client_info *info)
|
||||
|
||||
if (group_type == SID_NAME_ALIAS)
|
||||
{
|
||||
fprintf(out_hnd, "%s is a local alias, not a group. Use addaliasmem command instead\n");
|
||||
fprintf(out_hnd, "%s is a local alias, not a group. Use addaliasmem command instead\n",
|
||||
group_name);
|
||||
return;
|
||||
}
|
||||
res1 = res2 ? samr_query_lookup_names(smb_cli, fnum,
|
||||
@ -1575,6 +1576,7 @@ void cmd_sam_query_dominfo(struct client_info *info)
|
||||
fstring info_str;
|
||||
uint32 switch_value = 2;
|
||||
uint32 ace_perms = 0x304; /* absolutely no idea. */
|
||||
SAM_UNK_CTR ctr;
|
||||
|
||||
sid_to_string(sid, &info->dom.level5_sid);
|
||||
fstrcpy(domain, info->dom.level5_dom);
|
||||
@ -1615,7 +1617,7 @@ void cmd_sam_query_dominfo(struct client_info *info)
|
||||
|
||||
/* send a samr 0x8 command */
|
||||
res = res ? samr_query_dom_info(smb_cli, fnum,
|
||||
&info->dom.samr_pol_open_domain, switch_value) : False;
|
||||
&info->dom.samr_pol_open_domain, switch_value, &ctr) : False;
|
||||
|
||||
res = res ? samr_close(smb_cli, fnum,
|
||||
&info->dom.samr_pol_connect) : False;
|
||||
@ -1629,6 +1631,9 @@ void cmd_sam_query_dominfo(struct client_info *info)
|
||||
if (res)
|
||||
{
|
||||
DEBUG(5,("cmd_sam_query_dominfo: succeeded\n"));
|
||||
display_sam_unk_ctr(out_hnd, ACTION_HEADER , switch_value, &ctr);
|
||||
display_sam_unk_ctr(out_hnd, ACTION_ENUMERATE, switch_value, &ctr);
|
||||
display_sam_unk_ctr(out_hnd, ACTION_FOOTER , switch_value, &ctr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2190,6 +2190,88 @@ void display_sam_sync(FILE *out_hnd, enum action_type action,
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
display sam sync structure
|
||||
****************************************************************************/
|
||||
void display_sam_unk_info_2(FILE *out_hnd, enum action_type action,
|
||||
SAM_UNK_INFO_2 *info2)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case ACTION_HEADER:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case ACTION_ENUMERATE:
|
||||
{
|
||||
fstring name;
|
||||
unistr2_to_ascii(name, &(info2->uni_domain), sizeof(name)-1);
|
||||
fprintf(out_hnd, "Domain:\t%s\n", name);
|
||||
|
||||
unistr2_to_ascii(name, &(info2->uni_server), sizeof(name)-1);
|
||||
fprintf(out_hnd, "Server:\t%s\n", name);
|
||||
|
||||
fprintf(out_hnd, "Total Users:\t%d\n", info2->num_domain_usrs);
|
||||
fprintf(out_hnd, "Total Groups:\t%d\n", info2->num_domain_grps);
|
||||
fprintf(out_hnd, "Total Aliases:\t%d\n", info2->num_local_grps);
|
||||
|
||||
fprintf(out_hnd, "Sequence No:\t%d\n", info2->seq_num);
|
||||
|
||||
fprintf(out_hnd, "Unknown 0:\t0x%x\n", info2->unknown_0);
|
||||
fprintf(out_hnd, "Unknown 1:\t0x%x\n", info2->unknown_1);
|
||||
fprintf(out_hnd, "Unknown 2:\t0x%x\n", info2->unknown_2);
|
||||
fprintf(out_hnd, "Unknown 3:\t0x%x\n", info2->unknown_3);
|
||||
fprintf(out_hnd, "Unknown 4:\t0x%x\n", info2->unknown_4);
|
||||
fprintf(out_hnd, "Unknown 5:\t0x%x\n", info2->unknown_5);
|
||||
fprintf(out_hnd, "Unknown 6:\t0x%x\n", info2->unknown_6);
|
||||
|
||||
break;
|
||||
}
|
||||
case ACTION_FOOTER:
|
||||
{
|
||||
fprintf(out_hnd, "\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
display sam sync structure
|
||||
****************************************************************************/
|
||||
void display_sam_unk_ctr(FILE *out_hnd, enum action_type action,
|
||||
uint32 switch_value, SAM_UNK_CTR *ctr)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case ACTION_HEADER:
|
||||
{
|
||||
fprintf(out_hnd, "\tSAM Domain Info\n");
|
||||
fprintf(out_hnd, "\t---------------\n");
|
||||
|
||||
break;
|
||||
}
|
||||
case ACTION_ENUMERATE:
|
||||
{
|
||||
switch (switch_value)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
display_sam_unk_info_2(out_hnd, ACTION_HEADER , &ctr->info.inf2);
|
||||
display_sam_unk_info_2(out_hnd, ACTION_ENUMERATE, &ctr->info.inf2);
|
||||
display_sam_unk_info_2(out_hnd, ACTION_FOOTER , &ctr->info.inf2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ACTION_FOOTER:
|
||||
{
|
||||
fprintf(out_hnd, "\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if COPY_THIS_TEMPLATE
|
||||
/****************************************************************************
|
||||
|
@ -145,7 +145,7 @@ struct
|
||||
{"samtest", cmd_sam_test , "SAM User Encrypted RPC test (experimental!)"},
|
||||
{"enumaliases",cmd_sam_enum_aliases, "SAM Aliases Database Query (experimental!)"},
|
||||
{"enumgroups", cmd_sam_enum_groups, "SAM Group Database Query (experimental!)"},
|
||||
{"samgroups", cmd_sam_query_dominfo, "SAM Query Domain Info(experimental!)"},
|
||||
{"dominfo", cmd_sam_query_dominfo, "SAM Query Domain Info(experimental!)"},
|
||||
{"querysecret", cmd_lsa_query_secret, "LSA Query Secret (developer use)"},
|
||||
{"samsync", cmd_sam_sync, "SAM Synchronization Test (experimental)"},
|
||||
{"quit", cmd_quit, "logoff the server"},
|
||||
|
Loading…
Reference in New Issue
Block a user