mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
s3:rpc_client: remove unused rpccli_netlogon_setup_creds()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
6d457ad9c1
commit
a4faf57b47
@ -35,98 +35,6 @@
|
|||||||
#include "lib/param/param.h"
|
#include "lib/param/param.h"
|
||||||
#include "libcli/smb/smbXcli_base.h"
|
#include "libcli/smb/smbXcli_base.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
Wrapper function that uses the auth and auth2 calls to set up a NETLOGON
|
|
||||||
credentials chain. Stores the credentials in the struct dcinfo in the
|
|
||||||
netlogon pipe struct.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli,
|
|
||||||
const char *server_name,
|
|
||||||
const char *domain,
|
|
||||||
const char *clnt_name,
|
|
||||||
const char *machine_account,
|
|
||||||
const unsigned char machine_pwd[16],
|
|
||||||
enum netr_SchannelType sec_chan_type,
|
|
||||||
uint32_t *neg_flags_inout)
|
|
||||||
{
|
|
||||||
TALLOC_CTX *frame = talloc_stackframe();
|
|
||||||
struct loadparm_context *lp_ctx;
|
|
||||||
NTSTATUS status;
|
|
||||||
struct samr_Password password;
|
|
||||||
fstring mach_acct;
|
|
||||||
struct dcerpc_binding_handle *b = cli->binding_handle;
|
|
||||||
struct netlogon_creds_CredentialState *creds = NULL;
|
|
||||||
|
|
||||||
if (!ndr_syntax_id_equal(&cli->abstract_syntax,
|
|
||||||
&ndr_table_netlogon.syntax_id)) {
|
|
||||||
TALLOC_FREE(frame);
|
|
||||||
return NT_STATUS_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strequal(lp_netbios_name(), clnt_name)) {
|
|
||||||
TALLOC_FREE(frame);
|
|
||||||
return NT_STATUS_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
TALLOC_FREE(cli->netlogon_creds);
|
|
||||||
|
|
||||||
fstr_sprintf( mach_acct, "%s$", machine_account);
|
|
||||||
|
|
||||||
lp_ctx = loadparm_init_s3(frame, loadparm_s3_helpers());
|
|
||||||
if (lp_ctx == NULL) {
|
|
||||||
TALLOC_FREE(frame);
|
|
||||||
return NT_STATUS_NO_MEMORY;
|
|
||||||
}
|
|
||||||
status = netlogon_creds_cli_context_global(lp_ctx,
|
|
||||||
NULL, /* msg_ctx */
|
|
||||||
mach_acct,
|
|
||||||
sec_chan_type,
|
|
||||||
server_name,
|
|
||||||
domain,
|
|
||||||
cli, &cli->netlogon_creds);
|
|
||||||
talloc_unlink(frame, lp_ctx);
|
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
|
||||||
TALLOC_FREE(frame);
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = netlogon_creds_cli_get(cli->netlogon_creds,
|
|
||||||
frame, &creds);
|
|
||||||
if (NT_STATUS_IS_OK(status)) {
|
|
||||||
DEBUG(5,("rpccli_netlogon_setup_creds: server %s using "
|
|
||||||
"cached credential\n",
|
|
||||||
cli->desthost));
|
|
||||||
*neg_flags_inout = creds->negotiate_flags;
|
|
||||||
TALLOC_FREE(frame);
|
|
||||||
return NT_STATUS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Store the machine account password we're going to use. */
|
|
||||||
memcpy(password.hash, machine_pwd, 16);
|
|
||||||
|
|
||||||
DEBUG(5,("rpccli_netlogon_setup_creds: server %s credential "
|
|
||||||
"chain established.\n",
|
|
||||||
cli->desthost ));
|
|
||||||
|
|
||||||
status = netlogon_creds_cli_auth(cli->netlogon_creds, b,
|
|
||||||
password, NULL);
|
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
|
||||||
TALLOC_FREE(frame);
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = netlogon_creds_cli_get(cli->netlogon_creds,
|
|
||||||
frame, &creds);
|
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
|
||||||
TALLOC_FREE(frame);
|
|
||||||
return NT_STATUS_INTERNAL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
*neg_flags_inout = creds->negotiate_flags;
|
|
||||||
TALLOC_FREE(frame);
|
|
||||||
return NT_STATUS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NTSTATUS rpccli_pre_open_netlogon_creds(void)
|
NTSTATUS rpccli_pre_open_netlogon_creds(void)
|
||||||
{
|
{
|
||||||
|
@ -30,14 +30,6 @@ struct dcerpc_binding_handle;
|
|||||||
|
|
||||||
/* The following definitions come from rpc_client/cli_netlogon.c */
|
/* The following definitions come from rpc_client/cli_netlogon.c */
|
||||||
|
|
||||||
NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli,
|
|
||||||
const char *server_name,
|
|
||||||
const char *domain,
|
|
||||||
const char *clnt_name,
|
|
||||||
const char *machine_account,
|
|
||||||
const unsigned char machine_pwd[16],
|
|
||||||
enum netr_SchannelType sec_chan_type,
|
|
||||||
uint32_t *neg_flags_inout);
|
|
||||||
NTSTATUS rpccli_pre_open_netlogon_creds(void);
|
NTSTATUS rpccli_pre_open_netlogon_creds(void);
|
||||||
NTSTATUS rpccli_create_netlogon_creds(const char *server_computer,
|
NTSTATUS rpccli_create_netlogon_creds(const char *server_computer,
|
||||||
const char *server_netbios_domain,
|
const char *server_netbios_domain,
|
||||||
|
Loading…
Reference in New Issue
Block a user