diff options
author | Günther Deschner <gd@samba.org> | 2008-04-22 23:11:53 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-04-22 23:11:53 +0200 |
commit | bd8cb7b564941cd93c9b05529b4b7dfec0254d02 (patch) | |
tree | cdbc5f3d6e066bc566d6ae309fd9e8efa546cf4b /source3/rpcclient | |
parent | 071d0a4e5014bbfc06047d696f3d349b20dc4d45 (diff) | |
download | samba-bd8cb7b564941cd93c9b05529b4b7dfec0254d02.tar.gz samba-bd8cb7b564941cd93c9b05529b4b7dfec0254d02.tar.bz2 samba-bd8cb7b564941cd93c9b05529b4b7dfec0254d02.zip |
rpcclient: Add getdispinfoidx command.
Guenther
(This used to be commit 7d8461d080c92a83bd7a8d168fdf1fe98e8bec9a)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_samr.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index 4a820cd618..9220c20166 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -2566,6 +2566,67 @@ static NTSTATUS cmd_samr_chgpasswd3(struct rpc_pipe_client *cli, return result; } +static NTSTATUS cmd_samr_get_dispinfo_idx(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + int argc, const char **argv) +{ + NTSTATUS status; + struct policy_handle connect_handle; + struct policy_handle domain_handle; + uint16_t level = 1; + struct lsa_String name; + uint32_t idx = 0; + + if (argc < 2 || argc > 3) { + printf("Usage: %s name level\n", argv[0]); + return NT_STATUS_INVALID_PARAMETER; + } + + init_lsa_String(&name, argv[1]); + + if (argc == 3) { + level = atoi(argv[2]); + } + + status = rpccli_try_samr_connects(cli, mem_ctx, + SEC_RIGHTS_MAXIMUM_ALLOWED, + &connect_handle); + + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + + status = rpccli_samr_OpenDomain(cli, mem_ctx, + &connect_handle, + SEC_RIGHTS_MAXIMUM_ALLOWED, + &domain_sid, + &domain_handle); + + if (!NT_STATUS_IS_OK(status)) + goto done; + + + status = rpccli_samr_GetDisplayEnumerationIndex(cli, mem_ctx, + &domain_handle, + level, + &name, + &idx); + + if (NT_STATUS_IS_OK(status)) { + printf("idx: %d\n", idx); + } + done: + + if (is_valid_policy_hnd(&domain_handle)) { + rpccli_samr_Close(cli, mem_ctx, &domain_handle); + } + if (is_valid_policy_hnd(&connect_handle)) { + rpccli_samr_Close(cli, mem_ctx, &connect_handle); + } + + return status; + +} /* List of commands exported by this module */ struct cmd_set samr_commands[] = { @@ -2603,5 +2664,6 @@ struct cmd_set samr_commands[] = { { "lookupdomain", RPC_RTYPE_NTSTATUS, cmd_samr_lookup_domain, NULL, PI_SAMR, NULL, "Lookup Domain Name", "" }, { "chgpasswd2", RPC_RTYPE_NTSTATUS, cmd_samr_chgpasswd2, NULL, PI_SAMR, NULL, "Change user password", "" }, { "chgpasswd3", RPC_RTYPE_NTSTATUS, cmd_samr_chgpasswd3, NULL, PI_SAMR, NULL, "Change user password", "" }, + { "getdispinfoidx", RPC_RTYPE_NTSTATUS, cmd_samr_get_dispinfo_idx, NULL, PI_SAMR, NULL, "Get Display Information Index", "" }, { NULL } }; |