From 63addcb4d7c9c13446d91a0972fe29542a7e1bad Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 22 Nov 2005 14:10:49 +0000 Subject: r11853: Add Dsr_GetSiteName (handy for experimenting with GPOs). Guenther (This used to be commit c54430a7b5e40d3bdf8afdc813eb722c0a3b861e) --- source3/rpcclient/cmd_netlogon.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'source3/rpcclient') diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index 20f11bc3c9..9377f8fde8 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -99,6 +99,31 @@ static WERROR cmd_netlogon_dsr_getdcname(struct rpc_pipe_client *cli, return result; } +static WERROR cmd_netlogon_dsr_getsitename(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, int argc, + const char **argv) +{ + WERROR result; + char *sitename; + + if (argc != 2) { + fprintf(stderr, "Usage: %s computername\n", argv[0]); + return WERR_OK; + } + + result = rpccli_netlogon_dsr_getsitename(cli, mem_ctx, argv[1], &sitename); + + if (!W_ERROR_IS_OK(result)) { + printf("rpccli_netlogon_dsr_gesitename returned %s\n", + nt_errstr(werror_to_ntstatus(result))); + return result; + } + + printf("Computer %s is on Site: %s\n", argv[1], sitename); + + return WERR_OK; +} + static NTSTATUS cmd_netlogon_logon_ctrl(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) @@ -347,6 +372,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", "" }, + { "dsr_getsitename", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getsitename, PI_NETLOGON, NULL, "Get sitename", "" }, { "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", "" }, -- cgit