mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
Fixed a wrong return code with gpg --verify
This commit is contained in:
parent
2410941461
commit
966cd80d88
13 changed files with 121 additions and 41 deletions
|
@ -1,6 +1,6 @@
|
|||
/* mainproc.c - handle packets
|
||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
* 2005 Free Software Foundation, Inc.
|
||||
* 2005, 2006 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
|
@ -55,28 +55,31 @@ struct kidlist_item {
|
|||
* Structure to hold the context
|
||||
*/
|
||||
typedef struct mainproc_context *CTX;
|
||||
struct mainproc_context {
|
||||
struct mainproc_context *anchor; /* may be useful in the future */
|
||||
PKT_public_key *last_pubkey;
|
||||
PKT_secret_key *last_seckey;
|
||||
PKT_user_id *last_user_id;
|
||||
md_filter_context_t mfx;
|
||||
int sigs_only; /* process only signatures and reject all other stuff */
|
||||
int encrypt_only; /* process only encryption messages */
|
||||
STRLIST signed_data;
|
||||
const char *sigfilename;
|
||||
DEK *dek;
|
||||
int last_was_session_key;
|
||||
KBNODE list; /* the current list of packets */
|
||||
int have_data;
|
||||
IOBUF iobuf; /* used to get the filename etc. */
|
||||
int trustletter; /* temp usage in list_node */
|
||||
ulong symkeys;
|
||||
struct kidlist_item *pkenc_list; /* list of encryption packets */
|
||||
struct {
|
||||
int op;
|
||||
int stop_now;
|
||||
} pipemode;
|
||||
struct mainproc_context
|
||||
{
|
||||
struct mainproc_context *anchor; /* May be useful in the future. */
|
||||
PKT_public_key *last_pubkey;
|
||||
PKT_secret_key *last_seckey;
|
||||
PKT_user_id *last_user_id;
|
||||
md_filter_context_t mfx;
|
||||
int sigs_only; /* Process only signatures and reject all other stuff. */
|
||||
int encrypt_only; /* Process only encryption messages. */
|
||||
STRLIST signed_data;
|
||||
const char *sigfilename;
|
||||
DEK *dek;
|
||||
int last_was_session_key;
|
||||
KBNODE list; /* The current list of packets. */
|
||||
int have_data;
|
||||
IOBUF iobuf; /* Used to get the filename etc. */
|
||||
int trustletter; /* Temporary usage in list_node. */
|
||||
ulong symkeys;
|
||||
struct kidlist_item *pkenc_list; /* List of encryption packets. */
|
||||
struct
|
||||
{
|
||||
int op;
|
||||
int stop_now;
|
||||
} pipemode;
|
||||
int any_sig_seen; /* Set to true if a signature packet has been seen. */
|
||||
};
|
||||
|
||||
|
||||
|
@ -217,6 +220,7 @@ add_signature( CTX c, PACKET *pkt )
|
|||
{
|
||||
KBNODE node;
|
||||
|
||||
c->any_sig_seen = 1;
|
||||
if( pkt->pkttype == PKT_SIGNATURE && !c->list ) {
|
||||
/* This is the first signature for the following datafile.
|
||||
* GPG does not write such packets; instead it always uses
|
||||
|
@ -1152,6 +1156,18 @@ proc_signature_packets( void *anchor, IOBUF a,
|
|||
c->signed_data = signedfiles;
|
||||
c->sigfilename = sigfilename;
|
||||
rc = do_proc_packets( c, a );
|
||||
|
||||
/* If we have not encountered any signature we print an error
|
||||
messages, send a NODATA status back and return an error code.
|
||||
Using log_error is required becuase verify_files does not check
|
||||
error codes for each file but we want to terminate the process
|
||||
with an error. */
|
||||
if (!rc && !c->any_sig_seen)
|
||||
{
|
||||
write_status_text (STATUS_NODATA, "4");
|
||||
log_error (_("no signature found\n"));
|
||||
rc = G10ERR_NO_DATA;
|
||||
}
|
||||
xfree( c );
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue