mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-03 16:53:03 +01:00
* parse-packet.c (parse_plaintext), packet.h, plaintext.c
(handle_plaintext): Fix bug in handling literal packets with zero-length data (no data was being confused with partial body length). * misc.c (pct_expando), options.skel: %t means extension ("jpg"). %T means MIME type ("image/jpeg"). * import.c (import_one): Only trigger trust update if the keyring is actually changed. * export.c (do_export_stream): Missing a m_free.
This commit is contained in:
parent
0f2fedd806
commit
3b9a04844c
@ -1,3 +1,18 @@
|
|||||||
|
2002-04-22 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* parse-packet.c (parse_plaintext), packet.h, plaintext.c
|
||||||
|
(handle_plaintext): Fix bug in handling literal packets with
|
||||||
|
zero-length data (no data was being confused with partial body
|
||||||
|
length).
|
||||||
|
|
||||||
|
* misc.c (pct_expando), options.skel: %t means extension ("jpg").
|
||||||
|
%T means MIME type ("image/jpeg").
|
||||||
|
|
||||||
|
* import.c (import_one): Only trigger trust update if the keyring
|
||||||
|
is actually changed.
|
||||||
|
|
||||||
|
* export.c (do_export_stream): Missing a m_free.
|
||||||
|
|
||||||
2002-04-22 Stefan Bellon <sbellon@sbellon.de>
|
2002-04-22 Stefan Bellon <sbellon@sbellon.de>
|
||||||
|
|
||||||
* keyid.c (expirestr_from_sk, expirestr_from_sig): Added _() to
|
* keyid.c (expirestr_from_sk, expirestr_from_sig): Added _() to
|
||||||
|
@ -116,7 +116,7 @@ do_export_stream( IOBUF out, STRLIST users, int secret, int onlyrfc, int *any )
|
|||||||
KBNODE keyblock = NULL;
|
KBNODE keyblock = NULL;
|
||||||
KBNODE kbctx, node;
|
KBNODE kbctx, node;
|
||||||
int ndesc;
|
int ndesc;
|
||||||
KEYDB_SEARCH_DESC *desc;
|
KEYDB_SEARCH_DESC *desc = NULL;
|
||||||
KEYDB_HANDLE kdbhd;
|
KEYDB_HANDLE kdbhd;
|
||||||
STRLIST sl;
|
STRLIST sl;
|
||||||
|
|
||||||
@ -248,6 +248,7 @@ do_export_stream( IOBUF out, STRLIST users, int secret, int onlyrfc, int *any )
|
|||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
|
m_free(desc);
|
||||||
keydb_release (kdbhd);
|
keydb_release (kdbhd);
|
||||||
release_kbnode( keyblock );
|
release_kbnode( keyblock );
|
||||||
if( !*any )
|
if( !*any )
|
||||||
|
@ -467,7 +467,6 @@ import_one( const char *fname, KBNODE keyblock, int fast,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* do we have this key already in one of our pubrings ? */
|
/* do we have this key already in one of our pubrings ? */
|
||||||
pk_orig = m_alloc_clear( sizeof *pk_orig );
|
pk_orig = m_alloc_clear( sizeof *pk_orig );
|
||||||
rc = get_pubkey( pk_orig, keyid );
|
rc = get_pubkey( pk_orig, keyid );
|
||||||
@ -497,7 +496,10 @@ import_one( const char *fname, KBNODE keyblock, int fast,
|
|||||||
if (rc)
|
if (rc)
|
||||||
log_error (_("error writing keyring `%s': %s\n"),
|
log_error (_("error writing keyring `%s': %s\n"),
|
||||||
keydb_get_resource_name (hd), g10_errstr(rc));
|
keydb_get_resource_name (hd), g10_errstr(rc));
|
||||||
|
else
|
||||||
|
revalidation_mark ();
|
||||||
keydb_release (hd);
|
keydb_release (hd);
|
||||||
|
|
||||||
/* we are ready */
|
/* we are ready */
|
||||||
if( !opt.quiet )
|
if( !opt.quiet )
|
||||||
log_info( _("key %08lX: public key imported\n"), (ulong)keyid[1]);
|
log_info( _("key %08lX: public key imported\n"), (ulong)keyid[1]);
|
||||||
@ -568,6 +570,9 @@ import_one( const char *fname, KBNODE keyblock, int fast,
|
|||||||
if (rc)
|
if (rc)
|
||||||
log_error (_("error writing keyring `%s': %s\n"),
|
log_error (_("error writing keyring `%s': %s\n"),
|
||||||
keydb_get_resource_name (hd), g10_errstr(rc) );
|
keydb_get_resource_name (hd), g10_errstr(rc) );
|
||||||
|
else
|
||||||
|
revalidation_mark ();
|
||||||
|
|
||||||
/* we are ready */
|
/* we are ready */
|
||||||
if( !opt.quiet ) {
|
if( !opt.quiet ) {
|
||||||
if( n_uids == 1 )
|
if( n_uids == 1 )
|
||||||
@ -601,8 +606,6 @@ import_one( const char *fname, KBNODE keyblock, int fast,
|
|||||||
}
|
}
|
||||||
keydb_release (hd); hd = NULL;
|
keydb_release (hd); hd = NULL;
|
||||||
}
|
}
|
||||||
if (!rc)
|
|
||||||
revalidation_mark ();
|
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
release_kbnode( keyblock_orig );
|
release_kbnode( keyblock_orig );
|
||||||
|
16
g10/misc.c
16
g10/misc.c
@ -509,14 +509,22 @@ pct_expando(const char *string,PKT_public_key *pk)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* photo type. For now, it's always jpeg so this is
|
/* photo types. For now, it's always jpeg so this is
|
||||||
easy! */
|
easy! */
|
||||||
case 't':
|
case 't':
|
||||||
if(idx+4>maxlen)
|
if(idx+3>maxlen)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
strcpy(&ret[idx],"jpeg");
|
strcpy(&ret[idx],"jpg");
|
||||||
idx+=4;
|
idx+=3;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'T':
|
||||||
|
if(idx+10>maxlen)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
strcpy(&ret[idx],"image/jpeg");
|
||||||
|
idx+=10;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '%':
|
case '%':
|
||||||
|
@ -160,7 +160,8 @@ lock-once
|
|||||||
# %I is the same as %i, but the file isn't deleted afterwards by GnuPG.
|
# %I is the same as %i, but the file isn't deleted afterwards by GnuPG.
|
||||||
# %k is expanded to the key ID of the key.
|
# %k is expanded to the key ID of the key.
|
||||||
# %K is expanded to the long OpenPGP key ID of the key.
|
# %K is expanded to the long OpenPGP key ID of the key.
|
||||||
# %t is expanded to the type of image (e.g. "jpeg").
|
# %t is expanded to the extension of the image (e.g. "jpg").
|
||||||
|
# %T is expanded to the MIME type of the image (e.g. "image/jpeg").
|
||||||
# %f is expanded to the fingerprint of the key.
|
# %f is expanded to the fingerprint of the key.
|
||||||
# %% is %, of course.
|
# %% is %, of course.
|
||||||
#
|
#
|
||||||
@ -177,10 +178,10 @@ lock-once
|
|||||||
# photo-viewer "display -title 'KeyID 0x%k'"
|
# photo-viewer "display -title 'KeyID 0x%k'"
|
||||||
#
|
#
|
||||||
# This one saves a copy of the photo ID in your home directory:
|
# This one saves a copy of the photo ID in your home directory:
|
||||||
# photo-viewer "cat > ~/photoid-for-key-%k.jpg"
|
# photo-viewer "cat > ~/photoid-for-key-%k.%t"
|
||||||
#
|
#
|
||||||
# Use your MIME handler to view photos:
|
# Use your MIME handler to view photos:
|
||||||
# photo-viewer "metamail -q -d -b -c image/%t -s 'KeyID 0x%k' -f GnuPG"
|
# photo-viewer "metamail -q -d -b -c %T -s 'KeyID 0x%k' -f GnuPG"
|
||||||
|
|
||||||
|
|
||||||
# Passphrase agent
|
# Passphrase agent
|
||||||
|
@ -275,6 +275,7 @@ typedef struct {
|
|||||||
u32 len; /* length of encrypted data */
|
u32 len; /* length of encrypted data */
|
||||||
IOBUF buf; /* IOBUF reference */
|
IOBUF buf; /* IOBUF reference */
|
||||||
byte new_ctb;
|
byte new_ctb;
|
||||||
|
byte is_partial; /* partial length encoded */
|
||||||
int mode;
|
int mode;
|
||||||
u32 timestamp;
|
u32 timestamp;
|
||||||
int namelen;
|
int namelen;
|
||||||
|
@ -1928,7 +1928,7 @@ parse_plaintext( IOBUF inp, int pkttype, unsigned long pktlen,
|
|||||||
PACKET *pkt, int new_ctb )
|
PACKET *pkt, int new_ctb )
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
int mode, namelen;
|
int mode, namelen, partial=0;
|
||||||
PKT_plaintext *pt;
|
PKT_plaintext *pt;
|
||||||
byte *p;
|
byte *p;
|
||||||
int c, i;
|
int c, i;
|
||||||
@ -1938,12 +1938,18 @@ parse_plaintext( IOBUF inp, int pkttype, unsigned long pktlen,
|
|||||||
rc = G10ERR_INVALID_PACKET;
|
rc = G10ERR_INVALID_PACKET;
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
/* A packet length of zero indicates partial body length. A zero
|
||||||
|
data length isn't a zero length packet due to the header (mode,
|
||||||
|
name, etc), so this is accurate. */
|
||||||
|
if(pktlen==0)
|
||||||
|
partial=1;
|
||||||
mode = iobuf_get_noeof(inp); if( pktlen ) pktlen--;
|
mode = iobuf_get_noeof(inp); if( pktlen ) pktlen--;
|
||||||
namelen = iobuf_get_noeof(inp); if( pktlen ) pktlen--;
|
namelen = iobuf_get_noeof(inp); if( pktlen ) pktlen--;
|
||||||
pt = pkt->pkt.plaintext = m_alloc(sizeof *pkt->pkt.plaintext + namelen -1);
|
pt = pkt->pkt.plaintext = m_alloc(sizeof *pkt->pkt.plaintext + namelen -1);
|
||||||
pt->new_ctb = new_ctb;
|
pt->new_ctb = new_ctb;
|
||||||
pt->mode = mode;
|
pt->mode = mode;
|
||||||
pt->namelen = namelen;
|
pt->namelen = namelen;
|
||||||
|
pt->is_partial = partial;
|
||||||
if( pktlen ) {
|
if( pktlen ) {
|
||||||
for( i=0; pktlen > 4 && i < namelen; pktlen--, i++ )
|
for( i=0; pktlen > 4 && i < namelen; pktlen--, i++ )
|
||||||
pt->name[i] = iobuf_get_noeof(inp);
|
pt->name[i] = iobuf_get_noeof(inp);
|
||||||
|
@ -114,7 +114,8 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
|||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pt->len ) {
|
if( !pt->is_partial ) {
|
||||||
|
/* we have an actual length (which might be zero). */
|
||||||
assert( !clearsig );
|
assert( !clearsig );
|
||||||
if( convert ) { /* text mode */
|
if( convert ) { /* text mode */
|
||||||
for( ; pt->len; pt->len-- ) {
|
for( ; pt->len; pt->len-- ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user