[Winpt-commits] r109 - in trunk: . Include Po Src

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Fri Dec 2 08:32:14 CET 2005


Author: twoaday
Date: 2005-12-02 08:32:13 +0100 (Fri, 02 Dec 2005)
New Revision: 109

Modified:
   trunk/Include/ChangeLog
   trunk/Include/wptGPG.h
   trunk/NEWS
   trunk/Po/de.po
   trunk/Src/ChangeLog
   trunk/Src/WinPT-en.rc
   trunk/Src/resource.h
   trunk/Src/wptClipVerifyDlg.cpp
   trunk/Src/wptGPGME.cpp
   trunk/Src/wptKeyImportStatusDlg.cpp
   trunk/Src/wptKeylist.cpp
   trunk/Src/wptKeyserverDlg.cpp
   trunk/Src/wptVerifyList.cpp
   trunk/configure.ac
Log:
2005-12-01  Timo Schulz  <ts at g10code.com>
 
        * wptClipVerifyDlg.cpp (clipverify_dlg_proc): Use new semantic
        for get_gpg_sigstat().
        * wptGPGME.cpp (get_gpg_sigstat): New. It is now a function.
        As a macro strings will not be translated at runtime.
        * wptKeyserverDlg.cpp (hkp_recv_key): Properly detect if we
        need to update the cache. Thanks to Jan-Oliver.
        * wptKeyImportStatusDlg.cpp (import_status_dlg_proc): Localized.
         

Prepare a new release.



Modified: trunk/Include/ChangeLog
===================================================================
--- trunk/Include/ChangeLog	2005-12-01 13:41:45 UTC (rev 108)
+++ trunk/Include/ChangeLog	2005-12-02 07:32:13 UTC (rev 109)
@@ -1,3 +1,7 @@
+2005-12-01  Timo Schulz  <ts at g10code.com>
+
+	* wptGPG.h (get_gpg_sigstat): New.
+	
 2005-11-30  Timo Schulz  <ts at g10code.com>
 
 	* wptFileManager.h: Add data constants.

Modified: trunk/Include/wptGPG.h
===================================================================
--- trunk/Include/wptGPG.h	2005-12-01 13:41:45 UTC (rev 108)
+++ trunk/Include/wptGPG.h	2005-12-02 07:32:13 UTC (rev 109)
@@ -100,6 +100,7 @@
 };
 typedef struct gpg_optfile_s * gpg_optfile_t;
 
+
 struct passphrase_cb_s {
     int gpg_cmd;	/* sign or decrypt. */
     int pwd_init;	/* 1 = passphrase request via dialog. */
@@ -121,22 +122,6 @@
 };
 
 
-static const char * gpg_sigstat[] = {
-    _("Error during verification process."),
-    _("The signature is good."),
-    _("The signature is BAD!"),
-    _("The signature could not be checked due to a missing key."),
-    _("No valid OpenPGP signature."),
-    _("Signature Error"),
-    _("Good Signature (Expired Key)"),
-    _("Good Signature (Revoked Key)"),
-    NULL
-};
-
-int sigsum_to_index (gpgme_sigsum_t sum);
-#define SIGSTAT_MASK 8
-#define get_gpg_sigstat(sum) gpg_sigstat[sigsum_to_index ((sum)) % SIGSTAT_MASK]
-
 /* This variable is 1 if IDEA is available. */
 extern int idea_available;
 
@@ -189,8 +174,8 @@
 int count_insecure_elgkeys (void);
 
 int gpg_encrypt_symmetric (void);
+const char *get_gpg_sigstat (gpgme_sigsum_t sum);
 
-
 /*-- wptGPGParser.cpp --*/
 /* find */
 gpg_group_t find_group( gpg_optfile_t opt, const char *str );

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2005-12-01 13:41:45 UTC (rev 108)
+++ trunk/NEWS	2005-12-02 07:32:13 UTC (rev 109)
@@ -676,4 +676,6 @@
 * Modify --keymanager so there is just one instance.
 * Detect 'gpg --sign' output in the file manager and
   do not assume 'ENCRYPTED'.
+* Fix a problem that the key cache will not be reloaded
+  when a keys was updated/imported via the keyserver.
   
\ No newline at end of file

Modified: trunk/Po/de.po
===================================================================
--- trunk/Po/de.po	2005-12-01 13:41:45 UTC (rev 108)
+++ trunk/Po/de.po	2005-12-02 07:32:13 UTC (rev 109)
@@ -3211,7 +3211,7 @@
 msgstr "Die Signatur is gut."
 
 msgid "The signature is BAD!"
-msgstr "Die Signatur wurde geändert!"
+msgstr "Die Signatur ist nicht gültig!"
 
 msgid "The signature could not be checked due to a missing key."
 msgstr "Die Signature könnte durch einen fehlenden Key nicht geprüft werden."
@@ -3280,3 +3280,31 @@
 
 msgid "Output file"
 msgstr "Ausgabedatei"
+
+msgid "Number of public keys"
+msgstr "Anzahl öff. Schlüssel"
+
+msgid "Imported public keys"
+msgstr "Importierte öff. Schlüssel"
+
+msgid "Number of secret keys"
+msgstr "Anzahl priv. Schlüssel"
+
+msgid "Imported secret keys"
+msgstr "Importierte priv. Schlüssel"
+
+msgid "Revocation certificates"
+msgstr "\"Revocation certificates\""
+
+msgid "No (valid) user ID"
+msgstr "Keine (gültige) user ID"
+
+msgid "New user ID's"
+msgstr "Neue user ID's"
+
+msgid "New sub keys"
+msgstr "Neue Sekundär-Schlüssel"
+
+msgid "New signatures"
+msgstr "Neue Signaturen"
+

Modified: trunk/Src/ChangeLog
===================================================================
--- trunk/Src/ChangeLog	2005-12-01 13:41:45 UTC (rev 108)
+++ trunk/Src/ChangeLog	2005-12-02 07:32:13 UTC (rev 109)
@@ -1,3 +1,13 @@
+2005-12-01  Timo Schulz  <ts at g10code.com>
+
+	* wptClipVerifyDlg.cpp (clipverify_dlg_proc): Use new semantic
+	for get_gpg_sigstat().
+	* wptGPGME.cpp (get_gpg_sigstat): New. It is now a function.
+	As a macro strings will not be translated at runtime.
+	* wptKeyserverDlg.cpp (hkp_recv_key): Properly detect if we
+	need to update the cache. Thanks to Jan-Oliver.
+	* wptKeyImportStatusDlg.cpp (import_status_dlg_proc): Localized.
+	
 2005-11-30  Timo Schulz  <ts at g10code.com>
 
 	* wptW32API.cpp (dialog_box_param): Removed LANG_DE code.

Modified: trunk/Src/WinPT-en.rc
===================================================================
--- trunk/Src/WinPT-en.rc	2005-12-01 13:41:45 UTC (rev 108)
+++ trunk/Src/WinPT-en.rc	2005-12-02 07:32:13 UTC (rev 109)
@@ -963,39 +963,39 @@
     PUSHBUTTON      "&Cancel",IDCANCEL,135,63,50,14
 END
 
-IDD_WINPT_IMPORT_STAT DIALOG DISCARDABLE  0, 0, 142, 217
+IDD_WINPT_IMPORT_STAT DIALOG DISCARDABLE  0, 0, 154, 218
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
 CAPTION "Key Import Statistics"
 FONT 8, "MS Sans Serif"
 BEGIN
-    GROUPBOX        "",IDC_STATIC,8,6,121,38
-    LTEXT           "Number of public keys",IDC_STATIC,13,16,71,8
-    EDITTEXT        IDC_IMPSTAT_NPKEYS,91,14,28,12,ES_AUTOHSCROLL | 
+    GROUPBOX        "",IDC_STATIC,8,6,139,38
+    LTEXT           "Number of public keys",IDC_IMPSTAT_NPKEYSINF,13,16,90,8
+    EDITTEXT        IDC_IMPSTAT_NPKEYS,111,14,28,12,ES_AUTOHSCROLL | 
                     ES_READONLY
-    LTEXT           "Imported public keys",IDC_STATIC,13,30,66,8
-    EDITTEXT        IDC_IMPSTAT_IPKEYS,91,29,28,12,ES_AUTOHSCROLL | 
+    LTEXT           "Imported public keys",IDC_IMPSTAT_IPKEYSINF,13,30,90,8
+    EDITTEXT        IDC_IMPSTAT_IPKEYS,111,29,28,12,ES_AUTOHSCROLL | 
                     ES_READONLY
-    GROUPBOX        "",IDC_STATIC,8,46,122,37
-    LTEXT           "Number of secret keys",IDC_STATIC,13,54,72,8
-    EDITTEXT        IDC_IMPSTAT_NSKEYS,91,52,28,12,ES_AUTOHSCROLL | 
+    GROUPBOX        "",IDC_STATIC,8,46,138,37
+    LTEXT           "Number of secret keys",IDC_IMPSTAT_NSKEYSINF,13,54,91,8
+    EDITTEXT        IDC_IMPSTAT_NSKEYS,111,52,28,12,ES_AUTOHSCROLL | 
                     ES_READONLY
-    LTEXT           "Imported secret keys",IDC_STATIC,13,69,66,8
-    EDITTEXT        IDC_IMPSTAT_ISKEYS,91,67,28,12,ES_READONLY
-    LTEXT           "Revocation certificates",IDC_STATIC,13,91,74,8
-    EDITTEXT        IDC_IMPSTAT_NREV,91,89,28,12,ES_READONLY
-    LTEXT           "No (valid) user ID",IDC_STATIC,13,105,56,8
-    EDITTEXT        IDC_IMPSTAT_NOUID,91,104,28,12,ES_READONLY
-    GROUPBOX        "",IDC_STATIC,8,123,121,49
-    LTEXT           "New user ID's",IDC_STATIC,13,130,45,8
-    EDITTEXT        IDC_IMPSTAT_NUID,91,130,28,12,ES_READONLY
-    LTEXT           "New sub keys",IDC_STATIC,13,143,46,8
-    EDITTEXT        IDC_IMPSTAT_NSUBK,91,143,28,12,ES_READONLY
-    LTEXT           "New signatures",IDC_STATIC,13,156,50,8
-    EDITTEXT        IDC_IMPSTAT_NSIG,91,156,28,12,ES_READONLY
-    EDITTEXT        IDC_IMPSTAT_INFO,10,178,119,12,ES_AUTOHSCROLL | 
+    LTEXT           "Imported secret keys",IDC_IMPSTAT_ISKEYSINF,13,69,91,8
+    EDITTEXT        IDC_IMPSTAT_ISKEYS,111,67,28,12,ES_READONLY
+    LTEXT           "Revocation certificates",IDC_IMPSTAT_NREVINF,13,91,93,8
+    EDITTEXT        IDC_IMPSTAT_NREV,111,89,28,12,ES_READONLY
+    LTEXT           "No (valid) user ID",IDC_IMPSTAT_NOUIDINF,13,105,89,8
+    EDITTEXT        IDC_IMPSTAT_NOUID,111,104,28,12,ES_READONLY
+    GROUPBOX        "",IDC_STATIC,8,123,137,49
+    LTEXT           "New user ID's",IDC_IMPSTAT_NUIDINF,13,130,87,8
+    EDITTEXT        IDC_IMPSTAT_NUID,111,130,28,12,ES_READONLY
+    LTEXT           "New sub keys",IDC_IMPSTAT_NSUBKINF,13,143,88,8
+    EDITTEXT        IDC_IMPSTAT_NSUBK,111,143,28,12,ES_READONLY
+    LTEXT           "New signatures",IDC_IMPSTAT_NSIGINF,13,156,84,8
+    EDITTEXT        IDC_IMPSTAT_NSIG,111,156,28,12,ES_READONLY
+    EDITTEXT        IDC_IMPSTAT_INFO,10,178,133,12,ES_AUTOHSCROLL | 
                     ES_READONLY
-    DEFPUSHBUTTON   "&OK",IDOK,79,195,50,14
-    GROUPBOX        "",IDC_STATIC,8,81,122,38
+    DEFPUSHBUTTON   "&OK",IDOK,94,195,50,14
+    GROUPBOX        "",IDC_STATIC,8,81,138,38
 END
 
 IDD_WINPT_FIRST DIALOG DISCARDABLE  0, 0, 195, 63
@@ -1734,9 +1734,9 @@
     IDD_WINPT_IMPORT_STAT, DIALOG
     BEGIN
         LEFTMARGIN, 2
-        RIGHTMARGIN, 137
+        RIGHTMARGIN, 149
         TOPMARGIN, 3
-        BOTTOMMARGIN, 212
+        BOTTOMMARGIN, 213
     END
 
     IDD_WINPT_FIRST, DIALOG

Modified: trunk/Src/resource.h
===================================================================
--- trunk/Src/resource.h	2005-12-01 13:41:45 UTC (rev 108)
+++ trunk/Src/resource.h	2005-12-02 07:32:13 UTC (rev 109)
@@ -598,6 +598,15 @@
 #define IDC_KEYREVOKE_OPTINF            1484
 #define IDC_KEYREVOKE_PWDINF            1485
 #define IDC_KEYREVOKE_OUTINF            1486
+#define IDC_IMPSTAT_NPKEYSINF           1487
+#define IDC_IMPSTAT_IPKEYSINF           1488
+#define IDC_IMPSTAT_NSKEYSINF           1489
+#define IDC_IMPSTAT_ISKEYSINF           1490
+#define IDC_IMPSTAT_NREVINF             1491
+#define IDC_IMPSTAT_NOUIDINF            1492
+#define IDC_IMPSTAT_NUIDINF             1493
+#define IDC_IMPSTAT_NSUBKINF            1494
+#define IDC_IMPSTAT_NSIGINF             1495
 #define ID_GPG_ENCRYPT                  40003
 #define ID_GPG_DECRYPT                  40004
 #define ID_GPG_SIGN                     40005
@@ -768,7 +777,7 @@
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        230
 #define _APS_NEXT_COMMAND_VALUE         40176
-#define _APS_NEXT_CONTROL_VALUE         1487
+#define _APS_NEXT_CONTROL_VALUE         1496
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif

Modified: trunk/Src/wptClipVerifyDlg.cpp
===================================================================
--- trunk/Src/wptClipVerifyDlg.cpp	2005-12-01 13:41:45 UTC (rev 108)
+++ trunk/Src/wptClipVerifyDlg.cpp	2005-12-02 07:32:13 UTC (rev 109)
@@ -190,7 +190,7 @@
 			  strtimestamp (sig->timestamp),
 			  get_key_pubalgo (sig->pubkey_algo), keyid+8);
             if (rc == IDNO) {
-                msg_box (dlg, gpg_sigstat[GPGME_SIG_STAT_NOKEY], _("Verify"), MB_WARN);
+                msg_box (dlg, get_gpg_sigstat (GPGME_SIGSUM_KEY_MISSING), _("Verify"), MB_WARN);
 		gpgme_release (c);
                 EndDialog (dlg, FALSE);
                 return FALSE;

Modified: trunk/Src/wptGPGME.cpp
===================================================================
--- trunk/Src/wptGPGME.cpp	2005-12-01 13:41:45 UTC (rev 108)
+++ trunk/Src/wptGPGME.cpp	2005-12-02 07:32:13 UTC (rev 109)
@@ -17,13 +17,11 @@
  * along with WinPT; if not, write to the Free Software Foundation, 
  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
  */
-
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
 #include <sys/types.h>
-#include <sys/types.h>
 #include <windows.h>
 
 #include "resource.h"
@@ -304,3 +302,44 @@
     gpg_keycache_rewind (pc);
     return n;
 }
+
+
+
+/* Map the signature summary in @sum to signature status table index. 
+   Return value: index to table. */
+static int
+sigsum_to_index (gpgme_sigsum_t sum)
+{
+    if ((sum & GPGME_SIGSUM_VALID) && (sum & GPGME_SIGSUM_KEY_REVOKED))
+	return 7;
+    if ((sum & GPGME_SIGSUM_VALID) && (sum & GPGME_SIGSUM_SIG_EXPIRED))
+	return 6;
+    if (sum & GPGME_SIGSUM_GREEN)
+	return 1;
+    else if (sum & GPGME_SIGSUM_RED)
+	return 2;
+    else if (sum & GPGME_SIGSUM_KEY_MISSING)
+	return 3;
+    return 0;
+}
+
+
+/* Return a humand readable description for the signature status @sum. */
+const char*
+get_gpg_sigstat (gpgme_sigsum_t sum)
+{
+    const char *gpg_sigstat[] = {
+	_("Error during verification process."),
+	_("The signature is good."),
+	_("The signature is BAD!"),
+	_("The signature could not be checked due to a missing key."),
+	_("No valid OpenPGP signature."),
+	_("Signature Error"),
+	_("Good Signature (Expired Key)"),
+	_("Good Signature (Revoked Key)"),
+	NULL
+    };
+    const unsigned int mask = 8;
+
+    return gpg_sigstat[sigsum_to_index (sum) % mask];
+}

Modified: trunk/Src/wptKeyImportStatusDlg.cpp
===================================================================
--- trunk/Src/wptKeyImportStatusDlg.cpp	2005-12-01 13:41:45 UTC (rev 108)
+++ trunk/Src/wptKeyImportStatusDlg.cpp	2005-12-02 07:32:13 UTC (rev 109)
@@ -18,7 +18,6 @@
  * along with WinPT; if not, write to the Free Software Foundation, 
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
-
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -46,6 +45,16 @@
 	res = (gpgme_import_result_t)lparam;
 	if (!res)
 	    dlg_fatal_error (dlg, "Could not get dialog param");
+	SetDlgItemText (dlg, IDC_IMPSTAT_NPKEYSINF, _("Number of public keys"));
+	SetDlgItemText (dlg, IDC_IMPSTAT_IPKEYSINF, _("Imported public keys"));
+	SetDlgItemText (dlg, IDC_IMPSTAT_NSKEYSINF, _("Number of secret keys"));
+	SetDlgItemText (dlg, IDC_IMPSTAT_ISKEYSINF, _("Imported secret keys"));
+	SetDlgItemText (dlg, IDC_IMPSTAT_NREVINF, _("Revocation certificates"));
+	SetDlgItemText (dlg, IDC_IMPSTAT_NOUIDINF, _("No (valid) user ID"));
+	SetDlgItemText (dlg, IDC_IMPSTAT_NUIDINF, _("New user ID's"));
+	SetDlgItemText (dlg, IDC_IMPSTAT_NSUBKINF, _("New sub keys"));
+	SetDlgItemText (dlg, IDC_IMPSTAT_NSIGINF, _("New signatures"));
+
 	SetDlgItemInt (dlg, IDC_IMPSTAT_NPKEYS, res->considered, FALSE);
 	SetDlgItemInt (dlg, IDC_IMPSTAT_IPKEYS, res->imported, FALSE);
 	SetDlgItemInt (dlg, IDC_IMPSTAT_NSKEYS, res->secret_read, FALSE);

Modified: trunk/Src/wptKeylist.cpp
===================================================================
--- trunk/Src/wptKeylist.cpp	2005-12-01 13:41:45 UTC (rev 108)
+++ trunk/Src/wptKeylist.cpp	2005-12-02 07:32:13 UTC (rev 109)
@@ -546,7 +546,6 @@
     listview_ctrl_t lv;
     listview_column_t col;
     int j, n = 0;
-    int kl_nolist = 0;
     int rc = 0;
     
     rc = listview_new (&lv);

Modified: trunk/Src/wptKeyserverDlg.cpp
===================================================================
--- trunk/Src/wptKeyserverDlg.cpp	2005-12-01 13:41:45 UTC (rev 108)
+++ trunk/Src/wptKeyserverDlg.cpp	2005-12-02 07:32:13 UTC (rev 109)
@@ -17,7 +17,6 @@
  * along with WinPT; if not, write to the Free Software Foundation, 
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
-
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -42,47 +41,52 @@
 
 #define MAX_KEYSIZE 70000
 
-char * get_reg_entry_keyserver (const char *);
+char* get_reg_entry_keyserver (const char *);
 int set_reg_entry_keyserver (const char *, const char *);
 
 
+/* Print out keyserver error and a possible Winsock error. */
 static void
-hkp_err_box (HWND dlg, const char * host, u16 port, int rc)
+hkp_err_box (HWND dlg, const char *host, WORD port, int rc)
 {
-    const char *err = kserver_strerror();
+    const char *err = kserver_strerror ();
 
-    log_box( _("Keyserver"), MB_ERR, "%s:%d: %s", host, port, winpt_strerror (rc));
+    log_box (_("Keyserver"), MB_ERR, "%s:%d: %s", 
+	     host, port, winpt_strerror (rc));
     if (err)
         msg_box (dlg, err, wsock_strerror (), MB_ERR);
-} /* hkp_err_box */
+}
 
 
+/* Send the extracted key with keyid @pattern to the 
+   keyserver @kserver (port @port).
+   Return value: 0 on success. */
 int
-hkp_send_key (HWND dlg, const char *kserver, u16 port, const char *pattern)
+hkp_send_key (HWND dlg, const char *kserver, WORD port, const char *pattern)
 {
-    gpgme_ctx_t c;
+    gpgme_ctx_t ctx;
     gpgme_data_t keydata;
     gpgme_error_t ec;
-    char *rawkey = NULL, msg[1024];
+    char *rawkey = NULL;
+    char msg[384];
     size_t n;
-    int rc;
     
-    ec = gpgme_new( &c );
-    if( ec )
-	BUG( NULL );
-    gpgme_set_armor (c, 1);
-    ec = gpgme_data_new( &keydata );
-    if( ec )
-	BUG( NULL );
-    rc = (int) gpgme_op_export( c, pattern, 0, keydata );
-    if( rc ) {
-        msg_box( dlg, gpgme_strerror( (gpgme_error_t)rc ), _("Export"), MB_ERR );
+    ec = gpgme_new (&ctx);
+    if (ec)
+	BUG (NULL);
+    gpgme_set_armor (ctx, 1);
+    ec = gpgme_data_new (&keydata);
+    if (ec)
+	BUG (NULL);
+    ec = gpgme_op_export (ctx, pattern, 0, keydata);
+    if (ec) {
+        msg_box (dlg, gpgme_strerror (ec), _("Export"), MB_ERR);
         goto leave;
     }
     rawkey = gpgme_data_release_and_get_mem (keydata, &n);
-    rc = kserver_sendkey (kserver, port, rawkey, n);
-    if (rc) {
-        hkp_err_box (dlg, kserver, port, rc);
+    ec = kserver_sendkey (kserver, port, rawkey, n);
+    if (ec) {
+        hkp_err_box (dlg, kserver, port, ec);
         goto leave;
     }
     
@@ -90,15 +94,18 @@
     status_box (dlg, msg, _("GnuPG status"));
     
 leave:
-    gpgme_release (c);
+    gpgme_release (ctx);
     if (rawkey)
 	gpgme_free (rawkey);
-    return rc;
-} /* hkp_send_key */
+    return ec? -1 : 0;
+}
 
 
+/* Receive a key from the keyserver @kserver (port @port)
+   with the pattern @pattern.
+   Return value: 0 on success. */
 int
-hkp_recv_key (HWND dlg, const char *kserver, u16 port, 
+hkp_recv_key (HWND dlg, const char *kserver, WORD port, 
 	      const char *pattern, int proto, int flags)
 {
     gpgme_ctx_t ctx;
@@ -106,50 +113,53 @@
     gpgme_error_t ec;
     gpgme_import_result_t import_res = NULL;
     int rc;
-    char *rawkey = NULL, msg[384];
+    char *rawkey = NULL;
+    char msg[384];
     
     rawkey = new char[MAX_KEYSIZE];
     if (!rawkey)
 	BUG (0);
     memset (rawkey, 0, MAX_KEYSIZE);
-    if( proto == KSPROTO_LDAP ) {
-        rc = ldap_recvkey( kserver, pattern, rawkey, MAX_KEYSIZE-1 );
-        if( rc ) {
-	    msg_box( dlg, _("LDAP key import failed.\n"
+    if (proto == KSPROTO_LDAP) {
+        rc = ldap_recvkey (kserver, pattern, rawkey, MAX_KEYSIZE-1);
+        if (rc) {
+	    msg_box (dlg, _("LDAP key import failed.\n"
 			    "Please make sure you have an online connection"
 			    " and gpgkeys_ldap.exe is installed"),
-			    _("Keyserver"), MB_ERR );
-	    free_if_alloc( rawkey );
+			    _("Keyserver"), MB_ERR);
+	    free_if_alloc (rawkey);
             return rc;
 	}
     }
     else if (proto == KSPROTO_FINGER) {
 	rc = finger_recvkey (kserver, pattern, rawkey, MAX_KEYSIZE-1);
 	if (rc) {
-	    log_box (_("Keyserver"), MB_ERR, _("Finger key import failed: %s\n"),
-		     winpt_strerror (rc));
+	    log_box (_("Keyserver"), MB_ERR, 
+		     _("Finger key import failed: %s\n"), winpt_strerror (rc));
 	    free_if_alloc (rawkey);
 	    return rc;
 	}
     }
-    else if( ( rc = kserver_recvkey( kserver, port, kserver_check_keyid( pattern ),
-				     rawkey, MAX_KEYSIZE-1 ) ) ) {
+    else if ((rc = kserver_recvkey (kserver, port, 
+				    kserver_check_keyid (pattern),
+				    rawkey, MAX_KEYSIZE-1))) {
         hkp_err_box (dlg, kserver, port, rc);
 	free_if_alloc (rawkey);
         return rc;
     }
     else {
-        if( !strstr( rawkey, "BEGIN PGP PUBLIC KEY BLOCK" ) ) {
-            msg_box( dlg, _("This is not a valid OpenPGP key."), _("Keyserver"), MB_ERR );
+        if (!strstr (rawkey, "BEGIN PGP PUBLIC KEY BLOCK")) {
+            msg_box (dlg, _("This is not a valid OpenPGP key."), 
+		     _("Keyserver"), MB_ERR);
             goto leave;
         }
-        ec = gpgme_new( &ctx );
-	if( ec )
-	    BUG( NULL );
-        gpgme_data_new_from_mem( &keydata, rawkey, strlen( rawkey ), 1 );
-        rc = gpgme_op_import( ctx, keydata );
-        if( rc ) {
-            msg_box( dlg, gpgme_strerror( (gpgme_error_t)rc ), _("Import"), MB_ERR );
+        ec = gpgme_new (&ctx);
+	if (ec)
+	    BUG (NULL);
+        gpgme_data_new_from_mem (&keydata, rawkey, strlen (rawkey), 1);
+        rc = gpgme_op_import (ctx, keydata);
+        if (rc) {
+            msg_box (dlg, gpgme_strerror ((gpgme_error_t)rc), _("Import"), MB_ERR);
             goto leave;
         }
 	import_res = gpgme_op_import_result (ctx);
@@ -158,7 +168,7 @@
     /* if we use the refresh mode, a lot of keys will be fetched and thus only
        a summarize at the end is presented and not for each key. */
     if (!(flags & KM_KS_REFRESH)) {
-	if (import_res && import_res->new_user_ids == 0) {
+	if (import_res && import_res->unchanged == 1) {
 	    _snprintf (msg, DIM (msg)-1,
 		       _("Key '%s' successfully received but nothing was changed."), pattern );
 	    status_box (dlg, msg, _("GnuPG Status"));
@@ -175,25 +185,25 @@
     gpgme_data_release (keydata);
 
     return rc;
-} /* hkp_recv_key */
+}
 
 
-#define my_iskeychar(a) ( ( (a) >='0' && (a) <= '9' ) || ( (a) >= 'A' && (a) <= 'F' ) )
+#define my_iskeychar(a) (((a) >='0' && (a) <= '9' ) || ((a) >= 'A' && (a) <= 'F'))
 
 static int
-check_pattern( const char *pattern )
+check_pattern (const char *pattern)
 {
     int rc = 1;
     
     /* Whitespace are not allowed! */
-    if( strchr( pattern, ' ') ) {
+    if (strchr( pattern, ' ')) {
         rc = WPTERR_GENERAL;
         goto leave;
     }
     
-    if( (( strstr( pattern, "0x" ) ) && ( strlen( pattern ) == 10 ) )
-         || (strstr(pattern, "0x")) && ( strlen( pattern )  == 18 ) ) {
-        rc = 0;
+    if (((strstr (pattern, "0x")) && (strlen (pattern) == 10)) ||
+         (strstr(pattern, "0x")) && (strlen (pattern)  == 18)) {
+        rc = 0; /* Either long or short keyid */
         goto leave;
     }
     
@@ -216,19 +226,19 @@
 static void
 set_proxy (HWND dlg)
 {
-    char proxy[384];
+    char proxy[256];
     int port = 0;
     
     strcpy (proxy, "HTTP proxy: ");
     if (kserver_get_proxy (&port)) {
-        char t[256];
+        char t[128];
         const char *http = kserver_get_proxy (&port);
         _snprintf (t, sizeof (t) - 1, "\"%s:%d\"", http, port);
         strcat (proxy, t);
     }
     else
-        strcat( proxy, "none" );
-    SetDlgItemText( dlg, IDC_KEYSERVER_PROXY, proxy );
+        strcat (proxy, "none");
+    SetDlgItemText (dlg, IDC_KEYSERVER_PROXY, proxy);
 } /* set_proxy */
 
 
@@ -345,6 +355,7 @@
 }
 
 
+/* Dialog box procedure to access keyservers. */
 BOOL CALLBACK
 keyserver_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
 {
@@ -399,7 +410,7 @@
         switch( LOWORD( wparam ) ) {
         case IDC_KEYSERVER_PROXSETT:
             dialog_box_param( glob_hinst, (LPCTSTR)IDD_WINPT_KEYSERVER_PROXY, glob_hwnd,
-                              keyserver_proxy_dlg_proc, 0, 
+                              keyserver_proxy_dlg_proc, NULL, 
                               _("Proxy Settings"), IDS_WINPT_KEYSERVER_PROXY );
             set_proxy( dlg );
             return TRUE;
@@ -408,7 +419,8 @@
             if (!lv_idx) {
                 lv_idx = kserver_get_pos (lv);
                 if (lv_idx == -1) {
-                    msg_box (dlg, _("Please select one of the keyservers."), _("Keyserver"), MB_INFO);
+                    msg_box (dlg, _("Please select one of the keyservers."), 
+			     _("Keyserver"), MB_INFO);
                     return FALSE;
                 }
             }
@@ -434,7 +446,8 @@
             if (!lv_idx) {
                 lv_idx = kserver_get_pos (lv);
                 if (lv_idx == -1) {
-                    msg_box( dlg, _("Please select one of the keyservers."), _("Keyserver"), MB_INFO );
+                    msg_box (dlg, _("Please select one of the keyservers."), 
+			    _("Keyserver"), MB_INFO);
                     return FALSE;
                 }
             }
@@ -469,15 +482,16 @@
             return TRUE;
 
 	case IDC_KEYSERVER_DEFAULT:
-	    save_default_ks( lv );
+	    save_default_ks (lv);
 	    break;
             
         case IDCANCEL:
-            EndDialog( dlg, FALSE );
+            EndDialog (dlg, FALSE);
             return FALSE;
         }
         break;
     }
     
     return FALSE;
-} /* keyserver_dlg_proc */
+}
+

Modified: trunk/Src/wptVerifyList.cpp
===================================================================
--- trunk/Src/wptVerifyList.cpp	2005-12-01 13:41:45 UTC (rev 108)
+++ trunk/Src/wptVerifyList.cpp	2005-12-02 07:32:13 UTC (rev 109)
@@ -74,25 +74,6 @@
 }
 
 
-/* Map the signature summary in @sum to signature status table index. 
-   Return value: index to table. */
-int
-sigsum_to_index (gpgme_sigsum_t sum)
-{
-    if ((sum & GPGME_SIGSUM_VALID) && (sum & GPGME_SIGSUM_KEY_REVOKED))
-	return 7;
-    if ((sum & GPGME_SIGSUM_VALID) && (sum & GPGME_SIGSUM_SIG_EXPIRED))
-	return 6;
-    if (sum & GPGME_SIGSUM_GREEN)
-	return 1;
-    else if (sum & GPGME_SIGSUM_RED)
-	return 2;
-    else if (sum & GPGME_SIGSUM_KEY_MISSING)
-	return 3;
-    return 0;
-}
-
-
 /* 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.
@@ -164,7 +145,7 @@
 	return WPTERR_GENERAL;
     
     get_pubkey (sig->fpr, &key);
-
+    
     if (sig->summary == 0 && gpg_err_code (sig->status) == GPG_ERR_NO_ERROR)
 	attr = get_gpg_sigstat (GPGME_SIGSUM_GREEN);
     else
@@ -223,8 +204,10 @@
     const char *attr;    
     char t[64], *name;
 
-    if (listview_add_item (lv, ""))
+    if (listview_add_item (lv, "")) {
+	log_debug ("verlist_add_sig_log: listview_add_item() failed.\n");
 	return WPTERR_GENERAL;
+    }
 
     get_pubkey (sig->fpr, &key);
     
@@ -234,7 +217,7 @@
     else
 	listview_add_sub_item (lv, 0, 0, log->file);
     free_if_alloc (name);
-
+    
     if (sig->summary == 0 && gpg_err_code (sig->status) == GPG_ERR_NO_ERROR)
 	attr = get_gpg_sigstat (GPGME_SIGSUM_GREEN);
     else
@@ -259,7 +242,7 @@
 	_snprintf (t, sizeof (t)-1, "0x%s", attr + 32);
 	listview_add_sub_item (lv, 0, 4, t);
     }
-    else if( !log->use_uid && strlen( attr ) == 32 ) {
+    else if (!log->use_uid && strlen( attr ) == 32) {
 	_snprintf (t, sizeof (t)-1, "0x%s", attr + 24);
 	listview_add_sub_item (lv, 0, 4, t);
     }

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2005-12-01 13:41:45 UTC (rev 108)
+++ trunk/configure.ac	2005-12-02 07:32:13 UTC (rev 109)
@@ -15,7 +15,7 @@
 
 # Version number: Remember to change it immediately *after* a release.
 #                 Add a "-cvs" prefix for non-released code.
-AC_INIT(WinPT, 0.11.2-cvs2, http://www.winpt.org)
+AC_INIT(WinPT, 0.11.2, http://www.winpt.org)
 
 NEED_GPGME_API=1
 NEED_GPGME_VERSION=1.1.0



More information about the Winpt-commits mailing list