diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2014-05-23 14:29:11 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2014-05-23 14:29:11 +0400 |
commit | f9f90410fd78d44f06aef3cc34433f48dedf1882 (patch) | |
tree | 1683ef69b5431d99e9e8e15220cc88027d1167f0 /winsup/cygwin/ldap.cc | |
parent | 448c1d284b71d74edbab23976c24b1553eadf4f9 (diff) |
* autoload.cc (ldap_memfreeW): Remove.
(ldap_msgfree): Import.
* ldap.cc: Throughout, use ldap_msgfree to free LDAPMessage memory,
rather than ldap_memfreeW.
(cyg_ldap::next_account): Immediately abandon search when quiting from
search.
Diffstat (limited to 'winsup/cygwin/ldap.cc')
-rw-r--r-- | winsup/cygwin/ldap.cc | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/winsup/cygwin/ldap.cc b/winsup/cygwin/ldap.cc index 72f16defb..cee07c333 100644 --- a/winsup/cygwin/ldap.cc +++ b/winsup/cygwin/ldap.cc @@ -172,7 +172,7 @@ cyg_ldap::open (PCWSTR domain) } ldap_value_freeW (val); val = NULL; - ldap_memfreeW ((PWCHAR) msg); + ldap_msgfree (msg); msg = entry = NULL; return true; err: close (); @@ -187,9 +187,9 @@ cyg_ldap::close () if (lh) ldap_unbind (lh); if (srch_msg) - ldap_memfreeW ((PWCHAR) srch_msg); + ldap_msgfree (srch_msg); if (msg) - ldap_memfreeW ((PWCHAR) msg); + ldap_msgfree (msg); if (val) ldap_value_freeW (val); if (rootdse) @@ -214,7 +214,7 @@ cyg_ldap::fetch_ad_account (PSID sid, bool group, PCWSTR domain) if (msg) { - ldap_memfreeW ((PWCHAR) msg); + ldap_msgfree (msg); msg = entry = NULL; } if (val) @@ -318,7 +318,7 @@ cyg_ldap::next_account (cygsid &sid) ldap_value_free_len (bval); return true; } - ldap_memfreeW ((PWCHAR) srch_msg); + ldap_msgfree (srch_msg); srch_msg = srch_entry = NULL; } do @@ -327,19 +327,18 @@ cyg_ldap::next_account (cygsid &sid) } while (ret == LDAP_SUCCESS && ldap_count_entries (lh, srch_msg) == 0); if (ret == LDAP_NO_RESULTS_RETURNED) - return false; - if (ret != LDAP_SUCCESS) - { - debug_printf ("ldap_result() error 0x%02x", ret); - return false; - } - if ((srch_entry = ldap_first_entry (lh, srch_msg)) - && (bval = ldap_get_values_lenW (lh, srch_entry, sid_attr[0]))) + ; + else if (ret != LDAP_SUCCESS) + debug_printf ("ldap_result() error 0x%02x", ret); + else if ((srch_entry = ldap_first_entry (lh, srch_msg)) + && (bval = ldap_get_values_lenW (lh, srch_entry, sid_attr[0]))) { sid = (PSID) bval[0]->bv_val; ldap_value_free_len (bval); return true; } + ldap_search_abandon_page (lh, srch_id); + srch_id = NULL; return false; } @@ -351,7 +350,7 @@ cyg_ldap::fetch_posix_offset_for_domain (PCWSTR domain) if (msg) { - ldap_memfreeW ((PWCHAR) msg); + ldap_msgfree (msg); msg = entry = NULL; } if (val) @@ -407,7 +406,7 @@ cyg_ldap::fetch_unix_sid_from_ad (uint32_t id, cygsid &sid, bool group) if (msg) { - ldap_memfreeW ((PWCHAR) msg); + ldap_msgfree (msg); msg = entry = NULL; } if (group) @@ -439,7 +438,7 @@ cyg_ldap::fetch_unix_name_from_rfc2307 (uint32_t id, bool group) if (msg) { - ldap_memfreeW ((PWCHAR) msg); + ldap_msgfree (msg); msg = entry = NULL; } if (val) |