summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-08-29 16:36:21 +0000
committerLuke Leighton <lkcl@samba.org>1999-08-29 16:36:21 +0000
commit42fdd41b1d3e59f9052a9b382d0369315f77e718 (patch)
tree36f659072199e6bfef3f5ea528e5bc1581cb54da /source3
parent53b4095d2ceb91ae45efd04ab30626d6c352f72a (diff)
downloadsamba-42fdd41b1d3e59f9052a9b382d0369315f77e718.tar.gz
samba-42fdd41b1d3e59f9052a9b382d0369315f77e718.tar.bz2
samba-42fdd41b1d3e59f9052a9b382d0369315f77e718.zip
improved "dominfo" rpcclient command
(This used to be commit 65a54b6e16c40ec40727547593154b341d98fc83)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h7
-rw-r--r--source3/rpc_client/cli_samr.c4
-rw-r--r--source3/rpcclient/cmd_samr.c11
-rw-r--r--source3/rpcclient/display.c82
-rw-r--r--source3/rpcclient/rpcclient.c2
5 files changed, 100 insertions, 6 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index ad5fd558cf..f9e91b4644 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -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 */
diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c
index 49db8c8216..5e381ba523 100644
--- a/source3/rpc_client/cli_samr.c
+++ b/source3/rpc_client/cli_samr.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;
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index d38d1d0646..045160f78c 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -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
{
diff --git a/source3/rpcclient/display.c b/source3/rpcclient/display.c
index 55010390b4..70a9f76f90 100644
--- a/source3/rpcclient/display.c
+++ b/source3/rpcclient/display.c
@@ -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
/****************************************************************************
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 2530020352..c598777426 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -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"},