From 4493a9603b65fa7b39f05452c86451766c3aa036 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 2 Aug 2002 10:15:39 +0000 Subject: [PATCH] * delkey.c (do_delete_key): Always allow to delete a key in batch mode when specified by fingerprint. Suggested by Enzo Michelangeli. --- g10/ChangeLog | 6 ++++++ g10/delkey.c | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/g10/ChangeLog b/g10/ChangeLog index 63c5c01df..ec4731877 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -13,6 +13,11 @@ * sig-check.c (do_check): Properly validate v4 sigs with no hashed section at all. +2002-07-25 Werner Koch + + * delkey.c (do_delete_key): Always allow to delete a key in batch mode + when specified by fingerprint. Suggested by Enzo Michelangeli. + 2002-07-25 David Shaw * keyedit.c (menu_revsig): Change "revsig" to honor selected uids @@ -25,6 +30,7 @@ * exec.c, export.c, import.c, keyedit.c, keyserver.c, misc.c: "Warning" -> "WARNING" +>>>>>>> 1.214 2002-07-24 David Shaw * main.h, import.c (parse_import_options, fix_hkp_corruption, diff --git a/g10/delkey.c b/g10/delkey.c index f9d882113..ca578a590 100644 --- a/g10/delkey.c +++ b/g10/delkey.c @@ -59,11 +59,15 @@ do_delete_key( const char *username, int secret, int *r_sec_avail ) int okay=0; int yes; KEYDB_SEARCH_DESC desc; + int exactmatch; *r_sec_avail = 0; /* search the userid */ classify_user_id (username, &desc); + exactmatch = (desc.mode == KEYDB_SEARCH_MODE_FPR + || desc.mode == KEYDB_SEARCH_MODE_FPR16 + || desc.mode == KEYDB_SEARCH_MODE_FPR20); rc = desc.mode? keydb_search (hd, &desc, 1):G10ERR_INV_USER_ID; if (rc) { log_error (_("key `%s' not found: %s\n"), username, g10_errstr (rc)); @@ -108,12 +112,20 @@ do_delete_key( const char *username, int secret, int *r_sec_avail ) if( rc ) rc = 0; + else if (opt.batch && exactmatch) + okay++; else if( opt.batch && secret ) + { log_error(_("can't do that in batchmode\n")); + log_info (_("(unless you specify the key by fingerprint)\n")); + } else if( opt.batch && opt.answer_yes ) okay++; else if( opt.batch ) + { log_error(_("can't do that in batchmode without \"--yes\"\n")); + log_info (_("(unless you specify the key by fingerprint)\n")); + } else { char *p; size_t n;