1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

indent: Re-indent a function

--
This commit is contained in:
Werner Koch 2024-04-11 11:33:29 +02:00
parent f2fd4f1a9e
commit 869d1df270
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -1280,185 +1280,184 @@ static void
list_signature_print (ctrl_t ctrl, kbnode_t keyblock, kbnode_t node, list_signature_print (ctrl_t ctrl, kbnode_t keyblock, kbnode_t node,
struct keylist_context *listctx, PKT_public_key *lastpk) struct keylist_context *listctx, PKT_public_key *lastpk)
{ {
/* (extra indentation to keep the diff history short) */ PKT_signature *sig = node->pkt->pkt.signature;
PKT_signature *sig = node->pkt->pkt.signature; int rc, sigrc;
int rc, sigrc; char *sigstr;
char *sigstr; char *reason_text = NULL;
char *reason_text = NULL; char *reason_comment = NULL;
char *reason_comment = NULL; size_t reason_commentlen;
size_t reason_commentlen; int reason_code = 0;
int reason_code = 0;
if (listctx->check_sigs) if (listctx->check_sigs)
{ {
rc = check_key_signature (ctrl, keyblock, node, NULL); rc = check_key_signature (ctrl, keyblock, node, NULL);
switch (gpg_err_code (rc)) switch (gpg_err_code (rc))
{ {
case 0: case 0:
listctx->good_sigs++; listctx->good_sigs++;
sigrc = '!'; sigrc = '!';
break; break;
case GPG_ERR_BAD_SIGNATURE: case GPG_ERR_BAD_SIGNATURE:
listctx->inv_sigs++; listctx->inv_sigs++;
sigrc = '-'; sigrc = '-';
break; break;
case GPG_ERR_NO_PUBKEY: case GPG_ERR_NO_PUBKEY:
case GPG_ERR_UNUSABLE_PUBKEY: case GPG_ERR_UNUSABLE_PUBKEY:
listctx->no_key++; listctx->no_key++;
return; return;
case GPG_ERR_DIGEST_ALGO: case GPG_ERR_DIGEST_ALGO:
case GPG_ERR_PUBKEY_ALGO: case GPG_ERR_PUBKEY_ALGO:
if (!(opt.list_options & LIST_SHOW_UNUSABLE_SIGS)) if (!(opt.list_options & LIST_SHOW_UNUSABLE_SIGS))
return; return;
/* fallthru. */ /* fallthru. */
default: default:
listctx->oth_err++; listctx->oth_err++;
sigrc = '%'; sigrc = '%';
break; break;
} }
/* TODO: Make sure a cached sig record here still has /* TODO: Make sure a cached sig record here still has
the pk that issued it. See also the pk that issued it. See also
keyedit.c:print_and_check_one_sig */ keyedit.c:print_and_check_one_sig */
} }
else else
{ {
if (!(opt.list_options & LIST_SHOW_UNUSABLE_SIGS) if (!(opt.list_options & LIST_SHOW_UNUSABLE_SIGS)
&& (gpg_err_code (openpgp_pk_test_algo (sig->pubkey_algo) && (gpg_err_code (openpgp_pk_test_algo (sig->pubkey_algo)
== GPG_ERR_PUBKEY_ALGO) == GPG_ERR_PUBKEY_ALGO)
|| gpg_err_code (openpgp_md_test_algo (sig->digest_algo) || gpg_err_code (openpgp_md_test_algo (sig->digest_algo)
== GPG_ERR_DIGEST_ALGO) == GPG_ERR_DIGEST_ALGO)
|| (sig->digest_algo == DIGEST_ALGO_SHA1 || (sig->digest_algo == DIGEST_ALGO_SHA1
&& !(node->flag & NODFLG_MARK_B) /*no selfsig*/ && !(node->flag & NODFLG_MARK_B) /*no selfsig*/
&& !opt.flags.allow_weak_key_signatures))) && !opt.flags.allow_weak_key_signatures)))
return; return;
rc = 0; rc = 0;
sigrc = ' '; sigrc = ' ';
} }
if (IS_KEY_REV (sig) || IS_SUBKEY_REV (sig) || IS_UID_REV (sig)) if (IS_KEY_REV (sig) || IS_SUBKEY_REV (sig) || IS_UID_REV (sig))
{
sigstr = "rev";
reason_code = get_revocation_reason (sig, &reason_text,
&reason_comment,
&reason_commentlen);
}
else if (IS_UID_SIG (sig))
sigstr = "sig";
else if (IS_SUBKEY_SIG (sig))
sigstr = "sig";
else if (IS_KEY_SIG (sig))
sigstr = "sig";
else
{
es_fprintf (es_stdout, "sig "
"[unexpected signature class 0x%02x]\n",
sig->sig_class);
return;
}
es_fputs (sigstr, es_stdout);
es_fprintf (es_stdout, "%c%c %c%c%c%c%c%c %s %s",
sigrc, (sig->sig_class - 0x10 > 0 &&
sig->sig_class - 0x10 <
4) ? '0' + sig->sig_class - 0x10 : ' ',
sig->flags.exportable ? ' ' : 'L',
sig->flags.revocable ? ' ' : 'R',
sig->flags.policy_url ? 'P' : ' ',
sig->flags.notation ? 'N' : ' ',
sig->flags.expired ? 'X' : ' ',
(sig->trust_depth > 9) ? 'T' : (sig->trust_depth >
0) ? '0' +
sig->trust_depth : ' ', keystr (sig->keyid),
datestr_from_sig (sig));
if (opt.list_options & LIST_SHOW_SIG_EXPIRE)
es_fprintf (es_stdout, " %s", expirestr_from_sig (sig));
es_fprintf (es_stdout, " ");
if (sigrc == '%')
es_fprintf (es_stdout, "[%s] ", gpg_strerror (rc));
else if (sigrc == '?')
;
else if ((node->flag & NODFLG_MARK_B))
es_fputs (_("[self-signature]"), es_stdout);
else if (!opt.fast_list_mode )
{
size_t n;
char *p = get_user_id (ctrl, sig->keyid, &n, NULL);
print_utf8_buffer (es_stdout, p, n);
xfree (p);
}
es_putc ('\n', es_stdout);
if (sig->flags.policy_url
&& (opt.list_options & LIST_SHOW_POLICY_URLS))
show_policy_url (sig, 3, 0);
if (sig->flags.notation && (opt.list_options & LIST_SHOW_NOTATIONS))
show_notation (sig, 3, 0,
((opt.
list_options & LIST_SHOW_STD_NOTATIONS) ? 1 : 0)
+
((opt.
list_options & LIST_SHOW_USER_NOTATIONS) ? 2 :
0));
if (sig->flags.notation
&& (opt.list_options
& (LIST_SHOW_X509_NOTATIONS|LIST_STORE_X509_NOTATIONS)))
{
struct notation *nots;
if ((IS_KEY_SIG (sig) || IS_SUBKEY_SIG (sig))
&& (nots = search_sig_notations (sig,
"x509certificate@pgp.com")))
{
if ((opt.list_options & LIST_STORE_X509_NOTATIONS))
print_x509_notations (nots, lastpk);
else
print_x509_notations (nots, NULL);
free_notation (nots);
}
}
if (sig->flags.pref_ks
&& (opt.list_options & LIST_SHOW_KEYSERVER_URLS))
show_keyserver_url (sig, 3, 0);
if (reason_text && (reason_code || reason_comment))
{
es_fprintf (es_stdout, " %s%s\n",
_("reason for revocation: "), reason_text);
if (reason_comment)
{
const byte *s, *s_lf;
size_t n, n_lf;
s = reason_comment;
n = reason_commentlen;
s_lf = NULL;
do
{ {
sigstr = "rev"; /* We don't want any empty lines, so we skip them. */
reason_code = get_revocation_reason (sig, &reason_text, for (;n && *s == '\n'; s++, n--)
&reason_comment, ;
&reason_commentlen); if (n)
}
else if (IS_UID_SIG (sig))
sigstr = "sig";
else if (IS_SUBKEY_SIG (sig))
sigstr = "sig";
else if (IS_KEY_SIG (sig))
sigstr = "sig";
else
{
es_fprintf (es_stdout, "sig "
"[unexpected signature class 0x%02x]\n",
sig->sig_class);
return;
}
es_fputs (sigstr, es_stdout);
es_fprintf (es_stdout, "%c%c %c%c%c%c%c%c %s %s",
sigrc, (sig->sig_class - 0x10 > 0 &&
sig->sig_class - 0x10 <
4) ? '0' + sig->sig_class - 0x10 : ' ',
sig->flags.exportable ? ' ' : 'L',
sig->flags.revocable ? ' ' : 'R',
sig->flags.policy_url ? 'P' : ' ',
sig->flags.notation ? 'N' : ' ',
sig->flags.expired ? 'X' : ' ',
(sig->trust_depth > 9) ? 'T' : (sig->trust_depth >
0) ? '0' +
sig->trust_depth : ' ', keystr (sig->keyid),
datestr_from_sig (sig));
if (opt.list_options & LIST_SHOW_SIG_EXPIRE)
es_fprintf (es_stdout, " %s", expirestr_from_sig (sig));
es_fprintf (es_stdout, " ");
if (sigrc == '%')
es_fprintf (es_stdout, "[%s] ", gpg_strerror (rc));
else if (sigrc == '?')
;
else if ((node->flag & NODFLG_MARK_B))
es_fputs (_("[self-signature]"), es_stdout);
else if (!opt.fast_list_mode )
{
size_t n;
char *p = get_user_id (ctrl, sig->keyid, &n, NULL);
print_utf8_buffer (es_stdout, p, n);
xfree (p);
}
es_putc ('\n', es_stdout);
if (sig->flags.policy_url
&& (opt.list_options & LIST_SHOW_POLICY_URLS))
show_policy_url (sig, 3, 0);
if (sig->flags.notation && (opt.list_options & LIST_SHOW_NOTATIONS))
show_notation (sig, 3, 0,
((opt.
list_options & LIST_SHOW_STD_NOTATIONS) ? 1 : 0)
+
((opt.
list_options & LIST_SHOW_USER_NOTATIONS) ? 2 :
0));
if (sig->flags.notation
&& (opt.list_options
& (LIST_SHOW_X509_NOTATIONS|LIST_STORE_X509_NOTATIONS)))
{
struct notation *nots;
if ((IS_KEY_SIG (sig) || IS_SUBKEY_SIG (sig))
&& (nots = search_sig_notations (sig,
"x509certificate@pgp.com")))
{ {
if ((opt.list_options & LIST_STORE_X509_NOTATIONS)) s_lf = memchr (s, '\n', n);
print_x509_notations (nots, lastpk); n_lf = s_lf? s_lf - s : n;
else es_fprintf (es_stdout, " %s",
print_x509_notations (nots, NULL); _("revocation comment: "));
free_notation (nots); es_write_sanitized (es_stdout, s, n_lf, NULL, NULL);
es_putc ('\n', es_stdout);
s += n_lf; n -= n_lf;
} }
} } while (s_lf);
}
}
if (sig->flags.pref_ks xfree (reason_text);
&& (opt.list_options & LIST_SHOW_KEYSERVER_URLS)) xfree (reason_comment);
show_keyserver_url (sig, 3, 0);
if (reason_text && (reason_code || reason_comment)) /* fixme: check or list other sigs here */
{
es_fprintf (es_stdout, " %s%s\n",
_("reason for revocation: "), reason_text);
if (reason_comment)
{
const byte *s, *s_lf;
size_t n, n_lf;
s = reason_comment;
n = reason_commentlen;
s_lf = NULL;
do
{
/* We don't want any empty lines, so we skip them. */
for (;n && *s == '\n'; s++, n--)
;
if (n)
{
s_lf = memchr (s, '\n', n);
n_lf = s_lf? s_lf - s : n;
es_fprintf (es_stdout, " %s",
_("revocation comment: "));
es_write_sanitized (es_stdout, s, n_lf, NULL, NULL);
es_putc ('\n', es_stdout);
s += n_lf; n -= n_lf;
}
} while (s_lf);
}
}
xfree (reason_text);
xfree (reason_comment);
/* fixme: check or list other sigs here */
} }