This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
*res = NULL;
- if (!ads->ld &&
- time(NULL) - ads->last_attempt < ADS_RECONNECT_TIME) {
+ if (!ads->ldap.ld &&
+ time(NULL) - ads->ldap.last_attempt < ADS_RECONNECT_TIME) {
return ADS_ERROR(LDAP_SERVER_DOWN);
}
status = ads_do_search_all_args(ads, bp, scope, expr, attrs, args, res);
}
if (ADS_ERR_OK(status)) {
- DEBUG(5,("Search for %s in <%s> gave %d replies\n",
- expr, bp, ads_count_replies(ads, *res)));
+ DEBUG(5,("Search for %s in <%s> gave %d replies\n",
+ expr, bp, ads_count_replies(ads, *res)));
SAFE_FREE(bp);
return status;
}
while (--count) {
+ if (NT_STATUS_EQUAL(ads_ntstatus(status), NT_STATUS_IO_TIMEOUT) && ads->config.ldap_page_size >= 250) {
+ int new_page_size = (ads->config.ldap_page_size / 2);
+ DEBUG(1, ("Reducing LDAP page size from %d to %d due to IO_TIMEOUT\n",
+ ads->config.ldap_page_size, new_page_size));
+ ads->config.ldap_page_size = new_page_size;
+ }
+
if (*res)
ads_msgfree(ads, *res);
*res = NULL;
DEBUG(3,("Reopening ads connection to realm '%s' after error %s\n",
ads->config.realm, ads_errstr(status)));
- if (ads->ld) {
- ldap_unbind(ads->ld);
- }
-
- ads->ld = NULL;
+ ads_disconnect(ads);
status = ads_connect(ads);
if (!ADS_ERR_OK(status)) {
"(objectclass=*)", attrs, &args, res);
}
+ ADS_STATUS ads_search_retry_dn_sd_flags(ADS_STRUCT *ads, LDAPMessage **res,
+ uint32 sd_flags,
+ const char *dn,
+ const char **attrs)
+{
+ ads_control args;
+
+ args.control = ADS_SD_FLAGS_OID;
+ args.val = sd_flags;
+ args.critical = True;
+
+ return ads_do_search_retry_args(ads, dn, LDAP_SCOPE_BASE,
+ "(objectclass=*)", attrs, &args, res);
+}
+
ADS_STATUS ads_search_retry_extended_dn_ranged(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
const char *dn,
const char **attrs,
"(objectclass=*)", &args, attrs[0],
strings, num_strings);
-}
-
- ADS_STATUS ads_search_retry_dn_sd_flags(ADS_STRUCT *ads, LDAPMessage **res,
- uint32 sd_flags,
- const char *dn,
- const char **attrs)
-{
- ads_control args;
-
- args.control = ADS_SD_FLAGS_OID;
- args.val = sd_flags;
- args.critical = True;
-
- return ads_do_search_retry_args(ads, dn, LDAP_SCOPE_BASE,
- "(objectclass=*)", attrs, &args, res);
}
ADS_STATUS ads_search_retry_sid(ADS_STRUCT *ads, LDAPMessage **res,
uint32 first_usn;
int num_retries = 0;
const char **attrs;
- BOOL more_values = False;
+ bool more_values = False;
*num_strings = 0;
*strings = NULL;
size_t *num_strings,
uint32 *first_usn,
int *num_retries,
- BOOL *more_values)
+ bool *more_values)
{
LDAPMessage *res = NULL;
ADS_STATUS status;