- tevent_req_done(req);
- return tevent_req_post(req, ev);
-}
-
-_PUBLIC_ NTSTATUS authenticate_ldap_simple_bind(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct imessaging_context *msg,
- struct loadparm_context *lp_ctx,
- struct tsocket_address *remote_address,
- struct tsocket_address *local_address,
- bool using_tls,
- const char *dn,
- const char *password,
- struct auth_session_info **session_info)
-{
- struct auth4_context *auth_context;
- struct auth_usersupplied_info *user_info;
- struct auth_user_info_dc *user_info_dc;
- NTSTATUS nt_status;
- uint8_t authoritative = 0;
- TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
- const char *nt4_domain = NULL;
- const char *nt4_username = NULL;
- uint32_t flags = 0;
- const char *transport_protection = AUTHZ_TRANSPORT_PROTECTION_NONE;
- if (using_tls) {
- transport_protection = AUTHZ_TRANSPORT_PROTECTION_TLS;
- }
-
- if (!tmp_ctx) {
- return NT_STATUS_NO_MEMORY;
- }
-
- nt_status = auth_context_create(tmp_ctx,
- ev, msg,
- lp_ctx,
- &auth_context);
- if (!NT_STATUS_IS_OK(nt_status)) {
- talloc_free(tmp_ctx);
- return nt_status;
- }
-
- /*
- * We check the error after building the user_info so we can
- * log a failure to find the user correctly
- */
- nt_status = crack_auto_name_to_nt4_name(tmp_ctx, ev, lp_ctx, dn,
- &nt4_domain, &nt4_username);
-
- user_info = talloc_zero(tmp_ctx, struct auth_usersupplied_info);
- if (!user_info) {
- talloc_free(tmp_ctx);
- return NT_STATUS_NO_MEMORY;