Blame SOURCES/Fix-error-message-handling-in-gp_config_from_dir.patch

1f3433
From 298fb49c32d9bf709f14445c1848a3b2419cd3fd Mon Sep 17 00:00:00 2001
1f3433
From: Robbie Harwood <rharwood@redhat.com>
1f3433
Date: Fri, 27 Oct 2017 14:39:35 -0400
1f3433
Subject: [PATCH] Fix error message handling in gp_config_from_dir()
1f3433
1f3433
Resolves a potential double free if we ever get both a return value
1f3433
and error message back from ini_config_augment().
1f3433
1f3433
Commit c0d85387fc38f9554d601ec2ddb111031a694387 exposes a misbehavior
1f3433
in libini wherein merge failures are presented as nonfatal errors.
1f3433
Paper around this.
1f3433
1f3433
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
1f3433
(cherry picked from commit 49708ddde8c58d8197e1f7dfc2b2d097c6b278d5)
1f3433
---
1f3433
 proxy/src/gp_config.c | 17 ++++++++++-------
1f3433
 1 file changed, 10 insertions(+), 7 deletions(-)
1f3433
1f3433
diff --git a/proxy/src/gp_config.c b/proxy/src/gp_config.c
1f3433
index cd057a0..cb13b46 100644
1f3433
--- a/proxy/src/gp_config.c
1f3433
+++ b/proxy/src/gp_config.c
1f3433
@@ -798,20 +798,23 @@ static int gp_config_from_dir(const char *config_dir,
1f3433
                              &error_list,
1f3433
                              NULL);
1f3433
     if (error_list) {
1f3433
-        uint32_t len;
1f3433
-        len = ref_array_len(error_list);
1f3433
+        uint32_t len = ref_array_len(error_list);
1f3433
         for (uint32_t i = 0; i < len; i++) {
1f3433
             /* libini has an unfixable bug where error strings are (char **) */
1f3433
-            GPAUDIT("Error when reading config directory: %s\n",
1f3433
-                    *(char **)ref_array_get(error_list, i, NULL));
1f3433
+            char *errmsg = *(char **)ref_array_get(error_list, i, NULL);
1f3433
+
1f3433
+            /* libini reports pattern match failure as (non-fatal) error
1f3433
+             * https://pagure.io/SSSD/ding-libs/issue/3182 */
1f3433
+            if (strstr(errmsg, "did not match provided patterns. Skipping")) {
1f3433
+                continue;
1f3433
+            }
1f3433
+
1f3433
+            GPAUDIT("Error when reading config directory: %s\n", errmsg);
1f3433
         }
1f3433
         ref_array_destroy(error_list);
1f3433
     }
1f3433
-
1f3433
     if (ret && ret != EEXIST) {
1f3433
         GPERROR("Error when reading config directory number: %d\n", ret);
1f3433
-
1f3433
-        ref_array_destroy(error_list);
1f3433
         return ret;
1f3433
     }
1f3433