There is a FAQ about this (not specific to LDAP): http://faq.cprogramming.com/cgi-bin/...&id=1043284392