From 38df8b54a67653da9be3bbdcb8d907f3d18b1180 Mon Sep 17 00:00:00 2001 From: joss17 Date: Wed, 13 Jan 2010 21:34:47 +0000 Subject: [PATCH] change mutex lock in authgpg to avoid deadlock git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2028 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/pqi/authgpg.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/libretroshare/src/pqi/authgpg.cc b/libretroshare/src/pqi/authgpg.cc index e43b8fefa..a0c264844 100644 --- a/libretroshare/src/pqi/authgpg.cc +++ b/libretroshare/src/pqi/authgpg.cc @@ -1326,8 +1326,6 @@ bool AuthGPG::VerifySignBin(const void *data, uint32_t datalen, unsigned char *s int AuthGPG::privateSignCertificate(std::string id) { - RsStackMutex stack(pgpMtx); /******* LOCKED ******/ - /* The key should be in Others list and not in Peers list ?? * Once the key is signed, it moves from Others to Peers list ??? */ @@ -1360,8 +1358,10 @@ int AuthGPG::privateSignCertificate(std::string id) return 0; } - /* Should I move the certificate from Others to Peers ??? */ - + RsStackMutex stack(pgpMtx); /******* LOCKED ******/ + storeAllKeys_locked(); + + return 1; } @@ -1375,10 +1375,7 @@ int AuthGPG::privateRevokeCertificate(std::string id) int AuthGPG::privateTrustCertificate(std::string id, int trustlvl) { - RsStackMutex stack(pgpMtx); /******* LOCKED ******/ - - /* The certificate should be in Peers list ??? */ - + /* The certificate should be in Peers list ??? */ if(!isGPGSigned(id)) { std::cerr << "Invalid Certificate" << std::endl; return 0; @@ -1402,6 +1399,7 @@ int AuthGPG::privateTrustCertificate(std::string id, int trustlvl) //the key ref has changed, we got to get rid of the old reference. trustCert.key = NULL; + RsStackMutex stack(pgpMtx); /******* LOCKED ******/ storeAllKeys_locked(); return 1;