42 AuthLdap
this = _this;
43 char * url = va_arg(*params,
char*);
47 strcpy(this->url, url);
51 base_dn = va_arg(* params,
char *);
52 this->nbase_dn = va_arg(* params,
size_t);
54 this->base_dn =
memMalloc(this->nbase_dn + 1);
55 this->base_dn[this->nbase_dn] = 0;
56 memcpy(this->base_dn, base_dn, this->nbase_dn);
65 AuthLdap
this = _this;
75 AuthLdap
this = _this;
80 struct berval ldap_cred;
81 struct berval * ldap_servcred;
87 ldap_initialize(&(this->ldap), this->url);
88 ldap_set_option(this->ldap, LDAP_OPT_PROTOCOL_VERSION, &(this->version));
90 memcpy(who_ptr,
"cn=",
sizeof(
"cn=") - 1);
91 who_ptr +=
sizeof(
"cn=") - 1;
95 memcpy(who_ptr, this->base_dn, this->nbase_dn);
96 who_ptr[this->nbase_dn] = 0;
98 ldap_cred.bv_val =
CRED_PWD(cred).pass;
99 ldap_cred.bv_len =
CRED_PWD(cred).npass;
100 ldap_err = ldap_sasl_bind_s(
109 ldap_unbind_ext_s(this->ldap, NULL, NULL);
static void authLdapDtor(void *_this)
static int authLdapAuthenticate(void *_this, Credential cred, Uuid user_index)
static int authLdapCtor(void *_this, va_list *params)
INIT_IFACE(Class, authLdapCtor, authLdapDtor, NULL)
CREATE_CLASS(AuthLdap, NULL, IFACE(Class), IFACE(Auth))