Skip to content
Snippets Groups Projects
Commit d304a884 authored by Tilghman Lesher's avatar Tilghman Lesher
Browse files

Errors are all greater than 0

(closes issue #12422)
 Reported by: nito
 Patches: 
       res_config_ldap_result_check_patch.diff uploaded by nito (license 340)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114061 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 115d5024
Branches
Tags
No related merge requests found
...@@ -552,7 +552,7 @@ static struct ast_variable *ldap_loadentry(struct ldap_table_config *table_confi ...@@ -552,7 +552,7 @@ static struct ast_variable *ldap_loadentry(struct ldap_table_config *table_confi
do { do {
result = ldap_search_ext_s(ldapConn, dn, LDAP_SCOPE_BASE, result = ldap_search_ext_s(ldapConn, dn, LDAP_SCOPE_BASE,
"(objectclass=*)", NULL, 0, NULL, NULL, NULL, LDAP_NO_LIMIT, &ldap_result); "(objectclass=*)", NULL, 0, NULL, NULL, NULL, LDAP_NO_LIMIT, &ldap_result);
if (result < 0 && is_ldap_connect_error(result)) { if (result != LDAP_SUCCESS && is_ldap_connect_error(result)) {
ast_log(LOG_WARNING, ast_log(LOG_WARNING,
"Failed to query database. Try %d/3\n", "Failed to query database. Try %d/3\n",
tries + 1); tries + 1);
...@@ -567,9 +567,9 @@ static struct ast_variable *ldap_loadentry(struct ldap_table_config *table_confi ...@@ -567,9 +567,9 @@ static struct ast_variable *ldap_loadentry(struct ldap_table_config *table_confi
break; break;
} }
} }
} while (result < 0 && tries < 3 && is_ldap_connect_error(result)); } while (result != LDAP_SUCCESS && tries < 3 && is_ldap_connect_error(result));
if (result < 0) { if (result != LDAP_SUCCESS) {
ast_log(LOG_WARNING, ast_log(LOG_WARNING,
"Failed to query database. Check debug for more info.\n"); "Failed to query database. Check debug for more info.\n");
ast_debug(2, "dn=%s\n", dn); ast_debug(2, "dn=%s\n", dn);
...@@ -787,7 +787,7 @@ static struct ast_variable **realtime_ldap_base_ap(unsigned int *entries_count_p ...@@ -787,7 +787,7 @@ static struct ast_variable **realtime_ldap_base_ap(unsigned int *entries_count_p
result = ldap_search_ext_s(ldapConn, clean_basedn, result = ldap_search_ext_s(ldapConn, clean_basedn,
LDAP_SCOPE_SUBTREE, filter->str, NULL, 0, NULL, NULL, NULL, LDAP_NO_LIMIT, LDAP_SCOPE_SUBTREE, filter->str, NULL, 0, NULL, NULL, NULL, LDAP_NO_LIMIT,
&ldap_result); &ldap_result);
if (result < 0 && is_ldap_connect_error(result)) { if (result != LDAP_SUCCESS && is_ldap_connect_error(result)) {
ast_log(LOG_DEBUG, "Failed to query database. Try %d/10\n", ast_log(LOG_DEBUG, "Failed to query database. Try %d/10\n",
tries + 1); tries + 1);
if (++tries < 10) { if (++tries < 10) {
...@@ -800,9 +800,9 @@ static struct ast_variable **realtime_ldap_base_ap(unsigned int *entries_count_p ...@@ -800,9 +800,9 @@ static struct ast_variable **realtime_ldap_base_ap(unsigned int *entries_count_p
break; break;
} }
} }
} while (result < 0 && tries < 10 && is_ldap_connect_error(result)); } while (result != LDAP_SUCCESS && tries < 10 && is_ldap_connect_error(result));
if (result < 0) { if (result != LDAP_SUCCESS) {
ast_log(LOG_WARNING, "Failed to query database. Check debug for more info.\n"); ast_log(LOG_WARNING, "Failed to query database. Check debug for more info.\n");
ast_log(LOG_WARNING, "Query: %s\n", filter->str); ast_log(LOG_WARNING, "Query: %s\n", filter->str);
ast_log(LOG_WARNING, "Query Failed because: %s\n", ldap_err2string(result)); ast_log(LOG_WARNING, "Query Failed because: %s\n", ldap_err2string(result));
...@@ -1244,7 +1244,7 @@ static int update_ldap(const char *basedn, const char *table_name, const char *a ...@@ -1244,7 +1244,7 @@ static int update_ldap(const char *basedn, const char *table_name, const char *a
result = ldap_search_ext_s(ldapConn, clean_basedn, result = ldap_search_ext_s(ldapConn, clean_basedn,
LDAP_SCOPE_SUBTREE, filter->str, NULL, 0, NULL, NULL, NULL, LDAP_NO_LIMIT, LDAP_SCOPE_SUBTREE, filter->str, NULL, 0, NULL, NULL, NULL, LDAP_NO_LIMIT,
&ldap_result); &ldap_result);
if (result < 0 && is_ldap_connect_error(result)) { if (result != LDAP_SUCCESS && is_ldap_connect_error(result)) {
ast_log(LOG_WARNING, "Failed to query database. Try %d/3\n", ast_log(LOG_WARNING, "Failed to query database. Try %d/3\n",
tries + 1); tries + 1);
tries++; tries++;
...@@ -1258,9 +1258,9 @@ static int update_ldap(const char *basedn, const char *table_name, const char *a ...@@ -1258,9 +1258,9 @@ static int update_ldap(const char *basedn, const char *table_name, const char *a
break; break;
} }
} }
} while (result < 0 && tries < 3 && is_ldap_connect_error(result)); } while (result != LDAP_SUCCESS && tries < 3 && is_ldap_connect_error(result));
if (result < 0) { if (result != LDAP_SUCCESS) {
ast_log(LOG_WARNING, "Failed to query directory. Check debug for more info.\n"); ast_log(LOG_WARNING, "Failed to query directory. Check debug for more info.\n");
ast_log(LOG_WARNING, "Query: %s\n", filter->str); ast_log(LOG_WARNING, "Query: %s\n", filter->str);
ast_log(LOG_WARNING, "Query Failed because: %s\n", ast_log(LOG_WARNING, "Query Failed because: %s\n",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment