From 2cb978b6498c42947377a50fa8a5748f596d9114 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Fri, 16 Nov 2018 16:07:13 +0100 Subject: [PATCH] rpcclient: domain_sid is only needed for SAMR This allows using rpcclient commands with servers that don't implement LSA QueryInfoPolicy. Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/rpcclient/rpcclient.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 4497bb62242..fd7a4199bc2 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -36,6 +36,7 @@ #include "../libcli/smb/smbXcli_base.h" #include "messages.h" #include "cmdline_contexts.h" +#include "../librpc/gen_ndr/ndr_samr.h" enum pipe_auth_type_spnego { PIPE_AUTH_TYPE_SPNEGO_NONE = 0, @@ -219,11 +220,7 @@ static void fetch_machine_sid(struct cli_state *cli) fprintf(stderr, "could not obtain sid from server\n"); - if (!NT_STATUS_IS_OK(result)) { - fprintf(stderr, "error: %s\n", nt_errstr(result)); - } - - exit(1); + return; } /* List the available commands on a given pipe */ @@ -859,6 +856,12 @@ static NTSTATUS do_cmd(struct cli_state *cli, TALLOC_CTX *mem_ctx; + if (cmd_entry->table == &ndr_table_samr && + !dom_sid_is_valid_account_domain(&domain_sid)) + { + return NT_STATUS_INVALID_DOMAIN_STATE; + } + /* Create mem_ctx */ if (!(mem_ctx = talloc_stackframe())) { -- 2.47.2