forked from pool/strongswan
cf3fca2b32
Copy from network/strongswan based on submit request 19857 from user mtomaschewski OBS-URL: https://build.opensuse.org/request/show/19857 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/strongswan?expand=0&rev=16
39 lines
1.1 KiB
Diff
39 lines
1.1 KiB
Diff
From: Marius Tomaschewski <mt@suse.de>
|
|
Date: Wed, 2 Sep 2009 13:49:39 +0200
|
|
Subject: [PATCH] Fixed load_secrets to acquire/release lock in level 0 only
|
|
|
|
The write_lock call fails with EDEADLK and unlocks in the
|
|
next recursion level.
|
|
|
|
diff --git a/src/charon/plugins/stroke/stroke_cred.c b/src/charon/plugins/stroke/stroke_cred.c
|
|
index 31bcfe9f486f4dac0ae30bc5846ed3d818526dbb..68df7f0b6d709c396d7a572ca4d0198ef12b2446 100644
|
|
--- a/src/charon/plugins/stroke/stroke_cred.c
|
|
+++ b/src/charon/plugins/stroke/stroke_cred.c
|
|
@@ -722,9 +722,10 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level)
|
|
fclose(fd);
|
|
src = chunk;
|
|
|
|
- this->lock->write_lock(this->lock);
|
|
if (level == 0)
|
|
{
|
|
+ this->lock->write_lock(this->lock);
|
|
+
|
|
/* flush secrets on non-recursive invocation */
|
|
while (this->shared->remove_last(this->shared,
|
|
(void**)&shared) == SUCCESS)
|
|
@@ -1019,7 +1020,10 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level)
|
|
}
|
|
}
|
|
error:
|
|
- this->lock->unlock(this->lock);
|
|
+ if (level == 0)
|
|
+ {
|
|
+ this->lock->unlock(this->lock);
|
|
+ }
|
|
chunk_clear(&chunk);
|
|
}
|
|
|
|
--
|
|
1.6.0.2
|
|
|