diff options
author | Günther Deschner <gd@samba.org> | 2006-09-19 15:53:44 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:00:46 -0500 |
commit | 5864fb9fc52b8a8e16ff1a2389145c24b325a912 (patch) | |
tree | be1372bb81d00dbf72bf6fe491197f7abcf45889 /source3/rpcclient | |
parent | bc6295c3ec1a83a14764f82ee3d8f0e9e098a0ad (diff) | |
download | samba-5864fb9fc52b8a8e16ff1a2389145c24b325a912.tar.gz samba-5864fb9fc52b8a8e16ff1a2389145c24b325a912.tar.bz2 samba-5864fb9fc52b8a8e16ff1a2389145c24b325a912.zip |
r18677: quickly add samr_GetDisplayEnumerationIndex for debugging to rpcclient.
Guenther
(This used to be commit bd546edc482d42c6d783f474eeffa8a8086efd83)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_samr.c | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index 6649676887..1d1142e380 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -1192,7 +1192,7 @@ static NTSTATUS cmd_samr_query_dispinfo_int(struct rpc_pipe_client *cli, { POLICY_HND connect_pol, domain_pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - uint32 start_idx=0, max_entries=250, max_size = 0xffff, num_entries, i; + uint32 start_idx=0, max_entries=250, max_size = (uint32) -1, num_entries, i; uint32 access_mask = MAXIMUM_ALLOWED_ACCESS; uint32 info_level = 1; SAM_DISPINFO_CTR ctr; @@ -1228,6 +1228,7 @@ static NTSTATUS cmd_samr_query_dispinfo_int(struct rpc_pipe_client *cli, if (argc >= 6) sscanf(argv[5], "%x", &access_mask); + /* Get sam policy handle */ result = try_samr_connects(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, @@ -1360,6 +1361,67 @@ static NTSTATUS cmd_samr_query_dispinfo3(struct rpc_pipe_client *cli, { return cmd_samr_query_dispinfo_int(cli, mem_ctx, argc, argv, SAMR_QUERY_DISPINFO3); } + +/* Query display info index */ + +static NTSTATUS cmd_samr_get_dispenum_index(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + int argc, const char **argv) +{ + POLICY_HND connect_pol, domain_pol; + NTSTATUS result = NT_STATUS_UNSUCCESSFUL; + uint32 access_mask = MAXIMUM_ALLOWED_ACCESS; + uint16 info_level = 1; + uint32 idx; + const char *name; + + if (argc > 6) { + printf("Usage: %s mame [info level]\n", argv[0]); + return NT_STATUS_OK; + } + + if (argc >= 2) + name = argv[1]; + + if (argc >= 3) + sscanf(argv[2], "%hd", &info_level); + + + /* Get sam policy handle */ + + result = try_samr_connects(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, + &connect_pol); + + if (!NT_STATUS_IS_OK(result)) + goto done; + + /* Get domain policy handle */ + + result = rpccli_samr_open_domain(cli, mem_ctx, &connect_pol, + access_mask, + &domain_sid, &domain_pol); + + if (!NT_STATUS_IS_OK(result)) + goto done; + + /* Query display info index */ + + result = rpccli_samr_get_dispenum_index(cli, mem_ctx, &domain_pol, + info_level, name, &idx); + if (!NT_STATUS_IS_OK(result)) { + goto done; + }; + + printf("idx is: %d\n", idx); + + rpccli_samr_close(cli, mem_ctx, &domain_pol); + rpccli_samr_close(cli, mem_ctx, &connect_pol); + done: + return result; +} + + + /* Query domain info */ static NTSTATUS cmd_samr_query_dominfo(struct rpc_pipe_client *cli, @@ -2165,6 +2227,7 @@ struct cmd_set samr_commands[] = { { "querydispinfo", RPC_RTYPE_NTSTATUS, cmd_samr_query_dispinfo, NULL, PI_SAMR, NULL, "Query display info", "" }, { "querydispinfo2", RPC_RTYPE_NTSTATUS, cmd_samr_query_dispinfo2, NULL, PI_SAMR, NULL, "Query display info 2", "" }, { "querydispinfo3", RPC_RTYPE_NTSTATUS, cmd_samr_query_dispinfo3, NULL, PI_SAMR, NULL, "Query display info 3", "" }, + { "getdispenumindex", RPC_RTYPE_NTSTATUS, cmd_samr_get_dispenum_index, NULL, PI_SAMR, NULL, "Query display info index", "" }, { "querydominfo", RPC_RTYPE_NTSTATUS, cmd_samr_query_dominfo, NULL, PI_SAMR, NULL, "Query domain info", "" }, { "enumdomusers", RPC_RTYPE_NTSTATUS, cmd_samr_enum_dom_users, NULL, PI_SAMR, NULL, "Enumerate domain users", "" }, { "enumdomgroups", RPC_RTYPE_NTSTATUS, cmd_samr_enum_dom_groups, NULL, PI_SAMR, NULL, "Enumerate domain groups", "" }, |