mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-08 17:43:04 +01:00
* build-packet.c (write_header2): If a suggested header length is provided
along with a zero length, interpret this as an actual zero length packet and not as an indeterminate length packet. (do_comment, do_user_id): Use it here as these packets might be naturally zero length. * parse-packet.c (parse): Show packet type when failing due to an indeterminate length packet. * misc.c (parse_options): Only provide args for the true (i.e. not "no-xxx") form of options.
This commit is contained in:
parent
c9aa5000d7
commit
95d05215c3
@ -1,3 +1,17 @@
|
|||||||
|
2004-02-14 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* build-packet.c (write_header2): If a suggested header length is
|
||||||
|
provided along with a zero length, interpret this as an actual
|
||||||
|
zero length packet and not as an indeterminate length packet.
|
||||||
|
(do_comment, do_user_id): Use it here as these packets might be
|
||||||
|
naturally zero length.
|
||||||
|
|
||||||
|
* parse-packet.c (parse): Show packet type when failing due to an
|
||||||
|
indeterminate length packet.
|
||||||
|
|
||||||
|
* misc.c (parse_options): Only provide args for the true (i.e. not
|
||||||
|
"no-xxx") form of options.
|
||||||
|
|
||||||
2004-02-13 David Shaw <dshaw@jabberwocky.com>
|
2004-02-13 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* keyserver.c (argsep): Move to misc.c.
|
* keyserver.c (argsep): Move to misc.c.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* build-packet.c - assemble packets and write them
|
/* build-packet.c - assemble packets and write them
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002,
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
|
||||||
* 2003 Free Software Foundation, Inc.
|
* 2004 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -194,27 +194,32 @@ write_fake_data( IOBUF out, MPI a )
|
|||||||
static int
|
static int
|
||||||
do_comment( IOBUF out, int ctb, PKT_comment *rem )
|
do_comment( IOBUF out, int ctb, PKT_comment *rem )
|
||||||
{
|
{
|
||||||
if( opt.sk_comments ) {
|
if( opt.sk_comments )
|
||||||
write_header(out, ctb, rem->len);
|
{
|
||||||
|
write_header2(out, ctb, rem->len, 1, 1);
|
||||||
if( iobuf_write( out, rem->data, rem->len ) )
|
if( iobuf_write( out, rem->data, rem->len ) )
|
||||||
return G10ERR_WRITE_FILE;
|
return G10ERR_WRITE_FILE;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
do_user_id( IOBUF out, int ctb, PKT_user_id *uid )
|
do_user_id( IOBUF out, int ctb, PKT_user_id *uid )
|
||||||
{
|
{
|
||||||
if( uid->attrib_data ) {
|
if( uid->attrib_data )
|
||||||
write_header(out, ctb, uid->attrib_len);
|
{
|
||||||
|
/* Shouldn't be necessary to force a header here since attribs
|
||||||
|
can't be of zero length, but it doesn't hurt either. */
|
||||||
|
write_header2(out, ctb, uid->attrib_len, 1, 1);
|
||||||
if( iobuf_write( out, uid->attrib_data, uid->attrib_len ) )
|
if( iobuf_write( out, uid->attrib_data, uid->attrib_len ) )
|
||||||
return G10ERR_WRITE_FILE;
|
return G10ERR_WRITE_FILE;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
write_header(out, ctb, uid->len);
|
{
|
||||||
|
write_header2( out, ctb, uid->len, 1, 1 );
|
||||||
if( iobuf_write( out, uid->name, uid->len ) )
|
if( iobuf_write( out, uid->name, uid->len ) )
|
||||||
return G10ERR_WRITE_FILE;
|
return G10ERR_WRITE_FILE;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,8 +427,6 @@ do_symkey_enc( IOBUF out, int ctb, PKT_symkey_enc *enc )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
do_pubkey_enc( IOBUF out, int ctb, PKT_pubkey_enc *enc )
|
do_pubkey_enc( IOBUF out, int ctb, PKT_pubkey_enc *enc )
|
||||||
{
|
{
|
||||||
@ -456,8 +459,6 @@ do_pubkey_enc( IOBUF out, int ctb, PKT_pubkey_enc *enc )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static u32
|
static u32
|
||||||
calc_plaintext( PKT_plaintext *pt )
|
calc_plaintext( PKT_plaintext *pt )
|
||||||
{
|
{
|
||||||
@ -1035,8 +1036,11 @@ write_sign_packet_header( IOBUF out, int ctb, u32 len )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************
|
/****************
|
||||||
* if HDRLEN is > 0, try to build a header of this length.
|
* If HDRLEN is > 0, try to build a header of this length. We need
|
||||||
* we need this, so that we can hash packets without reading them again.
|
* this so that we can hash packets without reading them again. If
|
||||||
|
* len is 0, write a partial or indeterminate length header, unless
|
||||||
|
* hdrlen is specified in which case write an actual zero length
|
||||||
|
* (using the specified hdrlen).
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
write_header2( IOBUF out, int ctb, u32 len, int hdrlen, int blkmode )
|
write_header2( IOBUF out, int ctb, u32 len, int hdrlen, int blkmode )
|
||||||
@ -1045,9 +1049,7 @@ write_header2( IOBUF out, int ctb, u32 len, int hdrlen, int blkmode )
|
|||||||
return write_new_header( out, ctb, len, hdrlen );
|
return write_new_header( out, ctb, len, hdrlen );
|
||||||
|
|
||||||
if( hdrlen ) {
|
if( hdrlen ) {
|
||||||
if( !len )
|
if( hdrlen == 2 && len < 256 )
|
||||||
ctb |= 3;
|
|
||||||
else if( hdrlen == 2 && len < 256 )
|
|
||||||
;
|
;
|
||||||
else if( hdrlen == 3 && len < 65536 )
|
else if( hdrlen == 3 && len < 65536 )
|
||||||
ctb |= 1;
|
ctb |= 1;
|
||||||
@ -1066,7 +1068,7 @@ write_header2( IOBUF out, int ctb, u32 len, int hdrlen, int blkmode )
|
|||||||
}
|
}
|
||||||
if( iobuf_put(out, ctb ) )
|
if( iobuf_put(out, ctb ) )
|
||||||
return -1;
|
return -1;
|
||||||
if( !len ) {
|
if( !len && !hdrlen ) {
|
||||||
if( blkmode )
|
if( blkmode )
|
||||||
iobuf_set_block_mode(out, 8196 );
|
iobuf_set_block_mode(out, 8196 );
|
||||||
}
|
}
|
||||||
|
16
g10/misc.c
16
g10/misc.c
@ -1,5 +1,5 @@
|
|||||||
/* misc.c - miscellaneous functions
|
/* misc.c - miscellaneous functions
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
|
||||||
* 2004 Free Software Foundation, Inc.
|
* 2004 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
@ -771,11 +771,17 @@ parse_options(char *str,unsigned int *options,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(rev)
|
if(rev)
|
||||||
*options&=~opts[i].bit;
|
{
|
||||||
|
*options&=~opts[i].bit;
|
||||||
|
if(opts[i].value)
|
||||||
|
*opts[i].value=NULL;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
*options|=opts[i].bit;
|
{
|
||||||
if(opts[i].value)
|
*options|=opts[i].bit;
|
||||||
*opts[i].value=arg?m_strdup(arg):NULL;
|
if(opts[i].value)
|
||||||
|
*opts[i].value=arg?m_strdup(arg):NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* parse-packet.c - read packets
|
/* parse-packet.c - read packets
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002,
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
|
||||||
* 2003 Free Software Foundation, Inc.
|
* 2004 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -383,11 +383,11 @@ parse( IOBUF inp, PACKET *pkt, int onlykeypkts, off_t *retpos,
|
|||||||
case PKT_COMPRESSED:
|
case PKT_COMPRESSED:
|
||||||
break; /* the orginal pgp 2 way. */
|
break; /* the orginal pgp 2 way. */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_error ("%s: old style partial length "
|
log_error ("%s: old style partial length for invalid"
|
||||||
"for invalid packet type\n", iobuf_where(inp) );
|
" packet type %d\n", iobuf_where(inp), pkttype );
|
||||||
rc = G10ERR_INVALID_PACKET;
|
rc = G10ERR_INVALID_PACKET;
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user