URL: https://github.com/freeipa/bind-dyndb-ldap/pull/17
Author: tomaskrizek
 Title: #17: settings: skip unconfigured values
Action: opened

PR body:
"""
When a value is not configured in settings map, it is skipped.
If it is the last processed value, the result of ISC_R_NOTFOUND
would cause the cleanup section of the function fail. Since
unconfigured values are allowed and expected, override the result
to ISC_R_SUCCESS in this case to prevent triggerring an error.

https://pagure.io/bind-dyndb-ldap/issue/172

---

Also removed obsolete options from the map.
"""

To pull the PR as Git branch:
git remote add ghbind-dyndb-ldap https://github.com/freeipa/bind-dyndb-ldap
git fetch ghbind-dyndb-ldap pull/17/head:pr17
git checkout pr17
From 04e528f9c39084ffcb0e7f5caa7c3c87b95c130d Mon Sep 17 00:00:00 2001
From: Tomas Krizek <tkri...@redhat.com>
Date: Fri, 7 Apr 2017 14:48:32 +0200
Subject: [PATCH 1/2] settings: skip unconfigured values

When a value is not configured in settings map, it is skipped.
If it is the last processed value, the result of ISC_R_NOTFOUND
would cause the cleanup section of the function fail. Since
unconfigured values are allowed and expected, override the result
to ISC_R_SUCCESS in this case to prevent triggerring an error.

https://pagure.io/bind-dyndb-ldap/issue/172
---
 src/settings.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/settings.c b/src/settings.c
index 37e6e5c..8beb0d3 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -597,8 +597,11 @@ settings_set_fill(const cfg_obj_t *config, settings_set_t *set)
 	     setting++) {
 		cfg_value = NULL;
 		result = cfg_map_get(config, setting->name, &cfg_value);
-		if (result == ISC_R_NOTFOUND)
-			continue; /* setting not configured in map */
+		if (result == ISC_R_NOTFOUND) {
+			/* setting not configured in map */
+			result = ISC_R_SUCCESS;
+			continue;
+		}
 		else if (result != ISC_R_SUCCESS)
 			goto cleanup;
 		if (cfg_obj_isstring(cfg_value)) {

From 495b93e5e97909abf05f784013d78ee9fa80d871 Mon Sep 17 00:00:00 2001
From: Tomas Krizek <tkri...@redhat.com>
Date: Fri, 7 Apr 2017 15:11:28 +0200
Subject: [PATCH 2/2] settings: remove obsolete options

Re-remove obsolete options cache_ttl, psearch, serial_autoincrement
and zone_refresh. They were already removed in
c3bfe1a62ac4f8a73207bf4e80d64a4a3a58d9e4, but re-introduced in
refactoring.
---
 src/settings.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/settings.c b/src/settings.c
index 8beb0d3..180f027 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -33,9 +33,7 @@ static const setting_t settings_default[] = {
 	{ "uri",			no_default_string		}, /* User have to set this */
 	{ "connections",		default_uint(2)			},
 	{ "reconnect_interval",		default_uint(60)		},
-	{ "zone_refresh",		default_string("")		}, /* No longer supported */
 	{ "timeout",			default_uint(10)		},
-	{ "cache_ttl",			default_string("")		}, /* No longer supported */
 	{ "timeout",			default_uint(10)		},
 	{ "base",	 		no_default_string		}, /* User have to set this */
 	{ "auth_method",		default_string("none")		},
@@ -49,7 +47,6 @@ static const setting_t settings_default[] = {
 	{ "sasl_password",		default_string("")		},
 	{ "krb5_keytab",		default_string("")		},
 	{ "fake_mname",			default_string("")		},
-	{ "psearch",			default_string("")		}, /* No longer supported */
 	{ "ldap_hostname",		default_string("")		},
 	{ "sync_ptr",			default_boolean(ISC_FALSE)	},
 	{ "dyn_update",			default_boolean(ISC_FALSE)	},
@@ -60,7 +57,6 @@ static const setting_t settings_default[] = {
 	 * SSU table defined by empty string contains no rules =>
 	 * dns_ssutable_checkrules() will return deny. */
 	{ "update_policy",		default_string("")		},
-	{ "serial_autoincrement",	default_string("")		},
 	{ "verbose_checks",		default_boolean(ISC_FALSE)	},
 	{ "directory",			default_string("")		},
 	{ "server_id",			default_string("")		},
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to