[Winpt-commits] r219 - in trunk: . Include Src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Sat May 27 10:56:04 CEST 2006
Author: twoaday
Date: 2006-05-27 10:56:00 +0200 (Sat, 27 May 2006)
New Revision: 219
Modified:
trunk/Include/wptCommonCtl.h
trunk/Include/wptKeylist.h
trunk/NEWS
trunk/Src/ChangeLog
trunk/Src/WinPT-en.rc
trunk/Src/wptClipVerifyDlg.cpp
trunk/Src/wptFileCBS.cpp
trunk/Src/wptFileManager.cpp
trunk/Src/wptFileManagerDlg.cpp
trunk/Src/wptFileVerifyDlg.cpp
trunk/Src/wptGPGME.cpp
trunk/Src/wptGPGUtil.cpp
trunk/Src/wptKeylist.cpp
trunk/Src/wptKeyserverSearchDlg.cpp
trunk/Src/wptVerifyList.cpp
trunk/TODO
Log:
2006-05-25 Timo Schulz <ts at g10code.de>
* wptGPGUtil.cpp (gpg_rebuild_cache): Return error code.
* wptGPGME.cpp (winpt_get_seckey): Fix off-by-one bug.
* wptVerifyList.cpp (verlist_build): New argument type.
Change all callers.
(verlist_set_info_control): New.
(verlist_set_additional_info): New.
* wptFileVerifyDlg.cpp (file_verify_dlg_proc): Adjust code.
* wptClipVerifyDlg.cpp (clip_verify_dlg_proc): Likewise.
* wptFileCBS.cpp (read_cb, write_cb): Add logging.
Modified: trunk/Include/wptCommonCtl.h
===================================================================
--- trunk/Include/wptCommonCtl.h 2006-05-24 07:53:24 UTC (rev 218)
+++ trunk/Include/wptCommonCtl.h 2006-05-27 08:56:00 UTC (rev 219)
@@ -65,6 +65,7 @@
};
typedef struct listview_ctrl_s * listview_ctrl_t;
+
void listview_new (listview_ctrl_t *ctx, HWND ctrl);
void listview_release (listview_ctrl_t ctx);
int listview_add_column (listview_ctrl_t ctx, listview_column_t col);
Modified: trunk/Include/wptKeylist.h
===================================================================
--- trunk/Include/wptKeylist.h 2006-05-24 07:53:24 UTC (rev 218)
+++ trunk/Include/wptKeylist.h 2006-05-27 08:56:00 UTC (rev 219)
@@ -135,12 +135,20 @@
void siglist_sort (listview_ctrl_t sigl, int sortby);
/*-- wptVerifyList.cpp --*/
-int verlist_build (listview_ctrl_t *lv, HWND ctrl, int fm_mode);
-void verlist_delete (listview_ctrl_t lv);
-void verlist_alloc (listview_ctrl_t lv, int nentries );
-int verlist_add_sig (listview_ctrl_t lv, gpgme_signature_t sig);
-int verlist_add_sig_log (listview_ctrl_t lv, file_sig_ctx_t log);
+/* Verify list control context. */
+struct verlist_ctrl_s {
+ listview_ctrl_t lv; /* list view control. */
+ HWND infctl; /* handle to the optional sig info control. */
+};
+typedef struct verlist_ctrl_s *verlist_ctrl_t;
+void verlist_build (verlist_ctrl_t *vlv, HWND ctrl, int fm_mode);
+void verlist_delete (verlist_ctrl_t vlv);
+void verlist_alloc (verlist_ctrl_t vlv, int nentries );
+void verlist_set_info_control (verlist_ctrl_t vlv, HWND infctl);
+int verlist_add_sig (verlist_ctrl_t vlv, gpgme_signature_t sig);
+int verlist_add_sig_log (verlist_ctrl_t vlv, file_sig_ctx_t log);
+
/*-- seclist --*/
struct keylist_s {
struct keylist_s * next;
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2006-05-24 07:53:24 UTC (rev 218)
+++ trunk/NEWS 2006-05-27 08:56:00 UTC (rev 219)
@@ -828,3 +828,6 @@
* Avoid problem in the key property dialog when a key
has designated revokers.
* More PGP-friendly file output for encryption/signing/export.
+* Adjust verify code to print a stronger warning in case that
+ the issuer key is not certified by a trusted sig.
+
\ No newline at end of file
Modified: trunk/Src/ChangeLog
===================================================================
--- trunk/Src/ChangeLog 2006-05-24 07:53:24 UTC (rev 218)
+++ trunk/Src/ChangeLog 2006-05-27 08:56:00 UTC (rev 219)
@@ -1,3 +1,15 @@
+2006-05-25 Timo Schulz <ts at g10code.de>
+
+ * wptGPGUtil.cpp (gpg_rebuild_cache): Return error code.
+ * wptGPGME.cpp (winpt_get_seckey): Fix off-by-one bug.
+ * wptVerifyList.cpp (verlist_build): New argument type.
+ Change all callers.
+ (verlist_set_info_control): New.
+ (verlist_set_additional_info): New.
+ * wptFileVerifyDlg.cpp (file_verify_dlg_proc): Adjust code.
+ * wptClipVerifyDlg.cpp (clip_verify_dlg_proc): Likewise.
+ * wptFileCBS.cpp (read_cb, write_cb): Add logging.
+
2006-05-23 Timo Schulz <ts at g10code.de>
* wptKeyEditDlgs.cpp (do_add_new_userid): Fix re-introduced
Modified: trunk/Src/WinPT-en.rc
===================================================================
--- trunk/Src/WinPT-en.rc 2006-05-24 07:53:24 UTC (rev 218)
+++ trunk/Src/WinPT-en.rc 2006-05-27 08:56:00 UTC (rev 219)
@@ -571,16 +571,17 @@
PUSHBUTTON "&Properties",IDC_KEYSIG_SIGPROPS,288,149,55,14
END
-IDD_WINPT_VERIFY DIALOG DISCARDABLE 0, 0, 394, 87
+IDD_WINPT_VERIFY DIALOG DISCARDABLE 0, 0, 394, 102
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Verify"
FONT 8, "MS Sans Serif"
BEGIN
- DEFPUSHBUTTON "&OK",IDOK,135,67,50,14
- PUSHBUTTON "&Save",IDC_VERIFY_SAVE,187,67,54,14
+ DEFPUSHBUTTON "&OK",IDOK,135,82,50,14
+ PUSHBUTTON "&Save",IDC_VERIFY_SAVE,187,82,54,14
CONTROL "List1",IDC_VERIFY_SIGLIST,"SysListView32",LVS_REPORT |
LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,6,4,377,46
- EDITTEXT IDC_VERIFY_INFO,6,53,377,12,ES_AUTOHSCROLL | WS_DISABLED
+ EDITTEXT IDC_VERIFY_INFO,6,53,377,21,ES_MULTILINE |
+ ES_AUTOHSCROLL | ES_WANTRETURN | WS_DISABLED
END
IDD_WINPT_OWNERTRUST DIALOG DISCARDABLE 0, 0, 182, 76
@@ -1555,7 +1556,7 @@
LEFTMARGIN, 2
RIGHTMARGIN, 389
TOPMARGIN, 3
- BOTTOMMARGIN, 84
+ BOTTOMMARGIN, 99
END
IDD_WINPT_OWNERTRUST, DIALOG
Modified: trunk/Src/wptClipVerifyDlg.cpp
===================================================================
--- trunk/Src/wptClipVerifyDlg.cpp 2006-05-24 07:53:24 UTC (rev 218)
+++ trunk/Src/wptClipVerifyDlg.cpp 2006-05-27 08:56:00 UTC (rev 219)
@@ -138,31 +138,12 @@
}
-/* Return human printable PKA status.
- If no pka information is available, return NULL. */
-char*
-get_pka_status (gpgme_signature_t sig)
-{
- const char *fmt;
- char *pka_inf;
-
- if (sig->pka_trust == 0 || !sig->pka_address)
- return NULL;
- fmt = _("PKA: Verified signer's address is '%s'");
- pka_inf = new char[strlen (fmt)+strlen (sig->pka_address)+2];
- if (!pka_inf)
- BUG (NULL);
- sprintf (pka_inf, fmt, sig->pka_address);
- return pka_inf;
-}
-
-
/* Dialog procedure for the clipboard verification. */
BOOL CALLBACK
clip_verify_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
- static listview_ctrl_t lv = NULL;
- static text_input_s *ctx = NULL;
+ static verlist_ctrl_t vlv = NULL;
+ text_input_s *ctx;
gpgme_error_t err;
gpgme_signature_t sig = NULL, s;
gpg_keycache_t kc = NULL;
@@ -243,23 +224,16 @@
EndDialog (dlg, FALSE);
return FALSE;
}
- verlist_build (&lv, GetDlgItem (dlg, IDC_VERIFY_SIGLIST), 0);
+ verlist_build (&vlv, GetDlgItem (dlg, IDC_VERIFY_SIGLIST), 0);
+ verlist_set_info_control (vlv, GetDlgItem (dlg, IDC_VERIFY_INFO));
for (s = sig; s; s = s->next) {
- rc = verlist_add_sig (lv, s);
+ rc = verlist_add_sig (vlv, s);
if (rc)
msg_box (dlg, _("Could not extract key or signature information."),
_("Verify"), MB_ERR);
}
- if (sig->exp_timestamp > (DWORD)time (NULL))
- SetDlgItemText (dlg, IDC_VERIFY_INFO, _("The signature is expired!"));
- else {
- char *pka_info = get_pka_status (sig);
- if (pka_info != NULL) {
- SetDlgItemText (dlg, IDC_VERIFY_INFO, pka_info);
- free_if_alloc (pka_info);
- }
- }
+
if (sig->notations)
show_notation_data (dlg, sig->notations);
gpgme_release (c);
@@ -267,19 +241,18 @@
return TRUE;
case WM_DESTROY:
- if (lv) {
- listview_release (lv);
- lv = NULL;
+ if (vlv) {
+ verlist_delete (vlv);
+ vlv = NULL;
}
return FALSE;
- case WM_SYSCOMMAND:
- if (LOWORD (wparam) == SC_CLOSE)
- EndDialog (dlg, TRUE);
- return FALSE;
-
case WM_COMMAND:
switch (LOWORD (wparam )) {
+ case IDCANCEL:
+ EndDialog (dlg, FALSE);
+ break;
+
case IDOK:
EndDialog (dlg, TRUE);
return FALSE;
Modified: trunk/Src/wptFileCBS.cpp
===================================================================
--- trunk/Src/wptFileCBS.cpp 2006-05-24 07:53:24 UTC (rev 218)
+++ trunk/Src/wptFileCBS.cpp 2006-05-27 08:56:00 UTC (rev 219)
@@ -26,14 +26,13 @@
#include <windows.h>
#include <stdio.h>
#include <errno.h>
-#include <malloc.h>
-#include "gpgme.h"
#include "wptListView.h"
#include "wptGPG.h"
#include "wptFileManager.h"
#include "wptErrors.h"
#include "wptTypes.h"
+#include "wptW32API.h"
void progress_callback (void *opaque, const char *what, int type,
int off, int max);
@@ -50,8 +49,9 @@
if (cb->error)
return -1;
- if (!ReadFile (cb->handle, buffer, size, &nread, NULL)) {
+ if (!ReadFile (cb->handle, buffer, size, &nread, NULL)) {
cb->error = (int)GetLastError ();
+ log_debug ("read_cb: ReadFile() error=%d\r\n", cb->error);
return -1;
}
@@ -83,12 +83,14 @@
&sec_attr, CREATE_ALWAYS, 0, NULL);
if (cb->handle == INVALID_HANDLE_VALUE) {
cb->error = (int)GetLastError ();
+ log_debug ("write_cb: CreateFile() error=%d\r\n", cb->error);
return -1;
}
}
if (!WriteFile (cb->handle, buffer, size, &nwritten, NULL)) {
cb->error = (int)GetLastError ();
+ log_debug ("write_cb: WriteFile() error=%d\r\n", cb->error);
return -1;
}
return (long)nwritten;
@@ -115,15 +117,17 @@
if (flags & F_DATA_READ) {
fd = CreateFile (fname, GENERIC_READ, FILE_SHARE_READ,
&sec_attr, OPEN_EXISTING, 0, NULL);
- if (fd == INVALID_HANDLE_VALUE)
+ if (fd == INVALID_HANDLE_VALUE) {
+ log_debug ("gpg_file_data_new: CreateFile() error=%d\r\n",
+ (int)GetLastError ());
return gpgme_err_code_from_errno (ENOENT);
+ }
}
- cb = (file_data_t)calloc (1, sizeof *cb);
+ cb = new file_data_s;
if (!cb)
BUG (NULL);
- cb->name = strdup (fname);
- if (!cb->name)
- BUG (NULL);
+ memset (cb, 0, sizeof *cb);
+ cb->name = m_strdup (fname);
cb->cbs.read = read_cb;
cb->cbs.write = write_cb;
if (flags & F_DATA_READ) {
@@ -135,7 +139,7 @@
err = gpgme_data_new_from_cbs (&cb->dat, &cb->cbs, cb);
if (err) {
CloseHandle (fd);
- free (cb);
+ free_if_alloc (cb);
return err;
}
@@ -164,6 +168,6 @@
}
if (cb->dat)
gpgme_data_release (cb->dat);
- safe_free (cb->name);
- safe_free (cb);
+ free_if_alloc (cb->name);
+ free_if_alloc (cb);
}
Modified: trunk/Src/wptFileManager.cpp
===================================================================
--- trunk/Src/wptFileManager.cpp 2006-05-24 07:53:24 UTC (rev 218)
+++ trunk/Src/wptFileManager.cpp 2006-05-27 08:56:00 UTC (rev 219)
@@ -144,8 +144,8 @@
}
-/* Return -1 if the given name @name is a valid PGP extension. */
-static int
+/* Return -1 if the given name @name is a valid GPG extension. */
+int
is_openpgp_ext (const char *name)
{
if (stristr (name, ".gpg") || stristr (name, ".asc")
Modified: trunk/Src/wptFileManagerDlg.cpp
===================================================================
--- trunk/Src/wptFileManagerDlg.cpp 2006-05-24 07:53:24 UTC (rev 218)
+++ trunk/Src/wptFileManagerDlg.cpp 2006-05-27 08:56:00 UTC (rev 219)
@@ -57,6 +57,20 @@
typedef struct thread_ctx_s *thread_ctx_t;
+int is_openpgp_ext (const char *name);
+
+/* Return 1 if the selected file in the listview has a valid GPG extension. */
+static int
+is_openpgp_file (listview_ctrl_t lv)
+{
+ char name[MAX_PATH+32];
+
+ listview_get_item_text (lv, listview_get_curr_pos (lv), 1,
+ name, sizeof (name)-1);
+ return is_openpgp_ext (name);
+}
+
+
/* Dialog procedure for selecting recipients for encryption. */
BOOL CALLBACK
file_encrypt_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
@@ -577,6 +591,8 @@
set_menu_text (popup, ID_FILECTX_WIPE, _("Wipe"));
set_menu_text (popup, ID_FILECTX_SEND, _("Send as Mail"));
set_menu_text (popup, ID_FILECTX_LIST, _("List Packets"));
+ if (!is_openpgp_file (lv))
+ set_menu_state (popup, ID_FILECTX_LIST, MF_GRAYED|MF_DISABLED);
update_ui_items (dlg, popup, true, lv);
TrackPopupMenu (popup, TPM_RIGHTALIGN, p.x, p.y, 0, dlg, NULL);
DestroyMenu (popup);
@@ -609,10 +625,6 @@
case WM_COMMAND:
switch (LOWORD (wparam)) {
- case IDCANCEL:
- EndDialog (dlg, FALSE);
- return TRUE;
-
case ID_FILEMISC_QUIT:
EndDialog (dlg, TRUE);
return TRUE;
Modified: trunk/Src/wptFileVerifyDlg.cpp
===================================================================
--- trunk/Src/wptFileVerifyDlg.cpp 2006-05-24 07:53:24 UTC (rev 218)
+++ trunk/Src/wptFileVerifyDlg.cpp 2006-05-27 08:56:00 UTC (rev 219)
@@ -34,7 +34,7 @@
#include "wptTypes.h"
#include "wptKeyserver.h"
-static listview_ctrl_t dlg_lv = NULL;
+static verlist_ctrl_t dlg_vlv = NULL;
static HWND dlg_wnd = NULL; /* handle to the dialog box window */
static HANDLE dlg_event = NULL; /* event for the dialog. */
@@ -43,28 +43,26 @@
static BOOL CALLBACK
file_verify_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
{
- static listview_ctrl_t lv = NULL;
- int rc = 0;
+ static verlist_ctrl_t vlv = NULL;
switch (msg) {
case WM_INITDIALOG:
SetWindowText (dlg, _("File Verify"));
SetDlgItemText (dlg, IDC_VERIFY_SAVE, _("&Save"));
- rc = verlist_build (&lv, GetDlgItem (dlg, IDC_VERIFY_SIGLIST), 1);
- if (rc)
- BUG (dlg);
+ verlist_build (&vlv, GetDlgItem (dlg, IDC_VERIFY_SIGLIST), 1);
+ verlist_set_info_control (vlv, GetDlgItem (dlg, IDC_VERIFY_INFO));
EnableWindow (GetDlgItem (dlg, IDC_VERIFY_SAVE), FALSE);
SetForegroundWindow (dlg);
- dlg_lv = lv;
+ dlg_vlv = vlv;
dlg_wnd = dlg;
return TRUE;
case WM_DESTROY:
- if (lv) {
- listview_release (lv);
- lv = NULL;
+ if (vlv) {
+ verlist_delete (vlv);
+ vlv = NULL;
}
- dlg_lv = NULL;
+ dlg_vlv = NULL;
dlg_wnd = NULL;
return FALSE;
@@ -75,11 +73,14 @@
if (notify && notify->code == NM_DBLCLK &&
notify->idFrom == IDC_VERIFY_SIGLIST) {
char buf[64];
- listview_get_item_text (lv, listview_get_curr_pos (lv), 4, buf, 63);
+ int tmp;
+
+ tmp = listview_get_curr_pos (vlv->lv);
+ listview_get_item_text (vlv->lv, tmp, 4, buf, 63);
if (strlen (buf) == 10 && buf[0] == '0' && buf[1] == 'x') {
- rc = msg_box (dlg, _("Do you want to retrieve the key?"),
+ tmp = msg_box (dlg, _("Do you want to retrieve the key?"),
_("Verify"), MB_QUEST_ASK);
- if (rc == IDYES) {
+ if (tmp == IDYES) {
if (!hkp_recv_key (dlg, default_keyserver,
default_keyserver_port, buf, 0, 0))
keycache_update (0, buf);
@@ -88,14 +89,13 @@
}
break;
-
- case WM_SYSCOMMAND:
- if (LOWORD (wparam) == SC_CLOSE)
- EndDialog (dlg, TRUE);
- return FALSE;
case WM_COMMAND:
switch (LOWORD (wparam)) {
+ case IDCANCEL:
+ EndDialog (dlg, FALSE);
+ break;
+
case IDOK:
if (dlg_event)
SetEvent (dlg_event);
@@ -158,10 +158,10 @@
void
file_verify_add_state (file_sig_ctx_t c)
{
- if (!dlg_lv)
+ if (!dlg_vlv)
return;
ResetEvent (dlg_event);
- verlist_add_sig_log (dlg_lv, c);
+ verlist_add_sig_log (dlg_vlv, c);
}
Modified: trunk/Src/wptGPGME.cpp
===================================================================
--- trunk/Src/wptGPGME.cpp 2006-05-24 07:53:24 UTC (rev 218)
+++ trunk/Src/wptGPGME.cpp 2006-05-27 08:56:00 UTC (rev 219)
@@ -231,7 +231,7 @@
k->is_protected = k->ext->gloflags.is_protected;
k->keyid = k->ctx->subkeys->keyid+8;
k->uid = k->ext->uids->uid;
- k->allocated = sec? 1 : 0;
+ k->allocated = sec? 0 : 1;
return 0;
}
@@ -294,8 +294,7 @@
bool
secret_key_available (void)
{
- gpg_keycache_t _sec = sec;
- if (!_sec || gpg_keycache_get_size (_sec) == 0)
+ if (!sec || gpg_keycache_get_size (sec) == 0)
return false;
return true;
}
Modified: trunk/Src/wptGPGUtil.cpp
===================================================================
--- trunk/Src/wptGPGUtil.cpp 2006-05-24 07:53:24 UTC (rev 218)
+++ trunk/Src/wptGPGUtil.cpp 2006-05-27 08:56:00 UTC (rev 219)
@@ -189,8 +189,10 @@
DWORD type;
char *result = NULL;
- if (RegOpenKeyEx (root_key, dir, 0, KEY_READ, &key_handle))
+ if (RegOpenKeyEx (root_key, dir, 0, KEY_READ, &key_handle)) {
+ log_debug ("read_w32_registry (%s, %s) failed.\r\n", dir, name);
return NULL; /* no need for a RegClose, so return direct */
+ }
nbytes = 1;
if (RegQueryValueEx (key_handle, name, 0, NULL, NULL, &nbytes))
@@ -228,7 +230,7 @@
{
HANDLE out;
SECURITY_ATTRIBUTES sec_attr;
- char tmp[300];
+ char tmp[MAX_PATH+64];
memset (&sec_attr, 0, sizeof sec_attr);
sec_attr.bInheritHandle = TRUE;
@@ -374,7 +376,7 @@
return gpg_error (GPG_ERR_INV_ARG);
cmd = (char*)xcalloc (1, strlen (p) + 64 + 1);
- sprintf (cmd, "%s %s", p,
+ sprintf (cmd, "%s %s", p,
do_export? "--export-ownertrust" : "--import-ownertrust");
if (do_export)
@@ -384,7 +386,6 @@
in = create_tmpfile ("gpg_ot_in");
WriteFile (in, *data, strlen (*data), &nw, NULL);
FlushFileBuffers (in);
- /* XXX: need a rewind? */
}
if (create_process (cmd, in, out, NULL))
err = gpg_error (GPG_ERR_INTERNAL);
@@ -432,7 +433,7 @@
CloseHandle (out);
safe_free (p);
safe_free (cmd);
- return 0;
+ return err;
}
@@ -672,7 +673,7 @@
case 'm': *r_valid = GPGME_VALIDITY_MARGINAL; break;
case 'f':
case 'u': *r_valid = GPGME_VALIDITY_FULL; break;
- default: *r_valid = GPGME_VALIDITY_UNDEFINED; break;
+ default : *r_valid = GPGME_VALIDITY_UNDEFINED; break;
}
}
@@ -733,7 +734,8 @@
break;
l = (gpgme_recipient_t)xcalloc (1, sizeof *l);
l->keyid = (char*)xcalloc (1, 16+1);
- _snprintf (l->keyid, 16, "%08lX%08lX", enc->keyid[0], enc->keyid[1]);
+ _snprintf (l->keyid, 16, "%08lX%08lX",
+ enc->keyid[0], enc->keyid[1]);
l->pubkey_algo = (gpgme_pubkey_algo_t)enc->pubkey_algo;
l->status = 0;
l->next = (*r_list);
@@ -785,8 +787,7 @@
inside the key @key.
Return value: 0 on success. */
gpgme_error_t
-gpg_find_key_subpacket (const char *key, int subpktid,
- char **value)
+gpg_find_key_subpacket (const char *key, int subpktid, char **value)
{
gpgme_error_t err = gpg_error (GPG_ERR_NO_ERROR);
const char *fmt;
@@ -807,7 +808,7 @@
safe_free (p);
safe_free (cmd);
- p = map_tmpfile (out, NULL);
+ p = map_tmpfile (out, NULL);
if (p && (spk=strstr (p, "spk"))) {
char *end = strstr (spk, "\n");
Modified: trunk/Src/wptKeylist.cpp
===================================================================
--- trunk/Src/wptKeylist.cpp 2006-05-24 07:53:24 UTC (rev 218)
+++ trunk/Src/wptKeylist.cpp 2006-05-27 08:56:00 UTC (rev 219)
@@ -599,24 +599,24 @@
listview_new (&lv, ctrl);
if (mode & KEYLIST_ENCRYPT_MIN) {
col = klist_enc;
- n = (DIM(klist_enc) -1);
+ n = (DIM (klist_enc) -1);
ext_chk = 1;
}
else if ((mode & KEYLIST_SIGN)) {
col = klist_enc;
- n = (DIM(klist_enc) - 1) - 1;
+ n = (DIM (klist_enc) - 1) - 1;
ext_chk = 1;
}
else {
col = klist;
- n = (DIM(klist) - 1);
+ n = (DIM (klist) - 1);
}
for (j = 0; j < n; j++)
- listview_add_column (lv, &col[j]);
+ listview_add_column (lv, &col[j]);
listview_set_ext_style (lv);
if (ext_chk)
- listview_set_chkbox_style (lv);
+ listview_set_chkbox_style (lv);
ico[0] = LoadIcon (glob_hinst, (LPCTSTR)IDI_PUBKEY);
ico[1] = LoadIcon (glob_hinst, (LPCTSTR)IDI_KEYPAIR);
listview_set_image_list (lv, 22, 14, ico, 2);
Modified: trunk/Src/wptKeyserverSearchDlg.cpp
===================================================================
--- trunk/Src/wptKeyserverSearchDlg.cpp 2006-05-24 07:53:24 UTC (rev 218)
+++ trunk/Src/wptKeyserverSearchDlg.cpp 2006-05-27 08:56:00 UTC (rev 219)
@@ -36,6 +36,10 @@
#include "wptKeylist.h"
+#define MAX_N_KEYS 64
+
+
+/* Symbolic column IDs. */
enum { KSS_COL_BITS = 0, KSS_COL_ALGO,
KSS_COL_KEYID, KSS_COL_DATE, KSS_COL_UID };
@@ -49,7 +53,7 @@
struct listview_column_s keysearch[] = {
{0, 48, (char *)_("Size")},
{1, 48, (char*)_("Algorithm")},
- {2, 64, (char *)_("Key ID")},
+ {2, 80, (char *)_("Key ID")},
{3, 72, (char *)_("Creation")},
{4, 256, (char *)_("User ID")},
{0, 0, NULL}
@@ -80,7 +84,7 @@
{
keyserver_key_s *key;
const char *uid;
- char bits[32], algo[32];
+ char bits[32], algo[32], keyid[32];
int conn_fd = 0;
int rc, nkeys = 0;
@@ -91,19 +95,31 @@
return rc;
}
+ if (nkeys > MAX_N_KEYS) {
+ rc = log_box (_("Keyserver Search"), MB_INFO_ASK,
+ _("The search result contains a lot of keys: %d\n\n"
+ "Do you really want to continue?"), nkeys);
+ if (rc == IDNO) {
+ kserver_search_end (conn_fd);
+ return -1;
+ }
+ }
+
while (nkeys-- > 0) {
if (kserver_search_next (conn_fd, &key))
break;
if (!key)
continue;
+
_snprintf (bits, sizeof (bits) - 1, "%d", key->bits);
_snprintf (algo, sizeof (algo)-1, "%s",
get_key_pubalgo ((gpgme_pubkey_algo_t)key->algo));
+ _snprintf (keyid, sizeof (keyid)-1, "0x%s", key->keyid);
uid = key->main_uid? key->main_uid->uid : "";
listview_add_item (lv, " ");
listview_add_sub_item (lv, 0, KSS_COL_BITS, bits);
listview_add_sub_item (lv, 0, KSS_COL_ALGO, algo);
- listview_add_sub_item (lv, 0, KSS_COL_KEYID, key->keyid);
+ listview_add_sub_item (lv, 0, KSS_COL_KEYID, keyid);
listview_add_sub_item (lv, 0, KSS_COL_DATE, get_key_created (key->creation));
listview_add_sub_item (lv, 0, KSS_COL_UID, uid);
kserver_release_key (key); key=NULL;
@@ -148,7 +164,6 @@
{
static listview_ctrl_t lv = NULL;
static keyserver_ctx *ksc;
- int rc = 0;
switch (msg) {
case WM_INITDIALOG:
@@ -156,8 +171,7 @@
if (!ksc)
dlg_fatal_error (dlg, "Could not get dialog param.");
lv = on_init_dialog (dlg, msg, wparam, lparam);
- rc = search_hkp_keys (dlg, ksc, lv);
- if (rc) {
+ if (search_hkp_keys (dlg, ksc, lv)) {
EndDialog (dlg, FALSE);
return FALSE;
}
Modified: trunk/Src/wptVerifyList.cpp
===================================================================
--- trunk/Src/wptVerifyList.cpp 2006-05-24 07:53:24 UTC (rev 218)
+++ trunk/Src/wptVerifyList.cpp 2006-05-27 08:56:00 UTC (rev 219)
@@ -95,14 +95,67 @@
}
+/* Return human printable PKA status.
+ If no pka information is available, return NULL. */
+char*
+get_pka_status (gpgme_signature_t sig)
+{
+ const char *fmt;
+ char *pka_inf;
+
+ if (sig->pka_trust == 0 || !sig->pka_address)
+ return NULL;
+ fmt = _("PKA: Verified signer's address is '%s'");
+ pka_inf = new char[strlen (fmt)+strlen (sig->pka_address)+2];
+ if (!pka_inf)
+ BUG (NULL);
+ sprintf (pka_inf, fmt, sig->pka_address);
+ return pka_inf;
+}
+
+
+/* Set additional signature information according to the
+ signature @sig. If no info control is used, just return. */
+void
+verlist_set_additional_info (verlist_ctrl_t vlv, gpgme_signature_t sig)
+{
+ int used = 1;
+
+ if (!vlv->infctl)
+ return;
+
+ if (sig->exp_timestamp > (DWORD)time (NULL))
+ SendMessage (vlv->infctl, WM_SETTEXT, 0, (LPARAM)(char*)
+ _("The signature is expired!"));
+ else if (sig->validity != GPGME_VALIDITY_MARGINAL &&
+ sig->validity != GPGME_VALIDITY_FULL &&
+ sig->validity != GPGME_VALIDITY_ULTIMATE) {
+ SendMessage (vlv->infctl, WM_SETTEXT, 0, (LPARAM)(char*)
+ _("WARNING: This key is not certified with a trusted signature!\r\n"
+ " There is no indication that the signature belongs to the owner.\r\n"));
+ }
+ else {
+ char *pka_info = get_pka_status (sig);
+ if (pka_info != NULL) {
+ SendMessage (vlv->infctl, WM_SETTEXT, 0, (LPARAM)(char*)pka_info);
+ free_if_alloc (pka_info);
+ }
+ else {
+ SendMessage (vlv->infctl, WM_SETTEXT, 0, (LPARAM)(char*)"");
+ used = 0;
+ }
+ }
+ ShowWindow (vlv->infctl, used? SW_SHOW : SW_HIDE);
+}
+
+
/* Build a verify signature list control. With the parent window
from @ctrl and the mod given in @fm_mode. @lv contains the
new control on success.
Return value: 0 on success. */
-int
-verlist_build (listview_ctrl_t *lv, HWND ctrl, int fm_mode)
-{
- struct listview_ctrl_s *c;
+void
+verlist_build (verlist_ctrl_t *vlv, HWND ctrl, int fm_mode)
+{
struct listview_column_s verlist[] = {
{0, 100, (char *)_("Name")},
{1, 140, (char *)_("Status") },
@@ -112,25 +165,37 @@
{5, 160, (char *)_("User ID") },
{6, 0, NULL}
};
+ struct verlist_ctrl_s *v;
int j;
- listview_new (&c, ctrl);
+ v = new verlist_ctrl_s;
+ if (!v)
+ BUG (0);
+ memset (v, 0, sizeof *v);
+ listview_new (&v->lv, ctrl);
for(j=0; verlist[j].fieldname; j++)
- listview_add_column (c, &verlist[j]);
+ listview_add_column (v->lv, &verlist[j]);
if (!fm_mode)
- listview_set_column_width (c, 0, 60);
- listview_set_ext_style (c);
- *lv = c;
- return 0;
+ listview_set_column_width (v->lv, 0, 60);
+ listview_set_ext_style (v->lv);
+ *vlv = v;
}
+void
+verlist_set_info_control (verlist_ctrl_t vlv, HWND infctl)
+{
+ vlv->infctl = infctl;
+}
+
+
/* Delete the given verify control in @lv. */
void
-verlist_delete (listview_ctrl_t lv)
+verlist_delete (verlist_ctrl_t vlv)
{
- if (lv) {
- listview_release (lv);
+ if (vlv) {
+ listview_release (vlv->lv);
+ free_if_alloc (vlv);
}
}
@@ -138,13 +203,15 @@
/* Add the given signature in @sig to the verify control @lv.
Return value: 0 on success. */
int
-verlist_add_sig (listview_ctrl_t lv, gpgme_signature_t sig)
+verlist_add_sig (verlist_ctrl_t vlv, gpgme_signature_t sig)
{
+ struct listview_ctrl_s *lv;
struct winpt_key_s key;
u32 key_attr;
const char *attr;
char keyid[32+1];
+ lv = vlv->lv;
if (listview_add_item (lv, " "))
return WPTERR_GENERAL;
@@ -175,6 +242,9 @@
attr = key.ctx? key.ext->uids->name : _("user ID not found");
listview_add_sub_item (lv, 0, VER_COL_UID, attr);
+
+ if (vlv->infctl)
+ verlist_set_additional_info (vlv, sig);
return 0;
}
@@ -182,19 +252,20 @@
/* Add the given file signature in @log to the verify control @lv.
Return value: 0 on success. */
int
-verlist_add_sig_log (listview_ctrl_t lv, file_sig_ctx_t log)
+verlist_add_sig_log (verlist_ctrl_t vlv, file_sig_ctx_t log)
{
gpgme_signature_t sig = log->sig;
+ struct listview_ctrl_s *lv;
struct winpt_key_s key;
const char *attr;
char t[64], *name;
+ lv = vlv->lv;
if (listview_add_item (lv, "")) {
log_debug ("verlist_add_sig_log: listview_add_item() failed.\n");
return WPTERR_GENERAL;
}
-
memset (&key, 0, sizeof (key));
winpt_get_pubkey (sig->fpr, &key);
@@ -230,5 +301,8 @@
listview_add_sub_item (lv, 0, VER_COL_UID,
log->user_id?
log->user_id : _("user ID not found"));
+ if (vlv->infctl)
+ verlist_set_additional_info (vlv, sig);
+
return 0;
}
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2006-05-24 07:53:24 UTC (rev 218)
+++ trunk/TODO 2006-05-27 08:56:00 UTC (rev 219)
@@ -1,12 +1,13 @@
(priority: + high, * normal, - low)
-version 0.12.x
- * check double-click (explorer) code
+Finally, we are close to release 1.0.0. Make a feature freeze,
+fix all serious tracker items and do intensive tests.
+
+ check native language support with non-admin accounts.
* there is a problem with the +E hotkey in EURO countries.
- * migrate keyserver code to use the HTTP class.
+ - migrate keyserver code to use the HTTP class.
Implement proxy authentication into the HTTP class.
- * Implement a system to manage language files. Retrieve a list
+ - Implement a system to manage language files. Retrieve a list
of available files from the server, present it to the user
and allow to download the file and set the default language
accoarding to the downloaded language file.
@@ -17,28 +18,27 @@
but before GPG is executed, an external event changed the
keyring. So do not use BUG but issue an error.
* implement property sheets at some places to improve usability.
- * Implement a mechanism to download and update language files.
-
-version >= 1.0.0
+ * Implement a mechanism to download and update language files.
* The key cache reload is much faster when no progress callback
is used. Allow to disable the progress dialog.
- - Use '!' in the encrypt dialog to use the subkey which was selected
- and not the newest.
- Revamp the group database code. Use the GPG --group feature and make
* CARD
- sign/decrypt
- factor out some common code into wptCardManager.cpp
- * Implement --armor in the FM for --symmetric.
* Winpt should take care for a multi user environment.
- * Use accelators for some dialogs to support 'hotkeys'.
- * Move the both managers (key/file) to separate applications
+ (partly done via %foo% registry support)
+ - Use accelators for some dialogs to support 'hotkeys'.
+ - Move the both managers (key/file) to separate applications
and use ActiveX control elemens for the treelist element.
* Implement the non-swapable memory for passphrase handling.
+ - Allow to use "XP skins" to provide a better look in a XP/Vista
+ environment.
-
Wishlist/todo for the GPGME package:
====================================
+* Allow to select encryption subkeys.
+
* Select the signing subkey.
* Allow to use --hidden-recipient.
@@ -48,10 +48,6 @@
(IMHO: gpgme should care for 'CARDCTRL 5' and then return
GPG_ERR_CARD_REMOVED)
-* When a revocation certificate is imported, there is no way
- to call the user why the key has been revoked
- (superseded, insecure, ....) and the optional text.
-
* The current way to send large file through pipes is OK as
long as the file is not too large. The limite is <100 MB.
Otherwise the process would take too much time and propably
More information about the Winpt-commits
mailing list