1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

* photoid.c: Include ttyio.h.

* parse-packet.c (skip_rest): Removed.  Changed all callers to use
the new iobuf_skip_reset.  Orginal patch by Florian Weimer.

* iobuf.c (iobuf_skip_rest): New.  Orginal patch by Florian
Weimer.  Added new argument PARTIAL.
This commit is contained in:
Werner Koch 2004-09-09 12:42:10 +00:00
parent eda1b80760
commit 87e3264f77
7 changed files with 75 additions and 35 deletions

20
AUTHORS
View File

@ -11,7 +11,7 @@ Birger Langkjer <birger.langkjer@image.dk> Translations [da]
Daniel Resare <daniel@resare.com> Translations [sv]
David Shaw <dshaw@jabberwocky.com> Assignment
David Shaw <dshaw@jabberwocky.com> Assigns past and future changes.
(all in keyserver/,
a lot of changes in g10/ see the ChangeLog,
bug fixes here and there)
@ -20,6 +20,9 @@ Dokianakis Theofanis <madf@hellug.gr> Translations [el]
Edmund GRIMLEY EVANS <edmundo@rano.org> Translations [eo]
Florian Weimer <fw@deneb.enyo.de> Assigns past and future changes
(changed:g10/parse-packet.c, include/iobuf.h, util/iobuf.c)
Gaël Quéri <gael@lautre.net> Translations [fr]
(fixed a lot of typos)
@ -35,7 +38,7 @@ Janusz Aleksander Urbanowicz <alex@bofh.torun.pl> Translations [po]
Magda Procha'zkova' <magda@math.muni.cz> Translations [cs]
Michael Roth <mroth@nessie.de> Assignment
Michael Roth <mroth@nessie.de> Assigns changes.
(wrote cipher/des.c., changes and bug fixes all over the place)
Marco d'Itri <md@linux.it> Translations [it]
@ -48,7 +51,8 @@ Niklas Hernaeus <nh@df.lth.se> Disclaimer
Nilgun Belma Buguner <nilgun@technologist.com> Translations [tr]
Nils Ellmenreich <nils 'at' infosun.fmi.uni-passau.de> Assignment
Nils Ellmenreich <nils 'at' infosun.fmi.uni-passau.de>
Assigns past and future changes
(configure.in, cipher/rndlinux.c, FAQ)
Paul Eggert <eggert@twinsun.com>
@ -56,14 +60,14 @@ Paul Eggert <eggert@twinsun.com>
Pedro Morais <morais@poli.org> Translations [pt_PT]
Rémi Guyomarch <rguyom@mail.dotcom.fr> Assignment
Rémi Guyomarch <rguyom@mail.dotcom.fr> Assigns past and future changes.
(g10/compress.c, g10/encr-data.c,
g10/free-packet.c, g10/mdfilter.c, g10/plaintext.c, util/iobuf.c)
Stefan Bellon <sbellon@sbellon.de> Assignment
Stefan Bellon <sbellon@sbellon.de> Assigns past and future changes.
(All patches to support RISC OS)
Timo Schulz <twoaday@freakmail.de> Assignment
Timo Schulz <twoaday@freakmail.de> Assigns past and future changes.
(util/w32reg.c, g10/passphrase.c, g10/hkp.c)
Tedi Heriyanto <tedi_h@gmx.net> Translations [id]
@ -77,7 +81,7 @@ Urko Lusa <ulusa@euskalnet.net> Translations [es_ES]
Walter Koch <koch@u32.de> Translations [de]
Werner Koch <wk@gnupg.org> Assignment
Werner Koch <wk@gnupg.org> Assigns GNU Privacy Guard and future changes.
(started the whole thing)
Yosiaki IIDA <iida@ring.gr.jp> Translations [ja]
@ -107,7 +111,7 @@ for GnuPG.
The RPM specs file scripts/gnupg.spec has been contributed by
several people.
Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without

View File

@ -1,3 +1,10 @@
2004-09-09 Werner Koch <wk@g10code.com>
* photoid.c: Include ttyio.h.
* parse-packet.c (skip_rest): Removed. Changed all callers to use
the new iobuf_skip_reset. Orginal patch by Florian Weimer.
2004-09-07 Werner Koch <wk@g10code.de>
* photoid.c (generate_photo_id): Use tty_printf and not just

View File

@ -50,7 +50,6 @@ static int copy_packet( IOBUF inp, IOBUF out, int pkttype,
unsigned long pktlen, int partial );
static void skip_packet( IOBUF inp, int pkttype,
unsigned long pktlen, int partial );
static void skip_rest( IOBUF inp, unsigned long pktlen, int partial );
static void *read_rest( IOBUF inp, size_t pktlen, int partial );
static int parse_symkeyenc( IOBUF inp, int pkttype, unsigned long pktlen,
PACKET *packet );
@ -434,7 +433,7 @@ parse( IOBUF inp, PACKET *pkt, int onlykeypkts, off_t *retpos,
&& pkttype != PKT_PUBLIC_KEY
&& pkttype != PKT_SECRET_SUBKEY
&& pkttype != PKT_SECRET_KEY ) ) {
skip_rest(inp, pktlen, partial);
iobuf_skip_rest(inp, pktlen, partial);
*skip = 1;
rc = 0;
goto leave;
@ -593,21 +592,7 @@ skip_packet( IOBUF inp, int pkttype, unsigned long pktlen, int partial )
return;
}
}
skip_rest(inp,pktlen,partial);
}
static void
skip_rest( IOBUF inp, unsigned long pktlen, int partial )
{
if( partial ) {
while( iobuf_get(inp) != -1 )
;
}
else {
for( ; pktlen; pktlen-- )
if( iobuf_get(inp) == -1 )
break;
}
iobuf_skip_rest(inp,pktlen,partial);
}
@ -722,7 +707,7 @@ parse_symkeyenc( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet )
}
leave:
skip_rest(inp, pktlen, 0);
iobuf_skip_rest(inp, pktlen, 0);
return rc;
}
@ -776,7 +761,7 @@ parse_pubkeyenc( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet )
}
leave:
skip_rest(inp, pktlen, 0);
iobuf_skip_rest(inp, pktlen, 0);
return rc;
}
@ -1427,7 +1412,7 @@ parse_signature( IOBUF inp, int pkttype, unsigned long pktlen,
}
leave:
skip_rest(inp, pktlen, 0);
iobuf_skip_rest(inp, pktlen, 0);
return rc;
}
@ -1465,7 +1450,7 @@ parse_onepass_sig( IOBUF inp, int pkttype, unsigned long pktlen,
leave:
skip_rest(inp, pktlen, 0);
iobuf_skip_rest(inp, pktlen, 0);
return rc;
}
@ -1544,7 +1529,7 @@ parse_key( IOBUF inp, int pkttype, unsigned long pktlen,
}
printf("\"\n");
}
skip_rest(inp, pktlen, 0);
iobuf_skip_rest(inp, pktlen, 0);
return 0;
}
else if( version == 4 )
@ -1876,7 +1861,7 @@ parse_key( IOBUF inp, int pkttype, unsigned long pktlen,
}
leave:
skip_rest(inp, pktlen, 0);
iobuf_skip_rest(inp, pktlen, 0);
return rc;
}
@ -2111,7 +2096,7 @@ parse_trust( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *pkt )
if( list_mode )
printf(":trust packet: empty\n");
}
skip_rest (inp, pktlen, 0);
iobuf_skip_rest (inp, pktlen, 0);
}
@ -2236,7 +2221,7 @@ parse_encrypted( IOBUF inp, int pkttype, unsigned long pktlen,
if( orig_pktlen && pktlen < 10 ) { /* actually this is blocksize+2 */
log_error("packet(%d) too short\n", pkttype);
rc = G10ERR_INVALID_PACKET;
skip_rest(inp, pktlen, partial);
iobuf_skip_rest(inp, pktlen, partial);
goto leave;
}
if( list_mode ) {
@ -2339,7 +2324,7 @@ parse_gpg_control( IOBUF inp, int pkttype,
}
putchar('\n');
}
skip_rest(inp,pktlen, 0);
iobuf_skip_rest(inp,pktlen, 0);
return G10ERR_INVALID_PACKET;
}

View File

@ -39,6 +39,7 @@
#include "options.h"
#include "main.h"
#include "photoid.h"
#include "ttyio.h"
/* Generate a new photo id packet, or return NULL if canceled */
PKT_user_id *generate_photo_id(PKT_public_key *pk)

View File

@ -26,7 +26,6 @@
#define DBG_IOBUF iobuf_debug_mode
#define IOBUFCTRL_INIT 1
#define IOBUFCTRL_FREE 2
#define IOBUFCTRL_UNDERFLOW 3
@ -155,4 +154,6 @@ int iobuf_translate_file_handle ( int fd, int for_write );
#define iobuf_get_temp_length(a) ( (a)->d.len )
#define iobuf_is_temp(a) ( (a)->use == 3 )
void iobuf_skip_rest (IOBUF a, unsigned long n, int partial);
#endif /*G10_IOBUF_H*/

View File

@ -1,3 +1,8 @@
2004-09-09 Werner Koch <wk@g10code.com>
* iobuf.c (iobuf_skip_rest): New. Orginal patch by Florian
Weimer. Added new argument PARTIAL.
2004-08-19 David Shaw <dshaw@jabberwocky.com>
* http.c (insert_escapes): Fix encoding problem for non-URI-safe

View File

@ -2120,3 +2120,40 @@ translate_file_handle ( int fd, int for_write )
#endif
return fd;
}
void
iobuf_skip_rest(IOBUF a, unsigned long n, int partial)
{
if ( partial ) {
for (;;) {
if (a->nofast || a->d.start >= a->d.len) {
if (iobuf_readbyte (a) == -1) {
break;
}
} else {
unsigned long count = a->d.len - a->d.start;
a->nbytes += count;
a->d.start = a->d.len;
}
}
} else {
unsigned long remaining = n;
while (remaining > 0) {
if (a->nofast || a->d.start >= a->d.len) {
if (iobuf_readbyte (a) == -1) {
break;
}
--remaining;
} else {
unsigned long count = a->d.len - a->d.start;
if (count > remaining) {
count = remaining;
}
a->nbytes += count;
a->d.start += count;
remaining -= count;
}
}
}
}