summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/Makefile.in24
-rw-r--r--tests/gpg/Makefile.am11
-rw-r--r--tests/gpg/Makefile.in43
-rw-r--r--tests/gpg/t-decrypt-verify.c2
-rw-r--r--tests/gpg/t-thread-keylist-verify.c142
-rw-r--r--tests/gpg/t-thread-keylist.c85
-rw-r--r--tests/gpg/t-verify.c49
-rw-r--r--tests/gpgsm/Makefile.am2
-rw-r--r--tests/gpgsm/Makefile.in5
-rw-r--r--tests/gpgsm/cms-decrypt.c2
-rw-r--r--tests/gpgsm/cms-keylist.c2
-rw-r--r--tests/opassuan/Makefile.in3
-rw-r--r--tests/opassuan/t-command.c2
-rw-r--r--tests/run-decrypt.c55
-rw-r--r--tests/run-encrypt.c2
-rw-r--r--tests/run-export.c2
-rw-r--r--tests/run-genkey.c2
-rw-r--r--tests/run-identify.c2
-rw-r--r--tests/run-import.c2
-rw-r--r--tests/run-keylist.c2
-rw-r--r--tests/run-keysign.c2
-rw-r--r--tests/run-sign.c18
-rw-r--r--tests/run-support.h2
-rw-r--r--tests/run-swdb.c151
-rw-r--r--tests/run-tofu.c24
-rw-r--r--tests/run-verify.c18
27 files changed, 614 insertions, 44 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c71914f..30c35f0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,7 +15,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
-# License along with this program; if not, see <http://www.gnu.org/licenses/>.
+# License along with this program; if not, see <https://www.gnu.org/licenses/>.
## Process this file with automake to produce Makefile.in
@@ -33,7 +33,7 @@ noinst_HEADERS = run-support.h
noinst_PROGRAMS = $(TESTS) run-keylist run-export run-import run-sign \
run-verify run-encrypt run-identify run-decrypt run-genkey \
- run-keysign run-tofu
+ run-keysign run-tofu run-swdb
if RUN_GPG_TESTS
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 7af2558..a908f95 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -31,7 +31,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
-# License along with this program; if not, see <http://www.gnu.org/licenses/>.
+# License along with this program; if not, see <https://www.gnu.org/licenses/>.
VPATH = @srcdir@
@@ -103,7 +103,7 @@ noinst_PROGRAMS = $(am__EXEEXT_1) run-keylist$(EXEEXT) \
run-export$(EXEEXT) run-import$(EXEEXT) run-sign$(EXEEXT) \
run-verify$(EXEEXT) run-encrypt$(EXEEXT) run-identify$(EXEEXT) \
run-decrypt$(EXEEXT) run-genkey$(EXEEXT) run-keysign$(EXEEXT) \
- run-tofu$(EXEEXT)
+ run-tofu$(EXEEXT) run-swdb$(EXEEXT)
subdir = tests
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/build-aux/mkinstalldirs \
@@ -169,6 +169,10 @@ run_sign_SOURCES = run-sign.c
run_sign_OBJECTS = run-sign.$(OBJEXT)
run_sign_LDADD = $(LDADD)
run_sign_DEPENDENCIES = ../src/libgpgme.la
+run_swdb_SOURCES = run-swdb.c
+run_swdb_OBJECTS = run-swdb.$(OBJEXT)
+run_swdb_LDADD = $(LDADD)
+run_swdb_DEPENDENCIES = ../src/libgpgme.la
run_tofu_SOURCES = run-tofu.c
run_tofu_OBJECTS = run-tofu.$(OBJEXT)
run_tofu_LDADD = $(LDADD)
@@ -225,12 +229,12 @@ am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = run-decrypt.c run-encrypt.c run-export.c run-genkey.c \
run-identify.c run-import.c run-keylist.c run-keysign.c \
- run-sign.c run-tofu.c run-verify.c t-data.c t-engine-info.c \
- t-version.c
+ run-sign.c run-swdb.c run-tofu.c run-verify.c t-data.c \
+ t-engine-info.c t-version.c
DIST_SOURCES = run-decrypt.c run-encrypt.c run-export.c run-genkey.c \
run-identify.c run-import.c run-keylist.c run-keysign.c \
- run-sign.c run-tofu.c run-verify.c t-data.c t-engine-info.c \
- t-version.c
+ run-sign.c run-swdb.c run-tofu.c run-verify.c t-data.c \
+ t-engine-info.c t-version.c
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
@@ -452,6 +456,9 @@ SWIG = @SWIG@
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
@@ -604,6 +611,10 @@ run-sign$(EXEEXT): $(run_sign_OBJECTS) $(run_sign_DEPENDENCIES) $(EXTRA_run_sign
@rm -f run-sign$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(run_sign_OBJECTS) $(run_sign_LDADD) $(LIBS)
+run-swdb$(EXEEXT): $(run_swdb_OBJECTS) $(run_swdb_DEPENDENCIES) $(EXTRA_run_swdb_DEPENDENCIES)
+ @rm -f run-swdb$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(run_swdb_OBJECTS) $(run_swdb_LDADD) $(LIBS)
+
run-tofu$(EXEEXT): $(run_tofu_OBJECTS) $(run_tofu_DEPENDENCIES) $(EXTRA_run_tofu_DEPENDENCIES)
@rm -f run-tofu$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(run_tofu_OBJECTS) $(run_tofu_LDADD) $(LIBS)
@@ -639,6 +650,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-keylist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-keysign.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-sign.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-swdb.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-tofu.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-verify.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-data.Po@am__quote@
diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am
index 2538f63..c46feb0 100644
--- a/tests/gpg/Makefile.am
+++ b/tests/gpg/Makefile.am
@@ -38,7 +38,8 @@ c_tests = \
t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \
t-decrypt t-verify t-decrypt-verify t-sig-notation t-export \
t-import t-trustlist t-edit t-keylist t-keylist-sig t-wait \
- t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed $(tests_unix)
+ t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed $(tests_unix) \
+ t-thread-keylist t-thread-keylist-verify
TESTS = initial.test $(c_tests) final.test
@@ -61,8 +62,10 @@ EXTRA_DIST = initial.test final.test \
AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@
AM_LDFLAGS = -no-install
LDADD = ../../src/libgpgme.la
-t_thread1_LDADD = ../../src/libgpgme-pthread.la -lpthread
-t_cancel_LDADD = ../../src/libgpgme-pthread.la -lpthread
+t_thread1_LDADD = ../../src/libgpgme.la -lpthread
+t_thread_keylist_LDADD = ../../src/libgpgme.la -lpthread
+t_thread_keylist_verify_LDADD = ../../src/libgpgme.la -lpthread
+t_cancel_LDADD = ../../src/libgpgme.la -lpthread
# We don't run t-genkey and t-cancel in the test suite, because it
# takes too long
@@ -90,7 +93,7 @@ export GNUPGHOME := $(abs_builddir)
export GPG_AGENT_INFO :=
./private-keys-v1.d/gpg-sample.stamp: $(srcdir)/$(private_keys)
- test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
+ $(MKDIR_P) ./private-keys-v1.d
for k in $(private_keys); do \
cp $(srcdir)/$$k private-keys-v1.d/$$k.key; \
done
diff --git a/tests/gpg/Makefile.in b/tests/gpg/Makefile.in
index e1e943e..ed75d8a 100644
--- a/tests/gpg/Makefile.in
+++ b/tests/gpg/Makefile.in
@@ -132,13 +132,14 @@ am__EXEEXT_2 = t-encrypt$(EXEEXT) t-encrypt-sym$(EXEEXT) \
t-trustlist$(EXEEXT) t-edit$(EXEEXT) t-keylist$(EXEEXT) \
t-keylist-sig$(EXEEXT) t-wait$(EXEEXT) \
t-encrypt-large$(EXEEXT) t-file-name$(EXEEXT) \
- t-gpgconf$(EXEEXT) t-encrypt-mixed$(EXEEXT) $(am__EXEEXT_1)
+ t-gpgconf$(EXEEXT) t-encrypt-mixed$(EXEEXT) $(am__EXEEXT_1) \
+ t-thread-keylist$(EXEEXT) t-thread-keylist-verify$(EXEEXT)
@HAVE_W32_SYSTEM_FALSE@am__EXEEXT_3 = t-cancel$(EXEEXT)
am__EXEEXT_4 = t-genkey$(EXEEXT) $(am__EXEEXT_3)
PROGRAMS = $(noinst_PROGRAMS)
t_cancel_SOURCES = t-cancel.c
t_cancel_OBJECTS = t-cancel.$(OBJEXT)
-t_cancel_DEPENDENCIES = ../../src/libgpgme-pthread.la
+t_cancel_DEPENDENCIES = ../../src/libgpgme.la
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
@@ -219,9 +220,15 @@ t_signers_SOURCES = t-signers.c
t_signers_OBJECTS = t-signers.$(OBJEXT)
t_signers_LDADD = $(LDADD)
t_signers_DEPENDENCIES = ../../src/libgpgme.la
+t_thread_keylist_SOURCES = t-thread-keylist.c
+t_thread_keylist_OBJECTS = t-thread-keylist.$(OBJEXT)
+t_thread_keylist_DEPENDENCIES = ../../src/libgpgme.la
+t_thread_keylist_verify_SOURCES = t-thread-keylist-verify.c
+t_thread_keylist_verify_OBJECTS = t-thread-keylist-verify.$(OBJEXT)
+t_thread_keylist_verify_DEPENDENCIES = ../../src/libgpgme.la
t_thread1_SOURCES = t-thread1.c
t_thread1_OBJECTS = t-thread1.$(OBJEXT)
-t_thread1_DEPENDENCIES = ../../src/libgpgme-pthread.la
+t_thread1_DEPENDENCIES = ../../src/libgpgme.la
t_trustlist_SOURCES = t-trustlist.c
t_trustlist_OBJECTS = t-trustlist.$(OBJEXT)
t_trustlist_LDADD = $(LDADD)
@@ -273,13 +280,15 @@ SOURCES = t-cancel.c t-decrypt.c t-decrypt-verify.c t-edit.c \
t-encrypt-sign.c t-encrypt-sym.c t-eventloop.c t-export.c \
t-file-name.c t-genkey.c t-gpgconf.c t-import.c t-keylist.c \
t-keylist-sig.c t-sig-notation.c t-sign.c t-signers.c \
- t-thread1.c t-trustlist.c t-verify.c t-wait.c
+ t-thread-keylist.c t-thread-keylist-verify.c t-thread1.c \
+ t-trustlist.c t-verify.c t-wait.c
DIST_SOURCES = t-cancel.c t-decrypt.c t-decrypt-verify.c t-edit.c \
t-encrypt.c t-encrypt-large.c t-encrypt-mixed.c \
t-encrypt-sign.c t-encrypt-sym.c t-eventloop.c t-export.c \
t-file-name.c t-genkey.c t-gpgconf.c t-import.c t-keylist.c \
t-keylist-sig.c t-sig-notation.c t-sign.c t-signers.c \
- t-thread1.c t-trustlist.c t-verify.c t-wait.c
+ t-thread-keylist.c t-thread-keylist-verify.c t-thread1.c \
+ t-trustlist.c t-verify.c t-wait.c
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -459,6 +468,9 @@ SWIG = @SWIG@
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
@@ -534,7 +546,8 @@ c_tests = \
t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \
t-decrypt t-verify t-decrypt-verify t-sig-notation t-export \
t-import t-trustlist t-edit t-keylist t-keylist-sig t-wait \
- t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed $(tests_unix)
+ t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed $(tests_unix) \
+ t-thread-keylist t-thread-keylist-verify
CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \
@@ -554,8 +567,10 @@ EXTRA_DIST = initial.test final.test \
AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@
AM_LDFLAGS = -no-install
LDADD = ../../src/libgpgme.la
-t_thread1_LDADD = ../../src/libgpgme-pthread.la -lpthread
-t_cancel_LDADD = ../../src/libgpgme-pthread.la -lpthread
+t_thread1_LDADD = ../../src/libgpgme.la -lpthread
+t_thread_keylist_LDADD = ../../src/libgpgme.la -lpthread
+t_thread_keylist_verify_LDADD = ../../src/libgpgme.la -lpthread
+t_cancel_LDADD = ../../src/libgpgme.la -lpthread
# We don't run t-genkey and t-cancel in the test suite, because it
# takes too long
@@ -684,6 +699,14 @@ t-signers$(EXEEXT): $(t_signers_OBJECTS) $(t_signers_DEPENDENCIES) $(EXTRA_t_sig
@rm -f t-signers$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(t_signers_OBJECTS) $(t_signers_LDADD) $(LIBS)
+t-thread-keylist$(EXEEXT): $(t_thread_keylist_OBJECTS) $(t_thread_keylist_DEPENDENCIES) $(EXTRA_t_thread_keylist_DEPENDENCIES)
+ @rm -f t-thread-keylist$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_thread_keylist_OBJECTS) $(t_thread_keylist_LDADD) $(LIBS)
+
+t-thread-keylist-verify$(EXEEXT): $(t_thread_keylist_verify_OBJECTS) $(t_thread_keylist_verify_DEPENDENCIES) $(EXTRA_t_thread_keylist_verify_DEPENDENCIES)
+ @rm -f t-thread-keylist-verify$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_thread_keylist_verify_OBJECTS) $(t_thread_keylist_verify_LDADD) $(LIBS)
+
t-thread1$(EXEEXT): $(t_thread1_OBJECTS) $(t_thread1_DEPENDENCIES) $(EXTRA_t_thread1_DEPENDENCIES)
@rm -f t-thread1$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(t_thread1_OBJECTS) $(t_thread1_LDADD) $(LIBS)
@@ -726,6 +749,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-sig-notation.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-sign.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-signers.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-thread-keylist-verify.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-thread-keylist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-thread1.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-trustlist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-verify.Po@am__quote@
@@ -1073,7 +1098,7 @@ export GNUPGHOME := $(abs_builddir)
export GPG_AGENT_INFO :=
./private-keys-v1.d/gpg-sample.stamp: $(srcdir)/$(private_keys)
- test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
+ $(MKDIR_P) ./private-keys-v1.d
for k in $(private_keys); do \
cp $(srcdir)/$$k private-keys-v1.d/$$k.key; \
done
diff --git a/tests/gpg/t-decrypt-verify.c b/tests/gpg/t-decrypt-verify.c
index b774cfd..653d74e 100644
--- a/tests/gpg/t-decrypt-verify.c
+++ b/tests/gpg/t-decrypt-verify.c
@@ -15,7 +15,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
diff --git a/tests/gpg/t-thread-keylist-verify.c b/tests/gpg/t-thread-keylist-verify.c
new file mode 100644
index 0000000..6f747a6
--- /dev/null
+++ b/tests/gpg/t-thread-keylist-verify.c
@@ -0,0 +1,142 @@
+/* t-thread-verify.c - Regression test.
+ Copyright (C) 2015 Intevation GmbH
+
+ This file is part of GPGME.
+
+ GPGME is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ GPGME 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser 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. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <gpgme.h>
+
+#include <pthread.h>
+
+#include "t-support.h"
+
+#define THREAD_COUNT 100
+
+static const char test_text1[] = "Just GNU it!\n";
+static const char test_sig1[] =
+"-----BEGIN PGP SIGNATURE-----\n"
+"\n"
+"iN0EABECAJ0FAjoS+i9FFIAAAAAAAwA5YmFyw7bDpMO8w58gZGFzIHdhcmVuIFVt\n"
+"bGF1dGUgdW5kIGpldHp0IGVpbiBwcm96ZW50JS1aZWljaGVuNRSAAAAAAAgAJGZv\n"
+"b2Jhci4xdGhpcyBpcyBhIG5vdGF0aW9uIGRhdGEgd2l0aCAyIGxpbmVzGhpodHRw\n"
+"Oi8vd3d3Lmd1Lm9yZy9wb2xpY3kvAAoJEC1yfMdoaXc0JBIAoIiLlUsvpMDOyGEc\n"
+"dADGKXF/Hcb+AKCJWPphZCphduxSvrzH0hgzHdeQaA==\n"
+"=nts1\n"
+"-----END PGP SIGNATURE-----\n";
+
+void *
+start_keylist (void *arg)
+{
+ gpgme_error_t err;
+ gpgme_ctx_t ctx;
+ gpgme_key_t key;
+
+ (void)arg;
+ err = gpgme_new (&ctx);
+ fail_if_err (err);
+
+ err = gpgme_op_keylist_start (ctx, NULL, 0);
+ fail_if_err (err);
+
+ while (!(err = gpgme_op_keylist_next (ctx, &key)))
+ {
+ gpgme_key_unref (key);
+ }
+
+ gpgme_release (ctx);
+ return NULL;
+}
+
+void *
+start_verify (void *arg)
+{
+ gpgme_ctx_t ctx;
+ gpgme_error_t err;
+ gpgme_data_t sig, text;
+ gpgme_verify_result_t result;
+ gpgme_signature_t signature;
+
+ (void)arg;
+
+ err = gpgme_new (&ctx);
+ fail_if_err (err);
+
+ /* Checking a valid message. */
+ err = gpgme_data_new_from_mem (&text, test_text1, strlen (test_text1), 0);
+ fail_if_err (err);
+ err = gpgme_data_new_from_mem (&sig, test_sig1, strlen (test_sig1), 0);
+ fail_if_err (err);
+ err = gpgme_op_verify (ctx, sig, text, NULL);
+ fail_if_err (err);
+ result = gpgme_op_verify_result (ctx);
+
+ signature = result->signatures;
+
+ if (strcmp (signature->fpr, "A0FF4590BB6122EDEF6E3C542D727CC768697734"))
+ {
+ fprintf (stderr, "%s:%i: Unexpected fingerprint: %s\n",
+ __FILE__, __LINE__, signature->fpr);
+ exit (1);
+ }
+ if (gpgme_err_code (signature->status) != GPG_ERR_NO_ERROR)
+ {
+ fprintf (stderr, "%s:%i: Unexpected signature status: %s\n",
+ __FILE__, __LINE__, gpgme_strerror (signature->status));
+ exit (1);
+ }
+ gpgme_free (text);
+ gpgme_free (sig);
+ gpgme_release (ctx);
+ return NULL;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int i;
+ pthread_t verify_threads[THREAD_COUNT];
+ pthread_t keylist_threads[THREAD_COUNT];
+ init_gpgme (GPGME_PROTOCOL_OpenPGP);
+
+ (void)argc;
+ (void)argv;
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ {
+ if (pthread_create(&verify_threads[i], NULL, start_verify, NULL) ||
+ pthread_create(&keylist_threads[i], NULL, start_keylist, NULL))
+ {
+ fprintf(stderr, "%s:%i: failed to create threads \n",
+ __FILE__, __LINE__);
+ exit(1);
+ }
+ }
+ for (i = 0; i < THREAD_COUNT; i++)
+ {
+ pthread_join (verify_threads[i], NULL);
+ pthread_join (keylist_threads[i], NULL);
+ }
+ return 0;
+}
diff --git a/tests/gpg/t-thread-keylist.c b/tests/gpg/t-thread-keylist.c
new file mode 100644
index 0000000..c03f1ca
--- /dev/null
+++ b/tests/gpg/t-thread-keylist.c
@@ -0,0 +1,85 @@
+/* t-thread-verify.c - Regression test.
+ Copyright (C) 2015 Intevation GmbH
+
+ This file is part of GPGME.
+
+ GPGME is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ GPGME 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser 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. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <gpgme.h>
+
+#include <pthread.h>
+
+#include "t-support.h"
+
+#define THREAD_COUNT 100
+
+void *
+start_keylist (void *arg)
+{
+ gpgme_error_t err;
+ gpgme_ctx_t ctx;
+ gpgme_key_t key;
+
+ (void) arg;
+ err = gpgme_new (&ctx);
+ fail_if_err (err);
+
+ err = gpgme_op_keylist_start (ctx, NULL, 0);
+ fail_if_err (err);
+
+ while (!(err = gpgme_op_keylist_next (ctx, &key)))
+ {
+ gpgme_key_unref (key);
+ }
+
+ gpgme_release (ctx);
+
+ return NULL;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int i;
+ pthread_t keylist_threads[THREAD_COUNT];
+ init_gpgme (GPGME_PROTOCOL_OpenPGP);
+
+ (void)argc;
+ (void)argv;
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ {
+ if (pthread_create(&keylist_threads[i], NULL, start_keylist, NULL))
+ {
+ fprintf(stderr, "%s:%i: failed to create threads \n",
+ __FILE__, __LINE__);
+ exit(1);
+ }
+ }
+ for (i = 0; i < THREAD_COUNT; i++)
+ {
+ pthread_join (keylist_threads[i], NULL);
+ }
+ return 0;
+}
diff --git a/tests/gpg/t-verify.c b/tests/gpg/t-verify.c
index 9842d3a..f955cc9 100644
--- a/tests/gpg/t-verify.c
+++ b/tests/gpg/t-verify.c
@@ -209,6 +209,7 @@ main (int argc, char *argv[])
gpgme_error_t err;
gpgme_data_t sig, text;
gpgme_verify_result_t result;
+ const char *s;
(void)argc;
(void)argv;
@@ -270,6 +271,54 @@ main (int argc, char *argv[])
exit (1);
}
+ /* Checking that set/get_sernder works. */
+ err = gpgme_set_sender (ctx, "foo@example.org");
+ fail_if_err (err);
+ s = gpgme_get_sender (ctx);
+ if (!s || strcmp (s, "foo@example.org"))
+ {
+ fprintf (stderr, "%s:%i: gpgme_{set,get}_sender mismatch\n",
+ __FILE__, __LINE__);
+ exit (1);
+ }
+
+ err = gpgme_set_sender (ctx, "<bar@example.org>");
+ fail_if_err (err);
+ s = gpgme_get_sender (ctx);
+ if (!s || strcmp (s, "bar@example.org"))
+ {
+ fprintf (stderr, "%s:%i: gpgme_{set,get}_sender mismatch\n",
+ __FILE__, __LINE__);
+ exit (1);
+ }
+
+ err = gpgme_set_sender (ctx, "Foo bar (comment) <foo@example.org>");
+ fail_if_err (err);
+ s = gpgme_get_sender (ctx);
+ if (!s || strcmp (s, "foo@example.org"))
+ {
+ fprintf (stderr, "%s:%i: gpgme_{set,get}_sender mismatch\n",
+ __FILE__, __LINE__);
+ exit (1);
+ }
+
+ err = gpgme_set_sender (ctx, "foo");
+ if (gpgme_err_code (err) != GPG_ERR_INV_VALUE)
+ {
+ fprintf (stderr, "%s:%i: gpgme_set_sender didn't detect bogus address\n",
+ __FILE__, __LINE__);
+ exit (1);
+ }
+ /* (the former address should still be there.) */
+ s = gpgme_get_sender (ctx);
+ if (!s || strcmp (s, "foo@example.org"))
+ {
+ fprintf (stderr, "%s:%i: gpgme_{set,get}_sender mismatch\n",
+ __FILE__, __LINE__);
+ exit (1);
+ }
+
+
gpgme_data_release (sig);
gpgme_data_release (text);
gpgme_release (ctx);
diff --git a/tests/gpgsm/Makefile.am b/tests/gpgsm/Makefile.am
index 41645b6..46d6a9b 100644
--- a/tests/gpgsm/Makefile.am
+++ b/tests/gpgsm/Makefile.am
@@ -70,7 +70,7 @@ export GPG_AGENT_INFO :=
echo faked-system-time 1008241200 >> ./gpgsm.conf
./private-keys-v1.d/$(key_id).key: $(srcdir)/$(key_id)
- test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
+ $(MKDIR_P) ./private-keys-v1.d
cp $(srcdir)/$(key_id) private-keys-v1.d/$(key_id).key
./trustlist.txt:
diff --git a/tests/gpgsm/Makefile.in b/tests/gpgsm/Makefile.in
index d653b96..8f2109b 100644
--- a/tests/gpgsm/Makefile.in
+++ b/tests/gpgsm/Makefile.in
@@ -390,6 +390,9 @@ SWIG = @SWIG@
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
@@ -917,7 +920,7 @@ export GPG_AGENT_INFO :=
echo faked-system-time 1008241200 >> ./gpgsm.conf
./private-keys-v1.d/$(key_id).key: $(srcdir)/$(key_id)
- test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
+ $(MKDIR_P) ./private-keys-v1.d
cp $(srcdir)/$(key_id) private-keys-v1.d/$(key_id).key
./trustlist.txt:
diff --git a/tests/gpgsm/cms-decrypt.c b/tests/gpgsm/cms-decrypt.c
index 580832d..794f013 100644
--- a/tests/gpgsm/cms-decrypt.c
+++ b/tests/gpgsm/cms-decrypt.c
@@ -14,7 +14,7 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
diff --git a/tests/gpgsm/cms-keylist.c b/tests/gpgsm/cms-keylist.c
index 7ed3a4e..ffe17e2 100644
--- a/tests/gpgsm/cms-keylist.c
+++ b/tests/gpgsm/cms-keylist.c
@@ -14,7 +14,7 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
diff --git a/tests/opassuan/Makefile.in b/tests/opassuan/Makefile.in
index 1740ad0..797c4ae 100644
--- a/tests/opassuan/Makefile.in
+++ b/tests/opassuan/Makefile.in
@@ -345,6 +345,9 @@ SWIG = @SWIG@
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
diff --git a/tests/opassuan/t-command.c b/tests/opassuan/t-command.c
index 9c791ee..fd0ea71 100644
--- a/tests/opassuan/t-command.c
+++ b/tests/opassuan/t-command.c
@@ -14,7 +14,7 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
diff --git a/tests/run-decrypt.c b/tests/run-decrypt.c
index 6d38aee..8bcca0e 100644
--- a/tests/run-decrypt.c
+++ b/tests/run-decrypt.c
@@ -15,7 +15,7 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
@@ -51,9 +51,13 @@ print_result (gpgme_decrypt_result_t result)
{
gpgme_recipient_t recp;
int count = 0;
+
printf ("Original file name: %s\n", nonnull(result->file_name));
printf ("Wrong key usage: %i\n", result->wrong_key_usage);
- printf ("Unsupported algorithm: %s\n ", nonnull(result->unsupported_algorithm));
+ printf ("Unsupported algorithm: %s\n",
+ nonnull(result->unsupported_algorithm));
+ if (result->session_key)
+ printf ("Session key: %s\n", result->session_key);
for (recp = result->recipients; recp->next; recp = recp->next)
{
@@ -74,6 +78,8 @@ show_usage (int ex)
" --status print status lines from the backend\n"
" --openpgp use the OpenPGP protocol (default)\n"
" --cms use the CMS protocol\n"
+ " --export-session-key show the session key\n"
+ " --override-session-key STRING use STRING as session key\n"
, stderr);
exit (ex);
}
@@ -91,6 +97,8 @@ main (int argc, char **argv)
gpgme_data_t out = NULL;
gpgme_decrypt_result_t result;
int print_status = 0;
+ int export_session_key = 0;
+ const char *override_session_key = NULL;
if (argc)
{ argc--; argv++; }
@@ -125,6 +133,19 @@ main (int argc, char **argv)
protocol = GPGME_PROTOCOL_CMS;
argc--; argv++;
}
+ else if (!strcmp (*argv, "--export-session-key"))
+ {
+ export_session_key = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--override-session-key"))
+ {
+ argc--; argv++;
+ if (!argc)
+ show_usage (1);
+ override_session_key = *argv;
+ argc--; argv++;
+ }
else if (!strncmp (*argv, "--", 2))
show_usage (1);
@@ -152,6 +173,27 @@ main (int argc, char **argv)
gpgme_set_status_cb (ctx, status_cb, NULL);
gpgme_set_ctx_flag (ctx, "full-status", "1");
}
+ if (export_session_key)
+ {
+ err = gpgme_set_ctx_flag (ctx, "export-session-key", "1");
+ if (err)
+ {
+ fprintf (stderr, PGM ": error requesting exported session key: %s\n",
+ gpgme_strerror (err));
+ exit (1);
+ }
+ }
+ if (override_session_key)
+ {
+ err = gpgme_set_ctx_flag (ctx, "override-session-key",
+ override_session_key);
+ if (err)
+ {
+ fprintf (stderr, PGM ": error overriding session key: %s\n",
+ gpgme_strerror (err));
+ exit (1);
+ }
+ }
err = gpgme_data_new_from_stream (&in, fp_in);
if (err)
@@ -176,10 +218,11 @@ main (int argc, char **argv)
fprintf (stderr, PGM ": decrypt failed: %s\n", gpgme_strerror (err));
exit (1);
}
- if (result) {
- print_result (result);
- print_data (out);
- }
+ if (result)
+ {
+ print_result (result);
+ print_data (out);
+ }
gpgme_data_release (out);
gpgme_data_release (in);
diff --git a/tests/run-encrypt.c b/tests/run-encrypt.c
index b94b028..fd86836 100644
--- a/tests/run-encrypt.c
+++ b/tests/run-encrypt.c
@@ -14,7 +14,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
diff --git a/tests/run-export.c b/tests/run-export.c
index b133f13..0bb5468 100644
--- a/tests/run-export.c
+++ b/tests/run-export.c
@@ -14,7 +14,7 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
diff --git a/tests/run-genkey.c b/tests/run-genkey.c
index 20e7db5..c5abc42 100644
--- a/tests/run-genkey.c
+++ b/tests/run-genkey.c
@@ -14,7 +14,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
diff --git a/tests/run-identify.c b/tests/run-identify.c
index d5ce55f..01e9671 100644
--- a/tests/run-identify.c
+++ b/tests/run-identify.c
@@ -14,7 +14,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
diff --git a/tests/run-import.c b/tests/run-import.c
index 9225f61..081c0fa 100644
--- a/tests/run-import.c
+++ b/tests/run-import.c
@@ -14,7 +14,7 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
diff --git a/tests/run-keylist.c b/tests/run-keylist.c
index 647a9ed..93fbeb5 100644
--- a/tests/run-keylist.c
+++ b/tests/run-keylist.c
@@ -14,7 +14,7 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
diff --git a/tests/run-keysign.c b/tests/run-keysign.c
index f5a13e4..5f6cfce 100644
--- a/tests/run-keysign.c
+++ b/tests/run-keysign.c
@@ -14,7 +14,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
diff --git a/tests/run-sign.c b/tests/run-sign.c
index 70853ed..9f2e175 100644
--- a/tests/run-sign.c
+++ b/tests/run-sign.c
@@ -14,7 +14,7 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
@@ -83,6 +83,7 @@ show_usage (int ex)
" --uiserver use the UI server\n"
" --loopback use a loopback pinentry\n"
" --key NAME use key NAME for signing\n"
+ " --sender MBOX use MBOX as sender address\n"
, stderr);
exit (ex);
}
@@ -101,6 +102,7 @@ main (int argc, char **argv)
gpgme_sign_result_t result;
int print_status = 0;
int use_loopback = 0;
+ const char *sender = NULL;
if (argc)
{ argc--; argv++; }
@@ -148,6 +150,14 @@ main (int argc, char **argv)
key_string = *argv;
argc--; argv++;
}
+ else if (!strcmp (*argv, "--sender"))
+ {
+ argc--; argv++;
+ if (!argc)
+ show_usage (1);
+ sender = *argv;
+ argc--; argv++;
+ }
else if (!strcmp (*argv, "--loopback"))
{
use_loopback = 1;
@@ -192,6 +202,12 @@ main (int argc, char **argv)
gpgme_key_unref (akey);
}
+ if (sender)
+ {
+ err = gpgme_set_sender (ctx, sender);
+ fail_if_err (err);
+ }
+
err = gpgme_data_new_from_file (&in, *argv, 1);
if (err)
{
diff --git a/tests/run-support.h b/tests/run-support.h
index e4a4f70..841b223 100644
--- a/tests/run-support.h
+++ b/tests/run-support.h
@@ -15,7 +15,7 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#include <unistd.h>
diff --git a/tests/run-swdb.c b/tests/run-swdb.c
new file mode 100644
index 0000000..a373254
--- /dev/null
+++ b/tests/run-swdb.c
@@ -0,0 +1,151 @@
+/* run-swdb.c - Test tool for SWDB function
+ * Copyright (C) 2016 g10 Code GmbH
+ *
+ * This file is part of GPGME.
+ *
+ * GPGME is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * GPGME 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* We need to include config.h so that we know whether we are building
+ with large file system (LFS) support. */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#include <gpgme.h>
+
+#define PGM "run-swdb"
+
+#include "run-support.h"
+
+
+static int verbose;
+
+
+static const char *
+isotimestr (unsigned long value)
+{
+ time_t t;
+ static char buffer[25+5];
+ struct tm *tp;
+
+ if (!value)
+ return "none";
+ t = value;
+
+ tp = gmtime (&t);
+ snprintf (buffer, sizeof buffer, "%04d-%02d-%02d %02d:%02d:%02d",
+ 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
+ tp->tm_hour, tp->tm_min, tp->tm_sec);
+ return buffer;
+}
+
+
+static int
+show_usage (int ex)
+{
+ fputs ("usage: " PGM " [options] NAME [VERSION]\n\n"
+ "Options:\n"
+ " --verbose run in verbose mode\n"
+ " --status print status lines from the backend\n"
+ , stderr);
+ exit (ex);
+}
+
+
+int
+main (int argc, char **argv)
+{
+ int last_argc = -1;
+ gpgme_error_t err;
+ gpgme_ctx_t ctx;
+ gpgme_protocol_t protocol = GPGME_PROTOCOL_GPGCONF;
+ const char *name;
+ const char *iversion;
+ gpgme_query_swdb_result_t result;
+
+ if (argc)
+ { argc--; argv++; }
+
+ while (argc && last_argc != argc )
+ {
+ last_argc = argc;
+ if (!strcmp (*argv, "--"))
+ {
+ argc--; argv++;
+ break;
+ }
+ else if (!strcmp (*argv, "--help"))
+ show_usage (0);
+ else if (!strcmp (*argv, "--verbose"))
+ {
+ verbose = 1;
+ argc--; argv++;
+ }
+ else if (!strncmp (*argv, "--", 2))
+ show_usage (1);
+ }
+
+ if (argc < 1 || argc > 2)
+ show_usage (1);
+ name = argv[0];
+ iversion = argc > 1? argv[1] : NULL;
+
+ init_gpgme (protocol);
+
+ err = gpgme_new (&ctx);
+ fail_if_err (err);
+ gpgme_set_protocol (ctx, protocol);
+
+ err = gpgme_op_query_swdb (ctx, name, iversion, 0);
+ if (err)
+ {
+ fprintf (stderr, PGM ": error querying swdb: %s\n", gpg_strerror (err));
+ exit (1);
+ }
+
+ result = gpgme_op_query_swdb_result (ctx);
+ if (!result)
+ {
+ fprintf (stderr, PGM ": error querying swdb: %s\n", "no result");
+ exit (1);
+ }
+
+ printf ("package ...: %s\n"
+ "iversion ..: %s\n"
+ "version ...: %s\n",
+ nonnull (result->name),
+ nonnull (result->iversion),
+ nonnull (result->version));
+ printf ("reldate ...: %s\n", isotimestr (result->reldate));
+ printf ("created ...: %s\n", isotimestr (result->created));
+ printf ("retrieved .: %s\n", isotimestr (result->retrieved));
+ printf ("flags .....:%s%s%s%s%s%s%s\n",
+ result->warning? " warning" : "",
+ result->update? " update" : "",
+ result->urgent? " urgent" : "",
+ result->unknown? " unknown" : "",
+ result->tooold? " tooold" : "",
+ result->noinfo? " noinfo" : "",
+ result->error? " error" : "" );
+
+
+ gpgme_release (ctx);
+ return 0;
+}
diff --git a/tests/run-tofu.c b/tests/run-tofu.c
index ff55789..1f11c2d 100644
--- a/tests/run-tofu.c
+++ b/tests/run-tofu.c
@@ -14,7 +14,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
@@ -99,6 +99,7 @@ main (int argc, char **argv)
const char *fpr;
const char *policystr = NULL;
gpgme_tofu_policy_t policy;
+ const char *s;
if (argc)
{ argc--; argv++; }
@@ -145,10 +146,31 @@ main (int argc, char **argv)
fail_if_err (err);
gpgme_set_protocol (ctx, protocol);
gpgme_set_armor (ctx, 1);
+
+
+ s = gpgme_get_ctx_flag (ctx, "no_such-flag");
+ if (s)
+ {
+ fprintf (stderr, PGM ": gpgme_get_ctx_flag failed "
+ "(bad name not detected)\n");
+ exit (1);
+ }
+ s = gpgme_get_ctx_flag (ctx, "full-status");
+ if (!s || *s)
+ {
+ fprintf (stderr, PGM ": gpgme_get_ctx_flag failed (wrong false)\n");
+ exit (1);
+ }
if (print_status)
{
gpgme_set_status_cb (ctx, status_cb, NULL);
gpgme_set_ctx_flag (ctx, "full-status", "1");
+ s = gpgme_get_ctx_flag (ctx, "full-status");
+ if (!s || strcmp (s, "1"))
+ {
+ fprintf (stderr, PGM ": gpgme_get_ctx_flag fauled (wrong true)\n");
+ exit (1);
+ }
}
err = gpgme_get_key (ctx, fpr, &thekey, 0);
diff --git a/tests/run-verify.c b/tests/run-verify.c
index ebc20d9..3abc572 100644
--- a/tests/run-verify.c
+++ b/tests/run-verify.c
@@ -14,7 +14,7 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
@@ -221,6 +221,7 @@ show_usage (int ex)
" --status print status lines from the backend\n"
" --openpgp use the OpenPGP protocol (default)\n"
" --cms use the CMS protocol\n"
+ " --sender MBOX use MBOX as sender address\n"
, stderr);
exit (ex);
}
@@ -239,6 +240,7 @@ main (int argc, char **argv)
gpgme_data_t msg = NULL;
gpgme_verify_result_t result;
int print_status = 0;
+ const char *sender = NULL;
if (argc)
{ argc--; argv++; }
@@ -273,6 +275,14 @@ main (int argc, char **argv)
protocol = GPGME_PROTOCOL_CMS;
argc--; argv++;
}
+ else if (!strcmp (*argv, "--sender"))
+ {
+ argc--; argv++;
+ if (!argc)
+ show_usage (1);
+ sender = *argv;
+ argc--; argv++;
+ }
else if (!strncmp (*argv, "--", 2))
show_usage (1);
@@ -313,6 +323,12 @@ main (int argc, char **argv)
}
/* gpgme_set_ctx_flag (ctx, "raw-description", "1"); */
+ if (sender)
+ {
+ err = gpgme_set_sender (ctx, sender);
+ fail_if_err (err);
+ }
+
err = gpgme_data_new_from_stream (&sig, fp_sig);
if (err)
{