char *name, *password;
...

LDAP *ld = ldap_init(, 389);
ldap_simple_bind_s(ld, name, password);

LDAPMessage **result;
ldap_search_s(ld, , LDAP_SCOPE_SUBTREE,
	
	,
	NULL, 
	0,  
	result); 



ldap_msgfree(*result);	
ldap_unbind(ld);