You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.0 KiB

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