/*
* edir.c - Edirectory integrations
*/
-unlang_action_t fr_ldap_edir_get_password(request_t *request, char const *dn,
+unlang_action_t fr_ldap_edir_get_password(unlang_result_t *p_result, request_t *request, char const *dn,
fr_ldap_thread_trunk_t *ttrunk, fr_dict_attr_t const *password_da);
char const *fr_ldap_edir_errstr(int code);
int *msgid,
fr_ldap_connection_t *ldap_conn);
-unlang_action_t fr_ldap_sasl_bind_auth_async(request_t *request,
+unlang_action_t fr_ldap_sasl_bind_auth_async(unlang_result_t *p_result,
+ request_t *request,
fr_ldap_thread_t *thread,
char const *mechs,
char const *identity,
if (!ttrunk) {
ERROR("Failed to get trunk connection for LDAP bind");
- return UNLANG_ACTION_FAIL;
+ RETURN_UNLANG_FAIL;
}
treq = trunk_request_alloc(ttrunk->trunk, request);
if (!treq) {
ERROR ("Failed to allocate trunk request for LDAP bind");
- return UNLANG_ACTION_FAIL;
+ RETURN_UNLANG_FAIL;
}
MEM(bind_auth_ctx = talloc(treq, fr_ldap_bind_auth_ctx_t));
default:
ERROR("Failed to enqueue bind request");
trunk_request_free(&treq);
- return UNLANG_ACTION_FAIL;
+ RETURN_UNLANG_FAIL;
}
return unlang_function_push(p_result,
/** Initiate retrieval of the universal password from Novell eDirectory
*
+ * @param[out] p_result Where to write the result of the operation.
* @param[in] request Current request.
* @param[in] dn of the user whose password is to be retrieved.
* @param[in] ttrunk on which to send the LDAP request.
* - UNLANG_ACTION_PUSHED_CHILD on success.
* - UNLANG_ACTION_FAIL on failure.
*/
-unlang_action_t fr_ldap_edir_get_password(request_t *request, char const *dn, fr_ldap_thread_trunk_t *ttrunk,
+unlang_action_t fr_ldap_edir_get_password(unlang_result_t *p_result,
+ request_t *request, char const *dn, fr_ldap_thread_trunk_t *ttrunk,
fr_dict_attr_t const *password_da)
{
ldap_edir_ctx_t *edir_ctx;
if (!dn || !*dn) {
REDEBUG("Missing DN");
- return UNLANG_ACTION_FAIL;
+ RETURN_UNLANG_FAIL;
}
MEM(edir_ctx = talloc(unlang_interpret_frame_talloc_ctx(request), ldap_edir_ctx_t));
if (err) {
REDEBUG("Failed to encode user DN: %s", fr_ldap_edir_errstr(err));
talloc_free(edir_ctx);
- return UNLANG_ACTION_FAIL;
+ RETURN_UNLANG_FAIL;
}
- return unlang_function_push(NULL, request, ldap_edir_get_password_start, ldap_edir_get_password_resume,
+ return unlang_function_push(p_result,
+ request,
+ ldap_edir_get_password_start,
+ ldap_edir_get_password_resume,
ldap_edir_get_password_cancel, ~FR_SIGNAL_CANCEL,
UNLANG_SUB_FRAME, edir_ctx);
}
/** Initiate an async SASL LDAP bind for authentication
*
+ * @param[out] p_result Where to write the result of the bind.
* @param[in] request this bind relates to.
* @param[in] thread whose connection the bind should be performed on.
* @param[in] mechs SASL mechanisms to use.
* - 0 on success.
* - -1 on failure.
*/
-unlang_action_t fr_ldap_sasl_bind_auth_async(request_t *request, fr_ldap_thread_t *thread, char const *mechs,
- char const *identity, char const *password, char const *proxy, char const *realm)
+unlang_action_t fr_ldap_sasl_bind_auth_async(unlang_result_t *p_result,
+ request_t *request, fr_ldap_thread_t *thread, char const *mechs,
+ char const *identity, char const *password, char const *proxy, char const *realm)
{
fr_ldap_bind_auth_ctx_t *bind_auth_ctx;
trunk_request_t *treq;
if (!ttrunk) {
ERROR("Failed to get trunk connection for LDAP bind");
- return UNLANG_ACTION_FAIL;
+ RETURN_UNLANG_FAIL;
}
treq = trunk_request_alloc(ttrunk->trunk, request);
if (!treq) {
ERROR("Failed to allocate trunk request for LDAP bind");
- return UNLANG_ACTION_FAIL;
+ RETURN_UNLANG_FAIL;
}
MEM(bind_auth_ctx = talloc_zero(treq, fr_ldap_bind_auth_ctx_t));
default:
ERROR("Failed to enqueue bind request");
trunk_request_free(&treq);
- return UNLANG_ACTION_FAIL;
+ RETURN_UNLANG_FAIL;
}
- return unlang_function_push(NULL,
+ return unlang_function_push(p_result,
request,
ldap_async_sasl_bind_auth_start,
ldap_async_sasl_bind_auth_results,
#ifdef WITH_SASL
RDEBUG2("Login attempt using identity \"%pV\"", &call_env->user_sasl_authname);
- return fr_ldap_sasl_bind_auth_async(request, auth_ctx->thread, call_env->user_sasl_mech.vb_strvalue,
- call_env->user_sasl_authname.vb_strvalue,
- auth_ctx->password, call_env->user_sasl_proxy.vb_strvalue,
- call_env->user_sasl_realm.vb_strvalue);
+ return fr_ldap_sasl_bind_auth_async(p_result, request, auth_ctx->thread, call_env->user_sasl_mech.vb_strvalue,
+ call_env->user_sasl_authname.vb_strvalue,
+ auth_ctx->password, call_env->user_sasl_proxy.vb_strvalue,
+ call_env->user_sasl_realm.vb_strvalue);
#else
RDEBUG("Configuration item 'sasl.mech' is not supported. "
"The linked version of libldap does not provide ldap_sasl_bind( function");
*/
REPEAT_MOD_AUTHORIZE_RESUME;
autz_ctx->status = LDAP_AUTZ_EDIR_BIND;
- return fr_ldap_edir_get_password(request, autz_ctx->dn, autz_ctx->ttrunk,
+ return fr_ldap_edir_get_password(p_result, request, autz_ctx->dn, autz_ctx->ttrunk,
attr_cleartext_password);
}
FALL_THROUGH;