* 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.
This commit is contained in:
Corinna Vinschen 2014-05-23 10:29:11 +00:00
parent 448c1d284b
commit f9f90410fd
3 changed files with 25 additions and 17 deletions

View File

@ -1,3 +1,12 @@
2014-05-23 Corinna Vinschen <corinna@vinschen.de>
* 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.
2014-05-22 Corinna Vinschen <corinna@vinschen.de> 2014-05-22 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (ldap_abandon): Remove. * autoload.cc (ldap_abandon): Remove.

View File

@ -593,7 +593,7 @@ LoadDLLfunc (ldap_get_next_page_s, 0, wldap32)
LoadDLLfunc (ldap_get_valuesW, 0, wldap32) LoadDLLfunc (ldap_get_valuesW, 0, wldap32)
LoadDLLfunc (ldap_get_values_lenW, 0, wldap32) LoadDLLfunc (ldap_get_values_lenW, 0, wldap32)
LoadDLLfunc (ldap_initW, 0, wldap32) LoadDLLfunc (ldap_initW, 0, wldap32)
LoadDLLfunc (ldap_memfreeW, 0, wldap32) LoadDLLfunc (ldap_msgfree, 0, wldap32)
LoadDLLfunc (ldap_next_entry, 0, wldap32) LoadDLLfunc (ldap_next_entry, 0, wldap32)
LoadDLLfunc (ldap_search_abandon_page, 0, wldap32) LoadDLLfunc (ldap_search_abandon_page, 0, wldap32)
LoadDLLfunc (ldap_search_init_pageW, 0, wldap32) LoadDLLfunc (ldap_search_init_pageW, 0, wldap32)

View File

@ -172,7 +172,7 @@ cyg_ldap::open (PCWSTR domain)
} }
ldap_value_freeW (val); ldap_value_freeW (val);
val = NULL; val = NULL;
ldap_memfreeW ((PWCHAR) msg); ldap_msgfree (msg);
msg = entry = NULL; return true; msg = entry = NULL; return true;
err: err:
close (); close ();
@ -187,9 +187,9 @@ cyg_ldap::close ()
if (lh) if (lh)
ldap_unbind (lh); ldap_unbind (lh);
if (srch_msg) if (srch_msg)
ldap_memfreeW ((PWCHAR) srch_msg); ldap_msgfree (srch_msg);
if (msg) if (msg)
ldap_memfreeW ((PWCHAR) msg); ldap_msgfree (msg);
if (val) if (val)
ldap_value_freeW (val); ldap_value_freeW (val);
if (rootdse) if (rootdse)
@ -214,7 +214,7 @@ cyg_ldap::fetch_ad_account (PSID sid, bool group, PCWSTR domain)
if (msg) if (msg)
{ {
ldap_memfreeW ((PWCHAR) msg); ldap_msgfree (msg);
msg = entry = NULL; msg = entry = NULL;
} }
if (val) if (val)
@ -318,7 +318,7 @@ cyg_ldap::next_account (cygsid &sid)
ldap_value_free_len (bval); ldap_value_free_len (bval);
return true; return true;
} }
ldap_memfreeW ((PWCHAR) srch_msg); ldap_msgfree (srch_msg);
srch_msg = srch_entry = NULL; srch_msg = srch_entry = NULL;
} }
do do
@ -327,19 +327,18 @@ cyg_ldap::next_account (cygsid &sid)
} }
while (ret == LDAP_SUCCESS && ldap_count_entries (lh, srch_msg) == 0); while (ret == LDAP_SUCCESS && ldap_count_entries (lh, srch_msg) == 0);
if (ret == LDAP_NO_RESULTS_RETURNED) if (ret == LDAP_NO_RESULTS_RETURNED)
return false; ;
if (ret != LDAP_SUCCESS) else if (ret != LDAP_SUCCESS)
{ debug_printf ("ldap_result() error 0x%02x", ret);
debug_printf ("ldap_result() error 0x%02x", ret); else if ((srch_entry = ldap_first_entry (lh, srch_msg))
return false; && (bval = ldap_get_values_lenW (lh, srch_entry, sid_attr[0])))
}
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; sid = (PSID) bval[0]->bv_val;
ldap_value_free_len (bval); ldap_value_free_len (bval);
return true; return true;
} }
ldap_search_abandon_page (lh, srch_id);
srch_id = NULL;
return false; return false;
} }
@ -351,7 +350,7 @@ cyg_ldap::fetch_posix_offset_for_domain (PCWSTR domain)
if (msg) if (msg)
{ {
ldap_memfreeW ((PWCHAR) msg); ldap_msgfree (msg);
msg = entry = NULL; msg = entry = NULL;
} }
if (val) if (val)
@ -407,7 +406,7 @@ cyg_ldap::fetch_unix_sid_from_ad (uint32_t id, cygsid &sid, bool group)
if (msg) if (msg)
{ {
ldap_memfreeW ((PWCHAR) msg); ldap_msgfree (msg);
msg = entry = NULL; msg = entry = NULL;
} }
if (group) if (group)
@ -439,7 +438,7 @@ cyg_ldap::fetch_unix_name_from_rfc2307 (uint32_t id, bool group)
if (msg) if (msg)
{ {
ldap_memfreeW ((PWCHAR) msg); ldap_msgfree (msg);
msg = entry = NULL; msg = entry = NULL;
} }
if (val) if (val)