[PATCH] added support to gpg for gpgme passed file handles
Bart Trojanowski
bart at jukie.net
Tue Jul 3 21:07:01 CEST 2001
I have posted my problem before in messages titled 'gpgme_op_verify
returns GPGME_SIG_STAT_NONE'. I have solved the problem after a bit of
debugging.
A call to gpgme_op_verify with a detached signature causes gpgme to
spawn the following gpg command:
gpg --batch --status-fd 5 --no-tty --verify --verbose -- -&7 -
Where '5' is an opened file descriptor for command/status; '7' is an
opened file descriptor for the signature data; and 'stdin' is used to read
in the actual data for verification.
It would seem that gpg 1.0.4 does not understand -&7 (and neither did the
most recent CVS sources of gnupg).
The patch below is against util/iobuf.c from gpg 1.0.4 to add support for
opening the file descriptor passed in on the command line. No further
changes were needed to get this feature to work.
Adding this to the CVS tree would be appriciated.
Regards,
Bart.
gnupg-1.0.4$ diff -uN util/iobuf.c-org util/iobuf.c
--- util/iobuf.c-org Tue Jul 3 13:55:33 2001
+++ util/iobuf.c Tue Jul 3 13:50:49 2001
@@ -582,7 +582,7 @@
iobuf_open( const char *fname )
{
IOBUF a;
- FILE *fp;
+ FILE *fp = NULL;
file_filter_ctx_t *fcx;
size_t len;
int print_only = 0;
@@ -595,8 +595,16 @@
fname = "[stdin]";
print_only = 1;
}
- else if( !(fp = fopen(fname, "rb")) )
- return NULL;
+ else if( *fname=='-' && fname[1]=='&' ) {
+ int fd;
+ if( sscanf(fname+2, "%d*%s", &fd, (char*)NULL ) == 1 ) {
+ if( !(fp = fdopen(fd,"r")) )
+ return NULL;
+ }
+ }
+ if( !fp )
+ if( !(fp = fopen(fname, "rb")) )
+ return NULL;
a = iobuf_alloc(1, 8192 );
fcx = m_alloc( sizeof *fcx + strlen(fname) );
fcx->fp = fp;
--
WebSig: http://www.jukie.net/~bart/sig/
More information about the Gnupg-devel
mailing list