]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3-rpcclient: add logongetdomaininfo command
authorGünther Deschner <gd@samba.org>
Wed, 18 Sep 2019 02:11:33 +0000 (04:11 +0200)
committerGünther Deschner <gd@samba.org>
Fri, 20 Sep 2019 01:14:43 +0000 (01:14 +0000)
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/rpcclient/cmd_netlogon.c

index 4db23793c63909ed8872bfba320991e96351c166..d5c1b91f2bee88b75da466c9af8c9022aebb5419 100644 (file)
@@ -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,
        }