diff options
author | Volker Lendecke <vl@samba.org> | 2017-09-19 17:30:02 -0700 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2017-09-25 13:42:19 +0200 |
commit | 82c17bc9faaca395e1cc91a672348f08362984a0 (patch) | |
tree | f1f7bdeab85120be6ac7ff29ee92094bf7aeee21 /source3/rpcclient | |
parent | 32e823e08df305919ba0a001a389eb88b7d1be68 (diff) | |
download | samba-82c17bc9faaca395e1cc91a672348f08362984a0.tar.gz |
rpcclient: Fix "capabilities" command
This used to not properly store the chained credentials back into the
netlogon_creds_cli tdb. This by the way is the bug that all the
routines for the NT4 style sam replication had that just disappeared.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Sep 25 13:42:19 CEST 2017 on sn-devel-144
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_netlogon.c | 56 |
1 files changed, 16 insertions, 40 deletions
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index 88576aeb88b..2d6a0829a57 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -878,62 +878,38 @@ static NTSTATUS cmd_netlogon_capabilities(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) { - NTSTATUS status = NT_STATUS_UNSUCCESSFUL; - NTSTATUS result; - struct netr_Authenticator credential; - struct netr_Authenticator return_authenticator; + struct netlogon_creds_cli_lck *lck; union netr_Capabilities capabilities; - uint32_t level = 1; - struct dcerpc_binding_handle *b = cli->binding_handle; - struct netlogon_creds_CredentialState *creds = NULL; + NTSTATUS status; - if (argc > 2) { - fprintf(stderr, "Usage: %s <level>\n", argv[0]); + if (argc > 1) { + fprintf(stderr, "Usage: %s\n", argv[0]); return NT_STATUS_OK; } - if (argc == 2) { - level = atoi(argv[1]); - } - - ZERO_STRUCT(return_authenticator); - - if (rpcclient_netlogon_creds == NULL) { - return NT_STATUS_UNSUCCESSFUL; - } - - status = netlogon_creds_cli_lock(rpcclient_netlogon_creds, - mem_ctx, &creds); + status = netlogon_creds_cli_lck(rpcclient_netlogon_creds, + NETLOGON_CREDS_CLI_LCK_EXCLUSIVE, + mem_ctx, &lck); if (!NT_STATUS_IS_OK(status)) { + fprintf(stderr, "netlogon_creds_cli_lck failed: %s\n", + nt_errstr(status)); return status; } - netlogon_creds_client_authenticator(creds, &credential); - - status = dcerpc_netr_LogonGetCapabilities(b, mem_ctx, - cli->desthost, - lp_netbios_name(), - &credential, - &return_authenticator, - level, - &capabilities, - &result); + status = netlogon_creds_cli_check(rpcclient_netlogon_creds, + cli->binding_handle, + &capabilities); if (!NT_STATUS_IS_OK(status)) { - TALLOC_FREE(creds); + fprintf(stderr, "netlogon_creds_cli_check failed: %s\n", + nt_errstr(status)); return status; } - if (!netlogon_creds_client_check(creds, - &return_authenticator.cred)) { - DEBUG(0,("credentials chain check failed\n")); - TALLOC_FREE(creds); - return NT_STATUS_ACCESS_DENIED; - } - TALLOC_FREE(creds); + TALLOC_FREE(lck); printf("capabilities: 0x%08x\n", capabilities.server_capabilities); - return result; + return NT_STATUS_OK; } /* List of commands exported by this module */ |