[svn] GPGol - r144 - in trunk: . src
svn author wk
cvs at cvs.gnupg.org
Tue Mar 28 12:06:51 CEST 2006
Author: wk
Date: 2006-03-28 12:06:51 +0200 (Tue, 28 Mar 2006)
New Revision: 144
Modified:
trunk/ChangeLog
trunk/NEWS
trunk/configure.ac
trunk/src/ChangeLog
trunk/src/display.cpp
trunk/src/gpgmsg.cpp
trunk/src/olflange-dlgs.cpp
trunk/src/olflange-ids.h
trunk/src/olflange-rsrcs.rc
Log:
Preparing for 0.9.8
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-03-27 19:31:08 UTC (rev 143)
+++ trunk/ChangeLog 2006-03-28 10:06:51 UTC (rev 144)
@@ -1,3 +1,7 @@
+2006-03-28 Werner Koch <wk at g10code.com>
+
+ Released 0.9.8.
+
2006-03-21 Werner Koch <wk at g10code.com>
Released 0.9.7.
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2006-03-27 19:31:08 UTC (rev 143)
+++ trunk/NEWS 2006-03-28 10:06:51 UTC (rev 144)
@@ -1,9 +1,11 @@
-Noteworthy changes for version 0.9.8
+Noteworthy changes for version 0.9.8 (2006-03-28)
=================================================
* PGP/MIME signature verification may now work in some cases.
+* New option to prefer displaying of the HTML part.
+
Noteworthy changes for version 0.9.7 (2006-03-21)
=================================================
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2006-03-27 19:31:08 UTC (rev 143)
+++ trunk/configure.ac 2006-03-28 10:06:51 UTC (rev 144)
@@ -16,7 +16,7 @@
# Version number: Remember to change it immediately *after* a release.
# Make sure to run "svn up" before a "make dist".
# Add a "-cvs" prefix for non-released code.
-AC_INIT(gpgol, 0.9.8-cvs, bug-gpgol at g10code.com)
+AC_INIT(gpgol, 0.9.8, bug-gpgol at g10code.com)
NEED_GPGME_API=1
NEED_GPGME_VERSION=1.1.0
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2006-03-27 19:31:08 UTC (rev 143)
+++ trunk/src/ChangeLog 2006-03-28 10:06:51 UTC (rev 144)
@@ -1,3 +1,11 @@
+2006-03-28 Werner Koch <wk at g10code.com>
+
+ * olflange-rsrcs.rc (IDD_GPG_OPTIONS_DE): Add new control box.
+ (IDD_GPG_OPTIONS): Updated to match German version.
+ * olflange-dlgs.cpp (GPGOptionsDlgProc): Ditto.
+ * gpgmsg.cpp (decrypt): Implemented PREFER_HTML option.
+ (get_long_attach_data): New.
+
2006-03-27 Werner Koch <wk at g10code.com>
* engine-gpgme.c (op_verify_detached_sig_gpgme): New.
Modified: trunk/src/display.cpp
===================================================================
--- trunk/src/display.cpp 2006-03-27 19:31:08 UTC (rev 143)
+++ trunk/src/display.cpp 2006-03-28 10:06:51 UTC (rev 144)
@@ -161,7 +161,7 @@
}
else if (exchange_cb && !opt.compat.no_oom_write)
{
- log_debug ("updating display using OOM to `%s'", text);
+ log_debug ("updating display using OOM\n");
/* Bug in OL 2002 and 2003 - as a workaround set the body first
to empty. */
if (is_html)
Modified: trunk/src/gpgmsg.cpp
===================================================================
--- trunk/src/gpgmsg.cpp 2006-03-27 19:31:08 UTC (rev 143)
+++ trunk/src/gpgmsg.cpp 2006-03-28 10:06:51 UTC (rev 144)
@@ -87,6 +87,7 @@
static int get_attach_method (LPATTACH obj);
static char *get_short_attach_data (LPATTACH obj);
+static char *get_long_attach_data (LPMESSAGE msg, attach_info_t table,int pos);
static bool set_x_header (LPMESSAGE msg, const char *name, const char *val);
@@ -392,7 +393,6 @@
HRESULT hr;
LPSPropValue lpspvFEID = NULL;
LPSTREAM stream;
-// SPropValue prop;
STATSTG statInfo;
ULONG nread;
char *body = NULL;
@@ -491,8 +491,8 @@
ready:
if (body)
- log_debug ("%s:%s: loaded body `%s' at %p\n",
- SRCNAME, __func__, body, body);
+ log_debug ("%s:%s: loaded body %d bytes of body at %p\n",
+ SRCNAME, __func__, strlen (body), body);
// prop.ulPropTag = PR_ACCESS;
@@ -1082,6 +1082,7 @@
int have_pgphtml_sig = 0;
int have_pgphtml_enc = 0;
unsigned int pgphtml_pos = 0;
+ unsigned int pgphtml_pos_sig = 0;
HRESULT hr;
int pgpmime_succeeded = 0;
int is_html = 0;
@@ -1135,13 +1136,14 @@
{
if (!have_pgphtml_sig && !have_pgphtml_enc
&& table[pos].filename
- && !strcmp (table[pos].filename, "PGPexch.htm.asc")
+ && !strcmp (table[pos].filename, "PGPexch.htm")
&& table[pos].content_type
- && !strcmp (table[pos].content_type,
- "application/pgp-signature"))
+ && !strcmp (table[pos].content_type, "text/html")
+ && table[pos].sig_pos != pos)
{
have_pgphtml_sig = 1;
pgphtml_pos = pos;
+ pgphtml_pos_sig = table[pos].sig_pos;
}
else
n_signed++;
@@ -1151,6 +1153,13 @@
log_debug ("%s:%s: message has %u attachments with "
"%u signed and %d encrypted\n",
SRCNAME, __func__, n_attach, n_signed, n_encrypted);
+ if (have_pgphtml_enc)
+ log_debug ("%s:%s: pgphtml encrypted attachment found at pos %d\n",
+ SRCNAME, __func__, pgphtml_pos);
+ if (have_pgphtml_sig)
+ log_debug ("%s:%s: pgphtml signature attachment found at pos %d\n",
+ SRCNAME, __func__, pgphtml_pos);
+
if (mtype == OPENPGP_NONE && !n_encrypted && !n_signed
&& !have_pgphtml_enc && !have_pgphtml_sig && !is_pgpmime_sig)
@@ -1200,6 +1209,7 @@
{
if (attestation)
gpgme_data_release (attestation);
+ attestation = NULL;
log_debug ("%s:%s: we already have an attestation\n",
SRCNAME, __func__);
}
@@ -1313,39 +1323,51 @@
if (!err)
pgpmime_succeeded = 1;
}
- else if (mtype == OPENPGP_CLEARSIG )
+ else if (mtype == OPENPGP_CLEARSIG && !(have_pgphtml_sig && opt.prefer_html))
{
+ /* Cleartext signature. */
+
assert (body);
err = preview? 0 : op_verify (body, NULL, NULL, attestation);
}
- else if (body && *body)
+ else if ( (body && *body)
+ && !((have_pgphtml_enc||have_pgphtml_sig) && opt.prefer_html))
{
+ /* Standard encrypted body. We do not enter this if we also
+ have an pgphtml encrypted attachment and the prefer_html
+ option is activ. */
+
err = op_decrypt (body, &plaintext, opt.passwd_ttl, NULL,
attestation, preview);
- if (!err && have_pgphtml_enc)
- is_html = 1;
}
- else if (mtype == OPENPGP_NONE && have_pgphtml_sig)
+ else if ((mtype == OPENPGP_NONE || opt.prefer_html) && have_pgphtml_sig)
{
+ /* There is no body but a pgphtml signed attachment - decrypt
+ that one. */
if (preview)
err = 0;
else
{
+ /* Note that we don't access the HTML body. It seems that
+ Outlooks creates that one on the fly and it will break
+ the signature. It is better to use the attachment
+ directly. */
LPATTACH att;
- char *htmlbody = loadBody (true);
- if (htmlbody && *htmlbody)
+ plaintext = get_long_attach_data (message, table, pgphtml_pos);
+
+ if (plaintext && *plaintext)
{
is_html = 1;
- hr = message->OpenAttach (pgphtml_pos, NULL,
+ hr = message->OpenAttach (pgphtml_pos_sig, NULL,
MAPI_BEST_ACCESS, &att);
if (FAILED (hr))
{
log_error ("%s:%s: can't open attachment %d (sig): hr=%#lx",
- SRCNAME, __func__, pgphtml_pos, hr);
+ SRCNAME, __func__, pgphtml_pos_sig, hr);
err = gpg_error (GPG_ERR_GENERAL);
}
- else if (table[pgphtml_pos].method != ATTACH_BY_VALUE)
+ else if (table[pgphtml_pos_sig].method != ATTACH_BY_VALUE)
{
log_error ("%s:%s: HTML attachment: method not supported",
SRCNAME, __func__);
@@ -1360,7 +1382,7 @@
err = gpg_error (GPG_ERR_GENERAL);
else
{
- err = op_verify_detached_sig_mem (htmlbody, sigpart,
+ err = op_verify_detached_sig_mem (plaintext, sigpart,
NULL, attestation);
xfree (sigpart);
}
@@ -1368,11 +1390,12 @@
}
else
err = gpg_error (GPG_ERR_NO_DATA);
- xfree (htmlbody);
}
}
- else if (mtype == OPENPGP_NONE && have_pgphtml_enc)
+ else if ((mtype == OPENPGP_NONE || opt.prefer_html) && have_pgphtml_enc)
{
+ /* There is no body but a pgphtml encrypted attachment - decrypt
+ that one. */
LPATTACH att;
LPSTREAM from;
@@ -2059,8 +2082,8 @@
switch ( PROP_TYPE (propval->ulPropTag) )
{
case PT_BINARY:
- /* This is a binary obnject but we know that it must be plain
- ASCII due to the armoed format. */
+ /* This is a binary object but we know that it must be plain
+ ASCII due to the armored format. */
data = (char*)xmalloc (propval->Value.bin.cb + 1);
memcpy (data, propval->Value.bin.lpb, propval->Value.bin.cb);
data[propval->Value.bin.cb] = 0;
@@ -2077,6 +2100,77 @@
}
+/* Get an statchment as one long C string. We assume that there are
+ no binary nuls in it. Returns NULL on failure. */
+static char *
+get_long_attach_data (LPMESSAGE msg, attach_info_t table, int pos)
+{
+ HRESULT hr;
+ LPATTACH att;
+ LPSTREAM stream;
+ STATSTG statInfo;
+ ULONG nread;
+ char *buffer;
+
+ hr = msg->OpenAttach (pos, NULL, MAPI_BEST_ACCESS, &att);
+ if (FAILED (hr))
+ {
+ log_error ("%s:%s: can't open attachment %d: hr=%#lx",
+ SRCNAME, __func__, pos, hr);
+ return NULL;
+ }
+ if (table[pos].method != ATTACH_BY_VALUE)
+ {
+ log_error ("%s:%s: attachment: method not supported", SRCNAME, __func__);
+ att->Release ();
+ return NULL;
+ }
+
+ hr = att->OpenProperty (PR_ATTACH_DATA_BIN, &IID_IStream,
+ 0, 0, (LPUNKNOWN*) &stream);
+ if (FAILED (hr))
+ {
+ log_error ("%s:%s: can't open data stream of attachment: hr=%#lx",
+ SRCNAME, __func__, hr);
+ att->Release ();
+ return NULL;
+ }
+
+ hr = stream->Stat (&statInfo, STATFLAG_NONAME);
+ if ( hr != S_OK )
+ {
+ log_error ("%s:%s: Stat failed: hr=%#lx", SRCNAME, __func__, hr);
+ stream->Release ();
+ att->Release ();
+ return NULL;
+ }
+
+ buffer = (char*)xmalloc ((size_t)statInfo.cbSize.QuadPart + 2);
+ hr = stream->Read (buffer, (size_t)statInfo.cbSize.QuadPart, &nread);
+ if ( hr != S_OK )
+ {
+ log_error ("%s:%s: Read failed: hr=%#lx", SRCNAME, __func__, hr);
+ xfree (buffer);
+ stream->Release ();
+ att->Release ();
+ return NULL;
+ }
+ buffer[nread] = 0;
+ buffer[nread+1] = 0;
+ if (nread != statInfo.cbSize.QuadPart)
+ {
+ log_error ("%s:%s: not enough bytes returned\n", SRCNAME, __func__);
+ xfree (buffer);
+ buffer = NULL;
+ }
+ stream->Release ();
+ att->Release ();
+
+ return buffer;
+}
+
+
+
/* Check whether the attachment at position POS in the attachment
table is the first part of a PGP/MIME message. This routine should
only be called if it has already been checked that the content-type
@@ -2378,7 +2472,7 @@
if (table[pos].invalid)
continue;
if (table[pos].filename && (s = strrchr (table[pos].filename, '.'))
- && !stricmp (s, ".asc")
+ && !stricmp (s, ".asc")
&& table[pos].content_type
&& !stricmp (table[pos].content_type, "application/pgp-signature"))
{
Modified: trunk/src/olflange-dlgs.cpp
===================================================================
--- trunk/src/olflange-dlgs.cpp 2006-03-27 19:31:08 UTC (rev 143)
+++ trunk/src/olflange-dlgs.cpp 2006-03-28 10:06:51 UTC (rev 144)
@@ -1,6 +1,6 @@
/* olflange-dlgs.cpp - New dialogs for Outlook.
* Copyright (C) 2001 G Data Software AG, http://www.gdata.de
- * Copyright (C) 2004, 2005 g10 Code GmbH
+ * Copyright (C) 2004, 2005, 2006 g10 Code GmbH
*
* This file is part of GPGol.
*
@@ -148,6 +148,8 @@
!!opt.auto_sign_attach, 0L);
SendDlgItemMessage (hDlg, IDC_PREVIEW_DECRYPT, BM_SETCHECK,
!!opt.preview_decrypt, 0L);
+ SendDlgItemMessage (hDlg, IDC_PREFER_HTML, BM_SETCHECK,
+ !!opt.prefer_html, 0L);
bMsgResult = FALSE; /* accepts activation */
break; }
@@ -185,6 +187,8 @@
(hDlg, IDC_SIGN_ATTACHMENTS, BM_GETCHECK, 0, 0L);
opt.preview_decrypt = !!SendDlgItemMessage
(hDlg, IDC_PREVIEW_DECRYPT, BM_GETCHECK, 0, 0L);
+ opt.prefer_html = !!SendDlgItemMessage
+ (hDlg, IDC_PREFER_HTML, BM_GETCHECK, 0, 0L);
write_options ();
bMsgResult = PSNRET_NOERROR;
Modified: trunk/src/olflange-ids.h
===================================================================
--- trunk/src/olflange-ids.h 2006-03-27 19:31:08 UTC (rev 143)
+++ trunk/src/olflange-ids.h 2006-03-28 10:06:51 UTC (rev 144)
@@ -26,5 +26,6 @@
#define IDC_SIGN_ATTACHMENTS 4011
#define IDD_GPG_OPTIONS_DE 4012
#define IDC_PREVIEW_DECRYPT 4013
+#define IDC_PREFER_HTML 4014
#endif /*OLFLANGE_IDS_H*/
Modified: trunk/src/olflange-rsrcs.rc
===================================================================
--- trunk/src/olflange-rsrcs.rc 2006-03-27 19:31:08 UTC (rev 143)
+++ trunk/src/olflange-rsrcs.rc 2006-03-28 10:06:51 UTC (rev 144)
@@ -1,5 +1,5 @@
/* olflange-rsrcs.rc - Olflange specific resource. -*- c -*-
- * Copyright (C) 2004, 2005 g10 Code GmbH
+ * Copyright (C) 2004, 2005, 2006 g10 Code GmbH
*
* This file is part of GPGol.
*
@@ -56,7 +56,7 @@
CAPTION "GnuPG"
FONT 8, "MS Sans Serif"
BEGIN
- GROUPBOX "Optionen",IDC_STATIC,9,9,242,100
+ GROUPBOX "Optionen",IDC_STATIC,9,9,242,112
CONTROL "Neue Nachrichten per Voreinstellung verschlüsseln",
IDC_ENCRYPT_DEFAULT,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,24,19,177,10
@@ -77,11 +77,15 @@
IDC_PREVIEW_DECRYPT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
24,95,162,10
- GROUPBOX "Passphrase",IDC_STATIC,9,110,242,31
- LTEXT "Passphrase speichern für",IDC_STATIC,24,124,80,8
- EDITTEXT IDC_TIME_PHRASES,107,123,39,14,ES_AUTOHSCROLL
- LTEXT "Sekunden",IDC_STATIC,151,125,34,8
+ CONTROL "Wenn möglich, HTML Version anzeigen",
+ IDC_PREFER_HTML,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
+ 24,107,162,10
+ GROUPBOX "Passphrase",IDC_STATIC,9,124,242,31
+ LTEXT "Passphrase speichern für",IDC_STATIC,24,136,80,8
+ EDITTEXT IDC_TIME_PHRASES,107,135,39,14,ES_AUTOHSCROLL
+ LTEXT "Sekunden",IDC_STATIC,151,137,34,8
+
PUSHBUTTON "&Erweitert...",IDC_GPG_OPTIONS,202,166,50,14
LTEXT "GPGol by g10 Code GmbH", IDC_STATIC,8,185,100,8
LTEXT "Version x ",IDC_VERSION_INFO,150,185,200,9
@@ -132,7 +136,7 @@
CAPTION "GnuPG"
FONT 8, "MS Sans Serif"
BEGIN
- GROUPBOX "Options",IDC_STATIC,9,9,242,87
+ GROUPBOX "Options",IDC_STATIC,9,9,242,112
CONTROL "&Encrypt new messages by default",IDC_ENCRYPT_DEFAULT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,24,19,121,10
CONTROL "&Sign new messages by default",IDC_SIGN_DEFAULT,"Button",
@@ -146,10 +150,22 @@
IDC_ENCRYPT_WITH_STANDARD_KEY,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,24,67,148,10
EDITTEXT IDC_ENCRYPT_TO,36,79,133,12,ES_AUTOHSCROLL
- GROUPBOX "Passphrase",IDC_STATIC,9,100,242,31
- LTEXT "Cache &passphrase for",IDC_STATIC,24,114,70,8
- EDITTEXT IDC_TIME_PHRASES,107,113,39,14,ES_AUTOHSCROLL
- LTEXT "seconds",IDC_STATIC,151,115,28,8
+
+ CONTROL "Also decrypt in preview window",
+ IDC_PREVIEW_DECRYPT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
+ 24,95,162,10
+
+ CONTROL "Show HTML Version is possible",
+ IDC_PREFER_HTML,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
+ 24,107,162,10
+
+
+ GROUPBOX "Passphrase",IDC_STATIC,9,124,242,31
+ LTEXT "Cache &passphrase for",IDC_STATIC,24,136,70,8
+ EDITTEXT IDC_TIME_PHRASES,107,135,39,14,ES_AUTOHSCROLL
+ LTEXT "seconds",IDC_STATIC,151,137,28,8
+
+
PUSHBUTTON "Ad&vanced..",IDC_GPG_OPTIONS,202,166,50,14
LTEXT "GPGol by g10 Code GmbH", IDC_STATIC,8,185,100,8
LTEXT "Version x ",IDC_VERSION_INFO,150,185,200,9
More information about the Gnupg-commits
mailing list