gpg: Graceful exit for signature checking with --batch.

* g10/mainproc.c (check_sig_and_print): Don't abort computation in
the function, but returns an error.
(proc_tree): Break the loop, when check_sig_and_print returns an
error.

--

GnuPG-bug-id: 6512
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2023-06-01 11:58:53 +09:00
parent 0fba0bbc62
commit ef4f22b9d9
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054
1 changed files with 6 additions and 6 deletions

View File

@ -2542,8 +2542,6 @@ check_sig_and_print (CTX c, kbnode_t node)
release_kbnode( keyblock );
if (rc)
g10_errors_seen = 1;
if (opt.batch && rc)
g10_exit (1);
}
else /* Error checking the signature. (neither Good nor Bad). */
{
@ -2660,7 +2658,8 @@ proc_tree (CTX c, kbnode_t node)
}
for (n1 = node; (n1 = find_next_kbnode (n1, PKT_SIGNATURE));)
check_sig_and_print (c, n1);
if (check_sig_and_print (c, n1) && opt.batch)
break;
}
else if (node->pkt->pkttype == PKT_GPG_CONTROL
@ -2679,8 +2678,8 @@ proc_tree (CTX c, kbnode_t node)
}
for (n1 = node; (n1 = find_next_kbnode (n1, PKT_SIGNATURE));)
check_sig_and_print (c, n1);
if (check_sig_and_print (c, n1) && opt.batch)
break;
}
else if (node->pkt->pkttype == PKT_SIGNATURE)
{
@ -2807,7 +2806,8 @@ proc_tree (CTX c, kbnode_t node)
if (multiple_ok)
{
for (n1 = node; n1; (n1 = find_next_kbnode(n1, PKT_SIGNATURE)))
check_sig_and_print (c, n1);
if (check_sig_and_print (c, n1) && opt.batch)
break;
}
else
check_sig_and_print (c, node);