summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJean-François Micouleau <jfm@samba.org>2001-10-22 06:30:18 +0000
committerJean-François Micouleau <jfm@samba.org>2001-10-22 06:30:18 +0000
commitf78a8a613f21b44dc6d77977aab2ee9e0fc27e23 (patch)
tree2915da3cec22e4886381bbafa15db3c173970e62 /source3
parent0968ee87e14f33a87f7ad361dc5d915c24215ce7 (diff)
downloadsamba-f78a8a613f21b44dc6d77977aab2ee9e0fc27e23.tar.gz
samba-f78a8a613f21b44dc6d77977aab2ee9e0fc27e23.tar.bz2
samba-f78a8a613f21b44dc6d77977aab2ee9e0fc27e23.zip
samr querydispinfo can change level, start index and max entries.
added level 4 decoding. J.F. (This used to be commit 0573caa91bdff361e3e864d3fd39d450e3738580)
Diffstat (limited to 'source3')
-rw-r--r--source3/rpcclient/cmd_samr.c43
1 files changed, 33 insertions, 10 deletions
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index 4e112c90e4..3432c8c61b 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -136,6 +136,18 @@ void display_sam_info_1(SAM_ENTRY1 *e1, SAM_STR1 *s1)
printf("Desc: %s\n", tmp);
}
+void display_sam_info_4(SAM_ENTRY4 *e4, SAM_STR4 *s4)
+{
+ int i;
+
+ printf("index: %d ", e4->user_idx);
+
+ printf("Account: ");
+ for (i=0; i<s4->acct_name.str_str_len; i++)
+ printf("%c", s4->acct_name.buffer[i]);
+ printf("\n");
+
+}
/**********************************************************************
* Query user information
*/
@@ -533,20 +545,28 @@ static NTSTATUS cmd_samr_query_dispinfo(struct cli_state *cli,
{
POLICY_HND connect_pol, domain_pol;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
- uint32 start_idx, max_entries, num_entries, i;
+ uint32 start_idx=0, max_entries=250, num_entries, i;
uint16 info_level = 1;
SAM_DISPINFO_CTR ctr;
SAM_DISPINFO_1 info1;
- if (argc != 1) {
- printf("Usage: %s\n", argv[0]);
+ if (argc > 4) {
+ printf("Usage: %s [info level] [start index] [max entries]\n", argv[0]);
return NT_STATUS_OK;
}
+ if (argc >= 2)
+ info_level = atoi(argv[1]);
+
+ if (argc >= 3)
+ start_idx = atoi(argv[2]);
+
+ if (argc >= 4)
+ max_entries = atoi(argv[3]);
+
/* Get sam policy handle */
- result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
- &connect_pol);
+ result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, &connect_pol);
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@@ -562,9 +582,6 @@ static NTSTATUS cmd_samr_query_dispinfo(struct cli_state *cli,
/* Query display info */
- start_idx = 0;
- max_entries = 250;
-
ZERO_STRUCT(ctr);
ZERO_STRUCT(info1);
@@ -575,8 +592,14 @@ static NTSTATUS cmd_samr_query_dispinfo(struct cli_state *cli,
&num_entries, max_entries, &ctr);
for (i = 0; i < num_entries; i++) {
- display_sam_info_1(&ctr.sam.info1->sam[i],
- &ctr.sam.info1->str[i]);
+ switch (info_level) {
+ case 1:
+ display_sam_info_1(&ctr.sam.info1->sam[i], &ctr.sam.info1->str[i]);
+ break;
+ case 4:
+ display_sam_info_4(&ctr.sam.info4->sam[i], &ctr.sam.info4->str[i]);
+ break;
+ }
}
done: