Blob Blame History Raw
From f0a61fa88284f8872f1496c0c0b24908d70274c8 Mon Sep 17 00:00:00 2001
From: Nathaniel McCallum <npmccallum@redhat.com>
Date: Thu, 29 Jan 2015 16:58:16 -0500
Subject: [PATCH] Fix ipa-pwd-extop global configuration caching

This fix is already upstream as part of the following commit:
        9baa93da1cbf56c2a6f7e82e099bc3ff3f19e2e4

https://bugzilla.redhat.com/show_bug.cgi?id=1187342
---
 daemons/ipa-slapi-plugins/libotp/otp_config.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/daemons/ipa-slapi-plugins/libotp/otp_config.c b/daemons/ipa-slapi-plugins/libotp/otp_config.c
index 1b7c1e658f126e3d1e8eabd129bb69dc5c4ce970..f600789f34ca87bf57ac3ee7d551843680cc86f1 100644
--- a/daemons/ipa-slapi-plugins/libotp/otp_config.c
+++ b/daemons/ipa-slapi-plugins/libotp/otp_config.c
@@ -126,10 +126,14 @@ static uint32_t find_value(const struct otp_config *cfg,

     sdn = make_sdn(spec->prefix, suffix);
     for (struct record *rec = cfg->records; rec != NULL; rec = rec->next) {
-        if (rec->spec == spec) {
-            value = PR_ATOMIC_ADD(&rec->value, 0);
-            break;
-        }
+        if (rec->spec != spec)
+            continue;
+
+        if (slapi_sdn_compare(sdn, rec->sdn) != 0)
+            continue;
+
+        value = PR_ATOMIC_ADD(&rec->value, 0);
+        break;
     }

     slapi_sdn_free(&sdn);
--
2.1.0