niloulili hotmail.com writes:
> if ( (ld =
ldap_init("192.xxx.xxx.xxx",389 ))== NULL )
> return 1;
> if ( ldap_simple_bind_s( ld,"CN=nina
>
wang,CN=Users,DC=ldap,DC=qtier,DC=com","0000"
) != LDAP_SUCCESS )
> {
> ldap_perror( ld, "ldap_simple_bind_s"
);
insert "ldap_unbind( ld );" here. Does that fix
the problem?
That's how to free the LDAP* structure.
In LDAP, "unbind" is the "disconnect"
command, it's not the
opposite of "bind". The misleading name came
about because
originally one had to bind after connect.
> return 1;
> }
> ldap_msgfree( res );
res == NULL here in this particular code, so you can drop
this and the declaration of 'res'.
> /* close and free connection resources */
> ldap_unbind( ld );
> return 0;
> }
--
Regards,
Hallvard
|