diff options
author | Günther Deschner <gd@samba.org> | 2008-01-25 16:35:09 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-01-25 17:21:57 +0100 |
commit | a059d24488979cea047d88e0a2ace340553e801e (patch) | |
tree | 096932c68d720fedc08ec72df310844de3666390 /source3 | |
parent | e49650ea909c927a2a01f3f3bba3ca815e28a12f (diff) | |
download | samba-a059d24488979cea047d88e0a2ace340553e801e.tar.gz samba-a059d24488979cea047d88e0a2ace340553e801e.tar.bz2 samba-a059d24488979cea047d88e0a2ace340553e801e.zip |
Add cmd_netlogon_dsr_enumtrustdom() to rpcclient.
Guenther
(This used to be commit cb44c901c1bc66da9f3636020401238ce0005105)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/rpcclient/cmd_netlogon.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index 64c8b75cd8..ed38378353 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -579,6 +579,53 @@ static WERROR cmd_netlogon_gettrustrid(struct rpc_pipe_client *cli, return werr; } +static WERROR cmd_netlogon_dsr_enumtrustdom(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; + uint32_t trust_flags = NETR_TRUST_FLAG_IN_FOREST; + struct netr_DomainTrustList trusts; + + if (argc < 1 || argc > 3) { + fprintf(stderr, "Usage: %s <server_name> <trust_flags>\n", + argv[0]); + return WERR_OK; + } + + if (argc >= 2) { + server_name = argv[1]; + } + + if (argc >= 3) { + sscanf(argv[2], "%x", &trust_flags); + } + + status = rpccli_netr_DsrEnumerateDomainTrusts(cli, mem_ctx, + server_name, + trust_flags, + &trusts, + &werr); + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + + if (W_ERROR_IS_OK(werr)) { + int i; + + printf("%d domains returned\n", trusts.count); + + for (i=0; i<trusts.count; i++ ) { + printf("%s (%s)\n", + trusts.array[i].dns_name, + trusts.array[i].netbios_name); + } + } + done: + return werr; +} /* List of commands exported by this module */ @@ -600,6 +647,7 @@ struct cmd_set netlogon_commands[] = { { "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", "" }, + { "dsr_enumtrustdom", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_enumtrustdom, PI_NETLOGON, NULL, "Enumerate trusted domains", "" }, { NULL } }; |