mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-17 15:44:34 +02:00
gpg: Fix indendation of check_sig_and_print.
--
This commit is contained in:
parent
09055aa0f7
commit
e5279c85a0
653
g10/mainproc.c
653
g10/mainproc.c
@ -1,7 +1,7 @@
|
|||||||
/* mainproc.c - handle packets
|
/* mainproc.c - handle packets
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||||
* 2008, 2009 Free Software Foundation, Inc.
|
* 2008, 2009 Free Software Foundation, Inc.
|
||||||
* Copyright (C) 2013 Werner Koch
|
* Copyright (C) 2013, 2014 Werner Koch
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -1529,7 +1529,7 @@ pka_uri_from_sig (PKT_signature *sig)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
check_sig_and_print( CTX c, KBNODE node )
|
check_sig_and_print (CTX c, KBNODE node)
|
||||||
{
|
{
|
||||||
PKT_signature *sig = node->pkt->pkt.signature;
|
PKT_signature *sig = node->pkt->pkt.signature;
|
||||||
const char *astr;
|
const char *astr;
|
||||||
@ -1649,390 +1649,405 @@ check_sig_and_print( CTX c, KBNODE node )
|
|||||||
log_error(_("can't handle this ambiguous signature data\n"));
|
log_error(_("can't handle this ambiguous signature data\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (Indendation below not yet changed to GNU style.) */
|
astr = openpgp_pk_algo_name ( sig->pubkey_algo );
|
||||||
|
if (keystrlen () > 8)
|
||||||
|
{
|
||||||
|
log_info (_("Signature made %s\n"), asctimestamp(sig->timestamp));
|
||||||
|
log_info (_(" using %s key %s\n"),
|
||||||
|
astr? astr: "?",keystr(sig->keyid));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
log_info (_("Signature made %s using %s key ID %s\n"),
|
||||||
|
asctimestamp(sig->timestamp), astr? astr: "?",
|
||||||
|
keystr(sig->keyid));
|
||||||
|
|
||||||
astr = openpgp_pk_algo_name ( sig->pubkey_algo );
|
rc = do_check_sig(c, node, NULL, &is_expkey, &is_revkey );
|
||||||
if(keystrlen()>8)
|
|
||||||
{
|
|
||||||
log_info(_("Signature made %s\n"),asctimestamp(sig->timestamp));
|
|
||||||
log_info(_(" using %s key %s\n"),
|
|
||||||
astr? astr: "?",keystr(sig->keyid));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
log_info(_("Signature made %s using %s key ID %s\n"),
|
|
||||||
asctimestamp(sig->timestamp), astr? astr: "?",
|
|
||||||
keystr(sig->keyid));
|
|
||||||
|
|
||||||
rc = do_check_sig(c, node, NULL, &is_expkey, &is_revkey );
|
/* If the key isn't found, check for a preferred keyserver */
|
||||||
|
|
||||||
/* If the key isn't found, check for a preferred keyserver */
|
if (gpg_err_code (rc) == G10ERR_NO_PUBKEY && sig->flags.pref_ks)
|
||||||
|
{
|
||||||
|
const byte *p;
|
||||||
|
int seq = 0;
|
||||||
|
size_t n;
|
||||||
|
|
||||||
if(rc==G10ERR_NO_PUBKEY && sig->flags.pref_ks)
|
while ((p=enum_sig_subpkt (sig->hashed,SIGSUBPKT_PREF_KS,&n,&seq,NULL)))
|
||||||
{
|
{
|
||||||
const byte *p;
|
/* According to my favorite copy editor, in English grammar,
|
||||||
int seq=0;
|
you say "at" if the key is located on a web page, but
|
||||||
size_t n;
|
"from" if it is located on a keyserver. I'm not going to
|
||||||
|
even try to make two strings here :) */
|
||||||
|
log_info(_("Key available at: ") );
|
||||||
|
print_utf8_buffer (log_get_stream(), p, n);
|
||||||
|
log_printf ("\n");
|
||||||
|
|
||||||
while((p=enum_sig_subpkt(sig->hashed,SIGSUBPKT_PREF_KS,&n,&seq,NULL)))
|
if (opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE
|
||||||
{
|
&& opt.keyserver_options.options&KEYSERVER_HONOR_KEYSERVER_URL)
|
||||||
/* According to my favorite copy editor, in English
|
{
|
||||||
grammar, you say "at" if the key is located on a web
|
struct keyserver_spec *spec;
|
||||||
page, but "from" if it is located on a keyserver. I'm
|
|
||||||
not going to even try to make two strings here :) */
|
|
||||||
log_info(_("Key available at: ") );
|
|
||||||
print_utf8_buffer (log_get_stream(), p, n);
|
|
||||||
log_printf ("\n");
|
|
||||||
|
|
||||||
if(opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE
|
spec = parse_preferred_keyserver (sig);
|
||||||
&& opt.keyserver_options.options&KEYSERVER_HONOR_KEYSERVER_URL)
|
if (spec)
|
||||||
{
|
{
|
||||||
struct keyserver_spec *spec;
|
int res;
|
||||||
|
|
||||||
spec=parse_preferred_keyserver(sig);
|
glo_ctrl.in_auto_key_retrieve++;
|
||||||
if(spec)
|
res = keyserver_import_keyid (c->ctrl, sig->keyid,spec);
|
||||||
{
|
glo_ctrl.in_auto_key_retrieve--;
|
||||||
int res;
|
if (!res)
|
||||||
|
rc = do_check_sig(c, node, NULL, &is_expkey, &is_revkey );
|
||||||
|
free_keyserver_spec (spec);
|
||||||
|
|
||||||
glo_ctrl.in_auto_key_retrieve++;
|
if (!rc)
|
||||||
res = keyserver_import_keyid (c->ctrl, sig->keyid,spec);
|
break;
|
||||||
glo_ctrl.in_auto_key_retrieve--;
|
}
|
||||||
if(!res)
|
}
|
||||||
rc=do_check_sig(c, node, NULL, &is_expkey, &is_revkey );
|
}
|
||||||
free_keyserver_spec(spec);
|
}
|
||||||
|
|
||||||
if(!rc)
|
/* If the preferred keyserver thing above didn't work, our second
|
||||||
break;
|
try is to use the URI from a DNS PKA record. */
|
||||||
}
|
if (gpg_err_code (rc) == G10ERR_NO_PUBKEY
|
||||||
}
|
&& (opt.keyserver_options.options & KEYSERVER_AUTO_KEY_RETRIEVE)
|
||||||
}
|
&& (opt.keyserver_options.options & KEYSERVER_HONOR_PKA_RECORD))
|
||||||
}
|
{
|
||||||
|
const char *uri = pka_uri_from_sig (sig);
|
||||||
|
|
||||||
/* If the preferred keyserver thing above didn't work, our second
|
if (uri)
|
||||||
try is to use the URI from a DNS PKA record. */
|
{
|
||||||
if ( rc == G10ERR_NO_PUBKEY
|
/* FIXME: We might want to locate the key using the
|
||||||
&& opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE
|
fingerprint instead of the keyid. */
|
||||||
&& opt.keyserver_options.options&KEYSERVER_HONOR_PKA_RECORD)
|
int res;
|
||||||
{
|
struct keyserver_spec *spec;
|
||||||
const char *uri = pka_uri_from_sig (sig);
|
|
||||||
|
|
||||||
if (uri)
|
spec = parse_keyserver_uri (uri, 1, NULL, 0);
|
||||||
{
|
if (spec)
|
||||||
/* FIXME: We might want to locate the key using the
|
{
|
||||||
fingerprint instead of the keyid. */
|
glo_ctrl.in_auto_key_retrieve++;
|
||||||
int res;
|
res = keyserver_import_keyid (c->ctrl, sig->keyid, spec);
|
||||||
struct keyserver_spec *spec;
|
|
||||||
|
|
||||||
spec = parse_keyserver_uri (uri, 1, NULL, 0);
|
|
||||||
if (spec)
|
|
||||||
{
|
|
||||||
glo_ctrl.in_auto_key_retrieve++;
|
|
||||||
res = keyserver_import_keyid (c->ctrl, sig->keyid, spec);
|
|
||||||
glo_ctrl.in_auto_key_retrieve--;
|
glo_ctrl.in_auto_key_retrieve--;
|
||||||
free_keyserver_spec (spec);
|
free_keyserver_spec (spec);
|
||||||
if (!res)
|
if (!res)
|
||||||
rc = do_check_sig(c, node, NULL, &is_expkey, &is_revkey );
|
rc = do_check_sig (c, node, NULL, &is_expkey, &is_revkey );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the preferred keyserver thing above didn't work and we got
|
/* If the preferred keyserver thing above didn't work and we got
|
||||||
no information from the DNS PKA, this is a third try. */
|
no information from the DNS PKA, this is a third try. */
|
||||||
|
|
||||||
if( rc == G10ERR_NO_PUBKEY && opt.keyserver
|
if (gpg_err_code (rc) == G10ERR_NO_PUBKEY
|
||||||
&& opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE)
|
&& opt.keyserver
|
||||||
{
|
&& (opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE))
|
||||||
int res;
|
{
|
||||||
|
int res;
|
||||||
|
|
||||||
glo_ctrl.in_auto_key_retrieve++;
|
glo_ctrl.in_auto_key_retrieve++;
|
||||||
res=keyserver_import_keyid (c->ctrl, sig->keyid, opt.keyserver );
|
res=keyserver_import_keyid (c->ctrl, sig->keyid, opt.keyserver );
|
||||||
glo_ctrl.in_auto_key_retrieve--;
|
glo_ctrl.in_auto_key_retrieve--;
|
||||||
if(!res)
|
if (!res)
|
||||||
rc = do_check_sig(c, node, NULL, &is_expkey, &is_revkey );
|
rc = do_check_sig (c, node, NULL, &is_expkey, &is_revkey );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !rc || gpg_err_code (rc) == GPG_ERR_BAD_SIGNATURE ) {
|
if (!rc || gpg_err_code (rc) == GPG_ERR_BAD_SIGNATURE)
|
||||||
KBNODE un, keyblock;
|
{
|
||||||
int count=0, statno;
|
kbnode_t un, keyblock;
|
||||||
char keyid_str[50];
|
int count = 0;
|
||||||
PKT_public_key *pk=NULL;
|
int statno;
|
||||||
|
char keyid_str[50];
|
||||||
|
PKT_public_key *pk = NULL;
|
||||||
|
|
||||||
if(rc)
|
if (rc)
|
||||||
statno=STATUS_BADSIG;
|
statno = STATUS_BADSIG;
|
||||||
else if(sig->flags.expired)
|
else if (sig->flags.expired)
|
||||||
statno=STATUS_EXPSIG;
|
statno = STATUS_EXPSIG;
|
||||||
else if(is_expkey)
|
else if (is_expkey)
|
||||||
statno=STATUS_EXPKEYSIG;
|
statno = STATUS_EXPKEYSIG;
|
||||||
else if(is_revkey)
|
else if(is_revkey)
|
||||||
statno=STATUS_REVKEYSIG;
|
statno = STATUS_REVKEYSIG;
|
||||||
else
|
else
|
||||||
statno=STATUS_GOODSIG;
|
statno = STATUS_GOODSIG;
|
||||||
|
|
||||||
keyblock = get_pubkeyblock( sig->keyid );
|
keyblock = get_pubkeyblock (sig->keyid);
|
||||||
|
|
||||||
sprintf (keyid_str, "%08lX%08lX [uncertain] ",
|
snprintf (keyid_str, sizeof keyid_str, "%08lX%08lX [uncertain] ",
|
||||||
(ulong)sig->keyid[0], (ulong)sig->keyid[1]);
|
(ulong)sig->keyid[0], (ulong)sig->keyid[1]);
|
||||||
|
|
||||||
/* find and print the primary user ID */
|
/* Find and print the primary user ID. */
|
||||||
for( un=keyblock; un; un = un->next ) {
|
for (un=keyblock; un; un = un->next)
|
||||||
char *p;
|
{
|
||||||
int valid;
|
char *p;
|
||||||
if(un->pkt->pkttype==PKT_PUBLIC_KEY)
|
int valid;
|
||||||
{
|
|
||||||
pk=un->pkt->pkt.public_key;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if( un->pkt->pkttype != PKT_USER_ID )
|
|
||||||
continue;
|
|
||||||
if ( !un->pkt->pkt.user_id->created )
|
|
||||||
continue;
|
|
||||||
if ( un->pkt->pkt.user_id->is_revoked )
|
|
||||||
continue;
|
|
||||||
if ( un->pkt->pkt.user_id->is_expired )
|
|
||||||
continue;
|
|
||||||
if ( !un->pkt->pkt.user_id->is_primary )
|
|
||||||
continue;
|
|
||||||
/* We want the textual primary user ID here */
|
|
||||||
if ( un->pkt->pkt.user_id->attrib_data )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
assert(pk);
|
if (un->pkt->pkttype==PKT_PUBLIC_KEY)
|
||||||
|
{
|
||||||
|
pk=un->pkt->pkt.public_key;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (un->pkt->pkttype != PKT_USER_ID)
|
||||||
|
continue;
|
||||||
|
if (!un->pkt->pkt.user_id->created)
|
||||||
|
continue;
|
||||||
|
if (un->pkt->pkt.user_id->is_revoked)
|
||||||
|
continue;
|
||||||
|
if (un->pkt->pkt.user_id->is_expired)
|
||||||
|
continue;
|
||||||
|
if (!un->pkt->pkt.user_id->is_primary)
|
||||||
|
continue;
|
||||||
|
/* We want the textual primary user ID here */
|
||||||
|
if (un->pkt->pkt.user_id->attrib_data)
|
||||||
|
continue;
|
||||||
|
|
||||||
/* Get it before we print anything to avoid interrupting
|
assert (pk);
|
||||||
the output with the "please do a --check-trustdb"
|
|
||||||
line. */
|
|
||||||
valid=get_validity(pk,un->pkt->pkt.user_id);
|
|
||||||
|
|
||||||
keyid_str[17] = 0; /* cut off the "[uncertain]" part */
|
/* Get it before we print anything to avoid interrupting the
|
||||||
write_status_text_and_buffer (statno, keyid_str,
|
output with the "please do a --check-trustdb" line. */
|
||||||
un->pkt->pkt.user_id->name,
|
valid = get_validity (pk, un->pkt->pkt.user_id);
|
||||||
un->pkt->pkt.user_id->len,
|
|
||||||
-1 );
|
|
||||||
|
|
||||||
p=utf8_to_native(un->pkt->pkt.user_id->name,
|
keyid_str[17] = 0; /* cut off the "[uncertain]" part */
|
||||||
un->pkt->pkt.user_id->len,0);
|
write_status_text_and_buffer (statno, keyid_str,
|
||||||
|
un->pkt->pkt.user_id->name,
|
||||||
|
un->pkt->pkt.user_id->len,
|
||||||
|
-1);
|
||||||
|
|
||||||
if(rc)
|
p = utf8_to_native (un->pkt->pkt.user_id->name,
|
||||||
log_info(_("BAD signature from \"%s\""),p);
|
un->pkt->pkt.user_id->len, 0);
|
||||||
else if(sig->flags.expired)
|
|
||||||
log_info(_("Expired signature from \"%s\""),p);
|
|
||||||
else
|
|
||||||
log_info(_("Good signature from \"%s\""),p);
|
|
||||||
|
|
||||||
xfree(p);
|
if (rc)
|
||||||
|
log_info (_("BAD signature from \"%s\""), p);
|
||||||
|
else if (sig->flags.expired)
|
||||||
|
log_info (_("Expired signature from \"%s\""), p);
|
||||||
|
else
|
||||||
|
log_info (_("Good signature from \"%s\""), p);
|
||||||
|
|
||||||
if(opt.verify_options&VERIFY_SHOW_UID_VALIDITY)
|
xfree(p);
|
||||||
log_printf (" [%s]\n",trust_value_to_string(valid));
|
|
||||||
else
|
if (opt.verify_options&VERIFY_SHOW_UID_VALIDITY)
|
||||||
log_printf ("\n");
|
log_printf (" [%s]\n",trust_value_to_string(valid));
|
||||||
count++;
|
else
|
||||||
|
log_printf ("\n");
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
if( !count ) { /* just in case that we have no valid textual
|
|
||||||
userid */
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
/* Try for an invalid textual userid */
|
if (!count) /* Just in case that we have no valid textual userid */
|
||||||
for( un=keyblock; un; un = un->next ) {
|
{
|
||||||
if( un->pkt->pkttype == PKT_USER_ID &&
|
char *p;
|
||||||
!un->pkt->pkt.user_id->attrib_data )
|
|
||||||
break;
|
/* Try for an invalid textual userid */
|
||||||
|
for (un=keyblock; un; un = un->next)
|
||||||
|
{
|
||||||
|
if (un->pkt->pkttype == PKT_USER_ID
|
||||||
|
&& !un->pkt->pkt.user_id->attrib_data)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try for any userid at all */
|
/* Try for any userid at all */
|
||||||
if(!un) {
|
if (!un)
|
||||||
for( un=keyblock; un; un = un->next ) {
|
{
|
||||||
if( un->pkt->pkttype == PKT_USER_ID )
|
for (un=keyblock; un; un = un->next)
|
||||||
break;
|
{
|
||||||
|
if (un->pkt->pkttype == PKT_USER_ID)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt.trust_model==TM_ALWAYS || !un)
|
if (opt.trust_model==TM_ALWAYS || !un)
|
||||||
keyid_str[17] = 0; /* cut off the "[uncertain]" part */
|
keyid_str[17] = 0; /* cut off the "[uncertain]" part */
|
||||||
|
|
||||||
write_status_text_and_buffer (statno, keyid_str,
|
write_status_text_and_buffer (statno, keyid_str,
|
||||||
un? un->pkt->pkt.user_id->name:"[?]",
|
un? un->pkt->pkt.user_id->name:"[?]",
|
||||||
un? un->pkt->pkt.user_id->len:3,
|
un? un->pkt->pkt.user_id->len:3,
|
||||||
-1 );
|
-1 );
|
||||||
|
|
||||||
if(un)
|
if (un)
|
||||||
p=utf8_to_native(un->pkt->pkt.user_id->name,
|
p= utf8_to_native (un->pkt->pkt.user_id->name,
|
||||||
un->pkt->pkt.user_id->len,0);
|
un->pkt->pkt.user_id->len, 0);
|
||||||
else
|
else
|
||||||
p=xstrdup("[?]");
|
p = xstrdup ("[?]");
|
||||||
|
|
||||||
if(rc)
|
if (rc)
|
||||||
log_info(_("BAD signature from \"%s\""),p);
|
log_info (_("BAD signature from \"%s\""), p);
|
||||||
else if(sig->flags.expired)
|
else if (sig->flags.expired)
|
||||||
log_info(_("Expired signature from \"%s\""),p);
|
log_info (_("Expired signature from \"%s\""), p);
|
||||||
else
|
else
|
||||||
log_info(_("Good signature from \"%s\""),p);
|
log_info (_("Good signature from \"%s\""), p);
|
||||||
if (opt.trust_model!=TM_ALWAYS && un)
|
if (opt.trust_model != TM_ALWAYS && un)
|
||||||
log_printf (" %s",_("[uncertain]") );
|
log_printf (" %s",_("[uncertain]") );
|
||||||
log_printf ("\n");
|
log_printf ("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we have a good signature and already printed
|
/* If we have a good signature and already printed
|
||||||
* the primary user ID, print all the other user IDs */
|
* the primary user ID, print all the other user IDs */
|
||||||
if ( count && !rc
|
if (count
|
||||||
&& !(opt.verify_options&VERIFY_SHOW_PRIMARY_UID_ONLY)) {
|
&& !rc
|
||||||
char *p;
|
&& !(opt.verify_options & VERIFY_SHOW_PRIMARY_UID_ONLY))
|
||||||
for( un=keyblock; un; un = un->next ) {
|
{
|
||||||
if( un->pkt->pkttype != PKT_USER_ID )
|
char *p;
|
||||||
continue;
|
for( un=keyblock; un; un = un->next)
|
||||||
if((un->pkt->pkt.user_id->is_revoked
|
{
|
||||||
|| un->pkt->pkt.user_id->is_expired)
|
if (un->pkt->pkttype != PKT_USER_ID)
|
||||||
&& !(opt.verify_options&VERIFY_SHOW_UNUSABLE_UIDS))
|
continue;
|
||||||
continue;
|
if ((un->pkt->pkt.user_id->is_revoked
|
||||||
/* Only skip textual primaries */
|
|| un->pkt->pkt.user_id->is_expired)
|
||||||
if ( un->pkt->pkt.user_id->is_primary &&
|
&& !(opt.verify_options & VERIFY_SHOW_UNUSABLE_UIDS))
|
||||||
!un->pkt->pkt.user_id->attrib_data )
|
continue;
|
||||||
continue;
|
/* Only skip textual primaries */
|
||||||
|
if (un->pkt->pkt.user_id->is_primary
|
||||||
|
&& !un->pkt->pkt.user_id->attrib_data )
|
||||||
|
continue;
|
||||||
|
|
||||||
if(un->pkt->pkt.user_id->attrib_data)
|
if (un->pkt->pkt.user_id->attrib_data)
|
||||||
{
|
{
|
||||||
dump_attribs (un->pkt->pkt.user_id, pk);
|
dump_attribs (un->pkt->pkt.user_id, pk);
|
||||||
|
|
||||||
if(opt.verify_options&VERIFY_SHOW_PHOTOS)
|
if (opt.verify_options&VERIFY_SHOW_PHOTOS)
|
||||||
show_photos(un->pkt->pkt.user_id->attribs,
|
show_photos (un->pkt->pkt.user_id->attribs,
|
||||||
un->pkt->pkt.user_id->numattribs,
|
un->pkt->pkt.user_id->numattribs,
|
||||||
pk ,un->pkt->pkt.user_id);
|
pk ,un->pkt->pkt.user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
p=utf8_to_native(un->pkt->pkt.user_id->name,
|
p = utf8_to_native (un->pkt->pkt.user_id->name,
|
||||||
un->pkt->pkt.user_id->len,0);
|
un->pkt->pkt.user_id->len, 0);
|
||||||
log_info(_(" aka \"%s\""),p);
|
log_info (_(" aka \"%s\""), p);
|
||||||
xfree(p);
|
xfree (p);
|
||||||
|
|
||||||
if(opt.verify_options&VERIFY_SHOW_UID_VALIDITY)
|
if ((opt.verify_options & VERIFY_SHOW_UID_VALIDITY))
|
||||||
{
|
{
|
||||||
const char *valid;
|
const char *valid;
|
||||||
if(un->pkt->pkt.user_id->is_revoked)
|
|
||||||
valid=_("revoked");
|
if (un->pkt->pkt.user_id->is_revoked)
|
||||||
else if(un->pkt->pkt.user_id->is_expired)
|
valid = _("revoked");
|
||||||
valid=_("expired");
|
else if (un->pkt->pkt.user_id->is_expired)
|
||||||
else
|
valid = _("expired");
|
||||||
valid=trust_value_to_string(get_validity(pk,
|
else
|
||||||
un->pkt->
|
valid = (trust_value_to_string
|
||||||
pkt.user_id));
|
(get_validity (pk, un->pkt->pkt.user_id)));
|
||||||
log_printf (" [%s]\n",valid);
|
log_printf (" [%s]\n",valid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
log_printf ("\n");
|
log_printf ("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
release_kbnode( keyblock );
|
release_kbnode( keyblock );
|
||||||
|
|
||||||
if( !rc )
|
if (!rc)
|
||||||
{
|
{
|
||||||
if(opt.verify_options&VERIFY_SHOW_POLICY_URLS)
|
if ((opt.verify_options & VERIFY_SHOW_POLICY_URLS))
|
||||||
show_policy_url(sig,0,1);
|
show_policy_url (sig, 0, 1);
|
||||||
else
|
else
|
||||||
show_policy_url(sig,0,2);
|
show_policy_url (sig, 0, 2);
|
||||||
|
|
||||||
if(opt.verify_options&VERIFY_SHOW_KEYSERVER_URLS)
|
if ((opt.verify_options & VERIFY_SHOW_KEYSERVER_URLS))
|
||||||
show_keyserver_url(sig,0,1);
|
show_keyserver_url (sig, 0, 1);
|
||||||
else
|
else
|
||||||
show_keyserver_url(sig,0,2);
|
show_keyserver_url (sig, 0, 2);
|
||||||
|
|
||||||
if(opt.verify_options&VERIFY_SHOW_NOTATIONS)
|
if ((opt.verify_options & VERIFY_SHOW_NOTATIONS))
|
||||||
show_notation(sig,0,1,
|
show_notation
|
||||||
((opt.verify_options&VERIFY_SHOW_STD_NOTATIONS)?1:0)+
|
(sig, 0, 1,
|
||||||
((opt.verify_options&VERIFY_SHOW_USER_NOTATIONS)?2:0));
|
(((opt.verify_options&VERIFY_SHOW_STD_NOTATIONS)?1:0)
|
||||||
else
|
+ ((opt.verify_options&VERIFY_SHOW_USER_NOTATIONS)?2:0)));
|
||||||
show_notation(sig,0,2,0);
|
else
|
||||||
}
|
show_notation (sig, 0, 2, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if( !rc && is_status_enabled() ) {
|
if (!rc && is_status_enabled ())
|
||||||
/* print a status response with the fingerprint */
|
{
|
||||||
PKT_public_key *vpk = xmalloc_clear( sizeof *vpk );
|
/* Print a status response with the fingerprint. */
|
||||||
|
PKT_public_key *vpk = xmalloc_clear (sizeof *vpk);
|
||||||
|
|
||||||
if( !get_pubkey( vpk, sig->keyid ) ) {
|
if (!get_pubkey (vpk, sig->keyid))
|
||||||
byte array[MAX_FINGERPRINT_LEN], *p;
|
{
|
||||||
char buf[MAX_FINGERPRINT_LEN*4+90], *bufp;
|
byte array[MAX_FINGERPRINT_LEN], *p;
|
||||||
size_t i, n;
|
char buf[MAX_FINGERPRINT_LEN*4+90], *bufp;
|
||||||
|
size_t i, n;
|
||||||
|
|
||||||
bufp = buf;
|
bufp = buf;
|
||||||
fingerprint_from_pk( vpk, array, &n );
|
fingerprint_from_pk (vpk, array, &n);
|
||||||
p = array;
|
p = array;
|
||||||
for(i=0; i < n ; i++, p++, bufp += 2)
|
for(i=0; i < n ; i++, p++, bufp += 2)
|
||||||
sprintf(bufp, "%02X", *p );
|
sprintf (bufp, "%02X", *p );
|
||||||
/* TODO: Replace the reserved '0' in the field below
|
/* TODO: Replace the reserved '0' in the field below
|
||||||
with bits for status flags (policy url, notation,
|
with bits for status flags (policy url, notation,
|
||||||
etc.). Remember to make the buffer larger to
|
etc.). Remember to make the buffer larger to match! */
|
||||||
match! */
|
sprintf (bufp, " %s %lu %lu %d 0 %d %d %02X ",
|
||||||
sprintf(bufp, " %s %lu %lu %d 0 %d %d %02X ",
|
strtimestamp( sig->timestamp ),
|
||||||
strtimestamp( sig->timestamp ),
|
(ulong)sig->timestamp,(ulong)sig->expiredate,
|
||||||
(ulong)sig->timestamp,(ulong)sig->expiredate,
|
sig->version,sig->pubkey_algo,sig->digest_algo,
|
||||||
sig->version,sig->pubkey_algo,sig->digest_algo,
|
sig->sig_class);
|
||||||
sig->sig_class);
|
bufp = bufp + strlen (bufp);
|
||||||
bufp = bufp + strlen (bufp);
|
if (!vpk->flags.primary)
|
||||||
if (!vpk->flags.primary) {
|
{
|
||||||
u32 akid[2];
|
u32 akid[2];
|
||||||
|
|
||||||
akid[0] = vpk->main_keyid[0];
|
akid[0] = vpk->main_keyid[0];
|
||||||
akid[1] = vpk->main_keyid[1];
|
akid[1] = vpk->main_keyid[1];
|
||||||
free_public_key (vpk);
|
free_public_key (vpk);
|
||||||
vpk = xmalloc_clear( sizeof *vpk );
|
vpk = xmalloc_clear (sizeof *vpk);
|
||||||
if (get_pubkey (vpk, akid)) {
|
if (get_pubkey (vpk, akid))
|
||||||
/* impossible error, we simply return a zeroed out fpr */
|
{
|
||||||
n = MAX_FINGERPRINT_LEN < 20? MAX_FINGERPRINT_LEN : 20;
|
/* Impossible error, we simply return a zeroed out fpr */
|
||||||
memset (array, 0, n);
|
n = MAX_FINGERPRINT_LEN < 20? MAX_FINGERPRINT_LEN : 20;
|
||||||
}
|
memset (array, 0, n);
|
||||||
else
|
}
|
||||||
fingerprint_from_pk( vpk, array, &n );
|
else
|
||||||
|
fingerprint_from_pk( vpk, array, &n );
|
||||||
}
|
}
|
||||||
p = array;
|
p = array;
|
||||||
for(i=0; i < n ; i++, p++, bufp += 2)
|
for (i=0; i < n ; i++, p++, bufp += 2)
|
||||||
sprintf(bufp, "%02X", *p );
|
sprintf(bufp, "%02X", *p );
|
||||||
write_status_text( STATUS_VALIDSIG, buf );
|
write_status_text (STATUS_VALIDSIG, buf);
|
||||||
}
|
}
|
||||||
free_public_key( vpk );
|
free_public_key (vpk);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rc)
|
if (!rc)
|
||||||
{
|
{
|
||||||
if(opt.verify_options&VERIFY_PKA_LOOKUPS)
|
if ((opt.verify_options & VERIFY_PKA_LOOKUPS))
|
||||||
pka_uri_from_sig (sig); /* Make sure PKA info is available. */
|
pka_uri_from_sig (sig); /* Make sure PKA info is available. */
|
||||||
rc = check_signatures_trust( sig );
|
rc = check_signatures_trust (sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sig->flags.expired)
|
if (sig->flags.expired)
|
||||||
{
|
{
|
||||||
log_info(_("Signature expired %s\n"),
|
log_info (_("Signature expired %s\n"), asctimestamp(sig->expiredate));
|
||||||
asctimestamp(sig->expiredate));
|
rc = G10ERR_GENERAL; /* need a better error here? */
|
||||||
rc=G10ERR_GENERAL; /* need a better error here? */
|
}
|
||||||
}
|
else if (sig->expiredate)
|
||||||
else if(sig->expiredate)
|
log_info (_("Signature expires %s\n"), asctimestamp(sig->expiredate));
|
||||||
log_info(_("Signature expires %s\n"),asctimestamp(sig->expiredate));
|
|
||||||
|
|
||||||
if(opt.verbose)
|
if (opt.verbose)
|
||||||
log_info(_("%s signature, digest algorithm %s\n"),
|
log_info (_("%s signature, digest algorithm %s\n"),
|
||||||
sig->sig_class==0x00?_("binary"):
|
sig->sig_class==0x00?_("binary"):
|
||||||
sig->sig_class==0x01?_("textmode"):_("unknown"),
|
sig->sig_class==0x01?_("textmode"):_("unknown"),
|
||||||
gcry_md_algo_name (sig->digest_algo));
|
gcry_md_algo_name (sig->digest_algo));
|
||||||
|
|
||||||
if( rc )
|
if (rc)
|
||||||
g10_errors_seen = 1;
|
g10_errors_seen = 1;
|
||||||
if( opt.batch && rc )
|
if (opt.batch && rc)
|
||||||
g10_exit(1);
|
g10_exit (1);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
char buf[50];
|
{
|
||||||
sprintf(buf, "%08lX%08lX %d %d %02x %lu %d",
|
char buf[50];
|
||||||
(ulong)sig->keyid[0], (ulong)sig->keyid[1],
|
|
||||||
sig->pubkey_algo, sig->digest_algo,
|
snprintf (buf, sizeof buf, "%08lX%08lX %d %d %02x %lu %d",
|
||||||
sig->sig_class, (ulong)sig->timestamp, rc );
|
(ulong)sig->keyid[0], (ulong)sig->keyid[1],
|
||||||
write_status_text( STATUS_ERRSIG, buf );
|
sig->pubkey_algo, sig->digest_algo,
|
||||||
if( rc == G10ERR_NO_PUBKEY ) {
|
sig->sig_class, (ulong)sig->timestamp, rc);
|
||||||
buf[16] = 0;
|
write_status_text (STATUS_ERRSIG, buf);
|
||||||
write_status_text( STATUS_NO_PUBKEY, buf );
|
if (gpg_err_code (rc) == G10ERR_NO_PUBKEY)
|
||||||
|
{
|
||||||
|
buf[16] = 0;
|
||||||
|
write_status_text (STATUS_NO_PUBKEY, buf);
|
||||||
}
|
}
|
||||||
if( rc != G10ERR_NOT_PROCESSED )
|
if (gpg_err_code (rc) != G10ERR_NOT_PROCESSED)
|
||||||
log_error(_("Can't check signature: %s\n"), g10_errstr(rc) );
|
log_error (_("Can't check signature: %s\n"), g10_errstr(rc));
|
||||||
}
|
}
|
||||||
return rc;
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user