summaryrefslogtreecommitdiff
path: root/source3/libsmb/auth_generic.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2016-04-12 21:16:50 +0200
committerStefan Metzmacher <metze@samba.org>2016-04-12 21:16:50 +0200
commit47f3a1f221508598a1f43f723d1b654bebee4c57 (patch)
treee4b567488466eef023c80efce03d2f75cbaf6199 /source3/libsmb/auth_generic.c
parent0dd174954988b1e4d6f59863088e95f5aa07eba6 (diff)
parentcdf4f21e282599fc2b00d8d4ff38d92b4af1fd0b (diff)
downloadsamba-47f3a1f221508598a1f43f723d1b654bebee4c57.tar.gz
Merge tag 'samba-4.2.11' into v4-2-test
samba: tag release samba-4.2.11 Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/libsmb/auth_generic.c')
-rw-r--r--source3/libsmb/auth_generic.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/source3/libsmb/auth_generic.c b/source3/libsmb/auth_generic.c
index 1f6c681a6e5..2e45cdbc53e 100644
--- a/source3/libsmb/auth_generic.c
+++ b/source3/libsmb/auth_generic.c
@@ -78,7 +78,7 @@ NTSTATUS auth_generic_client_prepare(TALLOC_CTX *mem_ctx, struct auth_generic_st
}
backends = talloc_zero_array(gensec_settings,
- const struct gensec_security_ops *, 6);
+ const struct gensec_security_ops *, 7);
if (backends == NULL) {
TALLOC_FREE(ans);
return NT_STATUS_NO_MEMORY;
@@ -92,7 +92,8 @@ NTSTATUS auth_generic_client_prepare(TALLOC_CTX *mem_ctx, struct auth_generic_st
backends[idx++] = &gensec_gse_krb5_security_ops;
#endif
- backends[idx++] = &gensec_ntlmssp3_client_ops;
+ backends[idx++] = gensec_security_by_oid(NULL, GENSEC_OID_NTLMSSP);
+ backends[idx++] = gensec_security_by_name(NULL, "ntlmssp_resume_ccache");
backends[idx++] = gensec_security_by_oid(NULL, GENSEC_OID_SPNEGO);
backends[idx++] = gensec_security_by_auth_type(NULL, DCERPC_AUTH_TYPE_SCHANNEL);
@@ -143,6 +144,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)
@@ -167,3 +191,26 @@ NTSTATUS auth_generic_client_start_by_authtype(struct auth_generic_state *ans,
return NT_STATUS_OK;
}
+
+NTSTATUS auth_generic_client_start_by_sasl(struct auth_generic_state *ans,
+ const char **sasl_list)
+{
+ 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_sasl_list(ans->gensec_security, sasl_list);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ return NT_STATUS_OK;
+}