[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ldap_sasl_bind_s



On Dienstag, 27. Mai 2008, Gavin Henry wrote:
> <quote who="Quanah Gibson-Mount">
>
> > --On Monday, May 26, 2008 10:19 PM +0100 Gavin Henry
> >
> > <ghenry@suretecsystems.com> wrote:
> >> Hi All,
> >>
> >> I've been debugging the RealTime Asterisk LDAP driver, namely the
> >> function:
> >>         if (!ast_strlen_zero(user)) {
> >>                 ast_debug(2, "bind to '%s' as user '%s'\n", url,
> >> user); cred.bv_val = (char *) pass;
> >>                 cred.bv_len = strlen(pass);
> >>                 bind_result = ldap_sasl_bind_s(ldapConn, user,
> >> LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL);
> >>         } else {
> >>                 ast_debug(2, "bind %s anonymously\n", url);
> >>                 bind_result = ldap_sasl_bind_s(ldapConn, "",
> >> LDAP_SASL_SIMPLE, NULL, NULL, NULL, NULL);
> >>
> >> The line:
> >>
> >> bind_result = ldap_sasl_bind_s(ldapConn, NULL, LDAP_SASL_SIMPLE,
> >> NULL, NULL, NULL, NULL);

You need to set the cred pointer to an empty struct berval instead of 
NULL for an anoynmous bind:

cred.bv_val = NULL;
cred.bv_len = 0;
ldap_sasl_bind_s(ldapConn, NULL, LDAP_SASL_SIMPLE, &cred, NULL, NULL, 
    NULL);

-- 
Ralf