Can anybody guide me for the problems with ldap_simple_bind_s()
function in LDAP C API? I am passing arguments for HOST and PORT to
ldap_init and construct a ld pointer to LDAP structure.
After doing this, try to bind as admin ID and what I am getting in
LDAP access logs is, HOST is replaced by LOCALHOST loopback address
127.0.0.1. That is if my HOST LDAP port is say 255.xxx.xxx.220 , and
client IP is say 222.xxx.xxx.111, instead of seeing in logs a LDAP
connection
LDAP connection from 222.xxx.xxx.111 to 255.xxx.xxx.220
LDAP connection from 127.0.0.1 to 127.0.0.1
I checked that HOST and PORT are still valid even after mod is
attempted. I don't know at which point HOST is overwritten by
localhost. I understand that if no HOST is found alive, LDAP C api
will assume localhost?
Below is what I am doing
Note:
argv[0] = HOST
argv[1] = PORT
argv[2] = Admin
argv[3] = pass
if( (ld = ldap_init(argv[0], atoi(argv[1]))) == NULL)
{
/* error - Unable to Initialize*/
/* getting correct HOST and PORT here
}
ldapVersion = LDAP_VERSION3;
ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &ldapVersion);
ldap_set_option(ld, LDAP_OPT_REFERRALS,LDAP_OPT_ON);
/* auth to directory as admin */
if(ld is Initialized)
{
/*Checked if host and port are still valid - Yes they are valid */
if( ldap_simple_bind_s(ld, argv[2], argv[3]) !=
LDAP_SUCCESS) */
{
/* error - unable to BIND */
}
}
/* contruct the modification to make */
/* make the modification */
if( ldap_modify_s(ld, dn, mods) != LDAP_SUCCESS)
{
/* fails because HOST and PORT are changed to 127.0.0.1 to
whatever
is supplied */
/* error - unable to MOD */
}
ldap_unbind( ld );
_______________________________________________
mozilla-directory mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-directory