SF.net SVN: mahogany:[7519] trunk/M/src/modules/crypt/PGPEngine.cpp
[email protected] Tue, 05 Aug 2008 22:59:39 +0000
| Newsgroups | gmane.mail.mahogany.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 7519
http://mahogany.svn.sourceforge.net/mahogany/?rev=7519&view=rev
Author: vadz
Date: 2008-08-05 22:59:38 +0000 (Tue, 05 Aug 2008)
Log Message:
-----------
fix infinite loop/deadlock when verifying non-detached signature introduced by r7496
Modified Paths:
--------------
trunk/M/src/modules/crypt/PGPEngine.cpp
Modified: trunk/M/src/modules/crypt/PGPEngine.cpp
===================================================================
--- trunk/M/src/modules/crypt/PGPEngine.cpp 2008-08-05 22:48:57 UTC (rev 7518)
+++ trunk/M/src/modules/crypt/PGPEngine.cpp 2008-08-05 22:59:38 UTC (rev 7519)
@@ -316,8 +316,7 @@
const char *ptrIn = bufIn;
bool outEof = false,
- errEof = false,
- inEof = false; // set to true when we can safely close child stdin
+ errEof = false;
while ( !process.IsDone() || !outEof || !errEof )
{
wxYieldIfNeeded();
@@ -349,7 +348,7 @@
lenIn -= lenChunk;
ptrIn += lenChunk;
}
- else if ( inEof && in )
+ else if ( !lenIn )
{
process.CloseOutput();
in = NULL;
@@ -536,12 +535,6 @@
wxLogWarning(_("Secret key needed to decrypt this message is "
"not available"));
}
- else if ( code == _T("BEGIN_SIGNING") )
- {
- // we don't need to send anything more to GPG, close its stdin
- // so it knows that nothing more is coming
- inEof = true;
- }
else if ( code == _T("SIG_CREATED") )
{
status = OK;
@@ -635,6 +628,13 @@
wxLogError(_("Failed to sign message: %s"), err.c_str());
}
}
+ else if ( code == _T("BEGIN_SIGNING") ||
+ code == _T("PLAINTEXT") )
+ {
+ // these codes indicate that we don't need to send anything more
+ // to GPG, check that we did send everything
+ ASSERT_MSG( !lenIn, "should have sent everything by now" );
+ }
else if ( code == _T("ENC_TO") ||
code == _T("BEGIN_DECRYPTION") ||
code == _T("END_DECRYPTION") ||
@@ -642,8 +642,7 @@
code == _T("GOT_IT") ||
code == _T("SIGEXPIRED") || // we will give a warning
code == _T("KEYEXPIRED") || // when we get EXPKEYSIG
- code == _T("PLAINTEXT") || // not sure what to do with
- code == _T("PLAINTEXT_LENGTH") || // those two...
+ code == _T("PLAINTEXT_LENGTH") || // not sure about this
code == _T("IMPORT_OK") ||
code == _T("IMPORT_RES") )
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/