1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

See ChangeLog: Fri Sep 3 10:06:06 CEST 1999 Werner Koch

This commit is contained in:
Werner Koch 1999-09-03 08:15:32 +00:00
parent c7678c6462
commit 39fe1cbfde
13 changed files with 240 additions and 134 deletions

View file

@ -1,3 +1,15 @@
Fri Sep 3 10:04:45 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
* pkclist.c (build_pk_list): Skip keys set with --encrypt-to also
when asking for a key.
* plaintext.c (handle_plaintext): Make sure that we don't read a
second EOF in the read loop for partial length packets.
* mainproc.c (check_sig_and_print): print user ID as utf-8.
Thu Sep 2 16:40:55 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>

View file

@ -1058,8 +1058,8 @@ check_sig_and_print( CTX c, KBNODE node )
: _("Good signature from \""));
else
log_info( _(" aka \""));
print_string( log_stream(), un->pkt->pkt.user_id->name,
un->pkt->pkt.user_id->len, '\"' );
print_utf8_string( log_stream(), un->pkt->pkt.user_id->name,
un->pkt->pkt.user_id->len );
fputs("\"\n", log_stream() );
if( rc )
break; /* print only one id in this case */

View file

@ -751,11 +751,18 @@ build_pk_list( STRLIST remusr, PK_LIST *ret_pk_list, unsigned use )
tty_printf(_("No such user ID.\n"));
else if( !(rc=check_pubkey_algo2(pk->pubkey_algo, use)) ) {
if( have_def_rec ) {
PK_LIST r = m_alloc( sizeof *r );
r->pk = pk; pk = NULL;
r->next = pk_list;
r->mark = 0;
pk_list = r;
if (key_present_in_pk_list(pk_list, pk) == 0) {
free_public_key(pk); pk = NULL;
log_info(_("skipped: public key "
"already set as default recipient\n") );
}
else {
PK_LIST r = m_alloc( sizeof *r );
r->pk = pk; pk = NULL;
r->next = pk_list;
r->mark = 0;
pk_list = r;
}
any_recipients = 1;
break;
}
@ -771,13 +778,22 @@ build_pk_list( STRLIST remusr, PK_LIST *ret_pk_list, unsigned use )
tty_printf(_("Public key is disabled.\n") );
}
else if( do_we_trust_pre( pk, trustlevel ) ) {
PK_LIST r;
/* Skip the actual key if the key is already present
* in the list */
if (key_present_in_pk_list(pk_list, pk) == 0) {
free_public_key(pk); pk = NULL;
log_info(_("skipped: public key "
"already set with --encrypt-to\n") );
}
else {
PK_LIST r;
r = m_alloc( sizeof *r );
r->pk = pk; pk = NULL;
r->next = pk_list;
r->mark = 0;
pk_list = r;
r = m_alloc( sizeof *r );
r->pk = pk; pk = NULL;
r->next = pk_list;
r->mark = 0;
pk_list = r;
}
any_recipients = 1;
break;
}

View file

@ -166,10 +166,19 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
}
else { /* binary mode */
byte *buffer = m_alloc( 32768 );
for( ;; ) {
int eof;
for( eof=0; !eof; ) {
/* Why do we check for len < 32768:
* If we won´ we would practically read 2 EOFS but
* the first one has already popped the block_filter
* off and therefore we don't catch the boundary.
* Always assume EOF if iobuf_read returns less bytes
* then requested */
int len = iobuf_read( pt->buf, buffer, 32768 );
if( len == -1 )
break;
if( len < 32768 )
eof = 1;
if( mfx->md )
md_write( mfx->md, buffer, len );
if( fp ) {
@ -243,6 +252,46 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
return rc;
}
static void
do_hash( MD_HANDLE md, MD_HANDLE md2, IOBUF fp, int textmode )
{
text_filter_context_t tfx;
int c;
if( textmode ) {
memset( &tfx, 0, sizeof tfx);
iobuf_push_filter( fp, text_filter, &tfx );
}
if( md2 ) { /* work around a strange behaviour in pgp2 */
/* It seems that at least PGP5 converts a single CR to a CR,LF too */
int lc = -1;
while( (c = iobuf_get(fp)) != -1 ) {
if( c == '\n' && lc == '\r' )
md_putc(md2, c);
else if( c == '\n' ) {
md_putc(md2, '\r');
md_putc(md2, c);
}
else if( c != '\n' && lc == '\r' ) {
md_putc(md2, '\n');
md_putc(md2, c);
}
else
md_putc(md2, c);
if( md )
md_putc(md, c );
lc = c;
}
}
else {
while( (c = iobuf_get(fp)) != -1 ) {
if( md )
md_putc(md, c );
}
}
}
/****************
* Ask for the detached datafile and calculate the digest from it.
@ -255,7 +304,6 @@ ask_for_detached_datafile( MD_HANDLE md, MD_HANDLE md2,
char *answer = NULL;
IOBUF fp;
int rc = 0;
int c;
fp = open_sigfile( inname ); /* open default file */
if( !fp && !opt.batch ) {
@ -299,46 +347,6 @@ ask_for_detached_datafile( MD_HANDLE md, MD_HANDLE md2,
}
static void
do_hash( MD_HANDLE md, MD_HANDLE md2, IOBUF fp, int textmode )
{
text_filter_context_t tfx;
int c;
if( textmode ) {
memset( &tfx, 0, sizeof tfx);
iobuf_push_filter( fp, text_filter, &tfx );
}
if( md2 ) { /* work around a strange behaviour in pgp2 */
/* It seems that at least PGP5 converts a single CR to a CR,LF too */
int lc = -1;
while( (c = iobuf_get(fp)) != -1 ) {
if( c == '\n' && lc == '\r' )
md_putc(md2, c);
else if( c == '\n' ) {
md_putc(md2, '\r');
md_putc(md2, c);
}
else if( c != '\n' && lc == '\r' ) {
md_putc(md2, '\n');
md_putc(md2, c);
}
else
md_putc(md2, c);
if( md )
md_putc(md, c );
lc = c;
}
}
else {
while( (c = iobuf_get(fp)) != -1 ) {
if( md )
md_putc(md, c );
}
}
}
/****************
* Hash the given files and append the hash to hash context md.