chiark / gitweb /
g10: Signal an error when trying to revoke non-existant UID.
authorJustus Winter <justus@g10code.com>
Thu, 2 Mar 2017 10:39:00 +0000 (11:39 +0100)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Mon, 18 Sep 2017 20:41:12 +0000 (21:41 +0100)
* g10/keyedit.c (keyedit_quick_revuid): Signal an error when trying to
revoke non-existant UID.
* tests/openpgp/quick-key-manipulation.scm: Test that.

GnuPG-bug-id: 2962
Signed-off-by: Justus Winter <justus@g10code.com>
(cherry picked from commit 62d21a4ab4029b32ea129f1cf3a0e1f22e2fb7b0)

Gbp-Pq: Name 0046-g10-Signal-an-error-when-trying-to-revoke-non-exista.patch

g10/keyedit.c
tests/openpgp/quick-key-manipulation.scm

index 1456d286784d32b43d96aa19a9c8b923e2b49a83..a477e92c40f607ab39d4b2f06c89e8d00863ad69 100644 (file)
@@ -3053,6 +3053,8 @@ keyedit_quick_revuid (ctrl_t ctrl, const char *username, const char *uidtorev)
         }
     }
 
+  log_error (_("User ID revocation failed: %s\n"), gpg_strerror (GPG_ERR_NOT_FOUND));
+
  leave:
   release_kbnode (keyblock);
   keydb_release (kdbhd);
index d43f7b53aaa32c0c27c9ef0451836d6cd525d29c..ae1d0b9632bb3a3ecd99fa55986e7d9c654f590b 100755 (executable)
@@ -36,6 +36,7 @@
 
 (define alpha "Alpha <alpha@invalid.example.net>")
 (define bravo "Bravo <bravo@invalid.example.net>")
+(define charlie "Charlie <charlie@invalid.example.net>")
 
 (define (key-data key)
   (filter (lambda (x) (or (string=? (car x) "pub")
 (info "Checking that we can revoke a user ID...")
 (call-check `(,@GPG --quick-revoke-uid ,(exact bravo) ,alpha))
 
+(info "Checking that we get an error revoking a non-existant user ID.")
+(catch '()
+       (call-check `(,@GPG --quick-revoke-uid ,(exact bravo) ,charlie))
+       (error "Expected an error, but get none."))
+
 (assert (= 1 (count-uids-of-secret-key bravo)))
 
 (info "Checking that we can change the expiration time.")