2006-06-16 [colin] 2.3.0cvs17
authorColin Leroy <colin@colino.net>
Fri, 16 Jun 2006 06:46:34 +0000 (06:46 +0000)
committerColin Leroy <colin@colino.net>
Fri, 16 Jun 2006 06:46:34 +0000 (06:46 +0000)
* src/plugins/pgpcore/sgpgme.c
* src/plugins/pgpmime/pgpmime.c
* src/plugins/pgpinline/pgpinline.c
Better error reporting in setup_signers.
Don't fallback to default key if specified
key isn't found.
Don't allow signing if more than one secret
key matches the one specified in prefs.

ChangeLog
PATCHSETS
configure.ac
src/plugins/pgpcore/sgpgme.c
src/plugins/pgpinline/pgpinline.c
src/plugins/pgpmime/pgpmime.c

index 246473f174f5e9fe5c40d854af633dfecaca0c23..87e1992898ac54bb6d4a1761255725ee9c56c64b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2006-06-16 [colin]     2.3.0cvs17
+
+       * src/plugins/pgpcore/sgpgme.c
+       * src/plugins/pgpmime/pgpmime.c
+       * src/plugins/pgpinline/pgpinline.c
+               Better error reporting in setup_signers.
+               Don't fallback to default key if specified
+               key isn't found.
+               Don't allow signing if more than one secret
+               key matches the one specified in prefs.
+
 2006-06-15 [colin]     2.3.0cvs16
 
        * src/folderview.c
index 0eecd8ddc95d8d81a1e660aff7c2dc8e261d3717..52aff61a37980b41d33a8498123b0dc3c517d8be 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.213.2.100 -r 1.213.2.101 src/folder.c;  ) > 2.3.0cvs14.patchset
 ( diff -u /dev/null tools/make.themes.project;  ) > 2.3.0cvs15.patchset
 ( cvs diff -u -r 1.382.2.277 -r 1.382.2.278 src/compose.c;  cvs diff -u -r 1.207.2.103 -r 1.207.2.104 src/folderview.c;  cvs diff -u -r 1.28.2.17 -r 1.28.2.18 src/mbox.c;  cvs diff -u -r 1.94.2.87 -r 1.94.2.88 src/messageview.c;  cvs diff -u -r 1.10.2.8 -r 1.10.2.9 src/privacy.c;  cvs diff -u -r 1.10.2.7 -r 1.10.2.8 src/privacy.h;  cvs diff -u -r 1.49.2.77 -r 1.49.2.78 src/procmime.c;  cvs diff -u -r 1.150.2.68 -r 1.150.2.69 src/procmsg.c;  cvs diff -u -r 1.1.2.13 -r 1.1.2.14 src/plugins/pgpcore/passphrase.c;  cvs diff -u -r 1.1.2.18 -r 1.1.2.19 src/plugins/pgpcore/sgpgme.c;  cvs diff -u -r 1.1.2.12 -r 1.1.2.13 src/plugins/pgpinline/pgpinline.c;  cvs diff -u -r 1.1.2.34 -r 1.1.2.35 src/plugins/pgpmime/pgpmime.c;  ) > 2.3.0cvs16.patchset
+( cvs diff -u -r 1.1.2.19 -r 1.1.2.20 src/plugins/pgpcore/sgpgme.c;  cvs diff -u -r 1.1.2.35 -r 1.1.2.36 src/plugins/pgpmime/pgpmime.c;  cvs diff -u -r 1.1.2.13 -r 1.1.2.14 src/plugins/pgpinline/pgpinline.c;  ) > 2.3.0cvs17.patchset
index 5e5ad2d0604e8f0ea0cf56c59a14f178559826ee..b074bd960b65f70a53a5e1af45cd26a49eb1669e 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=3
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=16
+EXTRA_VERSION=17
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 060febf671c1cc389798b7ebf21a97430da09037..ccf87654b7858909afbbaddef85a1f63e0b358c8 100644 (file)
@@ -462,7 +462,7 @@ gboolean sgpgme_setup_signers(gpgme_ctx_t ctx, PrefsAccount *account)
 
        if (config->sign_key != SIGN_KEY_DEFAULT) {
                gchar *keyid;
-               gpgme_key_t key;
+               gpgme_key_t key, key2;
                gpgme_error_t err;
 
                if (config->sign_key == SIGN_KEY_BY_FROM)
@@ -470,34 +470,42 @@ gboolean sgpgme_setup_signers(gpgme_ctx_t ctx, PrefsAccount *account)
                else if (config->sign_key == SIGN_KEY_CUSTOM)
                        keyid = config->sign_key_id;
                else
-                       return FALSE;
+                       goto bail;
 
                err = gpgme_op_keylist_start(ctx, keyid, 1);
+               if (!err)
+                       err = gpgme_op_keylist_next(ctx, &key);
                if (err) {
-                       g_warning("setup_signers start: %s",
-                               gpg_strerror(err));
-                       return FALSE;
-               }
-               while (!(err = gpgme_op_keylist_next(ctx, &key))) {
-                       gpgme_signers_add(ctx, key);
-                       gpgme_key_release(key);
+                       g_warning("setup_signers start: %s", gpgme_strerror(err));
+                       privacy_set_error(_("Private key not found (%s)"), gpgme_strerror(err));
+                       goto bail;
                }
-               if (err && gpg_err_code(err) != GPG_ERR_EOF) {
-                       g_warning("setup_signers next: %s",
-                               gpg_strerror(err));
-                       return FALSE;
+               
+               err = gpgme_op_keylist_next(ctx, &key2);
+               if (!err) {
+                       g_warning("ambiguous specification of private key '%s'\n",
+                               keyid);
+                       privacy_set_error(_("Private key specification is ambiguous"));
+                       goto bail;
                }
-               err = gpgme_op_keylist_end(ctx);
+               
+               gpgme_op_keylist_end(ctx);
+               err = gpgme_signers_add(ctx, key);
+               gpgme_key_release(key);
+               
                if (err) {
-                       g_warning("setup_signers end: %s",
-                               gpg_strerror(err));
-                       return FALSE;
+                       g_warning("error adding secret key: %s\n", gpgme_strerror(err));
+                       privacy_set_error(_("Error setting private key: %s"), gpgme_strerror(err));
+                       goto bail;
                }
        }
 
        prefs_gpg_account_free_config(config);
 
        return TRUE;
+bail:
+       prefs_gpg_account_free_config(config);
+       return FALSE;
 }
 
 void sgpgme_init()
index 354230b3ad9568e630d6811d596919d6437a16d6..a88bd734428c87b831794fc0798437a4c9f13d9c 100644 (file)
@@ -515,7 +515,6 @@ static gboolean pgpinline_sign(MimeInfo *mimeinfo, PrefsAccount *account)
 
        if (!sgpgme_setup_signers(ctx, account)) {
                gpgme_release(ctx);
-               privacy_set_error(_("Couldn't find private key."));
                return FALSE;
        }
 
index 706f7925f066e06331cd69ccb24773168479ca89..d1378e7c694d0712a0bebfc5cabe6291d20c2b76 100644 (file)
@@ -459,7 +459,6 @@ gboolean pgpmime_sign(MimeInfo *mimeinfo, PrefsAccount *account)
 
        if (!sgpgme_setup_signers(ctx, account)) {
                gpgme_release(ctx);
-               privacy_set_error(_("Couldn't find private key."));
                return FALSE;
        }