m_ldap: time out LDAP queries

Set LDAP_OPT_NETWORK_TIMEOUT to 0 in m_ldap to prevent the asynchronous
library calls from blocking

Fix memory leak of pending queries when m_ldap is unloaded