diff options
author | Günther Deschner <gd@samba.org> | 2019-09-18 04:11:33 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2019-09-20 01:14:43 +0000 |
commit | 742d8ba9c4b9e6e70898f08a50f9929662bbafb6 (patch) | |
tree | 41aa3c24db95284eda1b3f6fde1a934e830304b2 /source3/rpcclient | |
parent | 6e47f9ab37744d628cc6b723f4838e81202f2df6 (diff) | |
download | samba-742d8ba9c4b9e6e70898f08a50f9929662bbafb6.tar.gz |
s3-rpcclient: add logongetdomaininfo command
Guenther
Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_netlogon.c | 52 |
1 files changed, 51 insertions, 1 deletions
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, } |