[svn] GpgOL - r282 - trunk/src

svn author wk cvs at cvs.gnupg.org
Mon Nov 3 14:56:35 CET 2008


Author: wk
Date: 2008-11-03 14:56:34 +0100 (Mon, 03 Nov 2008)
New Revision: 282

Modified:
   trunk/src/ChangeLog
   trunk/src/engine-assuan.c
   trunk/src/mimemaker.c
Log:
Add session title to sign and encrypt operations.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2008-10-29 13:01:28 UTC (rev 281)
+++ trunk/src/ChangeLog	2008-11-03 13:56:34 UTC (rev 282)
@@ -1,3 +1,13 @@
+2008-11-03  Werner Koch  <wk at g10code.com>
+
+	* mimemaker.c (do_mime_sign): Add arg SESSION_NUMBER and pass it
+	to the sign operation.  Set session title.
+	(mime_sign): Create a new session number.
+	(mime_sign_encrypt): Pass a session number and title to the engine.
+	(mime_encrypt): Ditto.
+	* engine-assuan.c (op_assuan_encrypt, op_assuan_sign): Send
+	session info.
+
 2008-10-29  Werner Koch  <wk at g10code.com>
 
 	* engine.c (engine_filter): Collect more data in the in buffer.

Modified: trunk/src/engine-assuan.c
===================================================================
--- trunk/src/engine-assuan.c	2008-10-29 13:01:28 UTC (rev 281)
+++ trunk/src/engine-assuan.c	2008-11-03 13:56:34 UTC (rev 282)
@@ -1635,6 +1635,7 @@
   err = assuan_transact (ctx, "RESET", NULL, NULL, NULL, NULL, NULL, NULL);
   if (err)
     goto leave;
+  send_session_info (ctx, filter);
   for (i=0; recipients && recipients[i]; i++)
     {
       snprintf (line, sizeof line, "RECIPIENT %s", recipients[i]);
@@ -1812,6 +1813,8 @@
   if (err)
     goto leave;
 
+  send_session_info (ctx, filter);
+
   /* We always send the SENDER command because it allows us to figure
      out the protocol to use.  In case the UI server fails to send the
      protocol we fall back to OpenPGP.  The --protocol option isused

Modified: trunk/src/mimemaker.c
===================================================================
--- trunk/src/mimemaker.c	2008-10-29 13:01:28 UTC (rev 281)
+++ trunk/src/mimemaker.c	2008-11-03 13:56:34 UTC (rev 282)
@@ -1148,7 +1148,8 @@
    written to that sink.  */
 static int 
 do_mime_sign (LPMESSAGE message, HWND hwnd, protocol_t protocol, 
-              mapi_attach_item_t **r_att_table, sink_t tmpsink)
+              mapi_attach_item_t **r_att_table, sink_t tmpsink,
+              unsigned int session_number)
 {
   int result = -1;
   int rc;
@@ -1203,6 +1204,17 @@
   /* Prepare the signing. */
   if (engine_create_filter (&filter, collect_signature, &sigbuffer))
     goto failure;
+
+  if (session_number)
+    {
+      engine_set_session_number (filter, session_number);
+      {
+        char *tmp = mapi_get_subject (message);
+        engine_set_session_title (filter, tmp);
+        xfree (tmp);
+      }
+    }
+
   if (engine_sign_start (filter, hwnd, protocol, 
                          mapi_get_sender (message), &protocol))
     goto failure;
@@ -1386,7 +1398,8 @@
   int result = -1;
   mapi_attach_item_t *att_table;
 
-  result = do_mime_sign (message, hwnd, protocol, &att_table, 0);
+  result = do_mime_sign (message, hwnd, protocol, &att_table, 0, 
+                         engine_new_session_number ());
   if (!result)
     {
       if (!finalize_message (message, att_table, protocol, 0))
@@ -1619,6 +1632,14 @@
      encryption will fail early. */
   if (engine_create_filter (&filter, write_buffer_for_cb, sink))
     goto failure;
+
+  engine_set_session_number (filter, engine_new_session_number ());
+  {
+    char *tmp = mapi_get_subject (message);
+    engine_set_session_title (filter, tmp);
+    xfree (tmp);
+  }
+
   if (engine_encrypt_prepare (filter, hwnd, protocol, recipients, &protocol))
     goto failure;
   if (engine_encrypt_start (filter, 0))
@@ -1723,6 +1744,7 @@
   char boundary[BOUNDARYSIZE+1];
   mapi_attach_item_t *att_table = NULL;
   engine_filter_t filter = NULL;
+  unsigned int session_number;
 
   memset (sink, 0, sizeof *sink);
   memset (encsink, 0, sizeof *encsink);
@@ -1732,7 +1754,7 @@
   if (!attach)
     return -1;
 
-  /* First check that we are not rying to process an empty message
+  /* First check that we are not trying to process an empty message
      which might lock up our engine.  Unfortunately we need to
      duplicate the code we use in do_mime_sign here.  FIXME: The
      engine should be fixed instead of using such a workaround.  */
@@ -1785,6 +1807,15 @@
      figure out the protocol to use if we have not forced one.  */
   if (engine_create_filter (&filter, write_buffer_for_cb, sink))
     goto failure;
+
+  session_number = engine_new_session_number ();
+  engine_set_session_number (filter, session_number);
+  {
+    char *tmp = mapi_get_subject (message);
+    engine_set_session_title (filter, tmp);
+    xfree (tmp);
+  }
+
   if ((rc=engine_encrypt_prepare (filter, hwnd, 
                                   protocol, recipients, &protocol)))
     goto failure;
@@ -1799,7 +1830,8 @@
      we need to fix up that ugly micalg parameter after having created
      the signature.  Note that the protocol to use is taken from the
      encryption operation. */
-  if (do_mime_sign (message, hwnd, protocol, &att_table, tmpsink))
+  if (do_mime_sign (message, hwnd, protocol, &att_table, tmpsink, 
+                    session_number))
     goto failure;
 
   /* Now send the actual ENCRYPT command.  This split up between




More information about the Gnupg-commits mailing list