[Patch] Relay secret key selection

Albrecht Dreß <[email protected]>
Newsgroups gmane.comp.gnome.apps.balsa
Message-ID <[email protected]>
Hi all,

attached is a tiny patch which relaxes the selection of the private key in the identity setup dialogue.

Currently, the user can only select a key with a uid which matches the account's email address.  However, there are use-cases where this is not sufficient.  At work, we have an isolated network with “internal” email addresses.  Outgoing messages are re-written to public addresses, but the internal ones shall not be exposed to the outside world (see e.g. [1]), i.e. the key /must not/ carry a user-id for the internal address.  Thus, neither auto-selection nor defining the key id in the gui works (it would be possible to run gpg[sm] on the console to print the id, and then copy it into the input field, though).

The patch enables selecting any valid private key in the identity dialogue, but /not/ when a message shall be sent and the private key cannot be determined.  Note that the vast majority of users will probably never use this feature, i.e. use automatic key selection (id is empty in the identity setup).

Opinions?

Cheers,
Albrecht.

[1] <http://www.postfix.org/ADDRESS_REWRITING_README.html#generic>

_______________________________________________
balsa-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/balsa-list
relax-secret-key-selection.diff (text/x-patch, 837 B)
diff --git a/libbalsa/libbalsa-gpgme.c b/libbalsa/libbalsa-gpgme.c
index 41dfe560f..c0b5fe737 100644
--- a/libbalsa/libbalsa-gpgme.c
+++ b/libbalsa/libbalsa-gpgme.c
@@ -771,8 +771,10 @@ libbalsa_gpgme_get_seckey(gpgme_protocol_t   protocol,
 	if (ctx != NULL) {
 		GList *keys = NULL;
 
-		/* let gpgme list all available keys */
-		if (libbalsa_gpgme_list_keys(ctx, &keys, NULL, name, TRUE, FALSE, FALSE, error)) {
+		/* Let gpgme list all available secret keys, including those not matching the passed email address.
+		 * Rationale: enable selecting a secret key even if the local email address is re-written by the MTA.
+		 * See e.g. http://www.postfix.org/ADDRESS_REWRITING_README.html#generic */
+		if (libbalsa_gpgme_list_keys(ctx, &keys, NULL, NULL, TRUE, FALSE, FALSE, error)) {
 			if (keys != NULL) {
 				gpgme_key_t key;
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEcCEPemLFTtyGf4zATKlvDmfn2fgFAlxm93gACgkQTKlvDmfn
2fgICwgAkvy+ike+kkLFM0UCHaEGJEEXwwl9/Fs4G1foacFEtcewzbLqhSdvGJay
gM4uu14tUBHkZZXMKEobToa2KlHRrEWqb95ajw0D85f50fZFF4HK3IcTJa/YIXjC
k+U2GyssHwOF5S8jbEdEnjHmOFuEwWQtvlk+Ujw/dDK1xBtoz5uXq3EiS2uFcYz4
GaH8SIoNj7jWj2iZdnJ7IN5XI3IUva2Nu5U96SvFVS+ZEOCDA0zCEk5Eky9tKDE3
hJQnPB19CkLyMUpPVN2inmLGL6odoUG7JHU9axr/2NoUUfeB7BUqxyszi3Y1C52K
UfarqKLAfMQILa8L0Z0trU84d5zzmw==
=LD7H
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.