diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2020-06-06 16:32:07 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2020-06-06 16:32:07 +0300 |
commit | dde5e459a522096d52a8a06ec3e032d20702cf24 (patch) | |
tree | 4cc271aa1d6280520636a7df2b31642a3dd94396 | |
parent | 4422069d8f01eb2b625422edacd8e4a52cb10f77 (diff) | |
download | anubis-dde5e459a522096d52a8a06ec3e032d20702cf24.tar.gz anubis-dde5e459a522096d52a8a06ec3e032d20702cf24.tar.bz2 |
Fix the GPG test.
Newer GPGME can't list keys by abbreviated ID.
* src/gpg.c (create_key_array): Improve diagnostics.
* testsuite/mta.c: Likewise.
* testsuite/etc/gpgcrypt.pat: Use anubis-dev as key ID
* testsuite/etc/gpgse.pat: Likewise.
* testsuite/etc/gpgsign.pat: Likewise.
-rw-r--r-- | src/gpg.c | 17 | ||||
-rw-r--r-- | testsuite/etc/gpgcrypt.pat | 4 | ||||
-rw-r--r-- | testsuite/etc/gpgse.pat | 8 | ||||
-rw-r--r-- | testsuite/etc/gpgsign.pat | 4 | ||||
-rw-r--r-- | testsuite/mta.c | 4 |
5 files changed, 24 insertions, 13 deletions
@@ -237,7 +237,9 @@ create_key_array(gpgme_ctx_t ctx, struct obstack *stk) if (err) break; - gpgme_get_key (ctx, current_key, &tmpkey, 0); + err = gpgme_get_key (ctx, current_key, &tmpkey, 0); + if (err) + break; obstack_grow (stk, &tmpkey, sizeof (tmpkey)); if (options.termlevel == DEBUG) { @@ -248,14 +250,23 @@ create_key_array(gpgme_ctx_t ctx, struct obstack *stk) uid->uid, uid->name, uid->email); } } - if (gpg_err_code (err) != GPG_ERR_EOF) + + switch (gpg_err_code (err)) { + case GPG_ERR_EOF: + break; + + case GPG_ERR_INV_VALUE: + fprintf (stderr, "key not found: %s\n", current_key); + exit (1); + + default: fprintf (stderr, "cannot list keys: %s\n", gpgme_strerror (err)); exit (1); } - memset (current_key, 0, sizeof (current_key)); + memset (current_key, 0, j); j = 0; } else diff --git a/testsuite/etc/gpgcrypt.pat b/testsuite/etc/gpgcrypt.pat index 1baba59..76c8ae2 100644 --- a/testsuite/etc/gpgcrypt.pat +++ b/testsuite/etc/gpgcrypt.pat @@ -32,9 +32,9 @@ DATA :EXPECT 354 From: <gray@gnu.org> To: <polak@gnu.org> -:DEL Subject: Does it work?@@encrypt:anubis +:DEL Subject: Does it work?@@encrypt:anubis-dev :ADD Subject: Does it work? -:ADD X-GPG-Comment: Encrypted for anubis +:ADD X-GPG-Comment: Encrypted for anubis-dev :DEL If you can read this, then it is working. :ADD -re -----BEGIN PGP MESSAGE-----.*-----END PGP MESSAGE----- diff --git a/testsuite/etc/gpgse.pat b/testsuite/etc/gpgse.pat index 7556016..b6acdfb 100644 --- a/testsuite/etc/gpgse.pat +++ b/testsuite/etc/gpgse.pat @@ -22,7 +22,7 @@ :RETCODE 0 :PATTERN :EXPECT 220 -HELO localhost +HELO localhost :EXPECT 250 MAIL FROM:<polak@gnu.org> :EXPECT 250 @@ -32,10 +32,10 @@ DATA :EXPECT 354 From: <polak@gnu.org> To: <gray@gnu.org> -:DEL Subject: gpg-se test@@se:anubis:anubis +:DEL Subject: gpg-se test@@se:anubis-dev:anubis-dev :ADD Subject: gpg-se test -:ADD X-GPG-Comment1: Encrypted for anubis -:ADD X-GPG-Comment2: Signed by anubis +:ADD X-GPG-Comment1: Encrypted for anubis-dev +:ADD X-GPG-Comment2: Signed by anubis-dev :DEL If you can read this, then it is working. :ADD -re -----BEGIN PGP MESSAGE-----.*-----END PGP MESSAGE----- diff --git a/testsuite/etc/gpgsign.pat b/testsuite/etc/gpgsign.pat index c8d6e39..b9fc68d 100644 --- a/testsuite/etc/gpgsign.pat +++ b/testsuite/etc/gpgsign.pat @@ -32,9 +32,9 @@ DATA :EXPECT 354 From: <gray@gnu.org> To: <polak@gnu.org> -:DEL Subject: Signing messages@@sign:anubis +:DEL Subject: Signing messages@@sign:anubis-dev :ADD Subject: Signing messages -:ADD X-GPG-Comment: Signed by anubis +:ADD X-GPG-Comment: Signed by anubis-dev :ADD -----BEGIN PGP SIGNED MESSAGE----- :ADD Hash: SHA1 diff --git a/testsuite/mta.c b/testsuite/mta.c index 43761a0..a7036a3 100644 --- a/testsuite/mta.c +++ b/testsuite/mta.c @@ -435,7 +435,7 @@ smtp_reply (int code, char *fmt, ...) rc = _mta_write (out, obuf, n, NULL); if (rc) { - fprintf (stderr, "Write failed: %s", _mta_strerror (rc)); + fprintf (stderr, "Write failed: %s\n", _mta_strerror (rc)); abort (); } } @@ -451,7 +451,7 @@ get_input_line (char *buf, size_t bufsize) rc = _mta_read (in, buf + i, 1, &n); if (rc) { - fprintf (stderr, "Read failed: %s", _mta_strerror (rc)); + fprintf (stderr, "Read failed: %s\n", _mta_strerror (rc)); abort (); } if (n == 0) |