1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

netlogon_creds_cli: Create cli_credentials from netlogon creds ctx

A netlogon_creds_cli_context holds all information required to do an
schannel bind. Used in the next commit.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Volker Lendecke 2017-09-07 12:36:14 +02:00
parent dac48cf2b9
commit 6f879b780a
2 changed files with 36 additions and 0 deletions

View File

@ -38,6 +38,7 @@
#include "source3/include/g_lock.h"
#include "libds/common/roles.h"
#include "lib/crypto/crypto.h"
#include "auth/credentials/credentials.h"
struct netlogon_creds_cli_locked_state;
@ -447,6 +448,37 @@ NTSTATUS netlogon_creds_cli_context_global(struct loadparm_context *lp_ctx,
return NT_STATUS_OK;
}
NTSTATUS netlogon_creds_bind_cli_credentials(
struct netlogon_creds_cli_context *context, TALLOC_CTX *mem_ctx,
struct cli_credentials **pcli_creds)
{
struct cli_credentials *cli_creds;
struct netlogon_creds_CredentialState *ncreds;
NTSTATUS status;
cli_creds = cli_credentials_init(mem_ctx);
if (cli_creds == NULL) {
return NT_STATUS_NO_MEMORY;
}
cli_credentials_set_secure_channel_type(cli_creds,
context->client.type);
cli_credentials_set_username(cli_creds, context->client.account,
CRED_SPECIFIED);
cli_credentials_set_domain(cli_creds, context->server.netbios_domain,
CRED_SPECIFIED);
cli_credentials_set_realm(cli_creds, context->server.dns_domain,
CRED_SPECIFIED);
status = netlogon_creds_cli_get(context, cli_creds, &ncreds);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(cli_creds);
return status;
}
*pcli_creds = cli_creds;
return NT_STATUS_OK;
}
char *netlogon_creds_cli_debug_string(
const struct netlogon_creds_cli_context *context,
TALLOC_CTX *mem_ctx)

View File

@ -26,6 +26,7 @@
#include "librpc/gen_ndr/schannel.h"
struct netlogon_creds_cli_context;
struct cli_credentials;
struct messaging_context;
struct dcerpc_binding_handle;
struct db_context;
@ -43,6 +44,9 @@ NTSTATUS netlogon_creds_cli_context_global(struct loadparm_context *lp_ctx,
const char *server_dns_domain,
TALLOC_CTX *mem_ctx,
struct netlogon_creds_cli_context **_context);
NTSTATUS netlogon_creds_bind_cli_credentials(
struct netlogon_creds_cli_context *context, TALLOC_CTX *mem_ctx,
struct cli_credentials **pcli_creds);
char *netlogon_creds_cli_debug_string(
const struct netlogon_creds_cli_context *context,