Summary: | Crypto plugin mangles text by adding additional newline character | ||
---|---|---|---|
Product: | [Unmaintained] kopete | Reporter: | Till Gerken <till.gerken> |
Component: | Cryptography Plugin | Assignee: | Kopete Developers <kopete-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | luke-jr+kdebugs, mart |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Till Gerken
2003-07-26 11:26:32 UTC
Re-assign since wizard does not support component selection. The quote problem is fixed, but i don't think i will be able to fix the newline problem. It seems gpg add it itself when encrypting. I would like to use the same way as kmail to encrypt/decrypt. maybe when i will do this, that will fix the problem it's easy to fix the newline problem: BEFORE you encrypt the message, ALWAYS add a newline, whether the message originally had one or not. gpg will now not add a newline since the message already ends with one. AFTER you decrypt, just always remove the last newline. Subject: Re: [Kopete-devel] Crypto plugin mangles text Le Mardi 19 Ao CVS commit by brunes: One more fix This should fix bug #61687 according to wjl@icecavern.net Oliver: The only reason it was not noticeable Kopete -> Kopete was because of the table that the plugin wraps the messages in. CCMAIl:61687-done@bugs.kde.org M +2 -1 kgpginterface.cpp 1.23 --- kdenetwork/kopete/plugins/cryptography/kgpginterface.cpp #1.22:1.23 @@ -61,5 +61,5 @@ QString KgpgInterface::KgpgEncryptText(Q QCString gpgcmd = "echo "; - gpgcmd += KShellProcess::quote(text).utf8(); + gpgcmd += KShellProcess::quote( text + QString::fromLatin1("\n") ).utf8(); gpgcmd += " | gpg --no-secmem-warning --no-tty "; gpgcmd += Options.local8Bit(); @@ -131,4 +131,5 @@ QString KgpgInterface::KgpgDecryptText(Q pclose(fp); password = QCString(); + encResult = encResult.left( encResult.length() - 1 ); } Re-opening this I resolved it incorrectly Jason, status on this bug? Will this be fixed soon or should be it be closed? This problem still exists in 3.3 beta 2. The text sent and received via Jabber is exactly the same as with other clients, so the newline is inside the encrypted text. Am I right in thinking from the comments above that the only way to fix this would be to use a non-canonical (possibly hown-brewed) version of gpg? If so, this is a WONTFIX. It seems very unlikely to me that you can't turn off the newline-adding behaviour of gpg (think of binary files). Perhaps some investigation of command line options is in order? No one must be able to fix it with a standard GPG binary. For some reason the crypto plugin adds a newline character into the crypted messages, either because the call to GPG is not perfect or because the message gets mangled before. If the bug is in the encryption, it could be caused by the command "echo" (kgpginterface.cpp:63). Maybe this should be "echo -n". There are a few other sentences which mangels text. For example: "<b>foo</b>" becomes "foo" (boldface), which is false with the jabber protocol. Also, "<foo>" becomes "", which should be untouched either. I think it must be clear before a message is decrypted if the message contains RichText or not (the format() function in KopeteMessage?). Elsewise, the decrypted message should be send back to the protocol to determe if it is RichText or not. As for the RichText issues, please open a separate bug report. The Jabber plugin does not announce RichText capabilities and only reads/writes plaintext messages to the message managers, so the bug is most likely in libkopete. As for the encryption, you might be right. I don't know if GPG expects the input to end with a newline though. We'll have to check. I tried that change, and one contact claims the newline disappeared. *** Bug 94251 has been marked as a duplicate of this bug. *** CVS commit by ogoffart: Fix Bug 61687: Crypto plugin mangles text by adding additional newline character the fix is so simple :-/ i could have thought to that before BUG: 61687 M +1 -1 kgpginterface.cpp 1.26 --- kdenetwork/kopete/plugins/cryptography/kgpginterface.cpp #1.25:1.26 @@ -60,5 +60,5 @@ QString KgpgInterface::KgpgEncryptText(Q dests+=" --recipient "+userIDs; - QCString gpgcmd = "echo "; + QCString gpgcmd = "echo -n "; gpgcmd += KShellProcess::quote( text ).utf8(); gpgcmd += " | gpg --no-secmem-warning --no-tty "; |