[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    Patch to fix #36138 (20 votes)
From:       Carsten Pfeiffer <carpdjih () mailbox ! zrz ! tu-berlin ! de>
Date:       2003-10-01 20:52:15
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----

Hi,

when replying to an encrypted message, the reply should be encrypted as well. 
Not doing this is a security problem (quoted text being sent back as 
plain-text).

There actually was some code for this already in in kmcomposewin (which I 
converted to a switch-statement for clarity), but it didn't work because the 
msg's encryption-state was always undefined. The change to kmmessage.cpp 
fixes this.

(Note: I'm not subscribed here).

Cheers
Carsten Pfeiffer
-----BEGIN PGP SIGNATURE-----

iQEVAwUBP3s+gqWgYMJuwmZtAQHHLwgAjRQN6oPH+vM8Zn9lAYrbHFD7GGcBSVFE
dgYedwunsKujYFXRTwKk++IxHe7gZ8hI1eUYMljio2ldSMaKDGhK2y7+Tp+pobBq
sTa0klCPNIHoyGcU85dHxxVk/LRM9Jxkb3muCkuvvoQvHpN0cf4C98oYcZNVaUly
bYgEmk57aFAjKMD8g8nQ8aOwg5gFzn9FnH9JpsNZPvZU3l2fCfOMKjW2SLZk0ebr
Eg0gn3UjUEGUzdmRL6O9CqTgIXFTZAoxgiBFJOkzQdys0qb2uOa/Q68BeAxMU3bv
faSRjR7Q8YCpuiu34Y0ialXYoQ1zEIFXPgHhGPZSJy9TQysgfxX+Zg==
=e3hl
-----END PGP SIGNATURE-----

["patch" (text/x-diff)]

? .kmcomposewin.cpp.swp
? patch
Index: kmcomposewin.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/kmcomposewin.cpp,v
retrieving revision 1.733
diff -u -p -r1.733 kmcomposewin.cpp
--- kmcomposewin.cpp	20 Sep 2003 17:37:34 -0000	1.733
+++ kmcomposewin.cpp	1 Oct 2003 21:14:23 -0000
@@ -1248,18 +1248,32 @@ void KMComposeWin::setMsg(KMMessage* new
   urgentAction->setChecked( newMsg->isUrgent() );
 
   // enable/disable encryption if the message was/wasn't encrypted
-  if(    ( mMsg->encryptionState() == KMMsgPartiallyEncrypted )
-      || ( mMsg->encryptionState() == KMMsgFullyEncrypted ) )
-    mLastEncryptActionState = true;
-  else if( mMsg->encryptionState() == KMMsgNotEncrypted )
-    mLastEncryptActionState = false;
+  switch ( mMsg->encryptionState() )
+  {
+    case KMMsgFullyEncrypted: // fall through
+    case KMMsgPartiallyEncrypted:
+      mLastEncryptActionState = true;
+      break;
+    case KMMsgNotEncrypted:
+      mLastEncryptActionState = false;
+      break;
+    default: // nothing
+      break;
+  }
 
   // enable/disable signing if the message was/wasn't signed
-  if(    ( mMsg->signatureState() == KMMsgPartiallySigned )
-      || ( mMsg->signatureState() == KMMsgFullySigned ) )
-    mLastSignActionState = true;
-  else if( mMsg->signatureState() == KMMsgNotSigned )
-    mLastSignActionState = false;
+  switch ( mMsg->signatureState() )
+  {
+    case KMMsgFullySigned: // fall through
+    case KMMsgPartiallySigned:
+      mLastSignActionState = true;
+      break;
+    case KMMsgNotSigned:
+      mLastSignActionState = false;
+      break;
+    default: // nothing
+      break;
+  }
 
   // get PGP user id for the currently selected identity
   QCString pgpUserId = ident.pgpIdentity();
Index: kmmessage.cpp
===================================================================
RCS file: /home/kde/kdepim/kmail/kmmessage.cpp,v
retrieving revision 1.429
diff -u -p -r1.429 kmmessage.cpp
--- kmmessage.cpp	30 Sep 2003 09:33:05 -0000	1.429
+++ kmmessage.cpp	1 Oct 2003 21:14:24 -0000
@@ -1097,6 +1097,12 @@ KMMessage* KMMessage::createReply( bool 
   // setStatus(KMMsgStatusReplied);
   msg->link(this, KMMsgStatusReplied);
 
+  // replies to an encrypted message should be encrypted as well
+  if ( encryptionState() == KMMsgPartiallyEncrypted || 
+       encryptionState() == KMMsgFullyEncrypted ) {
+    msg->setEncryptionState( encryptionState() );
+  }
+
   return msg;
 }
 


_______________________________________________
KMail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic