diff options
author | Volker Lendecke <vlendec@samba.org> | 2005-11-13 11:38:17 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:05:24 -0500 |
commit | 32cf16f3cfaf52414c324c0a333ff29cb9a326aa (patch) | |
tree | 62fa857b878289aeddbe6ac8ba0dc868c56ea9ce /source3/rpcclient | |
parent | 789bed878aa94edf22521c6c1946d3ab73462516 (diff) | |
download | samba-32cf16f3cfaf52414c324c0a333ff29cb9a326aa.tar.gz samba-32cf16f3cfaf52414c324c0a333ff29cb9a326aa.tar.bz2 samba-32cf16f3cfaf52414c324c0a333ff29cb9a326aa.zip |
r11706: Implement dsr_getdcname client code. It's handy: It not only gives you the IP
address but also the fqdn of the remote dc and site info.
Volker
(This used to be commit 62d01ce7e6c14971084c208ab61f379cb172cb22)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_netlogon.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index d8f5a75b54..20f11bc3c9 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -70,6 +70,35 @@ static NTSTATUS cmd_netlogon_getdcname(struct rpc_pipe_client *cli, return result; } +static WERROR cmd_netlogon_dsr_getdcname(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, int argc, + const char **argv) +{ + WERROR result; + char *dcname, *dcaddress; + + if (argc != 2) { + fprintf(stderr, "Usage: %s domainname\n", argv[0]); + return WERR_OK; + } + + result = rpccli_netlogon_dsr_getdcname( + cli, mem_ctx, cli->cli->desthost, argv[1], NULL, NULL, + 0x40000000, &dcname, &dcaddress, NULL, NULL, NULL, NULL, + NULL, NULL, NULL); + + if (W_ERROR_IS_OK(result)) { + printf("Domain %s's DC is called %s at IP %s\n", + argv[1], dcname, dcaddress); + return WERR_OK; + } + + printf("rpccli_netlogon_dsr_getdcname returned %s\n", + nt_errstr(werror_to_ntstatus(result))); + + return result; +} + static NTSTATUS cmd_netlogon_logon_ctrl(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) @@ -317,6 +346,7 @@ struct cmd_set netlogon_commands[] = { { "logonctrl2", RPC_RTYPE_NTSTATUS, cmd_netlogon_logon_ctrl2, NULL, PI_NETLOGON, NULL, "Logon Control 2", "" }, { "getdcname", RPC_RTYPE_NTSTATUS, cmd_netlogon_getdcname, NULL, PI_NETLOGON, NULL, "Get trusted DC name", "" }, + { "dsr_getdcname", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getdcname, PI_NETLOGON, NULL, "Get trusted DC name", "" }, { "logonctrl", RPC_RTYPE_NTSTATUS, cmd_netlogon_logon_ctrl, NULL, PI_NETLOGON, NULL, "Logon Control", "" }, { "samsync", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_sync, NULL, PI_NETLOGON, NULL, "Sam Synchronisation", "" }, { "samdeltas", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_deltas, NULL, PI_NETLOGON, NULL, "Query Sam Deltas", "" }, |