summaryrefslogtreecommitdiffstats
path: root/tools/gpgtar-list.c
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2015-11-30 16:21:22 +0100
committerJustus Winter <justus@g10code.com>2015-12-04 12:52:40 +0100
commit0c0dafd8e89bb702e856c661c1561e10cdcaf37f (patch)
treec5873a51c9a8ba8edf13d49c21d416a8d1011697 /tools/gpgtar-list.c
parentcommon: Add a stream interface to 'sh-exectool'. (diff)
downloadgnupg2-0c0dafd8e89bb702e856c661c1561e10cdcaf37f.tar.xz
gnupg2-0c0dafd8e89bb702e856c661c1561e10cdcaf37f.zip
tools/gpgtar: Use the new exectool helper.
* tools/Makefile.am: gpgtar now requires neither npth nor libassuan. * tools/gpgtar-create.c (gpgtar_create): Use the new 'sh-exectool' helper. * tools/gpgtar-extract.c (gpgtar_extract): Likewise. * tools/gpgtar-list.c (gpgtar_list): Likewise. * tools/gpgtar.c (main): Set default gpg program. Drop the initialization of npth and libassuan. Signed-off-by: Justus Winter <justus@g10code.com>
Diffstat (limited to 'tools/gpgtar-list.c')
-rw-r--r--tools/gpgtar-list.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/tools/gpgtar-list.c b/tools/gpgtar-list.c
index cb2ca5dac..7bf4d494b 100644
--- a/tools/gpgtar-list.c
+++ b/tools/gpgtar-list.c
@@ -26,7 +26,7 @@
#include "i18n.h"
#include "gpgtar.h"
-#include "../common/call-gpg.h"
+#include "../common/sh-exectool.h"
@@ -299,6 +299,10 @@ gpgtar_list (const char *filename, int decrypt)
if (decrypt)
{
+ int i;
+ strlist_t arg;
+ const char **argv;
+
cipher_stream = stream;
stream = es_fopenmem (0, "rwb");
if (! stream)
@@ -306,8 +310,24 @@ gpgtar_list (const char *filename, int decrypt)
err = gpg_error_from_syserror ();
goto leave;
}
- err = gpg_decrypt_stream (NULL, opt.gpg_program, opt.gpg_arguments,
- cipher_stream, stream);
+
+ argv = xtrycalloc (strlist_length (opt.gpg_arguments) + 2,
+ sizeof *argv);
+ if (argv == NULL)
+ {
+ err = gpg_error_from_syserror ();
+ goto leave;
+ }
+ i = 0;
+ argv[i++] = "--decrypt";
+ for (arg = opt.gpg_arguments; arg; arg = arg->next)
+ argv[i++] = arg->d;
+ argv[i++] = NULL;
+ assert (i == strlist_length (opt.gpg_arguments) + 2);
+
+ err = sh_exec_tool_stream (opt.gpg_program, argv,
+ cipher_stream, stream);
+ xfree (argv);
if (err)
goto leave;