1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-20 22:50:26 +03:00

s3:auth_generic: add auth_generic_client_start_by_name()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11804

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
(cherry picked from commit ccfd2647c7e65c3e2ad92dbc27c21570da0706d4)
This commit is contained in:
Stefan Metzmacher 2015-11-26 11:44:02 +01:00
parent 9e4231229a
commit a0feacff89
2 changed files with 25 additions and 1 deletions

View File

@ -42,7 +42,8 @@ NTSTATUS auth_generic_set_creds(struct auth_generic_state *ans,
NTSTATUS auth_generic_client_prepare(TALLOC_CTX *mem_ctx,
struct auth_generic_state **_ans);
NTSTATUS auth_generic_client_start(struct auth_generic_state *ans, const char *oid);
NTSTATUS auth_generic_client_start_by_name(struct auth_generic_state *ans,
const char *name);
NTSTATUS auth_generic_client_start_by_authtype(struct auth_generic_state *ans,
uint8_t auth_type,
uint8_t auth_level);

View File

@ -151,6 +151,29 @@ NTSTATUS auth_generic_client_start(struct auth_generic_state *ans, const char *o
return NT_STATUS_OK;
}
NTSTATUS auth_generic_client_start_by_name(struct auth_generic_state *ans,
const char *name)
{
NTSTATUS status;
/* Transfer the credentials to gensec */
status = gensec_set_credentials(ans->gensec_security, ans->credentials);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Failed to set GENSEC credentials: %s\n",
nt_errstr(status)));
return status;
}
talloc_unlink(ans, ans->credentials);
ans->credentials = NULL;
status = gensec_start_mech_by_name(ans->gensec_security, name);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
return NT_STATUS_OK;
}
NTSTATUS auth_generic_client_start_by_authtype(struct auth_generic_state *ans,
uint8_t auth_type,
uint8_t auth_level)