[svn] GpgOL - r296 - trunk/src
svn author wk
cvs at cvs.gnupg.org
Thu Feb 26 10:47:02 CET 2009
Author: wk
Date: 2009-02-26 10:47:01 +0100 (Thu, 26 Feb 2009)
New Revision: 296
Modified:
trunk/src/ChangeLog
trunk/src/engine-assuan.c
trunk/src/engine-assuan.h
trunk/src/engine.c
trunk/src/engine.h
trunk/src/mimemaker.c
Log:
Send SENDER command also for encryption.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2009-02-25 15:05:15 UTC (rev 295)
+++ trunk/src/ChangeLog 2009-02-26 09:47:01 UTC (rev 296)
@@ -1,3 +1,11 @@
+2009-02-26 Werner Koch <wk at g10code.com>
+
+ * engine.c (engine_encrypt_prepare): Add arg SENDER.
+ * engine-assuan.c (op_assuan_encrypt): Ditto.
+ * mimemaker.c (do_mime_sign): Free sender string.
+ (mime_encrypt): Pass the sender address to the engine.
+ (mime_sign_encrypt): Ditto.
+
2009-02-25 Werner Koch <wk at g10code.com>
* mapihelp.cpp (get_gpgoldraftinfo_tag): New.
Modified: trunk/src/engine-assuan.c
===================================================================
--- trunk/src/engine-assuan.c 2009-02-25 15:05:15 UTC (rev 295)
+++ trunk/src/engine-assuan.c 2009-02-26 09:47:01 UTC (rev 296)
@@ -1563,12 +1563,15 @@
this function returns success, the data objects may only be
destroyed after an engine_wait or engine_cancel. On success the
function returns a poiunter to the encryption state and thus
- requires that op_assuan_encrypt_bottom will be run later. */
+ requires that op_assuan_encrypt_bottom will be run later.
+ SENDER is the sender's mailbox or NULL; this information may be
+ used by the UI-server for role selection. */
int
op_assuan_encrypt (protocol_t protocol,
gpgme_data_t indata, gpgme_data_t outdata,
engine_filter_t filter, void *hwnd,
- char **recipients, protocol_t *r_used_protocol,
+ const char *sender, char **recipients,
+ protocol_t *r_used_protocol,
struct engine_assuan_encstate_s **r_encstate)
{
gpg_error_t err;
@@ -1608,6 +1611,17 @@
if (err)
goto leave;
send_session_info (ctx, filter);
+
+ /* If a sender has been supplied, tell the server about it. We
+ don't care about error because servers may not implement SENDER
+ in an encryption context. */
+ if (sender && *sender)
+ {
+ snprintf (line, sizeof line, "SENDER --info -- %s", sender);
+ assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
+ }
+
+ /* Send the recipients to the server. */
for (i=0; recipients && recipients[i]; i++)
{
snprintf (line, sizeof line, "RECIPIENT %s", recipients[i]);
Modified: trunk/src/engine-assuan.h
===================================================================
--- trunk/src/engine-assuan.h 2009-02-25 15:05:15 UTC (rev 295)
+++ trunk/src/engine-assuan.h 2009-02-26 09:47:01 UTC (rev 296)
@@ -40,7 +40,8 @@
int op_assuan_encrypt (protocol_t protocol,
gpgme_data_t indata, gpgme_data_t outdata,
engine_filter_t notify_data, void *hwnd,
- char **recipients, protocol_t *r_used_protocol,
+ const char *sender, char **recipients,
+ protocol_t *r_used_protocol,
struct engine_assuan_encstate_s **r_encstate);
int op_assuan_encrypt_bottom (struct engine_assuan_encstate_s *encstate,
int cancel);
Modified: trunk/src/engine.c
===================================================================
--- trunk/src/engine.c 2009-02-25 15:05:15 UTC (rev 295)
+++ trunk/src/engine.c 2009-02-26 09:47:01 UTC (rev 296)
@@ -835,10 +835,15 @@
R_PROTOCOL. This is a two part fucntion. engine_encrypt_prepare
needs to be called first followed by engine_encrypt_start. The
latter command has just one argument CANCEL which can be set to
- true to cancel the prepared command. */
+ true to cancel the prepared command.
+
+ SENDER is the sender's mailbox or NULL; this information may be
+ used by the UI-server for role selection.
+ */
int
engine_encrypt_prepare (engine_filter_t filter, HWND hwnd,
- protocol_t req_protocol, char **recipients,
+ protocol_t req_protocol,
+ const char *sender, char **recipients,
protocol_t *r_protocol)
{
gpg_error_t err;
@@ -848,8 +853,8 @@
if (filter->use_assuan)
{
err = op_assuan_encrypt (req_protocol, filter->indata, filter->outdata,
- filter, hwnd, recipients, &used_protocol,
- &filter->encstate);
+ filter, hwnd, sender, recipients,
+ &used_protocol, &filter->encstate);
if (!err)
*r_protocol = used_protocol;
}
Modified: trunk/src/engine.h
===================================================================
--- trunk/src/engine.h 2009-02-25 15:05:15 UTC (rev 295)
+++ trunk/src/engine.h 2009-02-26 09:47:01 UTC (rev 296)
@@ -72,7 +72,8 @@
void engine_cancel (engine_filter_t filter);
int engine_encrypt_prepare (engine_filter_t filter, HWND hwnd,
- protocol_t req_protocol, char **recipients,
+ protocol_t req_protocol,
+ const char *sender, char **recipients,
protocol_t *r_protocol);
int engine_encrypt_start (engine_filter_t filter, int cancel);
int engine_sign_start (engine_filter_t filter, HWND hwnd, protocol_t protocol,
Modified: trunk/src/mimemaker.c
===================================================================
--- trunk/src/mimemaker.c 2009-02-25 15:05:15 UTC (rev 295)
+++ trunk/src/mimemaker.c 2009-02-26 09:47:01 UTC (rev 296)
@@ -1170,6 +1170,7 @@
char top_header[BOUNDARYSIZE+200];
engine_filter_t filter = NULL;
struct databuf_s sigbuffer;
+ char *sender = NULL;
*r_att_table = NULL;
@@ -1219,8 +1220,8 @@
}
}
- if (engine_sign_start (filter, hwnd, protocol,
- mapi_get_sender (message), &protocol))
+ sender = mapi_get_sender (message);
+ if (engine_sign_start (filter, hwnd, protocol, sender, &protocol))
goto failure;
protocol = check_protocol (protocol);
@@ -1386,6 +1387,7 @@
else
*r_att_table = att_table;
xfree (sigbuffer.buf);
+ xfree (sender);
return result;
}
@@ -1602,6 +1604,7 @@
char *body = NULL;
int n_att_usable;
engine_filter_t filter = NULL;
+ char *sender = NULL;
memset (sink, 0, sizeof *sink);
memset (encsink, 0, sizeof *encsink);
@@ -1644,7 +1647,9 @@
xfree (tmp);
}
- if (engine_encrypt_prepare (filter, hwnd, protocol, recipients, &protocol))
+ sender = mapi_get_sender (message);
+ if (engine_encrypt_prepare (filter, hwnd, protocol,
+ sender, recipients, &protocol))
goto failure;
if (engine_encrypt_start (filter, 0))
goto failure;
@@ -1723,6 +1728,7 @@
cancel_mapi_attachment (&attach, sink);
xfree (body);
mapi_release_attach_table (att_table);
+ xfree (sender);
return result;
}
@@ -1749,6 +1755,7 @@
mapi_attach_item_t *att_table = NULL;
engine_filter_t filter = NULL;
unsigned int session_number;
+ char *sender = NULL;
memset (sink, 0, sizeof *sink);
memset (encsink, 0, sizeof *encsink);
@@ -1820,8 +1827,9 @@
xfree (tmp);
}
+ sender = mapi_get_sender (message);
if ((rc=engine_encrypt_prepare (filter, hwnd,
- protocol, recipients, &protocol)))
+ protocol, sender, recipients, &protocol)))
goto failure;
protocol = check_protocol (protocol);
@@ -1934,5 +1942,6 @@
if (tmpstream)
IStream_Release (tmpstream);
mapi_release_attach_table (att_table);
+ xfree (sender);
return result;
}
More information about the Gnupg-commits
mailing list