]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
rpcclient: domain_sid is only needed for SAMR
authorRalph Boehme <slow@samba.org>
Fri, 16 Nov 2018 15:07:13 +0000 (16:07 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 8 Aug 2019 20:24:32 +0000 (20:24 +0000)
This allows using rpcclient commands with servers that don't implement LSA
QueryInfoPolicy.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/rpcclient/rpcclient.c

index 4497bb622429a35b715483f63787b9127a5cc069..fd7a4199bc2d2a22750addebc899ea76c4933877 100644 (file)
@@ -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())) {