summaryrefslogtreecommitdiffstats
path: root/ldap/servers/plugins/replication/windows_connection.c
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2010-07-06 16:47:45 -0600
committerRich Megginson <rmeggins@redhat.com>2010-07-06 17:41:20 -0600
commit85eb9216d5d4163139a90432084452cf81c8444e (patch)
treea1f1306ce6cb9f2d346eaddefcf75a29d29f91f0 /ldap/servers/plugins/replication/windows_connection.c
parent7a9c069a7d64c1370353278c34bf9065aeb604ea (diff)
downloadds-85eb9216d5d4163139a90432084452cf81c8444e.tar.gz
ds-85eb9216d5d4163139a90432084452cf81c8444e.tar.xz
ds-85eb9216d5d4163139a90432084452cf81c8444e.zip
Bug 611850 - fix coverity Defect Type: Error handling issues
https://bugzilla.redhat.com/show_bug.cgi?id=611850 Resolves: bug 611850 Bug Description: fix coverity Defect Type: Error handling issues Reviewed by: nhosoi (Thanks!) Branch: HEAD Fix Description: Check the error return from the functions. In some cases, I was able to figure out that the calling function should perform additional error handling (return early, goto error label), but in general the code just logs an appropriate error message and continues. I was able to get rid of some more libacl code. I removed an unused variable from modify.c Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no
Diffstat (limited to 'ldap/servers/plugins/replication/windows_connection.c')
-rw-r--r--ldap/servers/plugins/replication/windows_connection.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/ldap/servers/plugins/replication/windows_connection.c b/ldap/servers/plugins/replication/windows_connection.c
index 8aabfdbb..2e24bfed 100644
--- a/ldap/servers/plugins/replication/windows_connection.c
+++ b/ldap/servers/plugins/replication/windows_connection.c
@@ -885,7 +885,10 @@ Slapi_Entry * windows_conn_get_search_result(Repl_Connection *conn)
LDAPControl **returned_controls = NULL;
int code = 0;
/* Purify says this is a leak : */
- ldap_parse_result( conn->ld, res, &code, NULL, NULL, NULL, &returned_controls, 0 );
+ if (LDAP_SUCCESS != (rc = ldap_parse_result( conn->ld, res, &code, NULL, NULL, NULL, &returned_controls, 0 ))) {
+ slapi_log_error(SLAPI_LOG_FATAL, windows_repl_plugin_name,
+ "error reading search result in windows_conn_get_search_result, rc=%d:%s\n", rc, ldap_err2string(rc));
+ }
if (returned_controls)
{
windows_private_update_dirsync_control(conn->agmt, returned_controls);
@@ -1818,7 +1821,20 @@ windows_check_user_password(Repl_Connection *conn, Slapi_DN *sdn, char *password
/* Attempt to do a bind on the existing connection
* using the dn and password that were passed in. */
msgid = do_simple_bind(conn, conn->ld, (char *) binddn, password);
- ldap_result(conn->ld, msgid, LDAP_MSG_ALL, NULL, &res);
+ rc = ldap_result(conn->ld, msgid, LDAP_MSG_ALL, NULL, &res);
+ if (0 > rc) { /* error */
+ rc = slapi_ldap_get_lderrno(conn->ld, NULL, NULL);
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
+ "Error reading bind response for id "
+ "[%s]: error %d (%s)\n",
+ binddn ? binddn : "(anon)",
+ rc, ldap_err2string(rc));
+ } else if (rc == 0) { /* timeout */
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
+ "Error: timeout reading "
+ "bind response for [%s]\n",
+ binddn ? binddn : "(anon)");
+ }
ldap_parse_result( conn->ld, res, &rc, NULL, NULL, NULL, NULL, 1 /* Free res */);
/* rebind as the DN specified in the sync agreement */