summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Fiskerstrand <k_f@gentoo.org>2015-05-13 20:38:35 +0000
committerKristian Fiskerstrand <k_f@gentoo.org>2015-05-13 20:38:35 +0000
commit20d2c335f648a2530e6cb3214ea15d7c53f28ed3 (patch)
tree1426f9a28797567fc14f5ae9d6e6092b1b0eed0d /app-crypt
parentVersion bumps. Ebuilds by Arfrever. (diff)
downloadhistorical-20d2c335f648a2530e6cb3214ea15d7c53f28ed3.tar.gz
historical-20d2c335f648a2530e6cb3214ea15d7c53f28ed3.tar.bz2
historical-20d2c335f648a2530e6cb3214ea15d7c53f28ed3.zip
new upstream version 0.9.2 with fixes
Package-Manager: portage-2.2.18/cvs/Linux x86_64 Manifest-Sign-Key: 0xFED5002857C1ABFA!
Diffstat (limited to 'app-crypt')
-rw-r--r--app-crypt/pinentry/ChangeLog12
-rw-r--r--app-crypt/pinentry/Manifest22
-rw-r--r--app-crypt/pinentry/files/pinentry-0.9.2-cmd_confirm.patch47
-rw-r--r--app-crypt/pinentry/files/pinentry-0.9.2-gnome3.patch518
-rw-r--r--app-crypt/pinentry/files/pinentry-0.9.2-handlers-return.patch28
-rw-r--r--app-crypt/pinentry/files/pinentry-0.9.2-linking-order.patch104
-rw-r--r--app-crypt/pinentry/files/pinentry-0.9.2-management.patch136
-rw-r--r--app-crypt/pinentry/files/pinentry-0.9.2-memory.patch32
-rw-r--r--app-crypt/pinentry/files/pinentry-0.9.2-simplify.patch48
-rw-r--r--app-crypt/pinentry/pinentry-0.9.2.ebuild92
10 files changed, 1033 insertions, 6 deletions
diff --git a/app-crypt/pinentry/ChangeLog b/app-crypt/pinentry/ChangeLog
index 07c9c078296d..1e8aedb45378 100644
--- a/app-crypt/pinentry/ChangeLog
+++ b/app-crypt/pinentry/ChangeLog
@@ -1,6 +1,16 @@
# ChangeLog for app-crypt/pinentry
# Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-crypt/pinentry/ChangeLog,v 1.170 2015/05/05 16:24:05 alonbl Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-crypt/pinentry/ChangeLog,v 1.171 2015/05/13 20:38:27 k_f Exp $
+
+*pinentry-0.9.2 (13 May 2015)
+
+ 13 May 2015; Kristian Fiskerstrand <k_f@gentoo.org>
+ +files/pinentry-0.9.2-cmd_confirm.patch, +files/pinentry-0.9.2-gnome3.patch,
+ +files/pinentry-0.9.2-handlers-return.patch,
+ +files/pinentry-0.9.2-linking-order.patch,
+ +files/pinentry-0.9.2-management.patch, +files/pinentry-0.9.2-memory.patch,
+ +files/pinentry-0.9.2-simplify.patch, +pinentry-0.9.2.ebuild:
+ new upstream version 0.9.2 with fixes
05 May 2015; Alon Bar-Lev <alonbl@gentoo.org> pinentry-0.9.1.ebuild:
Remove aix hack as upstream addressed the issue
diff --git a/app-crypt/pinentry/Manifest b/app-crypt/pinentry/Manifest
index 99ae29c6fbe6..e4671fb32048 100644
--- a/app-crypt/pinentry/Manifest
+++ b/app-crypt/pinentry/Manifest
@@ -5,19 +5,31 @@ AUX pinentry-0.8.2-ncurses.patch 824 SHA256 7d5e485e2c6dcce80ab63055d24761f53ae2
AUX pinentry-0.8.2-texi.patch 688 SHA256 47c5280fb82d0ba15338c60765c1ee37b368baf774a821f7afe85a7bf16dcbbc SHA512 4cd0b58a8719d0569d9a3c7c8258e609ccd6239436e3b981afcfb95859f8f4b898a8c29db3b310fb3611b285e58f89b09c9c9f8607a9168ee26ffc054ed9f680 WHIRLPOOL fd574ed478dcd9ff1a9306da1122f20d6f894ca055ed4f368f6796c5b41bfcff9c7842c8ed9a9b8a235ccd4031a153d9f0cf43e60e0cec16e482bcc021a21388
AUX pinentry-0.9.0-accessibility.patch 2587 SHA256 80adf350a7fa17ab7d60b36d1d373f629c85424de96950c4156fe44e0c2691ae SHA512 2c337e71aad65af0fae7d82bacb08304e1c276cbc0cb318442669a3c711ea0be7b909a5ff9c6a5e846464d1e91645ec5a2c57d9deb5eaaa8b16ce3c5244684a8 WHIRLPOOL 02bf8215210b81f48a16a519b9207356fd32c42a42acd1eaeae9faf81e5f8b500c006a3491948b48df855b7a44cde4976753a71494ff1a1b1b407d2ed653af56
AUX pinentry-0.9.1-memleak.patch 732 SHA256 53643494cdef3d0f9e1261c5c364e6eb42e2fc5e15259018572869f5c3bf4377 SHA512 2fd2d94a0894ef0ac895176ddc034d381a696cf8c4a5a9824d40ed0723953e85d561a9f03f8aef2ba2141eb71c1dc0b352f81346fd838b4fdff09f11f275a881 WHIRLPOOL 3525bee3c00718f19b6c30fbef1e98a19e105367150a3a9b9470900494d7eeb58128f19903917fe0878f7c5f7a67a9cb75cda464bc14b0b1a766c7d871733cf9
+AUX pinentry-0.9.2-cmd_confirm.patch 1341 SHA256 695557bdf9e3c7c206d07229665a79f7dbe5dde74694f602514c4fd2403b4d4e SHA512 c5c1417732f3d07a5f04e0fdfd2fc469e38bd03ddac7d9d269e1635674a4a8a7b7431e92e8a5da0c0d83d4ab040f79b6cb79fe5597a239f07c36f6839a51ed74 WHIRLPOOL 95a8a73478be25bf747d315c96a8d456e4482f6c89fd36893cb4244bff5c0b65721e9fdaf28110063c05fa1c77314113c014f5725efdfb60fc9e4c315ef2a324
+AUX pinentry-0.9.2-gnome3.patch 13855 SHA256 01fcec036a2eb9d56e156387a023594855ad27ba203ce06883cee32e8e6b51bb SHA512 9cfbdb66cb10b76f9f2fead8ff1c641ea2998748f74a8515e4f5dd1f8de99e4a601d07fa72ecfa73486631790dc8197c5f0942e1b0e2e648136d93cb22711975 WHIRLPOOL 40da7fafc4613278ad29dd6d8e322434f6e732a8205183f73a12d05622bd05f2cd6affec7d583ee49874872c0b1914036b9b185f2d44620d0df58d3da22b5192
+AUX pinentry-0.9.2-handlers-return.patch 953 SHA256 14f4295211550e64ee9797999e7bf87bd3b68092577c586358fc43e38d27b377 SHA512 c2acacc7244eb4fae7863b867913e2819e10e8aacde294e2528de0a35de0c4b7c23676720bbbd70d0e5aef8e8f6e03ceb499dd58d799e4e0b2bee087b80103bf WHIRLPOOL aa83879b5497f2507eae0d34f2538ef45182695e1bd2995be7d8cc9bf58ec2eec5732b49bee61ea4a18b9e73e08982268aa8aa124326851939c9ad5faab4b08f
+AUX pinentry-0.9.2-linking-order.patch 3866 SHA256 6937de3e176de2fb3425ba449fb4caab61cf1382135fa4ca2a5f9d4f0b500aac SHA512 50665ae47e955991f588cacd753ed4ec8e071e779cf016c25958e944da44aa6bbdbd911070f49d3431277619d242e3ee34e1d9c7747ce36d0f3018a52b7f9e3a WHIRLPOOL 44013aa6785a70e3564d1847c1d2205776461e093fab64503f7c69bc57c9e0d0ecc5f652cb6cbab28a16c65c6163d1b3f0cf9efa26add48950f502560644c93b
+AUX pinentry-0.9.2-management.patch 3590 SHA256 7890e73e0e5545ce817f96f0ab89fbb6626cb7166f03a9338f80bd0f26bfc03f SHA512 fba43beaed1f5856cc7fe20cc985d782fef9b75eb9464c0b8f82b426af6922a9da298a9461a251aba26c5cf1410ffdd2f09657bd73dedbc7b338e8f673a50a04 WHIRLPOOL 47bf4c3b30a329cc79580626e89b0fbbc78d91e466f2b5c7ba79b1f96f5a24b016ef912833bbb43cabaa47084061cc554b4222a76d7d0bedf574f3ac247b803d
+AUX pinentry-0.9.2-memory.patch 919 SHA256 788f73e7817b27adb5a0d2befb95da3c653291c2151bcbe493b2ec65f72eabf0 SHA512 2aa4e68b6d2c1100652c9a007381b5c181f761cd6cc30e5769a8fe02aa05933294841131815ea5706e010ab1e083da28094a3b1d61ebd393c084eff040330fc6 WHIRLPOOL 87f0c639ed5a61404c34b80bbe0d30e52c27fd407dfe4f938720953c76dcc15c024688252da0d9107fab7daecb04b565df202a723436b0bafda02d48e3ef56cf
+AUX pinentry-0.9.2-simplify.patch 1431 SHA256 093d623379ff571b23ceddd71f62e4792f1a004517bd43212ab1534efff46382 SHA512 2a541abfa8529050d6bba6381e852e8c1d66ae9c7dc07f25b0e4b313cbc6ec4a87cc44f19cc400de23a094b994d17871a2a9471e18a3fcba187968334e5524c7 WHIRLPOOL 312fb2d8fadab742a6af449b59a2319e5e1b7bc27fdef131f2e77480c1b916d131bae5a28456c1f09ce7a531e2d8862d9424a9a87b3877d246aaac67bacaf18d
DIST pinentry-0.9.0.tar.bz2 464272 SHA256 90045a07ab8e1a8e1ecf5d19b51691f195525e579fa5d71d7e92c120b05490ab SHA512 2cc53a5c3852edaf6e940228d9b43fe4709344eba5fe230b7afd22b2c0239d0b258917d75661d80590b2d61c6fe9dac8ad15a0b4a0a0e7fba90a9e1c07364edd WHIRLPOOL 3f77a8aa2d44c7206d877e31088ec927473441e61f06e788330545d75ac489e6e9d5bf0026b23d0824304dad54ce8e61c4571d186df7ad0edc2d644ca3af04ac
DIST pinentry-0.9.1.tar.bz2 482295 SHA256 9cd08e856b395df3adc7124170b53f77c6d5c8bf88e899e818648ec70d3e9695 SHA512 2462d25a471a6053a0d1b67a05d1a828b9d14ca4aeced352376ff16b6aa4d03fd6d1013aee1b07b97f9ee73f218065c48fe2746bbf27f3cb2bd9aa0b9c9c1a50 WHIRLPOOL 2e74e31567b26d0ee1d0d962f9c4dee6bd9c5a8679751dc85a14d3f2d47bc83aa068ac9810261c1e47a08eacb25777926be3de0db9e3d20d3d8348033c6b13c5
+DIST pinentry-0.9.2.tar.bz2 495742 SHA256 fd8bc1592ceb22bb492b07cb29b1b140bb882c859e6503b974254c0a4b4134d1 SHA512 68ba5643b9dc4e71b28f964172c7f37a67d1b22914c649c612e001c7c5ca0c40a0a2ec0974f50dbdc8dd98cc6266688c71d67e922db4334536797d331b0203cf WHIRLPOOL 457c8408ed04b2b5f72761d0b24cf1f07b1b81bb431cc666ee88015fda5a868a4ad296ac82fc98c79d5af5c1fdfdc597cb38914088143fb08e7838c9b572a090
EBUILD pinentry-0.9.0-r1.ebuild 2984 SHA256 5c8d235f29341909888aed86e394c0597391cbadf8a62f683e0843f416709c96 SHA512 d0b1eba241dee63b0bcb048fe7b73835727283a817d5a58f8390b6a9a4000d2f8532b045d3c284947a8e881f892c0a51d41276a0fe143d1271c11f171324986f WHIRLPOOL 5bf8814ec11ebc63a346db2368947aab5299489c07a93c80ec9097b366579194698f1637d63f0798941afaa330aa59bd6d13bd3b1be1eeba75e0ce8c38cbf14f
EBUILD pinentry-0.9.0-r2.ebuild 3038 SHA256 8cecfa92b1cd7f5cf663c409bad542b1cf2024ab3bebbab19daf32ea632a9404 SHA512 ab76435473aa4e22248a051607c28c76e634c6398096839b6436f738e852cfe564403c6addde7d696c6d4d28592c9257e48092af992c4211d5e84f4b07f1b5cc WHIRLPOOL c86ce2526f7c912edb0d0c12028d18ec3878e55008d0a70a89e7bcf33d27bb9461ecd5d9b6605f10c643d20a1bc94a9959857fb995314c61473660c19e815ea4
EBUILD pinentry-0.9.0-r3.ebuild 3136 SHA256 fbd8f91d0c28a92bc6923d19d0414f3c1b4035e6ce59eb7fdb153e5fe63f4551 SHA512 40c06d484b680507b18fdfdbbe17da15c1f41b9b7c87e8a3435b88d363f26d7ac8ec8d045c8e9f9988d110fe8ae826c249d5549974fe5bd60544718efadc4671 WHIRLPOOL 4053c9edbb0c036790166ba62ba25017eee419e43d5fadc2f561913d0a584fcb7d0b72e4da5e6a529316e06b23314bd88c17099e2fafe6c2b71a101129b7010f
EBUILD pinentry-0.9.0.ebuild 2901 SHA256 e890a9acc471f6252fe4658e7f5b54a99525c06d5cf96681c3d0483dd9735829 SHA512 cfcd1733d69eebcf8e1c01d275edf7e50be76ddfe1fb439ebde80d7ae3f188d1f4feafa4fe471beb59a6d82aab4edf681a122f4acf74083b0e7816605faf0c7a WHIRLPOOL 5502e3e32b46d1aec265eeac5467772c95d7d404b5afe3e1a4b56333e8d581b4e8270b5cad44c66db99949229cbf6d3a38c12c7ca43174a87da6f3bc090775ff
EBUILD pinentry-0.9.1.ebuild 2721 SHA256 97ba93a30e757ab11988a9f1ed9ece1175d61d0c353063a4372105dc6a37037f SHA512 a123d2bfea94b23b70ecee4c7f52ba8fe0cc163850f8dcad8952e137067c0717a089ef880f16454e296e86af983cb132b618ad3e750590cc891f741351b1651b WHIRLPOOL dbc1dca7cc2a7a98b27481f0eca034dc1ac73e80b3d5c94be8176564aff4e921704059ca510f6fc3fbaf485e714511231bc035177e40903b35bf701273b3f4ab
-MISC ChangeLog 22889 SHA256 f94e028c348d0f5fbb60ba51a3fca616bb0adddc4ae657522aa8e9cd95975c70 SHA512 f95ec11ad756cffd7adf57ee566bf846cbc8d4b5f3e31b567859bd82b391ab151a5aec27ecc633b6e9fd01b7952e35b22a37e61c939d90c57865918b1010ef2e WHIRLPOOL 89786aa96728a323ab7ed80709c06cb2a35e3dc866f091b00398cb2cbf0e9d0b16fef87fbe8a098df98251b8b07a029d8ab61e356c9228cff4806a8757bc84a0
+EBUILD pinentry-0.9.2.ebuild 3078 SHA256 418e7f8867258cf3254e4f09e768788625598585adde59ef7478d4e00260e583 SHA512 353c9de15756c2a933fc1420c1338181e62182c2b7c3bdf20c343aee918fac7d3dd99ca076976147dcbccfbf09a6a7892380a03beebf63d8e8200044b5953649 WHIRLPOOL 1a9a02921f76bec679338f6fba7d2c3d178e5e773627f9d56867f43986d2d10d450a93ddb3e1585154d79779443b2db5e8d6b72533195113463ed5be59d9b6a3
+MISC ChangeLog 23325 SHA256 d4e7b4899a3288c1f28a0a3f7748ccc1f0e469c66d14f413651c54aa6afe531b SHA512 f3898c71a72119bd13f370405fba8e9e2fd3c2336158bbc1fcd70e4ada14d35d60c4174e58855622ecffcaa132f5334a74c9003ea46a3c7360fbbdd018606725 WHIRLPOOL 35c49ba847aebefc3a72b0e63203672a7bef2c25efc62c02dc64531870f2b4e29ac98095b8282e3f649ec7f605b2fffcf53c594af3d0b6d165ef4267ad572e0f
MISC metadata.xml 232 SHA256 0f9362f8e4539dec9b2feb1bd93d34e4dff44290f4dac44dd50f9d44de62360e SHA512 79b3d9679dd2d61479a24ef159f6a23758dad2b77679824bae7758c8f47375b4548e0adf135b3dae5c6d6eff23d134f9477a06fd29789d4fb98670431670bb01 WHIRLPOOL 2ac86da5a1d1512f358400d0616ca3baba6ad55d68ad68296975192cf4f60ed55a3faefe0c3290720d61f117e6c8b24b37cd017e8b8c21c77f977dda8d3212fa
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v2
-iF4EAREIAAYFAlVI7qsACgkQXYk9GL8g3FGtowD/UU2P7jRiELm1+eOYTRFE0Bt+
-vD3ndyqm4gkAJjsuXo4BAKnXCLhtoDAB0q+mlzPqhd4S+Hs02eXog5K0n1PzOi92
-=A5qN
+iQEcBAEBCAAGBQJVU7ZEAAoJEP7VAChXwav6CdYH/2A3jvJmwVoXm1jqOCSe3k2y
+/YfTKXKceL0xEi/Hj7KkiniYGQhDDC16BxZdz/9vt1gv0RO4yiNmpf+JLEePoEaW
+8fgAQA1pzli2H3jw3iahqP3F79oaiW5UEMqBz4aPqxvXxWy9BTPbWv/aMX+kJP+l
+mmNxjTOWoo9Ul6Z7ev1kKKjhWyYUPRr/phg6w0RunTSen3gGmS04SY9z/grw5RIH
+w2yJ2uU7f5q0vjegV5dsJf9FnY4IZO8uVXIC/4b0/jmxvF6MlOmbPI+b81VvffdU
+12n53dLXFEMXWN0/GQuVnq5aAkYXIIFpR/zs0aRN262rXRBHESR+hl23VKP1sm8=
+=8Udx
-----END PGP SIGNATURE-----
diff --git a/app-crypt/pinentry/files/pinentry-0.9.2-cmd_confirm.patch b/app-crypt/pinentry/files/pinentry-0.9.2-cmd_confirm.patch
new file mode 100644
index 000000000000..8724d337f00d
--- /dev/null
+++ b/app-crypt/pinentry/files/pinentry-0.9.2-cmd_confirm.patch
@@ -0,0 +1,47 @@
+From 29236f84aca64be72c97a9b5513457a4e45afbc6 Mon Sep 17 00:00:00 2001
+From: "Neal H. Walfield" <neal@gnu.org>
+Date: Mon, 11 May 2015 16:14:58 +0200
+Subject: [PATCH] Implement cmd_confirm in terms of cmd_message.
+
+* pinentry/pinentry.c (cmd_confirm): Implement cmd_confirm in terms of
+cmd_message.
+---
+ pinentry/pinentry.c | 22 +---------------------
+ 1 file changed, 1 insertion(+), 21 deletions(-)
+
+diff --git a/pinentry/pinentry.c b/pinentry/pinentry.c
+index f28c576..11a8027 100644
+--- a/pinentry/pinentry.c
++++ b/pinentry/pinentry.c
+@@ -1146,27 +1146,7 @@ cmd_confirm (ASSUAN_CONTEXT ctx, char *line)
+ static int
+ cmd_message (ASSUAN_CONTEXT ctx, char *line)
+ {
+- int result;
+-
+- pinentry.one_button = 1;
+- pinentry.quality_bar = 0;
+- pinentry.close_button = 0;
+- pinentry.locale_err = 0;
+- pinentry.specific_err = 0;
+- result = (*pinentry_cmd_handler) (&pinentry);
+- if (pinentry.error)
+- {
+- free (pinentry.error);
+- pinentry.error = NULL;
+- }
+-
+- if (pinentry.close_button)
+- assuan_write_status (ctx, "BUTTON_INFO", "close");
+-
+- return result ? 0
+- : (pinentry.specific_err? pinentry.specific_err :
+- pinentry.locale_err? ASSUAN_Locale_Problem
+- : 0);
++ return cmd_confirm (ctx, "--one-button");
+ }
+
+ /* GETINFO <what>
+--
+2.1.4
+
diff --git a/app-crypt/pinentry/files/pinentry-0.9.2-gnome3.patch b/app-crypt/pinentry/files/pinentry-0.9.2-gnome3.patch
new file mode 100644
index 000000000000..040bc50eebc7
--- /dev/null
+++ b/app-crypt/pinentry/files/pinentry-0.9.2-gnome3.patch
@@ -0,0 +1,518 @@
+From be87785005d256b7f3dacc607ba5ea0a14de8593 Mon Sep 17 00:00:00 2001
+From: "Neal H. Walfield" <neal@gnu.org>
+Date: Tue, 12 May 2015 17:07:49 +0200
+Subject: [PATCH] Add a GNOME3 pinentry based on gcr.
+
+* configure.ac (--enable-pinentry-gnome3): Option to enable the GNOME3
+pinentry.
+(pinentry_gnome_3): Set to yes if enabled and gcr-3 and gcr-base-3 gcr
+is available.
+(GNOME3CFLAGS): Define and AC_SUBST.
+(GNOME3LIBS): Define and AC_SUBST.
+(GCR_API_SUBJECT_TO_CHANGE): Define.
+(BUILD_PINENTRY_GNOME_3): Define.
+* Makefile.am (pinentry_gnome_3): Define.
+(SUBDIRS): Add ${pinentry_gnome_3}.
+* gnome3/Makefile.am: New file.
+* gnome3/pinentry-gnome3.c: New file.
+---
+ Makefile.am | 11 +-
+ configure.ac | 62 +++++++++--
+ gnome3/Makefile.am | 39 +++++++
+ gnome3/pinentry-gnome3.c | 271 +++++++++++++++++++++++++++++++++++++++++++++++
+ 4 files changed, 370 insertions(+), 13 deletions(-)
+ create mode 100644 gnome3/Makefile.am
+ create mode 100644 gnome3/pinentry-gnome3.c
+
+diff --git a/Makefile.am b/Makefile.am
+index f8f7aac..177f37e 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,5 +1,5 @@
+ # Makefile.am
+-# Copyright (C) 2002, 2012 g10 Code GmbH
++# Copyright (C) 2002, 2012, 2015 g10 Code GmbH
+ #
+ # This file is part of PINENTRY.
+ #
+@@ -46,6 +46,12 @@ else
+ pinentry_gtk_2 =
+ endif
+
++if BUILD_PINENTRY_GNOME_3
++pinentry_gnome_3 = gnome3
++else
++pinentry_gnome_3 =
++endif
++
+ if BUILD_PINENTRY_QT4
+ pinentry_qt4 = qt4
+ else
+@@ -59,7 +65,8 @@ pinentry_w32 =
+ endif
+
+ SUBDIRS = assuan secmem pinentry ${pinentry_curses} ${pinentry_tty} \
+- ${pinentry_gtk_2} ${pinentry_qt4} ${pinentry_w32} doc
++ ${pinentry_gtk_2} ${pinentry_gnome_3} ${pinentry_qt4} \
++ ${pinentry_w32} doc
+
+
+ install-exec-local:
+diff --git a/configure.ac b/configure.ac
+index c50ce68..9948d1f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -274,28 +274,34 @@ fi
+
+
+ dnl
+-dnl Check for GTK+-2 pinentry program.
++dnl Check for GTK+-2 / GNOME3 pinentry programs.
+ dnl
+ AC_ARG_ENABLE(pinentry-gtk2,
+ AC_HELP_STRING([--enable-pinentry-gtk2], [build GTK+-2 pinentry]),
+ pinentry_gtk_2=$enableval, pinentry_gtk_2=maybe)
+
++AC_ARG_ENABLE(pinentry-gnome3,
++ AC_HELP_STRING([--enable-pinentry-gnome3], [build GNOME 3 pinentry]),
++ pinentry_gnome_3=$enableval, pinentry_gnome_3=maybe)
++
+ dnl check for pkg-config
+-if test "$pinentry_gtk_2" != "no"; then
++if test "$pinentry_gtk_2" != "no" -o "$pinentry_gnome_3" != "no"; then
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+ if test x"${PKG_CONFIG}" = xno ; then
+ pinentry_gtk_2=no
++ pinentry_gnome_3=no
+ fi
+ fi
+
+ dnl check if the module gtk+-2.0 exists
+-if test "$pinentry_gtk_2" != "no"; then
++if test "$pinentry_gtk_2" != "no" -o "$pinentry_gnome_3" != "no"; then
+ AC_MSG_CHECKING([for gtk+-2])
+ "${PKG_CONFIG}" --exists gtk+-2.0
+ if test $? -ne 0 ; then
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([pkg-config could not find the module gtk+-2.0])
+ pinentry_gtk_2=no
++ pinentry_gnome_3=no
+ else
+ AC_MSG_RESULT([yes])
+ AC_MSG_CHECKING([gtk+-2 version >= 2.4.0])
+@@ -305,17 +311,45 @@ if test "$pinentry_gtk_2" != "no"; then
+ if test $? -ne 0 ; then
+ AC_MSG_WARN([building GTK+-2 pinentry disabled])
+ pinentry_gtk_2=no
++ pinentry_gnome_3=no
+ else
+ GTK2CFLAGS=`"${PKG_CONFIG}" --cflags gtk+-2.0`
+ GTK2LIBS=`"${PKG_CONFIG}" --libs gtk+-2.0`
+ AC_SUBST(GTK2CFLAGS)
+ AC_SUBST(GTK2LIBS)
+- pinentry_gtk_2=yes
++ if test "$pinentry_gtk_2" != "no"
++ then
++ pinentry_gtk_2=yes
++ fi
++ if test "$pinentry_gnome_3" != "no"
++ then
++ pinentry_gnome_3=yes
++ fi
+ fi
+ fi
+ fi
+ AM_CONDITIONAL(BUILD_PINENTRY_GTK_2, test "$pinentry_gtk_2" = "yes")
+
++if test "$pinentry_gnome_3" != "no"; then
++ AC_MSG_CHECKING([for gcr])
++ "${PKG_CONFIG}" --exists gcr-3,gcr-base-3
++ if test $? -ne 0 ; then
++ AC_MSG_RESULT([no])
++ AC_MSG_WARN([pkg-config could not find the module gcr-3,gcr-base-3])
++ pinentry_gnome_3=no
++ else
++ AC_MSG_RESULT([yes])
++ GNOME3CFLAGS=`"${PKG_CONFIG}" --cflags gcr-3,gcr-base-3`
++ GNOME3LIBS=`"${PKG_CONFIG}" --libs gcr-3,gcr-base-3`
++ AC_SUBST(GNOME3CFLAGS)
++ AC_SUBST(GNOME3LIBS)
++ AC_DEFINE(GCR_API_SUBJECT_TO_CHANGE, 1, [Nod nod])
++ pinentry_gnome_3=yes
++ fi
++fi
++
++AM_CONDITIONAL(BUILD_PINENTRY_GNOME_3, test "$pinentry_gnome_3" = "yes")
++
+ dnl
+ dnl Check for libsecret.
+ dnl
+@@ -450,16 +484,20 @@ else
+ if test "$pinentry_qt4" = "yes"; then
+ PINENTRY_DEFAULT=pinentry-qt4
+ else
+- if test "$pinentry_curses" = "yes"; then
+- PINENTRY_DEFAULT=pinentry-curses
++ if test "$pinentry_gnome_3" = "yes"; then
++ PINENTRY_DEFAULT=pinentry-gnome3
+ else
+- if test "$pinentry_tty" = "yes"; then
+- PINENTRY_DEFAULT=pinentry-tty
++ if test "$pinentry_curses" = "yes"; then
++ PINENTRY_DEFAULT=pinentry-curses
+ else
+- if test "$pinentry_w32" = "yes"; then
+- PINENTRY_DEFAULT=pinentry-w32
++ if test "$pinentry_tty" = "yes"; then
++ PINENTRY_DEFAULT=pinentry-tty
+ else
+- AC_MSG_ERROR([[No pinentry enabled.]])
++ if test "$pinentry_w32" = "yes"; then
++ PINENTRY_DEFAULT=pinentry-w32
++ else
++ AC_MSG_ERROR([[No pinentry enabled.]])
++ fi
+ fi
+ fi
+ fi
+@@ -475,6 +513,7 @@ pinentry/Makefile
+ curses/Makefile
+ tty/Makefile
+ gtk+-2/Makefile
++gnome3/Makefile
+ qt4/Makefile
+ w32/Makefile
+ doc/Makefile
+@@ -493,6 +532,7 @@ AC_MSG_NOTICE([
+ Curses Pinentry ..: $pinentry_curses
+ TTY Pinentry .....: $pinentry_tty
+ GTK+-2 Pinentry ..: $pinentry_gtk_2
++ GNOME 3 Pinentry .: $pinentry_gnome_3
+ Qt4 Pinentry .....: $pinentry_qt4 $pinentry_qt4_clip_msg
+ W32 Pinentry .....: $pinentry_w32
+
+diff --git a/gnome3/Makefile.am b/gnome3/Makefile.am
+new file mode 100644
+index 0000000..78df706
+--- /dev/null
++++ b/gnome3/Makefile.am
+@@ -0,0 +1,39 @@
++# Makefile.am - PIN entry GTK+ frontend.
++# Copyright (C) 2002, 2015 g10 Code GmbH
++#
++# This file is part of PINENTRY.
++#
++# PINENTRY is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# PINENTRY is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
++
++## Process this file with automake to produce Makefile.in
++
++bin_PROGRAMS = pinentry-gnome3
++
++if FALLBACK_CURSES
++ncurses_include = $(NCURSES_INCLUDE)
++libcurses = ../pinentry/libpinentry-curses.a $(LIBCURSES) $(LIBICONV)
++else
++ncurses_include =
++libcurses =
++endif
++
++AM_CPPFLAGS = $(COMMON_CFLAGS) $(GNOME3CFLAGS) \
++ $(ncurses_include) -I$(top_srcdir)/assuan \
++ -I$(top_srcdir)/secmem -I$(top_srcdir)/pinentry
++LDADD = $(COMMON_LIBS) \
++ ../pinentry/libpinentry.a ../assuan/libassuan.a ../secmem/libsecmem.a \
++ $(LIBCAP) $(GNOME3LIBS) $(libcurses)
++
++pinentry_gnome3_SOURCES = pinentry-gnome3.c
+diff --git a/gnome3/pinentry-gnome3.c b/gnome3/pinentry-gnome3.c
+new file mode 100644
+index 0000000..74ec89c
+--- /dev/null
++++ b/gnome3/pinentry-gnome3.c
+@@ -0,0 +1,271 @@
++/* pinentry-gnome3.c
++ Copyright (C) 2015 g10 Code GmbH
++
++ pinentry-gnome-3 is a pinentry application for GNOME 3. It tries
++ to follow the Gnome Human Interface Guide as close as possible.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
++
++#ifdef HAVE_CONFIG_H
++# include "config.h"
++#endif
++
++#include <gtk/gtk.h>
++#include <gcr/gcr-base.h>
++
++#include <string.h>
++
++#include "assuan.h"
++
++#include "memory.h"
++
++#include "pinentry.h"
++
++#ifdef FALLBACK_CURSES
++#include "pinentry-curses.h"
++#endif
++
++
++#define PGMNAME "pinentry-gnome3"
++
++#ifndef VERSION
++# define VERSION
++#endif
++
++static gchar *
++pinentry_utf8_validate (gchar *text)
++{
++ gchar *result;
++
++ if (!text)
++ return NULL;
++
++ if (g_utf8_validate (text, -1, NULL))
++ return g_strdup (text);
++
++ /* Failure: Assume that it was encoded in the current locale and
++ convert it to utf-8. */
++ result = g_locale_to_utf8 (text, -1, NULL, NULL, NULL);
++ if (!result)
++ {
++ gchar *p;
++
++ result = p = g_strdup (text);
++ while (!g_utf8_validate (p, -1, (const gchar **) &p))
++ *p = '?';
++ }
++ return result;
++}
++
++static GcrPrompt *
++create_prompt (pinentry_t pe, int confirm)
++{
++ GcrPrompt *prompt;
++ GError *error = NULL;
++ char *msg;
++
++ /* Create the prompt. */
++ prompt = GCR_PROMPT (gcr_system_prompt_open (-1, NULL, &error));
++ if (! prompt)
++ {
++ g_warning ("couldn't create prompt for gnupg passphrase: %s",
++ error->message);
++ g_error_free (error);
++ return NULL;
++ }
++
++ /* Set the messages for the various buttons, etc. */
++ if (pe->title)
++ {
++ msg = pinentry_utf8_validate (pe->title);
++ gcr_prompt_set_title (prompt, msg);
++ g_free (msg);
++ }
++
++ if (pe->description)
++ {
++ msg = pinentry_utf8_validate (pe->description);
++ gcr_prompt_set_description (prompt, msg);
++ g_free (msg);
++ }
++
++ /* An error occured during the last prompt. */
++ if (pe->error)
++ {
++ msg = pinentry_utf8_validate (pe->error);
++ gcr_prompt_set_warning (prompt, msg);
++ g_free (msg);
++ }
++
++ if (! pe->prompt && confirm)
++ gcr_prompt_set_message (prompt, "Message");
++ else if (! pe->prompt && ! confirm)
++ gcr_prompt_set_message (prompt, "Enter Passphrase");
++ else
++ {
++ msg = pinentry_utf8_validate (pe->prompt);
++ gcr_prompt_set_message (prompt, msg);
++ g_free (msg);
++ }
++
++ if (! confirm)
++ gcr_prompt_set_password_new (prompt, !!pe->repeat_passphrase);
++
++ if (pe->ok || pe->default_ok)
++ {
++ msg = pinentry_utf8_validate (pe->ok ?: pe->default_ok);
++ gcr_prompt_set_continue_label (prompt, msg);
++ g_free (msg);
++ }
++ /* XXX: Disable this button if pe->one_button is set. */
++ if (pe->cancel || pe->default_cancel)
++ {
++ msg = pinentry_utf8_validate (pe->cancel ?: pe->default_cancel);
++ gcr_prompt_set_cancel_label (prompt, msg);
++ g_free (msg);
++ }
++
++ if (confirm && pe->notok)
++ {
++ /* XXX: Add support for the third option. */
++ }
++
++ /* XXX: gcr expects a string; we have a int. */
++ // gcr_prompt_set_caller_window (prompt, pe->parent_wid);
++
++ if (! confirm && pe->allow_external_password_cache && pe->keyinfo)
++ {
++ if (pe->default_pwmngr)
++ {
++ msg = pinentry_utf8_validate (pe->default_pwmngr);
++ gcr_prompt_set_choice_label (prompt, msg);
++ g_free (msg);
++ }
++ else
++ gcr_prompt_set_choice_label
++ (prompt, "Automatically unlock this key, whenever I'm logged in");
++ }
++
++ return prompt;
++}
++
++static int
++gnome3_cmd_handler (pinentry_t pe)
++{
++ GcrPrompt *prompt = NULL;
++ GError *error = NULL;
++ int ret = -1;
++
++ if (pe->pin)
++ /* Passphrase mode. */
++ {
++ const char *password;
++
++ prompt = create_prompt (pe, 0);
++ if (! prompt)
++ /* Something went wrong. */
++ {
++ pe->canceled = 1;
++ return -1;
++ }
++
++ /* "The returned password is valid until the next time a method
++ is called to display another prompt." */
++ password = gcr_prompt_password_run (prompt, NULL, &error);
++ if (error)
++ /* Error. */
++ {
++ pe->specific_err = ASSUAN_General_Error;
++ g_error_free (error);
++ ret = -1;
++ }
++ else if (! password && ! error)
++ /* User cancelled the operation. */
++ ret = -1;
++ else
++ {
++ pinentry_setbufferlen (pe, strlen (password) + 1);
++ if (pe->pin)
++ strcpy (pe->pin, password);
++
++ if (pe->repeat_passphrase)
++ pe->repeat_okay = 1;
++
++ ret = 1;
++ }
++ }
++ else
++ /* Message box mode. */
++ {
++ GcrPromptReply reply;
++
++ prompt = create_prompt (pe, 1);
++ if (! prompt)
++ /* Something went wrong. */
++ {
++ pe->canceled = 1;
++ return -1;
++ }
++
++ /* XXX: We don't support a third button! */
++
++ reply = gcr_prompt_confirm_run (prompt, NULL, &error);
++ if (error)
++ {
++ pe->specific_err = ASSUAN_General_Error;
++ ret = 0;
++ }
++ else if (reply == GCR_PROMPT_REPLY_CONTINUE
++ /* XXX: Hack since gcr doesn't yet support one button
++ message boxes treat cancel the same as okay. */
++ || pe->one_button)
++ /* Confirmation. */
++ ret = 1;
++ else
++ /* GCR_PROMPT_REPLY_CANCEL */
++ {
++ pe->canceled = 1;
++ ret = 0;
++ }
++ }
++
++ if (prompt)
++ g_clear_object (&prompt);
++ return ret;
++}
++
++pinentry_cmd_handler_t pinentry_cmd_handler = gnome3_cmd_handler;
++
++int
++main (int argc, char *argv[])
++{
++ pinentry_init (PGMNAME);
++
++#ifdef FALLBACK_CURSES
++ if (pinentry_have_display (argc, argv))
++ gtk_init (&argc, &argv);
++ else
++ pinentry_cmd_handler = curses_cmd_handler;
++#else
++ gtk_init (&argc, &argv);
++#endif
++
++ pinentry_parse_opts (argc, argv);
++
++ if (pinentry_loop ())
++ return 1;
++
++ return 0;
++}
+--
+2.1.4
+
diff --git a/app-crypt/pinentry/files/pinentry-0.9.2-handlers-return.patch b/app-crypt/pinentry/files/pinentry-0.9.2-handlers-return.patch
new file mode 100644
index 000000000000..43a84d96c3b5
--- /dev/null
+++ b/app-crypt/pinentry/files/pinentry-0.9.2-handlers-return.patch
@@ -0,0 +1,28 @@
+From 3062742b945f95d72001896f8ba5468b9e63aa9b Mon Sep 17 00:00:00 2001
+From: "Neal H. Walfield" <neal@gnu.org>
+Date: Wed, 13 May 2015 14:20:23 +0200
+Subject: [PATCH 1/1] Don't interpret the handler's return value as the
+ passphrase's length.
+
+* pinentry/pinentry.c (cmd_getpin): Don't interpret the return value
+as the passphrase length. Use strlen instead.
+---
+ pinentry/pinentry.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pinentry/pinentry.c b/pinentry/pinentry.c
+index 53216fc..836ee14 100644
+--- a/pinentry/pinentry.c
++++ b/pinentry/pinentry.c
+@@ -1109,7 +1109,7 @@ cmd_getpin (ASSUAN_CONTEXT ctx, char *line)
+ {
+ if (pinentry.repeat_okay)
+ assuan_write_status (ctx, "PIN_REPEATED", "");
+- result = assuan_send_data (ctx, pinentry.pin, result);
++ result = assuan_send_data (ctx, pinentry.pin, strlen(pinentry.pin));
+ if (!result)
+ result = assuan_send_data (ctx, NULL, 0);
+
+--
+2.1.4
+
diff --git a/app-crypt/pinentry/files/pinentry-0.9.2-linking-order.patch b/app-crypt/pinentry/files/pinentry-0.9.2-linking-order.patch
new file mode 100644
index 000000000000..2006a8ccc610
--- /dev/null
+++ b/app-crypt/pinentry/files/pinentry-0.9.2-linking-order.patch
@@ -0,0 +1,104 @@
+From 496235af8dfd373b54e5610f86bf1cada175ac23 Mon Sep 17 00:00:00 2001
+From: "Neal H. Walfield" <neal@gnu.org>
+Date: Wed, 13 May 2015 21:47:11 +0200
+Subject: [PATCH 1/1] Fix linking order to work when linked with --as-needed.
+
+* curses/Makefile.am (LDADD): Add $(COMMON_LIBS) after all of the
+local objects and object archives.
+* gnome3/Makefile.am (LDADD): Likewise.
+* gtk+-2/Makefile.am (LDADD): Likewise.
+* qt4/Makefile.am (pinentry_qt4_LDADD): Likewise.
+* tty/Makefile.am (LDADD): Likewise.
+
+Reported-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
+---
+ curses/Makefile.am | 5 ++---
+ gnome3/Makefile.am | 5 ++---
+ gtk+-2/Makefile.am | 5 ++---
+ qt4/Makefile.am | 6 +++---
+ tty/Makefile.am | 4 ++--
+ 5 files changed, 11 insertions(+), 14 deletions(-)
+
+diff --git a/curses/Makefile.am b/curses/Makefile.am
+index e8ea031..4d764c7 100644
+--- a/curses/Makefile.am
++++ b/curses/Makefile.am
+@@ -22,9 +22,8 @@
+ bin_PROGRAMS = pinentry-curses
+
+ AM_CPPFLAGS = $(COMMON_CFLAGS) $(NCURSES_INCLUDE) -I$(top_srcdir)/pinentry
+-LDADD = $(COMMON_LIBS) \
+- ../pinentry/libpinentry.a ../pinentry/libpinentry-curses.a \
++LDADD = ../pinentry/libpinentry.a ../pinentry/libpinentry-curses.a \
+ ../assuan/libassuan.a ../secmem/libsecmem.a \
+- $(LIBCAP) $(LIBCURSES) $(LIBICONV)
++ $(COMMON_LIBS) $(LIBCAP) $(LIBCURSES) $(LIBICONV)
+
+ pinentry_curses_SOURCES = pinentry-curses.c
+diff --git a/gnome3/Makefile.am b/gnome3/Makefile.am
+index 78df706..46639de 100644
+--- a/gnome3/Makefile.am
++++ b/gnome3/Makefile.am
+@@ -32,8 +32,7 @@ endif
+ AM_CPPFLAGS = $(COMMON_CFLAGS) $(GNOME3CFLAGS) \
+ $(ncurses_include) -I$(top_srcdir)/assuan \
+ -I$(top_srcdir)/secmem -I$(top_srcdir)/pinentry
+-LDADD = $(COMMON_LIBS) \
+- ../pinentry/libpinentry.a ../assuan/libassuan.a ../secmem/libsecmem.a \
+- $(LIBCAP) $(GNOME3LIBS) $(libcurses)
++LDADD = ../pinentry/libpinentry.a ../assuan/libassuan.a ../secmem/libsecmem.a \
++ $(COMMON_LIBS) $(LIBCAP) $(GNOME3LIBS) $(libcurses)
+
+ pinentry_gnome3_SOURCES = pinentry-gnome3.c
+diff --git a/gtk+-2/Makefile.am b/gtk+-2/Makefile.am
+index c98139f..7e37469 100644
+--- a/gtk+-2/Makefile.am
++++ b/gtk+-2/Makefile.am
+@@ -31,9 +31,8 @@ endif
+
+ AM_CPPFLAGS = $(COMMON_CFLAGS) $(GTK2CFLAGS) $(ncurses_include) \
+ -I$(top_srcdir)/secmem -I$(top_srcdir)/pinentry
+-LDADD = $(COMMON_LIBS) \
+- ../pinentry/libpinentry.a ../assuan/libassuan.a ../secmem/libsecmem.a \
+- $(LIBCAP) $(GTK2LIBS) $(libcurses)
++LDADD = ../pinentry/libpinentry.a ../assuan/libassuan.a ../secmem/libsecmem.a \
++ $(COMMON_LIBS) $(LIBCAP) $(GTK2LIBS) $(libcurses)
+
+ pinentry_gtk_2_SOURCES = pinentry-gtk-2.c \
+ gtksecentry.c gtksecentry.h gseal-gtk-compat.h
+diff --git a/qt4/Makefile.am b/qt4/Makefile.am
+index 31274bb..816aade 100644
+--- a/qt4/Makefile.am
++++ b/qt4/Makefile.am
+@@ -38,10 +38,10 @@ AM_CPPFLAGS = $(COMMON_CFLAGS) \
+ -I$(top_srcdir) -I$(top_srcdir)/assuan -I$(top_srcdir)/secmem \
+ $(ncurses_include) -I$(top_srcdir)/pinentry
+ AM_CXXFLAGS = $(QT4_CORE_CFLAGS) $(QT4_GUI_CFLAGS)
+-pinentry_qt4_LDADD = $(COMMON_LIBS) \
+- $(QT4_CORE_LIBS) $(QT4_GUI_LIBS) $(libcurses) \
++pinentry_qt4_LDADD = \
+ ../pinentry/libpinentry.a $(top_builddir)/assuan/libassuan.a \
+- $(top_builddir)/secmem/libsecmem.a $(LIBCAP)
++ $(top_builddir)/secmem/libsecmem.a \
++ $(COMMON_LIBS) $(QT4_CORE_LIBS) $(QT4_GUI_LIBS) $(libcurses) $(LIBCAP)
+
+ BUILT_SOURCES = \
+ pinentryconfirm.moc qsecurelineedit.moc pinentrydialog.moc
+diff --git a/tty/Makefile.am b/tty/Makefile.am
+index 798c08f..aa805b2 100644
+--- a/tty/Makefile.am
++++ b/tty/Makefile.am
+@@ -21,8 +21,8 @@
+ bin_PROGRAMS = pinentry-tty
+
+ AM_CPPFLAGS = $(COMMON_CFLAGS) -I$(top_srcdir)/pinentry
+-LDADD = $(COMMON_LIBS) ../pinentry/libpinentry.a \
++LDADD = ../pinentry/libpinentry.a \
+ ../assuan/libassuan.a ../secmem/libsecmem.a \
+- $(LIBCAP) $(LIBICONV)
++ $(COMMON_LIBS) $(LIBCAP) $(LIBICONV)
+
+ pinentry_tty_SOURCES = pinentry-tty.c
+--
+2.1.4
+
diff --git a/app-crypt/pinentry/files/pinentry-0.9.2-management.patch b/app-crypt/pinentry/files/pinentry-0.9.2-management.patch
new file mode 100644
index 000000000000..04b2bafe4650
--- /dev/null
+++ b/app-crypt/pinentry/files/pinentry-0.9.2-management.patch
@@ -0,0 +1,136 @@
+From bdd81974633f8e31d582b62999ef9b004bc3b95e Mon Sep 17 00:00:00 2001
+From: "Neal H. Walfield" <neal@gnu.org>
+Date: Wed, 13 May 2015 13:52:03 +0200
+Subject: [PATCH 1/1] Make the management of pinentry.pin more explicit.
+
+* pinentry/pinentry.c: Include <assert.h>.
+(pinentry): Set pin_len to 0.
+(pinentry_setbufferlen): If len is less than 2048, set it to 2048.
+Add an assertion.
+(pinentry_setbuffer_clear): New function that releases the pin buffer.
+(pinentry_setbuffer_init): New function that initializes the pin
+buffer.
+(cmd_getpin): Use pinentry_setbuffer_init and pinentry_setbuffer_clear
+instead of manual memory management.
+(cmd_confirm): Use pinentry_setbuffer_clear instead of manual memory
+management.
+---
+ pinentry/pinentry.c | 52 +++++++++++++++++++++++++++++++++++++++-------------
+ 1 file changed, 39 insertions(+), 13 deletions(-)
+
+diff --git a/pinentry/pinentry.c b/pinentry/pinentry.c
+index 3a44851..53216fc 100644
+--- a/pinentry/pinentry.c
++++ b/pinentry/pinentry.c
+@@ -27,6 +27,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
++#include <assert.h>
+ #ifndef HAVE_W32CE_SYSTEM
+ # include <locale.h>
+ #endif
+@@ -67,7 +68,7 @@ struct pinentry pinentry =
+ NULL, /* Not-Ok button. */
+ NULL, /* Cancel button. */
+ NULL, /* PIN. */
+- 2048, /* PIN length. */
++ 0, /* PIN length. */
+ 0, /* pin_from_cache. */
+ 0, /* Display. */
+ 0, /* TTY name. */
+@@ -354,8 +355,18 @@ char *
+ pinentry_setbufferlen (pinentry_t pin, int len)
+ {
+ char *newp;
+- if (len < pinentry.pin_len)
++
++ if (pin->pin_len)
++ assert (pin->pin);
++ else
++ assert (!pin->pin);
++
++ if (len < 2048)
++ len = 2048;
++
++ if (len <= pin->pin_len)
+ return NULL;
++
+ newp = secmem_realloc (pin->pin, len);
+ if (newp)
+ {
+@@ -371,6 +382,28 @@ pinentry_setbufferlen (pinentry_t pin, int len)
+ return newp;
+ }
+
++static void
++pinentry_setbuffer_clear (pinentry_t pin)
++{
++ if (! pin->pin)
++ {
++ assert (pin->pin_len == 0);
++ return;
++ }
++
++ assert (pin->pin_len > 0);
++
++ secmem_free (pin->pin);
++ pin->pin = NULL;
++ pin->pin_len = 0;
++}
++
++static void
++pinentry_setbuffer_init (pinentry_t pin)
++{
++ pinentry_setbuffer_clear (pin);
++ pinentry_setbufferlen (pin, 0);
++}
+
+ /* Initialize the secure memory subsystem, drop privileges and return.
+ Must be called early. */
+@@ -983,7 +1016,7 @@ cmd_getpin (ASSUAN_CONTEXT ctx, char *line)
+ int set_prompt = 0;
+ int just_read_password_from_cache = 0;
+
+- pinentry.pin = secmem_malloc (pinentry.pin_len);
++ pinentry_setbuffer_init (&pinentry);
+ if (!pinentry.pin)
+ return ASSUAN_Out_Of_Core;
+
+@@ -1065,11 +1098,7 @@ cmd_getpin (ASSUAN_CONTEXT ctx, char *line)
+
+ if (result < 0)
+ {
+- if (pinentry.pin)
+- {
+- secmem_free (pinentry.pin);
+- pinentry.pin = NULL;
+- }
++ pinentry_setbuffer_clear (&pinentry);
+ if (pinentry.specific_err)
+ return pinentry.specific_err;
+ return pinentry.locale_err? ASSUAN_Locale_Problem: ASSUAN_Canceled;
+@@ -1094,11 +1123,7 @@ cmd_getpin (ASSUAN_CONTEXT ctx, char *line)
+ password_cache_save (pinentry.keyinfo, pinentry.pin);
+ }
+
+- if (pinentry.pin)
+- {
+- secmem_free (pinentry.pin);
+- pinentry.pin = NULL;
+- }
++ pinentry_setbuffer_clear (&pinentry);
+
+ return result;
+ }
+@@ -1122,6 +1147,7 @@ cmd_confirm (ASSUAN_CONTEXT ctx, char *line)
+ pinentry.locale_err = 0;
+ pinentry.specific_err = 0;
+ pinentry.canceled = 0;
++ pinentry_setbuffer_clear (&pinentry);
+ result = (*pinentry_cmd_handler) (&pinentry);
+ if (pinentry.error)
+ {
+--
+2.1.4
+
diff --git a/app-crypt/pinentry/files/pinentry-0.9.2-memory.patch b/app-crypt/pinentry/files/pinentry-0.9.2-memory.patch
new file mode 100644
index 000000000000..08cb274c0ce6
--- /dev/null
+++ b/app-crypt/pinentry/files/pinentry-0.9.2-memory.patch
@@ -0,0 +1,32 @@
+From aa04dac66f2ee949e8789a3c91090b01646f2e57 Mon Sep 17 00:00:00 2001
+From: "Neal H. Walfield" <neal@gnu.org>
+Date: Mon, 11 May 2015 16:14:18 +0200
+Subject: [PATCH] Fix memory allocation in pinentry_setbufferlen.
+
+* pinentry/pinentry.c (pinentry_setbufferlen): Set PIN->PIN to a
+buffer that is LEN bytes large, not 2 * PIN->PIN_LENGTH.
+---
+ pinentry/pinentry.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pinentry/pinentry.c b/pinentry/pinentry.c
+index 51c873c..f28c576 100644
+--- a/pinentry/pinentry.c
++++ b/pinentry/pinentry.c
+@@ -356,11 +356,11 @@ pinentry_setbufferlen (pinentry_t pin, int len)
+ char *newp;
+ if (len < pinentry.pin_len)
+ return NULL;
+- newp = secmem_realloc (pin->pin, 2 * pin->pin_len);
++ newp = secmem_realloc (pin->pin, len);
+ if (newp)
+ {
+ pin->pin = newp;
+- pin->pin_len *= 2;
++ pin->pin_len = len;
+ }
+ else
+ {
+--
+2.1.4
+
diff --git a/app-crypt/pinentry/files/pinentry-0.9.2-simplify.patch b/app-crypt/pinentry/files/pinentry-0.9.2-simplify.patch
new file mode 100644
index 000000000000..8249849bce13
--- /dev/null
+++ b/app-crypt/pinentry/files/pinentry-0.9.2-simplify.patch
@@ -0,0 +1,48 @@
+From 831782b3b625ca81624fae0ee184da0d2fc46d96 Mon Sep 17 00:00:00 2001
+From: "Neal H. Walfield" <neal@gnu.org>
+Date: Mon, 11 May 2015 16:35:12 +0200
+Subject: [PATCH 1/1] Simplify code.
+
+* pinentry/pinentry.c (cmd_confirm): Don't use nested ternary
+expressions.
+---
+ pinentry/pinentry.c | 23 +++++++++++++++--------
+ 1 file changed, 15 insertions(+), 8 deletions(-)
+
+diff --git a/pinentry/pinentry.c b/pinentry/pinentry.c
+index 11a8027..3a44851 100644
+--- a/pinentry/pinentry.c
++++ b/pinentry/pinentry.c
+@@ -1132,14 +1132,21 @@ cmd_confirm (ASSUAN_CONTEXT ctx, char *line)
+ if (pinentry.close_button)
+ assuan_write_status (ctx, "BUTTON_INFO", "close");
+
+- return result ? 0
+- : (pinentry.specific_err? pinentry.specific_err :
+- pinentry.locale_err? ASSUAN_Locale_Problem
+- : (pinentry.one_button
+- ? 0
+- : (pinentry.canceled
+- ? ASSUAN_Canceled
+- : ASSUAN_Not_Confirmed)));
++ if (result)
++ return 0;
++
++ if (pinentry.specific_err)
++ return pinentry.specific_err;
++
++ if (pinentry.locale_err)
++ return ASSUAN_Locale_Problem;
++
++ if (pinentry.one_button)
++ return 0;
++
++ if (pinentry.canceled)
++ return ASSUAN_Canceled;
++ return ASSUAN_Not_Confirmed;
+ }
+
+
+--
+2.1.4
+
diff --git a/app-crypt/pinentry/pinentry-0.9.2.ebuild b/app-crypt/pinentry/pinentry-0.9.2.ebuild
new file mode 100644
index 000000000000..158f31182b9a
--- /dev/null
+++ b/app-crypt/pinentry/pinentry-0.9.2.ebuild
@@ -0,0 +1,92 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-crypt/pinentry/pinentry-0.9.2.ebuild,v 1.1 2015/05/13 20:38:27 k_f Exp $
+
+EAPI=5
+
+inherit qmake-utils autotools multilib eutils flag-o-matic toolchain-funcs
+
+DESCRIPTION="Collection of simple PIN or passphrase entry dialogs which utilize the Assuan protocol"
+HOMEPAGE="http://gnupg.org/aegypten2/index.html"
+SRC_URI="mirror://gnupg/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="clipboard gtk ncurses qt4 caps gnome-keyring static"
+
+RDEPEND="
+ app-eselect/eselect-pinentry
+ caps? ( sys-libs/libcap )
+ gtk? ( x11-libs/gtk+:2 )
+ ncurses? ( sys-libs/ncurses )
+ qt4? ( >=dev-qt/qtgui-4.4.1:4 )
+ static? ( >=sys-libs/ncurses-5.7-r5[static-libs,-gpm] )
+"
+DEPEND="${RDEPEND}
+ sys-devel/gettext
+ gtk? ( virtual/pkgconfig )
+ qt4? ( virtual/pkgconfig )
+ gnome-keyring? ( app-crypt/libsecret )
+"
+REQUIRED_USE="
+ || ( ncurses gtk qt4 )
+ gtk? ( !static )
+ qt4? ( !static )
+ static? ( ncurses )
+"
+
+DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO )
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-0.8.2-ncurses.patch"
+ epatch "${FILESDIR}/${P}-handlers-return.patch"
+ epatch "${FILESDIR}/${P}-gnome3.patch"
+ epatch "${FILESDIR}/${P}-simplify.patch"
+ epatch "${FILESDIR}/${P}-cmd_confirm.patch"
+ epatch "${FILESDIR}/${P}-memory.patch"
+ epatch "${FILESDIR}/${P}-management.patch"
+ epatch "${FILESDIR}/${P}-linking-order.patch"
+ eautoreconf
+}
+
+src_configure() {
+ use static && append-ldflags -static
+ [[ "$(gcc-major-version)" -ge 5 ]] && append-cxxflags -std=gnu++11
+
+ # Issues finding qt on multilib systems
+ export QTLIB="${QTDIR}/$(get_libdir)"
+
+ econf \
+ --enable-pinentry-tty \
+ $(use_enable gtk pinentry-gtk2) \
+ $(use_enable ncurses pinentry-curses) \
+ $(use_enable ncurses fallback-curses) \
+ $(use_enable qt4 pinentry-qt4) \
+ $(use qt4 && use_enable clipboard pinentry-qt4-clipboard) \
+ $(use_with caps libcap) \
+ $(use_enable gnome-keyring libsecret)
+ MOC="$(qt4_get_bindir)"/moc
+}
+
+src_install() {
+ default
+ rm -f "${ED}"/usr/bin/pinentry || die
+}
+
+pkg_postinst() {
+ if ! has_version 'app-crypt/pinentry' || has_version '<app-crypt/pinentry-0.7.3'; then
+ elog "We no longer install pinentry-curses and pinentry-qt SUID root by default."
+ elog "Linux kernels >=2.6.9 support memory locking for unprivileged processes."
+ elog "The soft resource limit for memory locking specifies the limit an"
+ elog "unprivileged process may lock into memory. You can also use POSIX"
+ elog "capabilities to allow pinentry to lock memory. To do so activate the caps"
+ elog "USE flag and add the CAP_IPC_LOCK capability to the permitted set of"
+ elog "your users."
+ fi
+ eselect pinentry update ifunset
+}
+
+pkg_postrm() {
+ eselect pinentry update ifunset
+}