mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Fixed the detached signature bug.
Minor modifications for W32.
This commit is contained in:
parent
daee3b1d9a
commit
41913b7f01
13 changed files with 136 additions and 27 deletions
26
g10/verify.c
26
g10/verify.c
|
@ -24,6 +24,7 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <unistd.h> /* for isatty() */
|
||||
|
||||
#include "options.h"
|
||||
#include "packet.h"
|
||||
|
@ -60,6 +61,31 @@ verify_signatures( int nfiles, char **files )
|
|||
STRLIST sl;
|
||||
|
||||
memset( &afx, 0, sizeof afx);
|
||||
/* decide whether we should handle a detached or a normal signature,
|
||||
* which is needed so that the code later can hash the correct data and
|
||||
* not have a normal signature act as detached signature and ignoring the
|
||||
* indended signed material from the 2nd file or stdin.
|
||||
* 1. gpg <file - normal
|
||||
* 2. gpg file - normal (or detached)
|
||||
* 3. gpg file <file2 - detached
|
||||
* 4. gpg file file2 - detached
|
||||
* The question is how decide between case 2 and 3? The only way
|
||||
* we can do it is by reading one byte from stdin and the unget
|
||||
* it; the problem here is that we may be reading from the
|
||||
* terminal (which could be detected using isatty() but won't work
|
||||
* when under contol of a pty using program (e.g. expect)) and
|
||||
* might get us in trouble when stdin is used for another purpose
|
||||
* (--passphrase-fd 0). So we have to break with the behaviour
|
||||
* prior to gpg 1.0.4 by assuming that case 3 is a normal
|
||||
* signature (where file2 is ignored and require for a detached
|
||||
* signature to indicate signed material comes from stdin by using
|
||||
* case 4 with a file2 of "-".
|
||||
*
|
||||
* Actually we don't have to change anything here but can handle
|
||||
* that all quite easily in mainproc.c
|
||||
*/
|
||||
|
||||
|
||||
sigfile = nfiles? *files : NULL;
|
||||
|
||||
/* open the signature file */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue