From: Günther Deschner Date: Wed, 18 Sep 2019 02:11:33 +0000 (+0200) Subject: s3-rpcclient: add logongetdomaininfo command X-Git-Tag: talloc-2.3.1~752 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=742d8ba9c4b9e6e70898f08a50f9929662bbafb6;p=thirdparty%2Fsamba.git s3-rpcclient: add logongetdomaininfo command Guenther Signed-off-by: Guenther Deschner Reviewed-by: Stefan Metzmacher --- diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index 4db23793c63..d5c1b91f2be 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -927,6 +927,46 @@ static NTSTATUS cmd_netlogon_capabilities(struct rpc_pipe_client *cli, return NT_STATUS_OK; } +static NTSTATUS cmd_netlogon_logongetdomaininfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, int argc, + const char **argv) +{ + union netr_WorkstationInfo query; + struct netr_WorkstationInformation workstation_info; + union netr_DomainInfo *domain_info; + NTSTATUS status; + char *s; + + if (argc > 1) { + fprintf(stderr, "Usage: %s\n", argv[0]); + return NT_STATUS_OK; + } + + ZERO_STRUCT(workstation_info); + + query.workstation_info = &workstation_info; + + status = netlogon_creds_cli_LogonGetDomainInfo(rpcclient_netlogon_creds, + cli->binding_handle, + mem_ctx, + 1, + &query, + &domain_info); + if (!NT_STATUS_IS_OK(status)) { + fprintf(stderr, "netlogon_creds_cli_LogonGetDomainInfo failed: %s\n", + nt_errstr(status)); + return status; + } + + s = NDR_PRINT_STRUCT_STRING(mem_ctx, netr_DomainInformation, domain_info->domain_info); + if (s) { + printf("%s\n", s); + TALLOC_FREE(s); + } + + return NT_STATUS_OK; +} + /* List of commands exported by this module */ struct cmd_set netlogon_commands[] = { @@ -1128,7 +1168,17 @@ struct cmd_set netlogon_commands[] = { .usage = "", .use_netlogon_creds = true, }, - + { + .name = "logongetdomaininfo", + .returntype = RPC_RTYPE_NTSTATUS, + .ntfn = cmd_netlogon_logongetdomaininfo, + .wfn = NULL, + .table = &ndr_table_netlogon, + .rpc_pipe = NULL, + .description = "Return LogonGetDomainInfo", + .usage = "", + .use_netlogon_creds = true, + }, { .name = NULL, }