[Gpgoe-commits] r19 - in trunk: . doc init po src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Sun Jun 4 12:12:51 CEST 2006
Author: twoaday
Date: 2006-06-04 12:12:47 +0200 (Sun, 04 Jun 2006)
New Revision: 19
Modified:
trunk/NEWS
trunk/README
trunk/configure.ac
trunk/doc/gpgoe.texi
trunk/init/GPGOEInit.c
trunk/init/init.rc
trunk/init/resource.h
trunk/mk-w32-dist.sh
trunk/po/de.po
trunk/po/it.po
trunk/src/GPGOE.c
trunk/src/GPGOE.h
trunk/src/GPGOE.rc
trunk/src/OECrypto.c
trunk/src/OEDlgVerify.c
trunk/src/OEDlgViewer.c
trunk/src/OENLS.c
trunk/src/OEPassphraseCBDlg.c
trunk/src/resource.h
Log:
Prepare new release.
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/NEWS 2006-06-04 10:12:47 UTC (rev 19)
@@ -1,3 +1,15 @@
+Noteworthy changes in version 0.9.1 (unreleased)
+------------------------------------------------
+
+
+Noteworthy changes in version 0.9.0 (2006-06-03)
+------------------------------------------------
+
+* Allow to cache one or more passphrases.
+* The verify dialog now also contains the signed
+ text plus some additional timestamp information.
+
+
Noteworthy changes in version 0.8.1 (2006-04-11)
------------------------------------------------
Modified: trunk/README
===================================================================
--- trunk/README 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/README 2006-06-04 10:12:47 UTC (rev 19)
@@ -17,7 +17,7 @@
To use the plugin a working GnuPG installation is *required*. If you
don't have GPG installed, please visit gnupg.org and read some manuals
-about it. The easiest way is to use gpg4win/gnupt to install GPG and WinPT.
+about it. The easiest way is to use gpg4win to install GPG and WinPT.
Now you should unzip all files into a directory. Make sure that
the GPGOE.dll and the GPGOEInit.exe is located in the same directory.
@@ -30,7 +30,8 @@
Native language support
-----------------------
-The only currently supported language is German.
+Currently the following languages are supported:
+German, Italian
In the case you want to translate GPGOE into your language, please contact
me. The amount of strings that need to be translated is totally
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/configure.ac 2006-06-04 10:12:47 UTC (rev 19)
@@ -7,7 +7,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(gpgoe, 0.8.1, twoaday at freakmail.de)
+AC_INIT(gpgoe, 0.9.0, twoaday at freakmail.de)
NEED_GPGME_API=1
NEED_GPGME_VERSION=1.1.0
Modified: trunk/doc/gpgoe.texi
===================================================================
--- trunk/doc/gpgoe.texi 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/doc/gpgoe.texi 2006-06-04 10:12:47 UTC (rev 19)
@@ -109,14 +109,14 @@
If you manually installed GPG and GPGoe, please make sure that
you installed GPG at a standard place or create at least the gpgBinary
registry entry. This is not needed if you use an automatic installer
-like GPG4WIN or GnuPT.
+like GPG4WIN.
@item
Due to the fact the plug-in uses the clipboard for data transfer,
the clipboard itself can be only of limited use to copy/paste messages
into the mailer window or elsewhere. Newer versions of the plug-in
save the original clipboard text before encryption/signing and the
-ext is restored after the GPG operation ends.
+text is restored after the GPG operation ends.
@item
The current version of the plug-in will NOT encrypt any attachments
Modified: trunk/init/GPGOEInit.c
===================================================================
--- trunk/init/GPGOEInit.c 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/init/GPGOEInit.c 2006-06-04 10:12:47 UTC (rev 19)
@@ -21,10 +21,10 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+#include <ctype.h>
#include <windows.h>
#include <tlhelp32.h>
#include <stdio.h>
-#include <ctype.h>
#include "resource.h"
@@ -32,7 +32,8 @@
/* Supported plug-in modes. */
enum gpgoe_mode_t {
GPGOE_MODE_NORMAL = 0,
- GPGOE_MODE_PLAINREPLY = 1
+ GPGOE_MODE_PLAINREPLY = 1,
+ GPGOE_MODE_CACHEPASS = 2
};
/* DLL imports. */
@@ -45,11 +46,18 @@
/* Global module handle. */
static HINSTANCE glob_hinst = NULL;
+struct {
+ int decrypt_replies;
+ int cache_passwd;
+} opt;
+
+
/* String array of programs which are known to cause trouble
with GPGoe. */
static const char *conflict_apps[] = {
"DUMMY", /* dummy entry. */
"SPYXX.EXE",
+ "FDM.EXE", /* fast download manager. */
NULL
};
@@ -75,7 +83,7 @@
size_t i;
for (i=0; i < strlen (pe.szExeFile); i++)
- pe.szExeFile[i] = (char)toupper ((int)pe.szExeFile[i]);
+ pe.szExeFile[i] = (char)toupper (pe.szExeFile[i]);
for (i=0; conflict_apps[i] != NULL; i++) {
if (strstr (pe.szExeFile, conflict_apps[i])) {
fnd = i;
@@ -101,6 +109,7 @@
}
+#if 0
/* Set the menu item @muid to the state @state. */
void
set_menu_state (HMENU menu, UINT muid, UINT state)
@@ -113,6 +122,7 @@
mii.fState = state;
SetMenuItemInfo (menu, muid, FALSE, &mii);
}
+#endif
/* Get an option with the name @name from the registry. */
@@ -176,11 +186,57 @@
}
+/* Dialog box procedure for setting preferences. */
+BOOL CALLBACK
+prefs_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+ int modes;
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ CheckDlgButton (dlg, IDC_OPT_PLAINREPLY,
+ opt.decrypt_replies? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton (dlg, IDC_OPT_CACHEPASS,
+ opt.cache_passwd? BST_CHECKED : BST_UNCHECKED);
+ SetForegroundWindow (dlg);
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD (wparam)) {
+ case IDOK:
+ opt.decrypt_replies = IsDlgButtonChecked (dlg, IDC_OPT_PLAINREPLY)? 1: 0;
+ opt.cache_passwd = IsDlgButtonChecked (dlg, IDC_OPT_CACHEPASS)? 1 : 0;
+ modes = gpgoe_get_active_modes ();
+ if (!opt.decrypt_replies)
+ gpgoe_set_active_modes (modes & (~GPGOE_MODE_PLAINREPLY));
+ else
+ gpgoe_set_active_modes (GPGOE_MODE_PLAINREPLY);
+ if (!opt.cache_passwd)
+ gpgoe_set_active_modes (modes & (~GPGOE_MODE_CACHEPASS));
+ else
+ gpgoe_set_active_modes (GPGOE_MODE_CACHEPASS);
+ if (outlook_is_running ())
+ MessageBox (NULL, "You need to restart Outlook Express.",
+ "GPGOE Information", MB_ICONINFORMATION|MB_OK);
+ EndDialog (dlg, TRUE);
+ break;
+
+ case IDCANCEL:
+ EndDialog (dlg, FALSE);
+ break;
+ }
+ break;
+ }
+
+ return FALSE;
+}
+
+
/* Main window procedure for the taskbar program. */
LRESULT CALLBACK
-gpgoe_main_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
+gpgoe_main_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
- static int decrypt_replies = 0;
+
NOTIFYICONDATA NID;
POINT p;
HMENU hm, popup;
@@ -197,9 +253,12 @@
Shell_NotifyIcon (NIM_ADD, &NID);
DestroyIcon (NID.hIcon);
- decrypt_replies = get_gpgoe_option ("PlaintextReply");
- if (decrypt_replies)
+ opt.decrypt_replies = get_gpgoe_option ("PlaintextReply");
+ if (opt.decrypt_replies)
gpgoe_set_active_modes (GPGOE_MODE_PLAINREPLY);
+ opt.cache_passwd = get_gpgoe_option ("CachePassphrase");
+ if (opt.cache_passwd)
+ gpgoe_set_active_modes (GPGOE_MODE_CACHEPASS);
if (gpgoe_initialize ()) {
MessageBox (hwnd, "Couldn't register GPG OE hook", "Error", MB_ICONERROR|MB_OK);
ExitProcess (0);
@@ -208,7 +267,8 @@
case WM_DESTROY:
case WM_ENDSESSION:
- put_gpgoe_option ("PlaintextReply", decrypt_replies);
+ put_gpgoe_option ("PlaintextReply", opt.decrypt_replies);
+ put_gpgoe_option ("CachePassphrase", opt.cache_passwd);
gpgoe_remove ();
Shell_NotifyIcon (NIM_DELETE, &NID);
PostQuitMessage (0);
@@ -217,18 +277,9 @@
case WM_COMMAND:
switch (LOWORD (wparam)) {
- case ID_INIT_SUPP_PLAINREPLY:
- decrypt_replies ^= 1;
- if (!decrypt_replies) {
- int modes = gpgoe_get_active_modes ();
- gpgoe_set_active_modes (modes & (~GPGOE_MODE_PLAINREPLY));
- }
- else {
- gpgoe_set_active_modes (GPGOE_MODE_PLAINREPLY);
- if (outlook_is_running ())
- MessageBox (NULL, "You need to restart Outlook Express.",
- "GPGOE Information", MB_ICONINFORMATION|MB_OK);
- }
+ case ID_INIT_PREFS:
+ DialogBoxParam (glob_hinst, (LPCTSTR)IDD_CONFIG,
+ GetDesktopWindow (), prefs_dlg_proc, 0);
break;
case ID_INIT_QUIT:
@@ -252,8 +303,6 @@
GetCursorPos (&p);
hm = LoadMenu (glob_hinst, MAKEINTRESOURCE (IDR_INIT));
popup = GetSubMenu (hm, 0);
- set_menu_state (popup, ID_INIT_SUPP_PLAINREPLY,
- decrypt_replies? MFS_CHECKED : MFS_UNCHECKED);
TrackPopupMenu (popup, TPM_RIGHTALIGN, p.x, p.y, 0, hwnd, NULL);
PostMessage (hwnd, WM_USER, 0, 0);
DestroyMenu (popup);
@@ -276,6 +325,7 @@
MSG msg;
int idx;
+ memset (&opt, 0, sizeof (opt));
idx = check_for_conflict_apps ();
if (idx > 0) {
char buf[256];
Modified: trunk/init/init.rc
===================================================================
--- trunk/init/init.rc 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/init/init.rc 2006-06-04 10:12:47 UTC (rev 19)
@@ -66,8 +66,8 @@
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,8,1,0
- PRODUCTVERSION 0,8,1,0
+ FILEVERSION 0,9,0,0
+ PRODUCTVERSION 0,9,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -85,14 +85,14 @@
VALUE "Comments", "This is free software under the terms of the LGNU GPL v2.1\0"
VALUE "CompanyName", "\0"
VALUE "FileDescription", "GPGOE DLL loader\0"
- VALUE "FileVersion", "0.8.1\0"
+ VALUE "FileVersion", "0.9.0\0"
VALUE "InternalName", "Init\0"
VALUE "LegalCopyright", "Copyright © 2006 Timo Schulz\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "GPGOEInit.exe\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "GPGOEInit\0"
- VALUE "ProductVersion", "0.8.1\0"
+ VALUE "ProductVersion", "0.9.0\0"
VALUE "SpecialBuild", "\0"
END
END
@@ -114,8 +114,7 @@
BEGIN
POPUP "File"
BEGIN
- MENUITEM "Allow to plain text reply", ID_INIT_SUPP_PLAINREPLY
- , INACTIVE
+ MENUITEM "&Preferences...", ID_INIT_PREFS
MENUITEM SEPARATOR
MENUITEM "Exit", ID_INIT_QUIT
END
@@ -130,6 +129,44 @@
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_GPGOE ICON DISCARDABLE "gpgoe.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_CONFIG DIALOG DISCARDABLE 0, 0, 215, 45
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "GPGoe Preferences"
+FONT 8, "MS Sans Serif"
+BEGIN
+ CONTROL "Allow to reply in plaintext",IDC_OPT_PLAINREPLY,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,9,118,9
+ CONTROL "Cache passphrase until program end",IDC_OPT_CACHEPASS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,22,142,10
+ DEFPUSHBUTTON "OK",IDOK,158,4,50,14
+ PUSHBUTTON "&Cancel",IDCANCEL,158,21,50,14
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_CONFIG, DIALOG
+ BEGIN
+ LEFTMARGIN, 2
+ RIGHTMARGIN, 208
+ TOPMARGIN, 4
+ BOTTOMMARGIN, 39
+ END
+END
+#endif // APSTUDIO_INVOKED
+
#endif // Englisch (USA) resources
/////////////////////////////////////////////////////////////////////////////
Modified: trunk/init/resource.h
===================================================================
--- trunk/init/resource.h 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/init/resource.h 2006-06-04 10:12:47 UTC (rev 19)
@@ -4,16 +4,19 @@
//
#define IDR_INIT 101
#define IDI_GPGOE 103
+#define IDD_CONFIG 104
+#define IDC_OPT_PLAINREPLY 1000
+#define IDC_OPT_CACHEPASS 1001
#define ID_INIT_QUIT 40002
-#define ID_INIT_SUPP_PLAINREPLY 40004
+#define ID_INIT_PREFS 40005
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 104
-#define _APS_NEXT_COMMAND_VALUE 40005
-#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_RESOURCE_VALUE 105
+#define _APS_NEXT_COMMAND_VALUE 40006
+#define _APS_NEXT_CONTROL_VALUE 1002
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
Modified: trunk/mk-w32-dist.sh
===================================================================
--- trunk/mk-w32-dist.sh 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/mk-w32-dist.sh 2006-06-04 10:12:47 UTC (rev 19)
@@ -1,6 +1,6 @@
#!/bin/sh
-VER="0.8.0"
+VER="0.9.0"
mkdir gpgoe 2> /dev/null
cp init/gpgoeinit.exe gpgoe/
Modified: trunk/po/de.po
===================================================================
--- trunk/po/de.po 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/po/de.po 2006-06-04 10:12:47 UTC (rev 19)
@@ -7,7 +7,7 @@
msgstr ""
"Project-Id-Version: GPGOE 0.6.0\n"
"Report-Msgid-Bugs-To: winpt at freakmail.de\n"
-"POT-Creation-Date: 2006-04-13 09:33+0200\n"
+"POT-Creation-Date: 2006-06-03 20:08+0200\n"
"PO-Revision-Date: 2006-03-24 22:40+0100\n"
"Last-Translator: Timo Schulz <twoaday at freakmail.de>\n"
"Language-Team: de <winpt-users at wald.intevation.org>\n"
@@ -15,7 +15,7 @@
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-#: src/OECrypto.c:485
+#: src/OECrypto.c:499
#, c-format
msgid ""
"encrypted with %s key, ID %s\n"
@@ -24,7 +24,7 @@
"verschlüsselt mit %s Schlüssel, ID %s\n"
"Entschlüsselung fehlgeschlagen: geheimer Schlüssel nicht gefunden"
-#: src/OECrypto.c:491
+#: src/OECrypto.c:505
#, c-format
msgid ""
"encrypted with %d-bit %s key, ID %s\n"
@@ -35,7 +35,7 @@
"\t\"%s\"\n"
"Entschlüsselung fehlgeschlagen: geheimer Schlüssel nicht vorhanden"
-#: src/OECrypto.c:684
+#: src/OECrypto.c:699
msgid ""
"This mail contains one or more public or secret keys.\n"
"\n"
@@ -45,7 +45,7 @@
"\n"
"Bitte speichern Sie die Mail ab und benutzen Sie WinPT zum Import."
-#: src/OECrypto.c:686 src/OEPassphraseCBDlg.c:193
+#: src/OECrypto.c:701 src/OEPassphraseCBDlg.c:169
msgid "GPG Plug-in Info"
msgstr "GPG Plug-in Information"
@@ -69,12 +69,12 @@
msgid "GPG Plug-in Error"
msgstr "GPG Plug-in Fehler"
-#: src/OEDlgEncrypt.c:164 src/OEDlgVerify.c:146 src/OEDlgViewer.c:61
-#: src/OEPassphraseCBDlg.c:152
+#: src/OEDlgEncrypt.c:164 src/OEDlgVerify.c:180 src/OEDlgViewer.c:61
+#: src/OEPassphraseCBDlg.c:128
msgid "&OK"
msgstr "&OK"
-#: src/OEDlgEncrypt.c:165 src/OEPassphraseCBDlg.c:153
+#: src/OEDlgEncrypt.c:165 src/OEPassphraseCBDlg.c:129
msgid "&Cancel"
msgstr "&Abbrechen"
@@ -151,7 +151,7 @@
"%s von \"%s\"\r\n"
"Gültigkeit des Schlüssels: %s"
-#: src/OEDlgVerify.c:147
+#: src/OEDlgVerify.c:181
msgid "Signature Verification"
msgstr "Überprüfung der Signatur"
@@ -167,7 +167,7 @@
msgid "Message Viewer"
msgstr "Betracher für Nachrichten"
-#: src/OEPassphraseCBDlg.c:146
+#: src/OEPassphraseCBDlg.c:122
#, c-format
msgid ""
"%s\n"
@@ -176,20 +176,20 @@
"%s\n"
"%s Schlüssel, ID %s"
-#: src/OEPassphraseCBDlg.c:154 src/OEPassphraseCBDlg.c:188
-#: src/OEPassphraseCBDlg.c:192
+#: src/OEPassphraseCBDlg.c:130 src/OEPassphraseCBDlg.c:164
+#: src/OEPassphraseCBDlg.c:168
msgid "Please enter your passphrase"
msgstr "Bitte geben Sie ihre Passphrase ein"
-#: src/OEPassphraseCBDlg.c:158
+#: src/OEPassphraseCBDlg.c:134
msgid "&Hide typing"
msgstr "&Maskiere Eingabe"
-#: src/OEPassphraseCBDlg.c:159
+#: src/OEPassphraseCBDlg.c:135
msgid "Decryption"
msgstr "Entschlüsselung"
-#: src/OEPassphraseCBDlg.c:185
+#: src/OEPassphraseCBDlg.c:161
msgid "Invalid passphrase; please enter your passphrase again"
msgstr "Ungültige Passphrase; Bitte geben Sie die Passphrase erneut ein"
Modified: trunk/po/it.po
===================================================================
--- trunk/po/it.po 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/po/it.po 2006-06-04 10:12:47 UTC (rev 19)
@@ -5,7 +5,7 @@
msgstr ""
"Project-Id-Version: GPGoe 0.7.0\n"
"Report-Msgid-Bugs-To: winpt at freakmail.de\n"
-"POT-Creation-Date: 2006-04-13 09:33+0200\n"
+"POT-Creation-Date: 2006-06-03 20:08+0200\n"
"PO-Revision-Date: 2006-04-08 13:19+0100\n"
"Last-Translator: Scire' Salvatore <salvatore.scire at fastwebnet.it>\n"
"Language-Team: \n"
@@ -13,7 +13,7 @@
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-#: src/OECrypto.c:485
+#: src/OECrypto.c:499
#, c-format
msgid ""
"encrypted with %s key, ID %s\n"
@@ -22,7 +22,7 @@
"cifrata con chiave %s , ID %s\n"
"decifratura fallita: chiave segreta non disponibile"
-#: src/OECrypto.c:491
+#: src/OECrypto.c:505
#, c-format
msgid ""
"encrypted with %d-bit %s key, ID %s\n"
@@ -33,7 +33,7 @@
"\t\"%s\"\n"
"decifratura fallita: chiave segreta non disponibile"
-#: src/OECrypto.c:684
+#: src/OECrypto.c:699
msgid ""
"This mail contains one or more public or secret keys.\n"
"\n"
@@ -43,7 +43,7 @@
"\n"
"Salva il testo della mail in un file al fine di usare WinPT per importarlo."
-#: src/OECrypto.c:686 src/OEPassphraseCBDlg.c:193
+#: src/OECrypto.c:701 src/OEPassphraseCBDlg.c:169
msgid "GPG Plug-in Info"
msgstr "Info su GPG Plug-in "
@@ -67,12 +67,12 @@
msgid "GPG Plug-in Error"
msgstr "Errore di GPG Plug-in"
-#: src/OEDlgEncrypt.c:164 src/OEDlgVerify.c:146 src/OEDlgViewer.c:61
-#: src/OEPassphraseCBDlg.c:152
+#: src/OEDlgEncrypt.c:164 src/OEDlgVerify.c:180 src/OEDlgViewer.c:61
+#: src/OEPassphraseCBDlg.c:128
msgid "&OK"
msgstr "&OK"
-#: src/OEDlgEncrypt.c:165 src/OEPassphraseCBDlg.c:153
+#: src/OEDlgEncrypt.c:165 src/OEPassphraseCBDlg.c:129
msgid "&Cancel"
msgstr "&Annulla"
@@ -150,7 +150,7 @@
"%s da \"%s\"\r\n"
"Validità della chiave: %s"
-#: src/OEDlgVerify.c:147
+#: src/OEDlgVerify.c:181
msgid "Signature Verification"
msgstr "Verifica della Firma "
@@ -166,7 +166,7 @@
msgid "Message Viewer"
msgstr "Visualizzatore Messaggio "
-#: src/OEPassphraseCBDlg.c:146
+#: src/OEPassphraseCBDlg.c:122
#, c-format
msgid ""
"%s\n"
@@ -175,20 +175,20 @@
"%s\n"
"%s key, ID %s"
-#: src/OEPassphraseCBDlg.c:154 src/OEPassphraseCBDlg.c:188
-#: src/OEPassphraseCBDlg.c:192
+#: src/OEPassphraseCBDlg.c:130 src/OEPassphraseCBDlg.c:164
+#: src/OEPassphraseCBDlg.c:168
msgid "Please enter your passphrase"
msgstr "Immetti la tua passphrase"
-#: src/OEPassphraseCBDlg.c:158
+#: src/OEPassphraseCBDlg.c:134
msgid "&Hide typing"
msgstr ""
-#: src/OEPassphraseCBDlg.c:159
+#: src/OEPassphraseCBDlg.c:135
msgid "Decryption"
msgstr "Decifratura"
-#: src/OEPassphraseCBDlg.c:185
+#: src/OEPassphraseCBDlg.c:161
msgid "Invalid passphrase; please enter your passphrase again"
msgstr "Passphrase non corretta; immetti la tua passphrase di nuovo"
Modified: trunk/src/GPGOE.c
===================================================================
--- trunk/src/GPGOE.c 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/src/GPGOE.c 2006-06-04 10:12:47 UTC (rev 19)
@@ -41,26 +41,18 @@
/* We need a shared section to define variables which
will keep their values in all address spaces. */
-#ifdef __GNUC__
-#define ATTR_SEC __attribute__((section (".SHARDAT"), shared))
-#else
-#define ATTR_SEC
-#pragma data_seg(".SHARDAT")
+#ifndef __GNUC__
+#pragma data_seg(".SHARDAT")
#endif
-static int gpgoe_active_modes ATTR_SEC = 0;
+/* Supported GPGOE feature modes. */
+int gpgoe_active_modes ATTR_SEC = 0;
+
+char gpgoe_pass_cache[HASH_BUCKETS][256];
#ifndef __GNUC__
#pragma data_seg()
#endif
-#undef ATTR_SEC
-/* Supported plug-in modes. */
-enum gpgoe_mode_t {
- GPGOE_MODE_NORMAL = 0,
- GPGOE_MODE_PLAINREPLY = 1 /* decrypt mails before a reply. */
-};
-
-
/* Main DLL entry point. */
BOOL WINAPI
DllMain (HINSTANCE hinst_dll, DWORD reason, LPVOID reserved)
@@ -147,9 +139,9 @@
}
break;
-#if 0
case HCBT_ACTIVATE:
- if (plugin_active != NULL &&
+#if 0
+ if (plugin_active != NULL &&
WaitForSingleObject (plugin_active, 0) == WAIT_OBJECT_0) {
char wclass[200];
@@ -159,8 +151,8 @@
of_proc_old = (WNDPROC)GetWindowLong (hwnd, GWL_WNDPROC);
SetWindowLong (hwnd, GWL_WNDPROC, (LONG)(WNDPROC)of_proc);
}
+#endif
break;
-#endif
}
return CallNextHookEx (ctb_hook, code, wparam, lparam);
}
@@ -172,6 +164,7 @@
int
gpgoe_initialize (void)
{
+ reset_pass_cache ();
CreateMutex (NULL, TRUE, "gpgoe");
if (GetLastError () == ERROR_ALREADY_EXISTS)
return 0;
@@ -187,7 +180,7 @@
{
HANDLE hd;
int rc;
-
+
hd = CreateMutex (NULL, TRUE, "gpgoe");
if (GetLastError() == ERROR_ALREADY_EXISTS) {
oe_hwnd = NULL;
@@ -195,6 +188,11 @@
}
SetWindowLong (oe_hwnd, GWL_WNDPROC, (LONG)(WNDPROC)oe_proc_old);
rc = UnhookWindowsHookEx (ctb_hook);
+
+ /* reset global variables. */
+ reset_pass_cache ();
+ gpgoe_active_modes = 0;
+
return rc ? 0 : (int)GetLastError ();
}
@@ -212,4 +210,3 @@
{
return gpgoe_active_modes;
}
-
Modified: trunk/src/GPGOE.h
===================================================================
--- trunk/src/GPGOE.h 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/src/GPGOE.h 2006-06-04 10:12:47 UTC (rev 19)
@@ -21,6 +21,15 @@
#ifndef GPGOE_H
#define GPGOE_H
+/* Macros to support a separate section for variables. */
+#ifdef __GNUC__
+#define ATTR_SEC __attribute__((section (".SHARDAT"), shared))
+#else
+#define ATTR_SEC
+#endif
+
+#define HASH_BUCKETS 3
+
/* gettext support. */
const char *gettext (const char *msgid);
#define _(X) gettext ((X))
@@ -58,6 +67,13 @@
#define ID_OF_SAVE_FILE 1148
+/* Supported plug-in modes. */
+enum gpgoe_mode_t {
+ GPGOE_MODE_NORMAL = 0,
+ GPGOE_MODE_PLAINREPLY = 1, /* decrypt mails before a reply. */
+ GPGOE_MODE_CACHEPASS = 2, /* cache passphrase. */
+};
+
/* Context for the recipient list. */
struct recip_list_s {
struct recip_list_s *next;
@@ -91,9 +107,17 @@
typedef struct viewer_ctx_s *viewer_ctx_t;
+struct verify_ctx_s {
+ gpgme_signature_t sig;
+ gpgme_data_t text;
+};
+typedef struct verify_ctx_s *verify_ctx_t;
+
/*-- GPGOE.c --*/
/*EXPORT*/ int gpgoe_initialize (void);
/*EXPORT*/ int gpgoe_remove (void);
+/*EXPORT*/ void gpgoe_set_active_modes (int mode);
+/*EXPORT*/ int gpgoe_get_active_modes (void);
/*-- OEProc.c --*/
extern plugin_ctx_t oe_plug;
@@ -152,7 +176,7 @@
void free_pass_cb (pass_cb_t cb);
pass_cb_t new_pass_cb (HWND main);
int pass_cb_cancelled (pass_cb_t cb);
-void free_pass_cache (void);
+void reset_pass_cache (void);
/*-- OENLS.c --*/
int setup_gettext (void);
Modified: trunk/src/GPGOE.rc
===================================================================
--- trunk/src/GPGOE.rc 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/src/GPGOE.rc 2006-06-04 10:12:47 UTC (rev 19)
@@ -66,8 +66,8 @@
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,8,0,0
- PRODUCTVERSION 0,8,0,0
+ FILEVERSION 0,9,0,0
+ PRODUCTVERSION 0,9,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -85,14 +85,14 @@
VALUE "Comments", "This is free software under the terms of the GNU LGPL v2.1\0"
VALUE "CompanyName", "\0"
VALUE "FileDescription", "GPG Outlook Express Plug-in\0"
- VALUE "FileVersion", "0.8.0\0"
+ VALUE "FileVersion", "0.9.0\0"
VALUE "InternalName", "GPGOE\0"
VALUE "LegalCopyright", "Copyright © 2006 Timo Schulz\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "GPGOE.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "GPGOE\0"
- VALUE "ProductVersion", "0.8.0\0"
+ VALUE "ProductVersion", "0.9.0\0"
VALUE "SpecialBuild", "\0"
END
END
@@ -154,14 +154,19 @@
293,137
END
-IDD_VERIFY DIALOG DISCARDABLE 0, 0, 266, 68
+IDD_VERIFY DIALOG DISCARDABLE 0, 0, 289, 250
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Signature Verification"
FONT 8, "MS Sans Serif"
BEGIN
- DEFPUSHBUTTON "&OK",IDOK,107,47,50,14
- EDITTEXT IDC_VERIFY_STATUS,5,6,247,33,ES_MULTILINE |
+ DEFPUSHBUTTON "&OK",IDOK,232,229,50,14
+ EDITTEXT IDC_VERIFY_STATUS,3,6,277,33,ES_MULTILINE |
ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN
+ LTEXT "begin info field",IDC_VERIFY_BEGININF,3,48,279,13
+ LTEXT "end info field",IDC_VERIFY_ENDINF,3,202,279,13
+ CONTROL "",IDC_VERIFY_SIGTEXT,"RICHEDIT",ES_MULTILINE |
+ ES_WANTRETURN | WS_BORDER | WS_VSCROLL | WS_TABSTOP,3,64,
+ 279,134
END
@@ -200,9 +205,9 @@
IDD_VERIFY, DIALOG
BEGIN
LEFTMARGIN, 3
- RIGHTMARGIN, 259
+ RIGHTMARGIN, 282
TOPMARGIN, 3
- BOTTOMMARGIN, 61
+ BOTTOMMARGIN, 243
END
END
#endif // APSTUDIO_INVOKED
Modified: trunk/src/OECrypto.c
===================================================================
--- trunk/src/OECrypto.c 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/src/OECrypto.c 2006-06-04 10:12:47 UTC (rev 19)
@@ -382,6 +382,21 @@
}
+static void
+start_verify_dialog (HWND main_wnd, gpgme_signature_t sig, gpgme_data_t text)
+{
+ struct verify_ctx_s ctx;
+
+ if (!sig)
+ return;
+ memset (&ctx, 0, sizeof (ctx));
+ ctx.sig = sig;
+ ctx.text = text;
+ DialogBoxParam (mod_hinst_dll, (LPCTSTR)IDD_VERIFY, main_wnd,
+ verify_dlg_proc, (LPARAM)&ctx);
+}
+
+
/* Sign and encrypt the message @r_msg. */
static gpgme_error_t
sign_encrypt_msg (plugin_ctx_t ctx, char **r_msg)
@@ -448,8 +463,7 @@
if (!err) {
res = gpgme_op_verify_result (gctx);
if (res && res->signatures)
- DialogBoxParam (mod_hinst_dll, (LPCTSTR)IDD_VERIFY, ctx->main_wnd,
- verify_dlg_proc, (LPARAM)res->signatures);
+ start_verify_dialog (ctx->main_wnd, res->signatures, out);
}
gpgme_release (gctx);
@@ -542,7 +556,7 @@
/* Decrypt the message @r_msg. If the type @type is actually a signature,
the verify function is called instead of decryption. */
static gpgme_error_t
-decrypt_msg (plugin_ctx_t ctx, char **r_msg, int type, int *r_cancel)
+decrypt_msg (plugin_ctx_t ctx, char **r_msg, int *type, int *r_cancel)
{
gpgme_ctx_t gctx = NULL;
gpgme_data_t in = NULL, out = NULL;
@@ -551,7 +565,7 @@
pass_cb_t cb_val;
char *msg = *r_msg;
- if ((type & PGP_SIG) || (type & PGP_CLEARSIG))
+ if ((*type & PGP_SIG) || (*type & PGP_CLEARSIG))
return verify_msg (ctx, r_msg);
cb_val = new_pass_cb (ctx->main_wnd);
@@ -565,9 +579,10 @@
gpgme_set_passphrase_cb (gctx, passphrase_cb, cb_val);
err = gpgme_op_decrypt_verify (gctx, in, out);
res = gpgme_op_verify_result (gctx);
- if (res && res->signatures)
- DialogBoxParam (mod_hinst_dll, (LPCTSTR)IDD_VERIFY, ctx->main_wnd,
- verify_dlg_proc, (LPARAM)res->signatures);
+ if (res && res->signatures) {
+ start_verify_dialog (ctx->main_wnd, res->signatures, out);
+ *type |= PGP_SIG;
+ }
}
*r_cancel = pass_cb_cancelled (cb_val);
@@ -686,10 +701,10 @@
_("GPG Plug-in Info"), MB_ICONINFORMATION|MB_OK);
}
else if (msg_type) {
- rc = decrypt_msg (ctx, &msg, msg_type, &cancel);
+ rc = decrypt_msg (ctx, &msg, &msg_type, &cancel);
SendMessage (ctx->msg_wnd, WM_CLEAR, 0, 0);
SendMessage (ctx->msg_wnd, WM_UNDO, 0, 0);
- if (!cancel && !rc && (msg_type & PGP_MESSAGE)
+ if (!cancel && !rc && (msg_type & PGP_MESSAGE) && !(msg_type & PGP_SIG)
&& msg && strlen (msg) > 0) {
struct viewer_ctx_s viewer;
viewer.msg = msg;
Modified: trunk/src/OEDlgVerify.c
===================================================================
--- trunk/src/OEDlgVerify.c 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/src/OEDlgVerify.c 2006-06-04 10:12:47 UTC (rev 19)
@@ -133,19 +133,54 @@
}
+static void
+set_info_fields (HWND dlg, gpgme_data_t text)
+{
+ gpgme_data_t in;
+ char date[64], buf[256], *p;
+ time_t t = time (NULL);
+ int n;
+
+ strncpy (date, ctime (&t), sizeof (date)-1);
+ date[strlen (date)-1]=0;
+
+ _snprintf (buf, sizeof (buf)-1, "BEGIN PGP SIGNED MESSAGE [%s]", date);
+ SetDlgItemText (dlg, IDC_VERIFY_BEGININF, buf);
+ _snprintf (buf, sizeof (buf)-1, "END PGP SIGNED MESSAGE [%s]", date);
+ SetDlgItemText (dlg, IDC_VERIFY_ENDINF, buf);
+
+ if (!text)
+ return;
+
+ gpgme_data_rewind (text);
+ gpgme_data_new (&in);
+ for (;;) {
+ n = gpgme_data_read (text, buf, sizeof (buf)-1);
+ if (n < 1)
+ break;
+ gpgme_data_write (in, buf, n);
+ }
+ gpgme_data_write (in, "\0", 1);
+ p = gpgme_data_release_and_get_mem (in, &n);
+ SetDlgItemText (dlg, IDC_VERIFY_SIGTEXT, p);
+ gpgme_free (p);
+}
+
+
/* Dialog box procedure for the verify process. */
BOOL CALLBACK
verify_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
- gpgme_signature_t sig;
+ verify_ctx_t ctx;
switch (msg) {
case WM_INITDIALOG:
- sig = (gpgme_signature_t)lparam;
- assert (sig);
+ ctx = (verify_ctx_t)lparam;
+ assert (ctx);
SetDlgItemText (dlg, IDOK, _("&OK"));
SetWindowText (dlg, _("Signature Verification"));
- set_sig_info (dlg, sig);
+ set_sig_info (dlg, ctx->sig);
+ set_info_fields (dlg, ctx->text);
SetForegroundWindow (dlg);
break;
Modified: trunk/src/OEDlgViewer.c
===================================================================
--- trunk/src/OEDlgViewer.c 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/src/OEDlgViewer.c 2006-06-04 10:12:47 UTC (rev 19)
@@ -66,13 +66,12 @@
center_window (dlg, viewer->main_wnd);
return FALSE;
- case WM_SYSCOMMAND:
- if (LOWORD (wparam) == SC_CLOSE)
- EndDialog (dlg, 0);
- return FALSE;
-
case WM_COMMAND:
switch (LOWORD (wparam)) {
+ case IDCANCEL:
+ EndDialog (dlg, 0);
+ return TRUE;
+
case IDOK:
EndDialog (dlg, 0);
return TRUE;
Modified: trunk/src/OENLS.c
===================================================================
--- trunk/src/OENLS.c 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/src/OENLS.c 2006-06-04 10:12:47 UTC (rev 19)
@@ -91,7 +91,7 @@
}
-static DWORD
+DWORD
hash_string (const char *str_param)
{
unsigned long int hval, g;
Modified: trunk/src/OEPassphraseCBDlg.c
===================================================================
--- trunk/src/OEPassphraseCBDlg.c 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/src/OEPassphraseCBDlg.c 2006-06-04 10:12:47 UTC (rev 19)
@@ -28,89 +28,65 @@
#include "GPGOE.h"
-/* Structure for the passphrase cache. */
-struct pass_cache_s {
- struct pass_cache_s *next;
- char *keyid;
- char *pass;
-};
-typedef struct pass_cache_s *pass_cache_t;
-
/* Structure for the passphrase callback. */
struct pass_cb_s {
const char *uid_hint;
const char *passphrase_info;
char keyid[8+2];
char *pass;
- pass_cache_t cache;
HWND main_wnd;
int cancel;
int prev_was_bad;
};
-/* Global passphrase cache. */
-static pass_cache_t the_cache = NULL;
+extern char gpgoe_pass_cache[HASH_BUCKETS][256];
-/* Release the passphrase cache @ctx and invalidate all passphrases. */
-static void
-invalidate_cache (pass_cache_t ctx)
-{
- pass_cache_t c;
+DWORD hash_string (const char *str_param);
- while (ctx) {
- c = ctx->next;
- free_if_alloc (ctx->keyid);
- wipememory (ctx->pass, strlen (ctx->pass));
- free_if_alloc (ctx->pass);
- ctx = c;
- }
-}
-
-/* Put the passphrase @pass into the passphrase cache @ctx. */
+/* Store the passphrase @pass in the hash table using the keyid @keyid
+ as the index. */
static void
-passphrase_put (pass_cache_t *ctx, const char *keyid, const char *pass)
+passphrase_put (char ctx[HASH_BUCKETS][256], const char *keyid, const char *pass)
{
- pass_cache_t c, n;
+ int pos = hash_string (keyid) % HASH_BUCKETS;
+ int n = 0;
- /* check if the item is already present. */
- for (n = *ctx; n; n = n->next) {
- if (!strcmp (n->keyid, keyid))
- return;
+ while (n < HASH_BUCKETS) {
+ if (strlen (ctx[(pos+n) % HASH_BUCKETS]) == 0) {
+ memcpy (ctx[(pos+n) % HASH_BUCKETS], keyid, strlen (keyid));
+ strncpy (ctx[(pos+n) % HASH_BUCKETS]+strlen (keyid), pass, 240);
+ break;
+ }
+ n++;
}
-
- c = xcalloc (1, sizeof *c);
- c->keyid = xstrdup (keyid);
- c->pass = xstrdup (pass);
-
- if (!*ctx)
- *ctx = c;
- else {
- for (n = *ctx; n->next; n = n->next)
- ;
- n->next = c;
- }
}
-/* Return the passphrase for the key with the keyid @keyid
- or NULL if the passphrase was not cached for this key. */
+/* Return the requested passphrase from the hash table @ctx
+ using the keyid @keyid as the index. Or NULL if there is
+ no stored passphrase. */
static const char*
-passphrase_get (pass_cache_t ctx, const char *keyid)
+passphrase_get (char ctx[HASH_BUCKETS][256], const char *keyid)
{
- pass_cache_t c;
+ const char *item;
+ int pos = hash_string (keyid) % HASH_BUCKETS;
+ int n=0;
- for (c = ctx; c; c = c->next) {
- if (!strcmp (c->keyid, keyid))
- return c->pass;
+ item = gpgoe_pass_cache[pos];
+ while (strncmp (item, keyid, strlen (keyid)) &&
+ n < HASH_BUCKETS) {
+ item = ctx[(pos+n) % HASH_BUCKETS];
+ n++;
}
+
+ if (strlen (item) > 0 && !strncmp (item, keyid, strlen (keyid)))
+ return item+strlen (keyid);
return NULL;
}
-
-
/* Extract public key algorithm from passwd info. */
const char*
get_pubkey_algo (const char *passphrase_info)
@@ -197,7 +173,8 @@
ctx->pass = xcalloc (1, n+2);
GetDlgItemText (dlg, IDC_DECRYPT_PWD, ctx->pass, n+1);
- /*passphrase_put (&the_cache, ctx->keyid, ctx->pass);*/
+ if (gpgoe_get_active_modes () & GPGOE_MODE_CACHEPASS)
+ passphrase_put (gpgoe_pass_cache, ctx->keyid, ctx->pass);
EndDialog (dlg, TRUE);
break;
}
@@ -219,6 +196,7 @@
const char *pass;
DWORD nwritten = 0;
+ assert (cb);
cb->prev_was_bad = prev_was_bad;
if (prev_was_bad && !cb->cancel) {
wipememory (cb->pass, strlen (cb->pass));
@@ -230,7 +208,8 @@
memset (cb->keyid, 0, sizeof (cb->keyid));
memcpy (cb->keyid, cb->passphrase_info+8, 8);
- if (the_cache && (pass=passphrase_get (the_cache, cb->keyid)))
+ pass = passphrase_get (gpgoe_pass_cache, cb->keyid);
+ if (pass)
cb->pass = xstrdup (pass);
else
DialogBoxParam (mod_hinst_dll, (LPCTSTR)IDD_DECRYPT,
@@ -280,10 +259,12 @@
}
-/* Release the passphrase cache. */
+/* Reset the passphrase cache. */
void
-free_pass_cache (void)
+reset_pass_cache (void)
{
- invalidate_cache (the_cache);
- the_cache = NULL;
+ int i;
+
+ for (i=0; i < HASH_BUCKETS; i++)
+ wipememory (gpgoe_pass_cache[i], 256);
}
Modified: trunk/src/resource.h
===================================================================
--- trunk/src/resource.h 2006-04-13 07:41:30 UTC (rev 18)
+++ trunk/src/resource.h 2006-06-04 10:12:47 UTC (rev 19)
@@ -20,6 +20,9 @@
#define IDC_VIEWER_QUOTE 1010
#define IDC_VIEWER_TEXT2 1013
#define IDC_DECRYPT_HIDE 1014
+#define IDC_VERIFY_BEGININF 1015
+#define IDC_VERIFY_ENDINF 1016
+#define IDC_VERIFY_SIGTEXT 1017
// Next default values for new objects
//
@@ -27,7 +30,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 108
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1015
+#define _APS_NEXT_CONTROL_VALUE 1018
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
More information about the Gpgoe-commits
mailing list