mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-01 16:33:02 +01:00
* keylist.c (list_keyblock_print): Show the fingerprint after the key, not
after the first user ID. * keyedit.c (show_key_with_all_names): Don't show validity if we're just printing user IDs for signing. * armor.c (fake_packet): Properly handle the case where the line is dash-space (i.e. a blank line that was quoted). Give a warning for bad dash escaping.
This commit is contained in:
parent
f294ce2d8b
commit
f13bba108a
@ -1,3 +1,15 @@
|
|||||||
|
2004-10-14 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* keylist.c (list_keyblock_print): Show the fingerprint after the
|
||||||
|
key, not after the first user ID.
|
||||||
|
|
||||||
|
* keyedit.c (show_key_with_all_names): Don't show validity if
|
||||||
|
we're just printing user IDs for signing.
|
||||||
|
|
||||||
|
* armor.c (fake_packet): Properly handle the case where the line
|
||||||
|
is dash-space (i.e. a blank line that was quoted). Give a warning
|
||||||
|
for bad dash escaping.
|
||||||
|
|
||||||
2004-10-14 Werner Koch <wk@g10code.com>
|
2004-10-14 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* export.c (do_export_stream) [ENABLE_SELINUX_HACKS]: Don't allow
|
* export.c (do_export_stream) [ENABLE_SELINUX_HACKS]: Don't allow
|
||||||
|
95
g10/armor.c
95
g10/armor.c
@ -518,15 +518,64 @@ fake_packet( armor_filter_context_t *afx, IOBUF a,
|
|||||||
}
|
}
|
||||||
if( !maxlen )
|
if( !maxlen )
|
||||||
afx->truncated++;
|
afx->truncated++;
|
||||||
if( !afx->not_dash_escaped ) {
|
|
||||||
int crlf;
|
p = afx->buffer;
|
||||||
p = afx->buffer;
|
n = afx->buffer_len;
|
||||||
n = afx->buffer_len;
|
|
||||||
crlf = n > 1 && p[n-2] == '\r' && p[n-1]=='\n';
|
/* Armor header or dash-escaped line? */
|
||||||
|
if(p[0]=='-')
|
||||||
|
{
|
||||||
|
/* 2440bis-10: When reversing dash-escaping, an
|
||||||
|
implementation MUST strip the string "- " if it occurs
|
||||||
|
at the beginning of a line, and SHOULD warn on "-" and
|
||||||
|
any character other than a space at the beginning of a
|
||||||
|
line. */
|
||||||
|
|
||||||
|
if(p[1]==' ' && !afx->not_dash_escaped)
|
||||||
|
{
|
||||||
|
/* It's a dash-escaped line, so skip over the
|
||||||
|
escape. */
|
||||||
|
afx->buffer_pos = 2;
|
||||||
|
}
|
||||||
|
else if(p[1]=='-' && p[2]=='-' && p[3]=='-' && p[4]=='-')
|
||||||
|
{
|
||||||
|
/* Five dashes in a row mean it's probably armor
|
||||||
|
header. */
|
||||||
|
int type = is_armor_header( p, n );
|
||||||
|
if( afx->not_dash_escaped && type != BEGIN_SIGNATURE )
|
||||||
|
; /* this is okay */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( type != BEGIN_SIGNATURE )
|
||||||
|
{
|
||||||
|
log_info(_("unexpected armor: "));
|
||||||
|
print_string( stderr, p, n, 0 );
|
||||||
|
putc('\n', stderr);
|
||||||
|
}
|
||||||
|
|
||||||
|
lastline = 1;
|
||||||
|
rc = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(!afx->not_dash_escaped)
|
||||||
|
{
|
||||||
|
/* Bad dash-escaping. */
|
||||||
|
log_info(_("invalid dash escaped line: "));
|
||||||
|
print_string( stderr, p, n, 0 );
|
||||||
|
putc('\n', stderr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now handle the end-of-line canonicalization */
|
||||||
|
if( !afx->not_dash_escaped )
|
||||||
|
{
|
||||||
|
int crlf = n > 1 && p[n-2] == '\r' && p[n-1]=='\n';
|
||||||
|
|
||||||
/* PGP2 does not treat a tab as white space character */
|
/* PGP2 does not treat a tab as white space character */
|
||||||
afx->buffer_len = trim_trailing_chars( p, n,
|
afx->buffer_len=
|
||||||
afx->pgp2mode ? " \r\n" : " \t\r\n");
|
trim_trailing_chars( &p[afx->buffer_pos], n-afx->buffer_pos,
|
||||||
|
afx->pgp2mode ? " \r\n" : " \t\r\n");
|
||||||
|
afx->buffer_len+=afx->buffer_pos;
|
||||||
/* the buffer is always allocated with enough space to append
|
/* the buffer is always allocated with enough space to append
|
||||||
* the removed [CR], LF and a Nul
|
* the removed [CR], LF and a Nul
|
||||||
* The reason for this complicated procedure is to keep at least
|
* The reason for this complicated procedure is to keep at least
|
||||||
@ -538,37 +587,9 @@ fake_packet( armor_filter_context_t *afx, IOBUF a,
|
|||||||
* faked packet could do the job).
|
* faked packet could do the job).
|
||||||
*/
|
*/
|
||||||
if( crlf )
|
if( crlf )
|
||||||
afx->buffer[afx->buffer_len++] = '\r';
|
afx->buffer[afx->buffer_len++] = '\r';
|
||||||
afx->buffer[afx->buffer_len++] = '\n';
|
afx->buffer[afx->buffer_len++] = '\n';
|
||||||
afx->buffer[afx->buffer_len] = 0;
|
afx->buffer[afx->buffer_len] = '\0';
|
||||||
}
|
|
||||||
p = afx->buffer;
|
|
||||||
n = afx->buffer_len;
|
|
||||||
|
|
||||||
if( n > 2 && *p == '-' )
|
|
||||||
{
|
|
||||||
/* check for dash escaped or armor header */
|
|
||||||
if( p[1] == ' ' && !afx->not_dash_escaped )
|
|
||||||
{
|
|
||||||
/* It's a dash-escaped line */
|
|
||||||
afx->buffer_pos = 2; /* skip */
|
|
||||||
}
|
|
||||||
else if( n >= 15 && p[1] == '-' && p[2] == '-' && p[3] == '-' )
|
|
||||||
{
|
|
||||||
/* It's armor header */
|
|
||||||
int type = is_armor_header( p, n );
|
|
||||||
if( afx->not_dash_escaped && type != BEGIN_SIGNATURE )
|
|
||||||
; /* this is okay */
|
|
||||||
else {
|
|
||||||
if( type != BEGIN_SIGNATURE ) {
|
|
||||||
log_info(_("unexpected armor: "));
|
|
||||||
print_string( stderr, p, n, 0 );
|
|
||||||
putc('\n', stderr);
|
|
||||||
}
|
|
||||||
lastline = 1;
|
|
||||||
rc = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -915,8 +915,8 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified,
|
|||||||
}
|
}
|
||||||
|
|
||||||
p=get_user_id_native(sk_keyid);
|
p=get_user_id_native(sk_keyid);
|
||||||
tty_printf(_("Are you really sure that you want to sign this key\n"
|
tty_printf(_("Are you sure that you want to sign this key with your\n"
|
||||||
"with your key \"%s\" (%s)\n"),p,keystr_from_sk(sk));
|
"key \"%s\" (%s)\n"),p,keystr_from_sk(sk));
|
||||||
m_free(p);
|
m_free(p);
|
||||||
|
|
||||||
if(selfsig)
|
if(selfsig)
|
||||||
@ -2325,26 +2325,34 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker,
|
|||||||
/* the user ids */
|
/* the user ids */
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
for( node = keyblock; node; node = node->next ) {
|
for( node = keyblock; node; node = node->next )
|
||||||
if( node->pkt->pkttype == PKT_USER_ID ) {
|
{
|
||||||
|
if( node->pkt->pkttype == PKT_USER_ID )
|
||||||
|
{
|
||||||
PKT_user_id *uid = node->pkt->pkt.user_id;
|
PKT_user_id *uid = node->pkt->pkt.user_id;
|
||||||
++i;
|
++i;
|
||||||
if( !only_marked || (only_marked && (node->flag & NODFLG_MARK_A))){
|
if( !only_marked || (only_marked && (node->flag & NODFLG_MARK_A)))
|
||||||
if(uid->is_revoked)
|
{
|
||||||
tty_printf(_("[%8.8s] "),_("revoked"));
|
if(!only_marked)
|
||||||
else if(uid->is_expired)
|
{
|
||||||
tty_printf(_("[%8.8s] "),_("expired"));
|
if(uid->is_revoked)
|
||||||
else if(primary)
|
tty_printf(_("[%8.8s] "),_("revoked"));
|
||||||
tty_printf(_("[%8.8s] "),
|
else if(uid->is_expired)
|
||||||
trust_value_to_string(get_validity(primary,uid)));
|
tty_printf(_("[%8.8s] "),_("expired"));
|
||||||
|
else if(primary)
|
||||||
|
tty_printf(_("[%8.8s] "),
|
||||||
|
trust_value_to_string(get_validity(primary,
|
||||||
|
uid)));
|
||||||
|
}
|
||||||
|
|
||||||
if( only_marked )
|
if( only_marked )
|
||||||
tty_printf(" ");
|
tty_printf(" ");
|
||||||
else if( node->flag & NODFLG_SELUID )
|
else if( node->flag & NODFLG_SELUID )
|
||||||
tty_printf("(%d)* ", i);
|
tty_printf("(%d)* ", i);
|
||||||
else if( uid->is_primary )
|
else if( uid->is_primary )
|
||||||
tty_printf("(%d). ", i);
|
tty_printf("(%d). ", i);
|
||||||
else
|
else
|
||||||
tty_printf("(%d) ", i);
|
tty_printf("(%d) ", i);
|
||||||
tty_print_utf8_string( uid->name, uid->len );
|
tty_print_utf8_string( uid->name, uid->len );
|
||||||
tty_printf("\n");
|
tty_printf("\n");
|
||||||
if( with_prefs )
|
if( with_prefs )
|
||||||
@ -2372,9 +2380,9 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker,
|
|||||||
tty_printf(_("There are no preferences on a "
|
tty_printf(_("There are no preferences on a "
|
||||||
"PGP 2.x-style user ID.\n"));
|
"PGP 2.x-style user ID.\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_warn)
|
if (do_warn)
|
||||||
tty_printf (_("Please note that the shown key validity "
|
tty_printf (_("Please note that the shown key validity "
|
||||||
|
@ -651,7 +651,6 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
|
|||||||
KBNODE node;
|
KBNODE node;
|
||||||
PKT_public_key *pk;
|
PKT_public_key *pk;
|
||||||
PKT_secret_key *sk;
|
PKT_secret_key *sk;
|
||||||
int any=0;
|
|
||||||
struct sig_stats *stats=opaque;
|
struct sig_stats *stats=opaque;
|
||||||
int skip_sigs=0;
|
int skip_sigs=0;
|
||||||
|
|
||||||
@ -735,6 +734,12 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( fpr )
|
||||||
|
print_fingerprint( pk, sk, 0 );
|
||||||
|
print_card_serialno (sk);
|
||||||
|
if( opt.with_key_data )
|
||||||
|
print_key_data( pk );
|
||||||
|
|
||||||
for( kbctx=NULL; (node=walk_kbnode( keyblock, &kbctx, 0)) ; ) {
|
for( kbctx=NULL; (node=walk_kbnode( keyblock, &kbctx, 0)) ; ) {
|
||||||
if( node->pkt->pkttype == PKT_USER_ID && !opt.fast_list_mode ) {
|
if( node->pkt->pkttype == PKT_USER_ID && !opt.fast_list_mode ) {
|
||||||
PKT_user_id *uid=node->pkt->pkt.user_id;
|
PKT_user_id *uid=node->pkt->pkt.user_id;
|
||||||
@ -776,14 +781,6 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
|
|||||||
|
|
||||||
print_utf8_string( stdout, uid->name, uid->len );
|
print_utf8_string( stdout, uid->name, uid->len );
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( !any ) {
|
|
||||||
if( fpr )
|
|
||||||
print_fingerprint( pk, sk, 0 );
|
|
||||||
print_card_serialno (sk);
|
|
||||||
if( opt.with_key_data )
|
|
||||||
print_key_data( pk );
|
|
||||||
any = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((opt.list_options&LIST_SHOW_PHOTOS) && uid->attribs!=NULL)
|
if((opt.list_options&LIST_SHOW_PHOTOS) && uid->attribs!=NULL)
|
||||||
show_photos(uid->attribs,uid->numattribs,pk,sk);
|
show_photos(uid->attribs,uid->numattribs,pk,sk);
|
||||||
@ -801,14 +798,6 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
|
|||||||
else
|
else
|
||||||
skip_sigs=0;
|
skip_sigs=0;
|
||||||
|
|
||||||
if( !any )
|
|
||||||
{
|
|
||||||
putchar('\n');
|
|
||||||
if( fpr )
|
|
||||||
print_fingerprint( pk, sk, 0 ); /* of the main key */
|
|
||||||
any = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("sub %4u%c/%s %s",
|
printf("sub %4u%c/%s %s",
|
||||||
nbits_from_pk( pk2 ),pubkey_letter( pk2->pubkey_algo ),
|
nbits_from_pk( pk2 ),pubkey_letter( pk2->pubkey_algo ),
|
||||||
keystr_from_pk(pk2),datestr_from_pk(pk2));
|
keystr_from_pk(pk2),datestr_from_pk(pk2));
|
||||||
@ -840,15 +829,6 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
|
|||||||
{
|
{
|
||||||
PKT_secret_key *sk2 = node->pkt->pkt.secret_key;
|
PKT_secret_key *sk2 = node->pkt->pkt.secret_key;
|
||||||
|
|
||||||
if( !any )
|
|
||||||
{
|
|
||||||
putchar('\n');
|
|
||||||
if( fpr )
|
|
||||||
print_fingerprint( pk, sk, 0 ); /* of the main key */
|
|
||||||
print_card_serialno (sk);
|
|
||||||
any = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("ssb%c %4u%c/%s %s",
|
printf("ssb%c %4u%c/%s %s",
|
||||||
(sk2->protect.s2k.mode==1001)?'#':
|
(sk2->protect.s2k.mode==1001)?'#':
|
||||||
(sk2->protect.s2k.mode==1002)?'>':' ',
|
(sk2->protect.s2k.mode==1002)?'>':' ',
|
||||||
@ -894,25 +874,6 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
|
|||||||
sigrc = ' ';
|
sigrc = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !any ) { /* no user id, (maybe a revocation follows)*/
|
|
||||||
/* Check if the pk is really revoked - there could be a
|
|
||||||
0x20 sig packet there even if we are not revoked
|
|
||||||
(say, if a revocation key issued the packet, but the
|
|
||||||
revocation key isn't present to verify it.) */
|
|
||||||
if( sig->sig_class == 0x20 && pk->is_revoked )
|
|
||||||
puts("[revoked]");
|
|
||||||
else if( sig->sig_class == 0x18 )
|
|
||||||
puts("[key binding]");
|
|
||||||
else if( sig->sig_class == 0x28 )
|
|
||||||
puts("[subkey revoked]");
|
|
||||||
else
|
|
||||||
putchar('\n');
|
|
||||||
if( fpr )
|
|
||||||
print_fingerprint( pk, sk, 0 );
|
|
||||||
print_card_serialno (sk);
|
|
||||||
any=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( sig->sig_class == 0x20 || sig->sig_class == 0x28
|
if( sig->sig_class == 0x20 || sig->sig_class == 0x28
|
||||||
|| sig->sig_class == 0x30 )
|
|| sig->sig_class == 0x30 )
|
||||||
sigstr = "rev";
|
sigstr = "rev";
|
||||||
@ -1535,7 +1496,7 @@ print_card_serialno (PKT_secret_key *sk)
|
|||||||
if (!sk->is_protected || sk->protect.s2k.mode != 1002)
|
if (!sk->is_protected || sk->protect.s2k.mode != 1002)
|
||||||
return; /* Not a card. */
|
return; /* Not a card. */
|
||||||
if (opt.with_colons)
|
if (opt.with_colons)
|
||||||
return; /* Handled elesewhere. */
|
return; /* Handled elsewhere. */
|
||||||
|
|
||||||
fputs (_(" Card serial no. ="), stdout);
|
fputs (_(" Card serial no. ="), stdout);
|
||||||
putchar (' ');
|
putchar (' ');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user