creating own ldap module. Bind error

Maria Ripolles mariaripolles63 at
Tue Feb 7 18:41:28 CET 2006

Hy all,
First, congratulations for your work :-)
I am using FreeRadius 1.0.5 and OpenLDAP 2.3.19

I have tested your ldap module and it worked great.
Now, I am experimenting trying to develop my own ldap
I am new to LDAP and FreeRadius programming.
I wrote a simple module to connect to search users in
the LDAP server. But I am getting a LDAP Bind error.
If someone could clarify me, I will really thank you:
Here is my simple code:
static int connect (void *instance)
        int msgid;
        LDAP    *ld;
        ldap2_instance  *inst = instance;
       radlog(L_INFO,"connect: bound = %d",
       if (inst->bound == 0)
             if (ld != NULL)
                ldap_unbind (ld);
             /*LDAP_INIT */
             if ( ( ld = ldap_init (inst->ldapHost,
                radlog(L_INFO, "ERROR IN INIT");
                inst->bound = 0;
                return (-1);
             radlog(L_INFO,"Host is %s and port is
%d", inst->ldapHost, inst->ldapPort);
             /*LDAP_SIMPLE_BIND */
                msgid = ldap_simple_bind_s (ld,
inst->radiusMgrDn, inst->radiusMgrPw);
                 if (msgid != LDAP_SUCCESS) {
                radlog(L_INFO, "ERROR IN SIMPLE BIND
connecting as %s. The error is number: %d",
inst->radiusMgrDn , msgid);
                inst->bound = 0;
                return (-1);
             inst->bound = 1;
       return (0);
And here is my result:
connect: bound = 0
Host is localhost and port is 389
Password: secret
ERROR EN SIMPLE BIND connecting as
cn=root,dc=mydomain,dc=com.  The error is number: 2
What am I doing wrong?
Thanks a lot, it is really important for me 
Best regards,

LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto.

More information about the Freeradius-Devel mailing list