29RCSID(
"$Id: 190832cadf77462637abc94691e19a01ec8782f3 $")
 
   33#include <freeradius-devel/util/debug.h> 
   34#include <freeradius-devel/ldap/base.h> 
   37#define NMAS_E_BASE     (-1600) 
   39#define NMAS_E_FRAG_FAILURE             (NMAS_E_BASE-31)         
   40#define NMAS_E_SYSTEM_RESOURCES         (NMAS_E_BASE-34)         
   41#define NMAS_E_INSUFFICIENT_MEMORY      (NMAS_E_BASE-35)         
   42#define NMAS_E_NOT_SUPPORTED            (NMAS_E_BASE-36)         
   43#define NMAS_E_INVALID_PARAMETER        (NMAS_E_BASE-43)         
   44#define NMAS_E_INVALID_VERSION          (NMAS_E_BASE-52)         
   45#define NMAS_E_ACCESS_NOT_ALLOWED       (NMAS_E_BASE-59)         
   46#define NMAS_E_INVALID_SPM_REQUEST      (NMAS_E_BASE-97)         
   49#define NMASLDAP_GET_PASSWORD_REQUEST     "2.16.840.1.113719.1.39.42.100.13" 
   50#define NMASLDAP_GET_PASSWORD_RESPONSE    "2.16.840.1.113719.1.39.42.100.14" 
   52#define NMAS_LDAP_EXT_VERSION 1 
   80        BerElement *request_ber = NULL;
 
   88        if ((request_ber = ber_alloc()) == NULL) {
 
  103        if (ber_flatten(request_ber, request_bv) < 0) {
 
  109        if (request_ber) ber_free(request_ber, 1);
 
 
  138        BerElement *reply_ber = NULL;
 
  143        if ((reply_ber = ber_init(reply_bv)) == NULL) {
 
  148        rc = ber_scanf(reply_ber, 
"{iis}", server_version, &
err, 
out, outlen);
 
  155        if (reply_ber) ber_free(reply_ber, 1);
 
 
  171                                      edir_ctx->
reqoid, edir_ctx->
dn, NULL, NULL);
 
 
  187        char            *reply_oid = NULL;
 
  188        struct berval   *reply_bv = NULL;
 
  199                REDEBUG(
"Failed retrieving Universal Password");
 
  235        if (
err) 
goto finish;
 
  249                RDEBUG3(
"Added eDirectory password.  control.%pP", 
vp);
 
  251                RDEBUG2(
"Added eDirectory password");
 
  258        if (reply_bv) ber_bvfree(reply_bv);
 
  259        if (reply_oid) ldap_memfree(reply_oid);
 
 
  309                .password_da = password_da
 
 
  331                return "BER manipulation failed";
 
  335                return "Insufficient memory or system resources";
 
  338                return "Server response indicated Universal Password is not supported (missing password response OID)";
 
  341                return "Bad arguments passed to eDir functions";
 
  347                return "Bound user does not have sufficient rights to read the Universal Password of users";
 
  350                return "Universal password is not enabled for the container of this user object";
 
  353                return ldap_err2string(code);
 
 
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
static int const char char buffer[256]
#define USES_APPLE_DEPRECATED_API
#define NMAS_E_INVALID_VERSION
static int ber_encode_request_data(char const *dn, struct berval **request_bv)
Takes the object DN and BER encodes the data into the BER value which is used as part of the request.
#define NMAS_E_SYSTEM_RESOURCES
#define NMAS_E_FRAG_FAILURE
#define NMAS_E_ACCESS_NOT_ALLOWED
static int ber_decode_login_data(struct berval *reply_bv, int *server_version, void *out, size_t *outlen)
Converts the reply into server version and a return code.
fr_dict_attr_t const  * password_da
static void ldap_edir_get_password_cancel(UNUSED request_t *request, UNUSED fr_signal_t action, void *uctx)
Cancel an in progress Universal Password lookup.
#define NMASLDAP_GET_PASSWORD_REQUEST
fr_ldap_thread_trunk_t * ttrunk
static unlang_action_t ldap_edir_get_password_resume(unlang_result_t *p_result, request_t *request, void *uctx)
Handle results of retrieving Universal Password.
char const * fr_ldap_edir_errstr(int code)
#define NMASLDAP_GET_PASSWORD_RESPONSE
static unlang_action_t ldap_edir_get_password_start(UNUSED unlang_result_t *p_result, request_t *request, void *uctx)
Submit LDAP extended operation to retrieve Universal Password.
#define NMAS_E_INVALID_PARAMETER
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)
Initiate retrieval of the universal password from Novell eDirectory.
#define NMAS_LDAP_EXT_VERSION
#define NMAS_E_INSUFFICIENT_MEMORY
#define NMAS_E_NOT_SUPPORTED
#define NMAS_E_INVALID_SPM_REQUEST
#define unlang_function_push_with_result(_result_p, _request, _func, _repeat, _signal, _sigmask, _top_frame, _uctx)
Push a generic function onto the unlang stack that produces a result.
TALLOC_CTX * unlang_interpret_frame_talloc_ctx(request_t *request)
Get a talloc_ctx which is valid only for this frame.
LDAP * handle
libldap handle.
fr_ldap_result_code_t ret
Result code.
trunk_request_t * treq
Trunk request this query is associated with.
fr_ldap_connection_t * ldap_conn
LDAP connection this query is running on.
LDAPMessage * result
Head of LDAP results list.
Thread LDAP trunk structure.
unlang_action_t fr_ldap_trunk_extended(TALLOC_CTX *ctx, fr_ldap_query_t **out, request_t *request, fr_ldap_thread_trunk_t *ttrunk, char const *reqoid, struct berval *reqdata, LDAPControl **serverctrls, LDAPControl **clientctrls)
Run an async LDAP "extended operation" query on a trunk connection.
#define RDEBUG_ENABLED3
True if request debug level 1-3 messages are enabled.
int fr_pair_value_bstrndup(fr_pair_t *vp, char const *src, size_t len, bool tainted)
Copy data into a "string" type value pair.
#define RETURN_UNLANG_RCODE(_rcode)
#define RETURN_UNLANG_FAIL
rlm_rcode_t
Return codes indicating the result of the module call.
@ RLM_MODULE_OK
The module is OK, continue.
@ RLM_MODULE_FAIL
Module failed, don't reply.
#define pair_update_control(_attr, _da)
Return or allocate a fr_pair_t in the control list.
fr_signal_t
Signals that can be generated/processed by request signal handlers.
@ FR_SIGNAL_CANCEL
Request has been cancelled.
Stores an attribute, a value and various bits of other data.
void trunk_request_signal_cancel(trunk_request_t *treq)
Cancel a trunk request.
static size_t char ** out