diff options
author | Günther Deschner <gd@samba.org> | 2008-01-24 23:38:43 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-01-24 23:41:53 +0100 |
commit | 96b41578a7a4270274a6e1d97cd53a4fb42505d1 (patch) | |
tree | d787a348eec276f03f5b398cd042b1c82baf5161 | |
parent | cd8ef2e41db5ec60ed9a893c4d533839af3501a6 (diff) | |
download | samba-96b41578a7a4270274a6e1d97cd53a4fb42505d1.tar.gz samba-96b41578a7a4270274a6e1d97cd53a4fb42505d1.tar.bz2 samba-96b41578a7a4270274a6e1d97cd53a4fb42505d1.zip |
Add cmd_netlogon_gettrustrid() to rpcclient.
Guenther
(This used to be commit 231a4d051f24af7cf5bf13d7dd613f33dc06f21a)
-rw-r--r-- | source3/rpcclient/cmd_netlogon.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index 2c1f7e0f11..64c8b75cd8 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -539,6 +539,47 @@ static NTSTATUS cmd_netlogon_change_trust_pw(struct rpc_pipe_client *cli, return result; } +static WERROR cmd_netlogon_gettrustrid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, int argc, + const char **argv) +{ + NTSTATUS status = NT_STATUS_UNSUCCESSFUL; + WERROR werr = WERR_GENERAL_FAILURE; + const char *server_name = cli->cli->desthost; + const char *domain_name = lp_workgroup(); + uint32_t rid = 0; + + if (argc < 1 || argc > 3) { + fprintf(stderr, "Usage: %s <server_name> <domain_name>\n", + argv[0]); + return WERR_OK; + } + + if (argc >= 2) { + server_name = argv[1]; + } + + if (argc >= 3) { + domain_name = argv[2]; + } + + status = rpccli_netr_LogonGetTrustRid(cli, mem_ctx, + server_name, + domain_name, + &rid, + &werr); + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + + if (W_ERROR_IS_OK(werr)) { + printf("Rid: %d\n", rid); + } + done: + return werr; +} + + /* List of commands exported by this module */ @@ -558,6 +599,7 @@ struct cmd_set netlogon_commands[] = { { "samdeltas", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_deltas, NULL, PI_NETLOGON, NULL, "Query Sam Deltas", "" }, { "samlogon", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_logon, NULL, PI_NETLOGON, NULL, "Sam Logon", "" }, { "change_trust_pw", RPC_RTYPE_NTSTATUS, cmd_netlogon_change_trust_pw, NULL, PI_NETLOGON, NULL, "Change Trust Account Password", "" }, + { "gettrustrid", RPC_RTYPE_WERROR, NULL, cmd_netlogon_gettrustrid, PI_NETLOGON, NULL, "Get trust rid", "" }, { NULL } }; |