summaryrefslogtreecommitdiffstats
path: root/daemons/ipa-slapi-plugins
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2010-10-25 16:28:15 -0400
committerSimo Sorce <ssorce@redhat.com>2010-10-28 07:58:31 -0400
commit1233a7aff336528c3241771f150b6ee0fd838aa9 (patch)
tree0895716f75b9d284d1bb26796d2983102ed61ac7 /daemons/ipa-slapi-plugins
parent2d63522d48c02e8d6461907d1ed3fb41d8438967 (diff)
downloadfreeipa-1233a7aff336528c3241771f150b6ee0fd838aa9.tar.gz
freeipa-1233a7aff336528c3241771f150b6ee0fd838aa9.tar.xz
freeipa-1233a7aff336528c3241771f150b6ee0fd838aa9.zip
ipa-uuid: safer unlock handling
This allows the code in the for loop to error out without worrying of forgetting to unlock the config entries.
Diffstat (limited to 'daemons/ipa-slapi-plugins')
-rw-r--r--daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c b/daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c
index d80562b72..32fe0f976 100644
--- a/daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c
+++ b/daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c
@@ -783,6 +783,7 @@ static int ipauuid_pre_op(Slapi_PBlock *pb, int modtype)
char *errstr = NULL;
bool generate;
int ret = LDAP_SUCCESS;
+ bool locked = false;
LOG_TRACE("--in-->\n");
@@ -876,6 +877,7 @@ static int ipauuid_pre_op(Slapi_PBlock *pb, int modtype)
}
ipauuid_read_lock();
+ locked = true;
if (!PR_CLIST_IS_EMPTY(ipauuid_global_config)) {
list = PR_LIST_HEAD(ipauuid_global_config);
@@ -1071,11 +1073,13 @@ static int ipauuid_pre_op(Slapi_PBlock *pb, int modtype)
}
}
- ipauuid_unlock();
-
ret = LDAP_SUCCESS;
done:
+ if (locked) {
+ ipauuid_unlock();
+ }
+
if (smods != NULL) {
/* Put the updated mods back into place. */
mods = slapi_mods_get_ldapmods_passout(smods);