[SSSD] [PATCH] Check the return value of sysdb_search_services

Jakub Hrozek jhrozek at redhat.com
Mon Mar 4 23:21:36 UTC 2013


With the amount of patches making its way to master these days, I
thought it was prudent to run clang out-of-band. It uncovered a bunch of
false positives and this bug.
-------------- next part --------------
>From c2c562c356761d899c8f879e6e46e1553778e0bd Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Tue, 5 Mar 2013 00:11:46 +0100
Subject: [PATCH] Check the return value of sysdb_search_services

---
 src/providers/ldap/sdap_reinit.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/providers/ldap/sdap_reinit.c b/src/providers/ldap/sdap_reinit.c
index 3fba9360b9e98e9a48fd3d59aace7dbfab8fbfde..b273c1a66cca5e78ab3c281c684feab93f476471 100644
--- a/src/providers/ldap/sdap_reinit.c
+++ b/src/providers/ldap/sdap_reinit.c
@@ -165,6 +165,12 @@ static errno_t sdap_reinit_clear_usn(struct sysdb_ctx *sysdb,
     /* reset services' usn */
     ret = sysdb_search_services(tmp_ctx, sysdb, domain,
                                 "", attrs, &msgs_num, &msgs);
+    if (ret != EOK) {
+        DEBUG(SSSDBG_OP_FAILURE,
+              ("Cannot search services [%d]: %s\n", ret, strerror(ret)));
+        goto done;
+    }
+
     sdap_delete_msgs_usn(sysdb, msgs, msgs_num);
     talloc_zfree(msgs);
     msgs_num = 0;
-- 
1.8.1.4



More information about the sssd-devel mailing list