[Winpt-commits] r220 - in trunk: . Src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue May 30 17:31:53 CEST 2006


Author: twoaday
Date: 2006-05-30 17:31:49 +0200 (Tue, 30 May 2006)
New Revision: 220

Modified:
   trunk/NEWS
   trunk/Src/ChangeLog
   trunk/Src/WinPT-en.rc
   trunk/Src/wptClipDecryptDlg.cpp
   trunk/Src/wptClipEncryptDlg.cpp
   trunk/Src/wptClipImportDlg.cpp
   trunk/Src/wptFileManager.cpp
   trunk/Src/wptKeyEdit.cpp
   trunk/Src/wptKeyEditCB.cpp
   trunk/Src/wptKeyEditDlgs.cpp
   trunk/Src/wptKeyTrustPathDlg.cpp
   trunk/Src/wptKeyserver.cpp
   trunk/configure.ac
Log:


Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2006-05-27 08:56:00 UTC (rev 219)
+++ trunk/NEWS	2006-05-30 15:31:49 UTC (rev 220)
@@ -830,4 +830,4 @@
 * 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
+* Fix problem on first-start when the default keyserver will be set.

Modified: trunk/Src/ChangeLog
===================================================================
--- trunk/Src/ChangeLog	2006-05-27 08:56:00 UTC (rev 219)
+++ trunk/Src/ChangeLog	2006-05-30 15:31:49 UTC (rev 220)
@@ -1,3 +1,16 @@
+2006-05-29  Timo Schulz  <ts at g10code.de>
+
+	* wptKeyserver.cpp (keyserver_set_default): Also set default port.
+
+2006-05-27  Timo Schulz  <ts at g10code.de>
+
+	* wptKeyEditDlgs.cpp (keyedit_change_passwd): Handle empty
+	passphrase requests.
+	* wptClipDecryptDlg.cpp (verify_show_signature_state): Modified
+	for global use.
+	* wptFileManager.cpp (fm_decrypt): Use it here.
+	* wptClipEncryptDlg.cpp (clip_encrypt_dlg_proc): Simplified.
+	
 2006-05-25  Timo Schulz  <ts at g10code.de>
 
 	* wptGPGUtil.cpp (gpg_rebuild_cache): Return error code.

Modified: trunk/Src/WinPT-en.rc
===================================================================
--- trunk/Src/WinPT-en.rc	2006-05-27 08:56:00 UTC (rev 219)
+++ trunk/Src/WinPT-en.rc	2006-05-30 15:31:49 UTC (rev 220)
@@ -596,19 +596,19 @@
     PUSHBUTTON      "&Close",IDCANCEL,126,57,50,14
 END
 
-IDD_WINPT_KEYEDIT_ADDUID DIALOG DISCARDABLE  0, 0, 166, 82
+IDD_WINPT_KEYEDIT_ADDUID DIALOG DISCARDABLE  0, 0, 180, 82
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Add new User ID"
 FONT 8, "MS Sans Serif"
 BEGIN
     LTEXT           "Name",IDC_ADDUID_INFNAME,6,6,44,10
-    EDITTEXT        IDC_ADDUID_NAME,55,6,100,12,ES_AUTOHSCROLL
+    EDITTEXT        IDC_ADDUID_NAME,56,6,119,12,ES_AUTOHSCROLL
     LTEXT           "Email",IDC_ADDUID_INFEMAIL,6,23,45,11
-    EDITTEXT        IDC_ADDUID_EMAIL,56,23,99,12,ES_AUTOHSCROLL
+    EDITTEXT        IDC_ADDUID_EMAIL,56,23,118,12,ES_AUTOHSCROLL
     LTEXT           "Comment",IDC_ADDUID_INFCOMMENT,6,39,47,11
-    EDITTEXT        IDC_ADDUID_COMMENT,56,39,99,12,ES_AUTOHSCROLL
-    DEFPUSHBUTTON   "&OK",IDOK,58,60,50,14
-    PUSHBUTTON      "&Cancel",IDCANCEL,109,60,46,14
+    EDITTEXT        IDC_ADDUID_COMMENT,56,39,118,12,ES_AUTOHSCROLL
+    DEFPUSHBUTTON   "&OK",IDOK,78,63,50,14
+    PUSHBUTTON      "&Cancel",IDCANCEL,129,63,46,14
 END
 
 IDD_WINPT_KEYEDIT_ADDSUBKEY DIALOG DISCARDABLE  0, 0, 176, 127
@@ -1059,7 +1059,7 @@
     LTEXT           "Size",IDC_STATIC,112,147,14,8
 END
 
-IDD_WINPT_CONFDELCLIP DIALOG DISCARDABLE  0, 0, 129, 66
+IDD_WINPT_CONFDELCLIP DIALOG DISCARDABLE  0, 0, 129, 74
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
 CAPTION "Delete Clipboard Contents"
 FONT 8, "MS Sans Serif"
@@ -1068,8 +1068,8 @@
                     IDC_CONFDELCLIP_INFO,6,7,116,20
     CONTROL         "&Remember the answer",IDC_CONFDELCLIP_BRAIN,"Button",
                     BS_AUTOCHECKBOX | WS_TABSTOP,6,33,111,10
-    DEFPUSHBUTTON   "&Yes",IDYES,38,49,43,14
-    PUSHBUTTON      "&No",IDNO,83,49,43,14
+    DEFPUSHBUTTON   "&Yes",IDYES,38,57,43,14
+    PUSHBUTTON      "&No",IDNO,83,57,43,14
 END
 
 IDD_WINPT_DATACB DIALOG DISCARDABLE  0, 0, 125, 34
@@ -1570,7 +1570,7 @@
     IDD_WINPT_KEYEDIT_ADDUID, DIALOG
     BEGIN
         LEFTMARGIN, 2
-        RIGHTMARGIN, 161
+        RIGHTMARGIN, 175
         TOPMARGIN, 3
         BOTTOMMARGIN, 77
     END
@@ -1772,7 +1772,7 @@
         LEFTMARGIN, 2
         RIGHTMARGIN, 126
         TOPMARGIN, 2
-        BOTTOMMARGIN, 63
+        BOTTOMMARGIN, 71
     END
 
     IDD_WINPT_DATACB, DIALOG

Modified: trunk/Src/wptClipDecryptDlg.cpp
===================================================================
--- trunk/Src/wptClipDecryptDlg.cpp	2006-05-27 08:56:00 UTC (rev 219)
+++ trunk/Src/wptClipDecryptDlg.cpp	2006-05-30 15:31:49 UTC (rev 220)
@@ -1,5 +1,5 @@
-/* wptClipDecryptDlg.cpp - Clipboard decrypt dialog
- *	Copyright (C) 2000-2005 Timo Schulz
+/* wptClipDecryptDlg.cpp - Clipboard decryption
+ *	Copyright (C) 2000-2006 Timo Schulz
  *	Copyright (C) 2005 g10 Code GmbH
  *
  * This file is part of WinPT.
@@ -40,22 +40,26 @@
 #include "resource.h"
 
 bool is_seckey_available (gpgme_recipient_t rset);
+char* get_pka_status (gpgme_signature_t sig);
 
+
 /* Return the primary user-ID of the key with the keyid @keyid. 
    Caller must free string. */
 char*
 get_key_userid (const char *keyid)
 {
     winpt_key_s key;
+    const char *fmt;
     char *uid;
 
     memset (&key, 0, sizeof (key));
     if (winpt_get_pubkey (keyid, &key))
 	return m_strdup (_("user ID not found"));
-    uid = new char[strlen (key.ext->uids->uid) + 4 + 8];
+    fmt = "\n    \"%s\"";
+    uid = new char[strlen (key.ext->uids->uid) + strlen (fmt)+ 2];
     if (!uid)
 	BUG (NULL);
-    sprintf (uid, "\n    \"%s\"", key.ext->uids->uid);
+    sprintf (uid, fmt, key.ext->uids->uid);
     winpt_release_pubkey (&key);
     return uid;
 }
@@ -89,6 +93,61 @@
 }
 
 
+/* Show a human readable description of the given signature @sig. */
+void
+verify_show_signature_state (gpgme_signature_t sig)
+{
+    winpt_key_s key;
+    const char *keyid, *uid;
+    const char *s;
+    char *pka_info = NULL;
+    int novalid = 0;
+
+    if (!sig->fpr)
+	BUG (NULL);
+	
+    keyid = get_keyid_from_fpr (sig->fpr);
+    memset (&key, 0, sizeof (key));
+
+    pka_info = get_pka_status (sig);
+
+    if (!winpt_get_pubkey (keyid, &key)) {
+	if (key.ctx->owner_trust == GPGME_VALIDITY_FULL ||	
+	    key.ctx->owner_trust == GPGME_VALIDITY_ULTIMATE)
+	    s = _("Signature Status: Created with a fully trusted key");
+	else if (key.ctx->owner_trust == GPGME_VALIDITY_MARGINAL)
+	    s = _("Signature Status: Created with a marginal trusted key");
+	else if (key.ctx->owner_trust == GPGME_VALIDITY_NEVER) {
+	    novalid = 1;
+	    s =  _("Signature Status: Created with an UNTRUSTED key");
+	}
+	else
+	    s = _("Signature Status: Created with an undefined trusted key");
+	uid = key.ext->uids->uid;	
+    }	
+    else {
+	s = "";
+	uid = _("user ID not found");
+    }
+
+    log_box (_("Decrypt Verify"), novalid? MB_WARN : MB_OK, 
+	     _("%s\n"
+	       "%s\n"
+               "Signature made: %s\n"
+               "From \"%s\" using key ID 0x%s"
+	       "%s %s\n%s"),
+	       s, get_gpg_sigstat (sig->summary),		   
+	       strtimestamp (sig->timestamp),
+	       uid, keyid,
+	       novalid? "\nPrimary key fingerprint: " : "",
+	       novalid? get_key_fpr (key.ctx) : "",
+	       pka_info? pka_info : ""
+	       );
+    free_if_alloc (pka_info);
+    winpt_release_pubkey (&key);
+}
+
+
 /* Convenient function to provide clipboard decryption.
    @hwnd is the parent window used for showing messsages.
    Return value: 0 on success. */
@@ -97,14 +156,11 @@
 {
     gpgme_error_t err;
     gpgme_ctx_t ctx = NULL;
-    gpgme_signature_t sig = NULL;
     gpgme_decrypt_result_t res;
     gpgme_verify_result_t sigres;
     passphrase_cb_s pwd;
-    const char *s;
-    const char *uid;
+    const char *s;    
     int pgp_type = 0;
-    int novalid = 0;
 
     /* allow to verify data generated by 'gpg -a --sign foo' */
     if (fm_assume_onepass_sig (NULL) == 1) {
@@ -163,45 +219,8 @@
     show_msg (GetDesktopWindow (), 1500, _("GnuPG Status: Finished"));
 
     sigres = gpgme_op_verify_result (ctx);
-    if (sigres && sigres->signatures) {
-	winpt_key_s key;
-	const char *keyid;
-
-	sig = sigres->signatures;
-	if (!sig->fpr)
-	    BUG (NULL);
-	keyid = get_keyid_from_fpr (sig->fpr);
-	memset (&key, 0, sizeof (key));
-	if (!winpt_get_pubkey (keyid, &key)) {
-	    if (key.ctx->owner_trust == GPGME_VALIDITY_FULL || 
-		key.ctx->owner_trust == GPGME_VALIDITY_ULTIMATE)
-		s = _("Signature Status: Created with a fully trusted key");
-	    else if (key.ctx->owner_trust == GPGME_VALIDITY_MARGINAL)
-		s = _("Signature Status: Created with a marginal trusted key");
-	    else if (key.ctx->owner_trust == GPGME_VALIDITY_NEVER) {
-		novalid = 1;
-		s =  _("Signature Status: Created with an UNTRUSTED key");
-	    }
-	    else
-		s = _("Signature Status: Created with an undefined trusted key");
-	    uid = key.ext->uids->uid;
-	}
-	else {
-	    s = "";
-	    uid = _("user ID not found");
-	}
-	log_box (_("WinPT Verify"), MB_OK, 
-		 _("%s\n"
-		   "%s\n"
-                   "Signature made: %s\n"
-                   "From \"%s\" using key ID 0x%s"
-		   "%s %s"),
-		   s, get_gpg_sigstat (sig->summary), 
-		   strtimestamp (sig->timestamp),
-		   uid, keyid, 
-		   novalid? "\nPrimary key fingerprint: " : "",
-		   novalid? get_key_fpr (key.ctx) : "");
-    }
+    if (sigres && sigres->signatures)
+	verify_show_signature_state (sigres->signatures);   
     
 leave:
     release_gpg_passphrase_cb (&pwd);

Modified: trunk/Src/wptClipEncryptDlg.cpp
===================================================================
--- trunk/Src/wptClipEncryptDlg.cpp	2006-05-27 08:56:00 UTC (rev 219)
+++ trunk/Src/wptClipEncryptDlg.cpp	2006-05-30 15:31:49 UTC (rev 220)
@@ -1,5 +1,5 @@
 /* wptClipEncryptDlg.cpp - Clipboard encrypt dialog
- *	Copyright (C) 2000-2005 Timo Schulz
+ *	Copyright (C) 2000-2006 Timo Schulz
  *	Copyright (C) 2005 g10 Code GmbH
  *
  * This file is part of WinPT.
@@ -124,7 +124,7 @@
 	safe_free (uid);
     }
     msg_box (dlg, p, _("Encryption"), MB_ERR);
-    free (p);
+    safe_free (p);
     return 0;
 }
 
@@ -147,8 +147,6 @@
 	SetDlgItemText (dlg, IDC_ENCRYPT_FNDCMD, _("&Find"));
 	SetDlgItemText (dlg, IDCANCEL, _("&Cancel"));
         kc = keycache_get_ctx (KEYCACHE_PUB);
-        if (!kc)
-            BUG (NULL);
         lv = keylist_load (GetDlgItem (dlg, IDC_ENCRYPT_KEYLIST), kc, NULL,
 			   KEYLIST_ENCRYPT_MIN, KEY_SORT_USERID);
 	center_window (dlg, NULL);
@@ -156,8 +154,8 @@
         return TRUE;
         
     case WM_DESTROY:
-        if( lv ) {
-            keylist_delete( lv );
+        if (lv) {
+            keylist_delete (lv);
             lv = NULL;
         }
         return FALSE;
@@ -174,22 +172,17 @@
 	    NMLISTVIEW *p = (LPNMLISTVIEW) lparam;
 	    int sortby = 0;
 
-	    switch( p->iSubItem ) {
+	    switch (p->iSubItem) {
 	    case  0: sortby = KEY_SORT_USERID; break;
 	    case  1: sortby = KEY_SORT_KEYID; break;
 	    case  2: sortby = KEY_SORT_LEN; break;
 	    case  4: sortby = KEY_SORT_VALIDITY; break;
 	    default: sortby = KEY_SORT_USERID; break;
 	    }
-	    keylist_sort( lv, sortby );
+	    keylist_sort (lv, sortby);
 	}
         return TRUE;
         
-    case WM_SYSCOMMAND:
-        if( LOWORD( wparam ) == SC_CLOSE )
-            EndDialog( dlg, TRUE );
-        return FALSE;
-        
     case WM_COMMAND:
         switch( LOWORD( wparam ) ) {
         case IDOK:
@@ -204,20 +197,18 @@
             if (err) {
 		if (show_invalid_recipients (dlg, ctx))
 		    msg_box (dlg, gpgme_strerror (err), _("Encryption"), MB_ERR);
-		if (ctx)
-		    gpgme_release (ctx);
-		safe_free (rset);
-                return FALSE;
             }
             else
-		show_msg( dlg, 1500, _("GnuPG Status: Finished") );
-            free (rset);
-	    gpgme_release (ctx);
-            EndDialog (dlg, TRUE);
+		show_msg (dlg, 1500, _("GnuPG Status: Finished"));
+            safe_free (rset);
+	    if (ctx)
+		gpgme_release (ctx);
+	    if (!err)
+		EndDialog (dlg, TRUE);
             return TRUE;
             
         case IDCANCEL:
-            EndDialog( dlg, FALSE );
+            EndDialog (dlg, FALSE);
             return FALSE;
 
 	case IDC_ENCRYPT_FNDCMD:

Modified: trunk/Src/wptClipImportDlg.cpp
===================================================================
--- trunk/Src/wptClipImportDlg.cpp	2006-05-27 08:56:00 UTC (rev 219)
+++ trunk/Src/wptClipImportDlg.cpp	2006-05-30 15:31:49 UTC (rev 220)
@@ -1,5 +1,5 @@
 /* wptClipImportDlg.cpp - WinPT key import dialog
- *	Copyright (C) 2001-2005 Timo Schulz
+ *	Copyright (C) 2001-2006 Timo Schulz
  *	Copyright (C) 2005 g10 Code GmbH
  *
  * This file is part of WinPT.
@@ -55,8 +55,7 @@
 	for (st=res->imports; st; st=st->next) {
 	    if (st->status == 0) /* nothing changed */
 		continue;
-	    keyid = st->fpr;
-	    keyid += (strlen (st->fpr) == 32)? 24 : 32;
+	    keyid = get_keyid_from_fpr (st->fpr);
 	    keycache_update (0, keyid);
 	}
     }

Modified: trunk/Src/wptFileManager.cpp
===================================================================
--- trunk/Src/wptFileManager.cpp	2006-05-27 08:56:00 UTC (rev 219)
+++ trunk/Src/wptFileManager.cpp	2006-05-30 15:31:49 UTC (rev 220)
@@ -57,6 +57,7 @@
 char* gpg_keylist_to_pattern (gpgme_key_t *rset, int n);
 gpgme_error_t sym_passphrase_cb (void *hook, const char *hint, const char *pass_inf,
 			         int prev_was_bad, int fd);
+void verify_show_signature_state (gpgme_signature_t sig);
 
 
 /* Symbolic column IDs. */
@@ -1199,44 +1200,6 @@
 }
 
 
-char* get_pka_status (gpgme_signature_t sig);
-
-
-/* Show the human readable verify result from @sigres. */
-static void
-show_verify_result (gpgme_verify_result_t sigres)
-{    
-    gpgme_signature_t sig=sigres->signatures;
-    winpt_key_s key;
-    const char *s, *keyid, *uid;
-    char *pka_info;
-    char buf[384];
-    int sigok = 0;
-
-    sig = sigres->signatures;
-    sigok = sig->summary & GPGME_SIGSUM_GREEN;
-    s = sigok? _("Good signature") : _("BAD signature");
-    keyid = sig->fpr;
-    if (!keyid)
-	return;
-    pka_info = get_pka_status (sig);
-    keyid = get_keyid_from_fpr (sig->fpr);
-    memset (&key, 0, sizeof (key));
-    if (!winpt_get_pubkey (sig->fpr, &key))
-	uid = key.ext->uids->uid;
-    else
-	uid = _("user ID not found");
-    _snprintf (buf, sizeof (buf)-1, _("Signature made %s using %s key ID %s\n"
-				      "%s from \"%s\"\n%s"),
-		strtimestamp (sig->timestamp), 
-		get_key_pubalgo (sig->pubkey_algo),
-		keyid, s, uid, pka_info? pka_info : "");
-    msg_box (NULL, buf, _("Decrypt Verify"), sigok? MB_OK: MB_ICONWARNING|MB_OK);
-    free_if_alloc (pka_info);
-    winpt_release_pubkey (&key);
-}
-
-
 /* Check the recipients if we have at least one secret key. */
 bool
 is_seckey_available (gpgme_recipient_t rset)
@@ -1398,7 +1361,7 @@
     }
     sigres = gpgme_op_verify_result (ctx);
     if (sigres && sigres->signatures)
-	show_verify_result (sigres);
+	verify_show_signature_state (sigres->signatures);
     
 leave:
     if (in)

Modified: trunk/Src/wptKeyEdit.cpp
===================================================================
--- trunk/Src/wptKeyEdit.cpp	2006-05-27 08:56:00 UTC (rev 219)
+++ trunk/Src/wptKeyEdit.cpp	2006-05-30 15:31:49 UTC (rev 220)
@@ -377,7 +377,6 @@
 {
     cmd_sent = 0;
     cnt = 0;
-    //resval = 0;
 }
 
 

Modified: trunk/Src/wptKeyEditCB.cpp
===================================================================
--- trunk/Src/wptKeyEditCB.cpp	2006-05-27 08:56:00 UTC (rev 219)
+++ trunk/Src/wptKeyEditCB.cpp	2006-05-30 15:31:49 UTC (rev 220)
@@ -341,6 +341,9 @@
     }
     if (ctx->cnt == 0 && !strcmp (key, "passphrase.enter")) {
         ctx->cnt = 1;
+	/* it is possible that there is no old passphrase. */
+	if (!ctx->pass && ctx->flags)
+	    return "";
 	return ctx->pass;
     }
     if (!strcmp (key, "passphrase.enter" ))
@@ -359,7 +362,7 @@
 static const char*
 cmd_setpref_handler (GpgKeyEdit *ctx, gpgme_status_code_t code, const char * key)
 {
-    static char buf[128];
+    static char buf[128] = {0};
 
     /* XXX: check the code. */
 #if 0
@@ -386,7 +389,7 @@
 	return "save";
     }
 #endif
-    return NULL;
+    return buf;
 }
 
 
@@ -721,6 +724,7 @@
 	break;
 
     case GPGME_STATUS_BAD_PASSPHRASE:
+	log_debug ("editkey_command_handler: bad passphrase\n");
 	ke->setResult (EDITKEY_ERR_BAD_PASSPHRASE);
 	break;
 

Modified: trunk/Src/wptKeyEditDlgs.cpp
===================================================================
--- trunk/Src/wptKeyEditDlgs.cpp	2006-05-27 08:56:00 UTC (rev 219)
+++ trunk/Src/wptKeyEditDlgs.cpp	2006-05-30 15:31:49 UTC (rev 220)
@@ -1046,22 +1046,35 @@
     }
     new_pass = request_passphrase2 (_("New Passphrase" ), 1, &cancel);
     if (cancel) {
-	free_if_alloc (old_pass);
+	sfree_if_alloc (old_pass);
         return FALSE;
     }
 
+    if (strlen (new_pass) == 0) {
+	cancel = msg_box (dlg, _("Are you sure that you really don't want a passphrase?\n"
+				 "This is propably a bad idea, still proceed?"),
+			    _("Key Edit"), MB_WARN_ASK);
+	if (cancel != IDYES) {
+	    sfree_if_alloc (old_pass);
+	    sfree_if_alloc (new_pass);
+	    return FALSE;
+	}
+    }
+
     if (is_8bit_string (new_pass)) {
 	msg_box (dlg, _("The passphrase contains 8-bit characters.\n"
 		         "It is not suggested to use charset specific characters."),
 			 _("Key Edit"), MB_ERR);
-	free_if_alloc (old_pass);
-	free_if_alloc (new_pass);
+	sfree_if_alloc (old_pass);
+	sfree_if_alloc (new_pass);
 	return FALSE;
     }
 
     ke = create_GpgKeyEdit (k->keyid);
     ke->setPassphrase (k->is_protected? old_pass : NULL);
-    err = ke->changePassphrase (new_pass, 0);
+    if (!k->is_protected)
+	ke->setNoPassphrase (true);
+    err = ke->changePassphrase (new_pass, 1);
     if (err)
 	msg_box (dlg, gpgme_strerror (err), _("Change Passwd"), MB_ERR);
     else

Modified: trunk/Src/wptKeyTrustPathDlg.cpp
===================================================================
--- trunk/Src/wptKeyTrustPathDlg.cpp	2006-05-27 08:56:00 UTC (rev 219)
+++ trunk/Src/wptKeyTrustPathDlg.cpp	2006-05-30 15:31:49 UTC (rev 220)
@@ -126,9 +126,7 @@
         if( !lparam )
             dlg_fatal_error( dlg, "Could not get dialog param!" );
         k = (winpt_key_t )lparam;
-#ifndef LANG_DE
         SetWindowText( dlg, _("List Trust Path") );
-#endif
         tree = GetDlgItem( dlg, IDC_KEYTRUST_TREE );
         ec = gpgme_new( &ctx );
 	if( ec )

Modified: trunk/Src/wptKeyserver.cpp
===================================================================
--- trunk/Src/wptKeyserver.cpp	2006-05-27 08:56:00 UTC (rev 219)
+++ trunk/Src/wptKeyserver.cpp	2006-05-30 15:31:49 UTC (rev 220)
@@ -146,6 +146,7 @@
     char *p, *end;
     int ec, len;
 
+    log_debug ("check_hkp_response: '%s'\r\n", resp);
     ec = recv ? WPTERR_WINSOCK_RECVKEY : WPTERR_WINSOCK_SENDKEY;
     if (!strstr (resp, "HTTP/1.0 200 OK") &&
 	!strstr (resp, "HTTP/1.1 200 OK")) /* http error */
@@ -452,6 +453,7 @@
 	closesocket (fd);
 	return 0;
     }
+    log_debug ("kserver_check_inet_connection: no inet connection.\r\n");
     return -1;
 }
 
@@ -535,18 +537,22 @@
 }
 
 
+/* Set the default keyserver. 
+   If @hostname is NULL, use the predefined keyserver. */
 void
 keyserver_set_default (const char *hostname, WORD port)
 {
+    if (!port)
+	port = HKP_PORT;
     if (hostname != NULL) {
 	free_if_alloc (default_keyserver);
 	default_keyserver = m_strdup (hostname);
 	default_keyserver_port = port;
     }
-    if (!port)
-	port = HKP_PORT;
-    if (!default_keyserver)
+    if (!default_keyserver) {
 	default_keyserver = m_strdup (DEF_HKP_KEYSERVER);
+	default_keyserver_port = HKP_PORT;
+    }
     server[0].name =  m_strdup (default_keyserver);
     server[0].used = 1;
     server[0].port = port;
@@ -854,7 +860,7 @@
     }
 
     free_if_alloc (enc_pubkey);
-    log_debug ("%s\r\n", request);
+    log_debug ("request:\r\n%s\r\n", request);
     return request;
 }
 
@@ -899,7 +905,7 @@
         _snprintf (request, reqlen, fmt, keyid);
     }
 
-    log_debug ("%s\r\n", request);
+    log_debug ("request:\r\n%s\r\n", request);
     
     rc = sock_write (conn_fd, request, strlen (request));
     if (rc == SOCKET_ERROR) {
@@ -913,7 +919,7 @@
         goto leave;
     }
 
-    log_debug ("%s\r\n", *r_key);
+    log_debug ("response:\r\n%s\r\n", *r_key);
     rc = check_hkp_response (*r_key, 1);
     if (rc)
         goto leave;
@@ -1173,8 +1179,7 @@
 	    break;
 
 	case UID:
-	    /* XXX: search for %3A and decode it back to ':' */
-	    u->uid = m_strdup (p);
+	    unhexify_buffer (p, &u->uid);
 	    break;
 
 	case CREATE:
@@ -1232,6 +1237,7 @@
     for (;;) {
 	if (sock_getline (fd, buf, sizeof (buf)-1, &n))
 	    break;
+	/*log_debug ("record: '%s'\r\n", buf); */
 	if (!strncmp (buf, "pub", 3))
 	    parse_pub_record (key, buf);
 	else
@@ -1504,6 +1510,6 @@
     /* XXX: remove / in .de/:11371 */
     *r_keyserver = substr (url, 0, (p-url));    
     *r_port = atoi (url+(p-url)+1);
-    safe_free (url);
+    free_if_alloc (url);
     return 0;
 }

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2006-05-27 08:56:00 UTC (rev 219)
+++ trunk/configure.ac	2006-05-30 15:31:49 UTC (rev 220)
@@ -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.12.2-cvs, http://www.winpt.org)
+AC_INIT(WinPT, 0.12.2, http://www.winpt.org)
 NEED_GPG_VERSION=1.4.2
 NEED_GPGME_API=1
 NEED_GPGME_VERSION=1.1.1



More information about the Winpt-commits mailing list