when I use LDAP-API 'ldap_search_s'offered with openldap to search entry, I get duplicate entries. Do you ever meet this? I write as follows. ldap_search_s(ld,baseDn,LDAP_SCOPE_SUBTREE,"objectclass=*",allAttrs,0,&res); m=ldap_first_message(ld,res); while(m!=NULL&&ldap_msgtype(m)==LDAP_RES_SEARCH_ENTRY) { for(e=ldap_first_entry(ld,m);e!=NULL;e=ldap_next_entry(ld,e)) {...} ... m=ldap_next_message(ld,m); }