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

auth:creds: Add cli_credentials_init_server()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Andreas Schneider 2020-09-04 12:21:21 +02:00 committed by Stefan Metzmacher
parent 515cffb1f2
commit 2c00bea2ae
2 changed files with 27 additions and 0 deletions

View File

@ -56,6 +56,31 @@ _PUBLIC_ struct cli_credentials *cli_credentials_init(TALLOC_CTX *mem_ctx)
return cred;
}
_PUBLIC_
struct cli_credentials *cli_credentials_init_server(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx)
{
struct cli_credentials *server_creds = NULL;
NTSTATUS status;
server_creds = cli_credentials_init(mem_ctx);
if (server_creds == NULL) {
return NULL;
}
cli_credentials_set_conf(server_creds, lp_ctx);
status = cli_credentials_set_machine_account(server_creds, lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Failed to obtain server credentials: %s\n",
nt_errstr(status)));
TALLOC_FREE(server_creds);
return NULL;
}
return server_creds;
}
_PUBLIC_ void cli_credentials_set_callback_data(struct cli_credentials *cred,
void *callback_data)
{

View File

@ -76,6 +76,8 @@ bool cli_credentials_set_workstation(struct cli_credentials *cred,
enum credentials_obtained obtained);
bool cli_credentials_is_anonymous(struct cli_credentials *cred);
struct cli_credentials *cli_credentials_init(TALLOC_CTX *mem_ctx);
struct cli_credentials *cli_credentials_init_server(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx);
void cli_credentials_set_anonymous(struct cli_credentials *cred);
bool cli_credentials_wrong_password(struct cli_credentials *cred);
const char *cli_credentials_get_password(struct cli_credentials *cred);