mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-31 11:41:32 +01:00
g10: Move more flags into the flag bitfield.
* g10/packet.h (PKT_user_id): Move 'is_primary', 'is_revoked', and 'is_expired' into the flags bitfield, and drop the prefix. * g10/call-dirmngr.c: Adapt accordingly. * g10/export.c: Likewise. * g10/getkey.c: Likewise. * g10/import.c: Likewise. * g10/kbnode.c: Likewise. * g10/keyedit.c: Likewise. * g10/keylist.c: Likewise. * g10/keyserver.c: Likewise. * g10/mainproc.c: Likewise. * g10/pkclist.c: Likewise. * g10/pubkey-enc.c: Likewise. * g10/tofu.c: Likewise. * g10/trust.c: Likewise. * g10/trustdb.c: Likewise. -- This patch has been created by applying the following semantic patch: @@ expression E; @@ -E->is_expired +E->flags.expired @@ expression E; @@ -E->is_primary +E->flags.primary @@ expression E; @@ -E->is_revoked +E->flags.revoked Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
8f02864223
commit
2649fdfff5
@ -987,9 +987,9 @@ ks_put_inq_cb (void *opaque, const char *line)
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
if (uid->is_revoked)
|
||||
if (uid->flags.revoked)
|
||||
validity[i ++] = 'r';
|
||||
if (uid->is_expired)
|
||||
if (uid->flags.expired)
|
||||
validity[i ++] = 'e';
|
||||
validity[i] = '\0';
|
||||
|
||||
|
@ -1434,7 +1434,7 @@ print_pka_or_dane_records (iobuf_t out, kbnode_t keyblock, PKT_public_key *pk,
|
||||
continue;
|
||||
uid = node->pkt->pkt.user_id;
|
||||
|
||||
if (uid->is_expired || uid->is_revoked)
|
||||
if (uid->flags.expired || uid->flags.revoked)
|
||||
continue;
|
||||
|
||||
xfree (mbox);
|
||||
|
36
g10/getkey.c
36
g10/getkey.c
@ -274,7 +274,7 @@ get_primary_uid (KBNODE keyblock, size_t * uidlen)
|
||||
{
|
||||
if (k->pkt->pkttype == PKT_USER_ID
|
||||
&& !k->pkt->pkt.user_id->attrib_data
|
||||
&& k->pkt->pkt.user_id->is_primary)
|
||||
&& k->pkt->pkt.user_id->flags.primary)
|
||||
{
|
||||
*uidlen = k->pkt->pkt.user_id->len;
|
||||
return k->pkt->pkt.user_id->name;
|
||||
@ -970,7 +970,7 @@ skip_unusable (void *dummy, u32 * keyid, int uid_no)
|
||||
if (uids_seen != uid_no)
|
||||
continue;
|
||||
|
||||
if (user_id->is_revoked || user_id->is_expired)
|
||||
if (user_id->flags.revoked || user_id->flags.expired)
|
||||
unusable = 1;
|
||||
|
||||
break;
|
||||
@ -1494,7 +1494,7 @@ key_is_ok (const PKT_public_key *key)
|
||||
static int
|
||||
uid_is_ok (const PKT_public_key *key, const PKT_user_id *uid)
|
||||
{
|
||||
return key_is_ok (key) && ! uid->is_revoked;
|
||||
return key_is_ok (key) && ! uid->flags.revoked;
|
||||
}
|
||||
|
||||
|
||||
@ -2347,26 +2347,26 @@ fixup_uidnode (KBNODE uidnode, KBNODE signode, u32 keycreated)
|
||||
uid->created = 0; /* Not created == invalid. */
|
||||
if (IS_UID_REV (sig))
|
||||
{
|
||||
uid->is_revoked = 1;
|
||||
uid->flags.revoked = 1;
|
||||
return; /* Has been revoked. */
|
||||
}
|
||||
else
|
||||
uid->is_revoked = 0;
|
||||
uid->flags.revoked = 0;
|
||||
|
||||
uid->expiredate = sig->expiredate;
|
||||
|
||||
if (sig->flags.expired)
|
||||
{
|
||||
uid->is_expired = 1;
|
||||
uid->flags.expired = 1;
|
||||
return; /* Has expired. */
|
||||
}
|
||||
else
|
||||
uid->is_expired = 0;
|
||||
uid->flags.expired = 0;
|
||||
|
||||
uid->created = sig->timestamp; /* This one is okay. */
|
||||
uid->selfsigversion = sig->version;
|
||||
/* If we got this far, it's not expired :) */
|
||||
uid->is_expired = 0;
|
||||
uid->flags.expired = 0;
|
||||
|
||||
/* Store the key flags in the helper variable for later processing. */
|
||||
uid->help_key_usage = parse_key_usage (sig);
|
||||
@ -2380,10 +2380,10 @@ fixup_uidnode (KBNODE uidnode, KBNODE signode, u32 keycreated)
|
||||
|
||||
/* Set the primary user ID flag - we will later wipe out some
|
||||
* of them to only have one in our keyblock. */
|
||||
uid->is_primary = 0;
|
||||
uid->flags.primary = 0;
|
||||
p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_PRIMARY_UID, NULL);
|
||||
if (p && *p)
|
||||
uid->is_primary = 2;
|
||||
uid->flags.primary = 2;
|
||||
|
||||
/* We could also query this from the unhashed area if it is not in
|
||||
* the hased area and then later try to decide which is the better
|
||||
@ -2917,7 +2917,7 @@ merge_selfsigs_main (KBNODE keyblock, int *r_revoked,
|
||||
if (k->pkt->pkttype == PKT_USER_ID && !k->pkt->pkt.user_id->attrib_data)
|
||||
{
|
||||
PKT_user_id *uid = k->pkt->pkt.user_id;
|
||||
if (uid->is_primary)
|
||||
if (uid->flags.primary)
|
||||
{
|
||||
if (uid->created > uiddate)
|
||||
{
|
||||
@ -2961,7 +2961,7 @@ merge_selfsigs_main (KBNODE keyblock, int *r_revoked,
|
||||
{
|
||||
PKT_user_id *uid = k->pkt->pkt.user_id;
|
||||
if (k != uidnode)
|
||||
uid->is_primary = 0;
|
||||
uid->flags.primary = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2969,7 +2969,7 @@ merge_selfsigs_main (KBNODE keyblock, int *r_revoked,
|
||||
{
|
||||
/* None is flagged primary - use the latest user ID we have,
|
||||
and disambiguate with the arbitrary packet comparison. */
|
||||
uidnode2->pkt->pkt.user_id->is_primary = 1;
|
||||
uidnode2->pkt->pkt.user_id->flags.primary = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2988,7 +2988,7 @@ merge_selfsigs_main (KBNODE keyblock, int *r_revoked,
|
||||
if (!uidnode)
|
||||
{
|
||||
uidnode = k;
|
||||
uidnode->pkt->pkt.user_id->is_primary = 1;
|
||||
uidnode->pkt->pkt.user_id->flags.primary = 1;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
@ -2996,12 +2996,12 @@ merge_selfsigs_main (KBNODE keyblock, int *r_revoked,
|
||||
if (cmp_user_ids (k->pkt->pkt.user_id,
|
||||
uidnode->pkt->pkt.user_id) > 0)
|
||||
{
|
||||
uidnode->pkt->pkt.user_id->is_primary = 0;
|
||||
uidnode->pkt->pkt.user_id->flags.primary = 0;
|
||||
uidnode = k;
|
||||
uidnode->pkt->pkt.user_id->is_primary = 1;
|
||||
uidnode->pkt->pkt.user_id->flags.primary = 1;
|
||||
}
|
||||
else
|
||||
k->pkt->pkt.user_id->is_primary = 0; /* just to be
|
||||
k->pkt->pkt.user_id->flags.primary = 0; /* just to be
|
||||
safe */
|
||||
}
|
||||
}
|
||||
@ -3315,7 +3315,7 @@ merge_selfsigs (KBNODE keyblock)
|
||||
{
|
||||
if (k->pkt->pkttype == PKT_USER_ID
|
||||
&& !k->pkt->pkt.user_id->attrib_data
|
||||
&& k->pkt->pkt.user_id->is_primary)
|
||||
&& k->pkt->pkt.user_id->flags.primary)
|
||||
{
|
||||
prefs = k->pkt->pkt.user_id->prefs;
|
||||
mdc_feature = k->pkt->pkt.user_id->flags.mdc;
|
||||
|
@ -1189,15 +1189,15 @@ impex_filter_getval (void *cookie, const char *propname)
|
||||
}
|
||||
else if (!strcmp (propname, "primary"))
|
||||
{
|
||||
result = uid->is_primary? "1":"0";
|
||||
result = uid->flags.primary? "1":"0";
|
||||
}
|
||||
else if (!strcmp (propname, "expired"))
|
||||
{
|
||||
result = uid->is_expired? "1":"0";
|
||||
result = uid->flags.expired? "1":"0";
|
||||
}
|
||||
else if (!strcmp (propname, "revoked"))
|
||||
{
|
||||
result = uid->is_revoked? "1":"0";
|
||||
result = uid->flags.revoked? "1":"0";
|
||||
}
|
||||
else
|
||||
result = NULL;
|
||||
|
@ -392,10 +392,10 @@ dump_kbnode (KBNODE node)
|
||||
es_write_sanitized (log_get_stream (), uid->name, uid->len,
|
||||
NULL, NULL);
|
||||
log_printf ("\" %c%c%c%c\n",
|
||||
uid->is_expired? 'e':'.',
|
||||
uid->is_revoked? 'r':'.',
|
||||
uid->flags.expired? 'e':'.',
|
||||
uid->flags.revoked? 'r':'.',
|
||||
uid->created? 'v':'.',
|
||||
uid->is_primary? 'p':'.' );
|
||||
uid->flags.primary? 'p':'.' );
|
||||
}
|
||||
else if (node->pkt->pkttype == PKT_SIGNATURE)
|
||||
{
|
||||
|
@ -1164,7 +1164,7 @@ sign_uids (ctrl_t ctrl, estream_t fp,
|
||||
uidnode->flag &= ~NODFLG_MARK_A;
|
||||
uidnode = NULL;
|
||||
}
|
||||
else if (uidnode->pkt->pkt.user_id->is_revoked)
|
||||
else if (uidnode->pkt->pkt.user_id->flags.revoked)
|
||||
{
|
||||
tty_fprintf (fp, _("User ID \"%s\" is revoked."), user);
|
||||
|
||||
@ -1192,7 +1192,7 @@ sign_uids (ctrl_t ctrl, estream_t fp,
|
||||
tty_fprintf (fp, _(" Unable to sign.\n"));
|
||||
}
|
||||
}
|
||||
else if (uidnode->pkt->pkt.user_id->is_expired)
|
||||
else if (uidnode->pkt->pkt.user_id->flags.expired)
|
||||
{
|
||||
tty_fprintf (fp, _("User ID \"%s\" is expired."), user);
|
||||
|
||||
@ -3028,8 +3028,8 @@ keyedit_quick_revuid (ctrl_t ctrl, const char *username, const char *uidtorev)
|
||||
for (node = keyblock; node; node = node->next)
|
||||
valid_uids +=
|
||||
node->pkt->pkttype == PKT_USER_ID
|
||||
&& ! node->pkt->pkt.user_id->is_revoked
|
||||
&& ! node->pkt->pkt.user_id->is_expired;
|
||||
&& ! node->pkt->pkt.user_id->flags.revoked
|
||||
&& ! node->pkt->pkt.user_id->flags.expired;
|
||||
|
||||
revlen = strlen (uidtorev);
|
||||
/* find the right UID */
|
||||
@ -3043,8 +3043,8 @@ keyedit_quick_revuid (ctrl_t ctrl, const char *username, const char *uidtorev)
|
||||
|
||||
/* Make sure that we do not revoke the last valid UID. */
|
||||
if (valid_uids == 1
|
||||
&& ! node->pkt->pkt.user_id->is_revoked
|
||||
&& ! node->pkt->pkt.user_id->is_expired)
|
||||
&& ! node->pkt->pkt.user_id->flags.revoked
|
||||
&& ! node->pkt->pkt.user_id->flags.expired)
|
||||
{
|
||||
log_error (_("Cannot revoke the last valid user ID.\n"));
|
||||
goto leave;
|
||||
@ -3735,9 +3735,9 @@ show_key_with_all_names_colon (ctrl_t ctrl, estream_t fp, kbnode_t keyblock)
|
||||
else
|
||||
es_fputs ("uid:", fp);
|
||||
|
||||
if (uid->is_revoked)
|
||||
if (uid->flags.revoked)
|
||||
es_fputs ("r::::::::", fp);
|
||||
else if (uid->is_expired)
|
||||
else if (uid->flags.expired)
|
||||
es_fputs ("e::::::::", fp);
|
||||
else if (opt.fast_list_mode || opt.no_expensive_trust_checks)
|
||||
es_fputs ("::::::::", fp);
|
||||
@ -3785,11 +3785,11 @@ show_key_with_all_names_colon (ctrl_t ctrl, estream_t fp, kbnode_t keyblock)
|
||||
es_putc (':', fp);
|
||||
/* flags */
|
||||
es_fprintf (fp, "%d,", i);
|
||||
if (uid->is_primary)
|
||||
if (uid->flags.primary)
|
||||
es_putc ('p', fp);
|
||||
if (uid->is_revoked)
|
||||
if (uid->flags.revoked)
|
||||
es_putc ('r', fp);
|
||||
if (uid->is_expired)
|
||||
if (uid->flags.expired)
|
||||
es_putc ('e', fp);
|
||||
if ((node->flag & NODFLG_SELUID))
|
||||
es_putc ('s', fp);
|
||||
@ -3835,7 +3835,7 @@ show_names (ctrl_t ctrl, estream_t fp,
|
||||
tty_fprintf (fp, " ");
|
||||
else if (node->flag & NODFLG_SELUID)
|
||||
tty_fprintf (fp, "(%d)* ", i);
|
||||
else if (uid->is_primary)
|
||||
else if (uid->flags.primary)
|
||||
tty_fprintf (fp, "(%d). ", i);
|
||||
else
|
||||
tty_fprintf (fp, "(%d) ", i);
|
||||
@ -4167,9 +4167,9 @@ show_basic_key_info (KBNODE keyblock)
|
||||
++i;
|
||||
|
||||
tty_printf (" ");
|
||||
if (uid->is_revoked)
|
||||
if (uid->flags.revoked)
|
||||
tty_printf ("[%s] ", _("revoked"));
|
||||
else if (uid->is_expired)
|
||||
else if (uid->flags.expired)
|
||||
tty_printf ("[%s] ", _("expired"));
|
||||
tty_print_utf8_string (uid->name, uid->len);
|
||||
tty_printf ("\n");
|
||||
@ -4277,7 +4277,7 @@ no_primary_warning (KBNODE keyblock)
|
||||
{
|
||||
uid_count++;
|
||||
|
||||
if (node->pkt->pkt.user_id->is_primary == 2)
|
||||
if (node->pkt->pkt.user_id->flags.primary == 2)
|
||||
{
|
||||
have_primary = 1;
|
||||
break;
|
||||
@ -4478,7 +4478,7 @@ menu_deluid (KBNODE pub_keyblock)
|
||||
{
|
||||
/* Only cause a trust update if we delete a
|
||||
non-revoked user id */
|
||||
if (!node->pkt->pkt.user_id->is_revoked)
|
||||
if (!node->pkt->pkt.user_id->flags.revoked)
|
||||
update_trust = 1;
|
||||
delete_kbnode (node);
|
||||
}
|
||||
@ -4598,9 +4598,9 @@ menu_clean (KBNODE keyblock, int self_only)
|
||||
{
|
||||
const char *reason;
|
||||
|
||||
if (uidnode->pkt->pkt.user_id->is_revoked)
|
||||
if (uidnode->pkt->pkt.user_id->flags.revoked)
|
||||
reason = _("revoked");
|
||||
else if (uidnode->pkt->pkt.user_id->is_expired)
|
||||
else if (uidnode->pkt->pkt.user_id->flags.expired)
|
||||
reason = _("expired");
|
||||
else
|
||||
reason = _("invalid");
|
||||
@ -6335,7 +6335,7 @@ reloop: /* (must use this, because we are modifing the list) */
|
||||
/* Are we revoking our own uid? */
|
||||
if (primary_pk->keyid[0] == sig->keyid[0] &&
|
||||
primary_pk->keyid[1] == sig->keyid[1])
|
||||
unode->pkt->pkt.user_id->is_revoked = 1;
|
||||
unode->pkt->pkt.user_id->flags.revoked = 1;
|
||||
pkt = xmalloc_clear (sizeof *pkt);
|
||||
pkt->pkttype = PKT_SIGNATURE;
|
||||
pkt->pkt.signature = sig;
|
||||
@ -6369,7 +6369,7 @@ core_revuid (ctrl_t ctrl, kbnode_t keyblock, KBNODE node,
|
||||
{
|
||||
PKT_user_id *uid = node->pkt->pkt.user_id;
|
||||
|
||||
if (uid->is_revoked)
|
||||
if (uid->flags.revoked)
|
||||
{
|
||||
char *user = utf8_to_native (uid->name, uid->len, 0);
|
||||
log_info (_("user ID \"%s\" is already revoked\n"), user);
|
||||
@ -6429,7 +6429,7 @@ core_revuid (ctrl_t ctrl, kbnode_t keyblock, KBNODE node,
|
||||
update_trust = 1;
|
||||
#endif /*!NO_TRUST_MODELS*/
|
||||
|
||||
node->pkt->pkt.user_id->is_revoked = 1;
|
||||
node->pkt->pkt.user_id->flags.revoked = 1;
|
||||
if (modified)
|
||||
*modified = 1;
|
||||
}
|
||||
@ -6471,8 +6471,8 @@ menu_revuid (ctrl_t ctrl, kbnode_t pub_keyblock)
|
||||
for (node = pub_keyblock; node; node = node->next)
|
||||
valid_uids +=
|
||||
node->pkt->pkttype == PKT_USER_ID
|
||||
&& ! node->pkt->pkt.user_id->is_revoked
|
||||
&& ! node->pkt->pkt.user_id->is_expired;
|
||||
&& ! node->pkt->pkt.user_id->flags.revoked
|
||||
&& ! node->pkt->pkt.user_id->flags.expired;
|
||||
|
||||
reloop: /* (better this way because we are modifying the keyring) */
|
||||
for (node = pub_keyblock; node; node = node->next)
|
||||
@ -6482,8 +6482,8 @@ menu_revuid (ctrl_t ctrl, kbnode_t pub_keyblock)
|
||||
|
||||
/* Make sure that we do not revoke the last valid UID. */
|
||||
if (valid_uids == 1
|
||||
&& ! node->pkt->pkt.user_id->is_revoked
|
||||
&& ! node->pkt->pkt.user_id->is_expired)
|
||||
&& ! node->pkt->pkt.user_id->flags.revoked
|
||||
&& ! node->pkt->pkt.user_id->flags.expired)
|
||||
{
|
||||
log_error (_("Cannot revoke the last valid user ID.\n"));
|
||||
goto leave;
|
||||
|
@ -849,9 +849,8 @@ dump_attribs (const PKT_user_id *uid, PKT_public_key *pk)
|
||||
(ulong) uid->attribs[i].len, uid->attribs[i].type, i + 1,
|
||||
uid->numattribs, (ulong) uid->created,
|
||||
(ulong) uid->expiredate,
|
||||
((uid->is_primary ? 0x01 : 0) | (uid->
|
||||
is_revoked ? 0x02 : 0) |
|
||||
(uid->is_expired ? 0x04 : 0)));
|
||||
((uid->flags.primary ? 0x01 : 0) | (uid->flags.revoked ? 0x02 : 0) |
|
||||
(uid->flags.expired ? 0x04 : 0)));
|
||||
write_status_text (STATUS_ATTRIBUTE, buf);
|
||||
}
|
||||
|
||||
@ -926,7 +925,7 @@ list_keyblock_print (ctrl_t ctrl, kbnode_t keyblock, int secret, int fpr,
|
||||
int indent;
|
||||
int kl = opt.keyid_format == KF_NONE? 10 : keystrlen ();
|
||||
|
||||
if ((uid->is_expired || uid->is_revoked)
|
||||
if ((uid->flags.expired || uid->flags.revoked)
|
||||
&& !(opt.list_options & LIST_SHOW_UNUSABLE_UIDS))
|
||||
{
|
||||
skip_sigs = 1;
|
||||
@ -938,7 +937,7 @@ list_keyblock_print (ctrl_t ctrl, kbnode_t keyblock, int secret, int fpr,
|
||||
if (attrib_fp && uid->attrib_data != NULL)
|
||||
dump_attribs (uid, pk);
|
||||
|
||||
if ((uid->is_revoked || uid->is_expired)
|
||||
if ((uid->flags.revoked || uid->flags.expired)
|
||||
|| ((opt.list_options & LIST_SHOW_UID_VALIDITY)
|
||||
&& !listctx->no_validity))
|
||||
{
|
||||
@ -1297,9 +1296,9 @@ list_keyblock_colon (ctrl_t ctrl, kbnode_t keyblock,
|
||||
if (attrib_fp && uid->attrib_data != NULL)
|
||||
dump_attribs (uid, pk);
|
||||
|
||||
if (uid->is_revoked)
|
||||
if (uid->flags.revoked)
|
||||
uid_validity = 'r';
|
||||
else if (uid->is_expired)
|
||||
else if (uid->flags.expired)
|
||||
uid_validity = 'e';
|
||||
else if (opt.no_expensive_trust_checks)
|
||||
uid_validity = 0;
|
||||
@ -1556,7 +1555,7 @@ do_reorder_keyblock (KBNODE keyblock, int attr)
|
||||
if (node->pkt->pkttype == PKT_USER_ID &&
|
||||
((attr && node->pkt->pkt.user_id->attrib_data) ||
|
||||
(!attr && !node->pkt->pkt.user_id->attrib_data)) &&
|
||||
node->pkt->pkt.user_id->is_primary)
|
||||
node->pkt->pkt.user_id->flags.primary)
|
||||
{
|
||||
primary = primary2 = node;
|
||||
for (node = node->next; node; primary2 = node, node = node->next)
|
||||
|
@ -1323,7 +1323,7 @@ keyidlist(strlist_t users,KEYDB_SEARCH_DESC **klist,int *count,int fakev3)
|
||||
for(node=node->next;node;node=node->next)
|
||||
{
|
||||
if(node->pkt->pkttype==PKT_USER_ID
|
||||
&& node->pkt->pkt.user_id->is_primary)
|
||||
&& node->pkt->pkt.user_id->flags.primary)
|
||||
uid=node->pkt->pkt.user_id;
|
||||
else if(node->pkt->pkttype==PKT_SIGNATURE
|
||||
&& node->pkt->pkt.signature->
|
||||
|
@ -1960,11 +1960,11 @@ check_sig_and_print (CTX c, kbnode_t node)
|
||||
continue;
|
||||
if (!un->pkt->pkt.user_id->created)
|
||||
continue;
|
||||
if (un->pkt->pkt.user_id->is_revoked)
|
||||
if (un->pkt->pkt.user_id->flags.revoked)
|
||||
continue;
|
||||
if (un->pkt->pkt.user_id->is_expired)
|
||||
if (un->pkt->pkt.user_id->flags.expired)
|
||||
continue;
|
||||
if (!un->pkt->pkt.user_id->is_primary)
|
||||
if (!un->pkt->pkt.user_id->flags.primary)
|
||||
continue;
|
||||
/* We want the textual primary user ID here */
|
||||
if (un->pkt->pkt.user_id->attrib_data)
|
||||
@ -2041,12 +2041,12 @@ check_sig_and_print (CTX c, kbnode_t node)
|
||||
{
|
||||
if (un->pkt->pkttype != PKT_USER_ID)
|
||||
continue;
|
||||
if ((un->pkt->pkt.user_id->is_revoked
|
||||
|| un->pkt->pkt.user_id->is_expired)
|
||||
if ((un->pkt->pkt.user_id->flags.revoked
|
||||
|| un->pkt->pkt.user_id->flags.expired)
|
||||
&& !(opt.verify_options & VERIFY_SHOW_UNUSABLE_UIDS))
|
||||
continue;
|
||||
/* Skip textual primary user ids which we printed above. */
|
||||
if (un->pkt->pkt.user_id->is_primary
|
||||
if (un->pkt->pkt.user_id->flags.primary
|
||||
&& !un->pkt->pkt.user_id->attrib_data )
|
||||
continue;
|
||||
|
||||
@ -2071,9 +2071,9 @@ check_sig_and_print (CTX c, kbnode_t node)
|
||||
{
|
||||
const char *valid;
|
||||
|
||||
if (un->pkt->pkt.user_id->is_revoked)
|
||||
if (un->pkt->pkt.user_id->flags.revoked)
|
||||
valid = _("revoked");
|
||||
else if (un->pkt->pkt.user_id->is_expired)
|
||||
else if (un->pkt->pkt.user_id->flags.expired)
|
||||
valid = _("expired");
|
||||
else
|
||||
/* Since this is just informational, don't
|
||||
|
@ -280,19 +280,18 @@ typedef struct
|
||||
u32 help_key_expire;
|
||||
int help_full_count;
|
||||
int help_marginal_count;
|
||||
int is_primary; /* 2 if set via the primary flag, 1 if calculated */
|
||||
int is_revoked;
|
||||
int is_expired;
|
||||
u32 expiredate; /* expires at this date or 0 if not at all */
|
||||
prefitem_t *prefs; /* list of preferences (may be NULL)*/
|
||||
u32 created; /* according to the self-signature */
|
||||
byte selfsigversion;
|
||||
struct
|
||||
{
|
||||
/* TODO: Move more flags here */
|
||||
unsigned int mdc:1;
|
||||
unsigned int ks_modify:1;
|
||||
unsigned int compacted:1;
|
||||
unsigned int primary:2; /* 2 if set via the primary flag, 1 if calculated */
|
||||
unsigned int revoked:1;
|
||||
unsigned int expired:1;
|
||||
} flags;
|
||||
char *mbox; /* NULL or the result of mailbox_from_userid. */
|
||||
/* The text contained in the user id packet, which is normally the
|
||||
|
@ -235,12 +235,12 @@ do_edit_ownertrust (ctrl_t ctrl, PKT_public_key *pk, int mode,
|
||||
{
|
||||
if (un->pkt->pkttype != PKT_USER_ID )
|
||||
continue;
|
||||
if (un->pkt->pkt.user_id->is_revoked )
|
||||
if (un->pkt->pkt.user_id->flags.revoked)
|
||||
continue;
|
||||
if (un->pkt->pkt.user_id->is_expired )
|
||||
if (un->pkt->pkt.user_id->flags.expired)
|
||||
continue;
|
||||
/* Only skip textual primaries */
|
||||
if (un->pkt->pkt.user_id->is_primary
|
||||
if (un->pkt->pkt.user_id->flags.primary
|
||||
&& !un->pkt->pkt.user_id->attrib_data )
|
||||
continue;
|
||||
|
||||
|
@ -54,7 +54,7 @@ is_algo_in_prefs (kbnode_t keyblock, preftype_t type, int algo)
|
||||
PKT_user_id *uid = k->pkt->pkt.user_id;
|
||||
prefitem_t *prefs = uid->prefs;
|
||||
|
||||
if (uid->created && prefs && !uid->is_revoked && !uid->is_expired)
|
||||
if (uid->created && prefs && !uid->flags.revoked && !uid->flags.expired)
|
||||
{
|
||||
for (; prefs->type; prefs++)
|
||||
if (prefs->type == type && prefs->value == algo)
|
||||
|
@ -2209,9 +2209,9 @@ build_conflict_set (tofu_dbs_t dbs,
|
||||
{
|
||||
found_user_id = 1;
|
||||
|
||||
if (user_id2->is_revoked)
|
||||
if (user_id2->flags.revoked)
|
||||
iter->flags |= BINDING_REVOKED;
|
||||
if (user_id2->is_expired)
|
||||
if (user_id2->flags.expired)
|
||||
iter->flags |= BINDING_EXPIRED;
|
||||
}
|
||||
|
||||
@ -3486,7 +3486,7 @@ tofu_register_encryption (ctrl_t ctrl,
|
||||
{
|
||||
PKT_user_id *uid = n->pkt->pkt.user_id;
|
||||
|
||||
if (uid->is_revoked)
|
||||
if (uid->flags.revoked)
|
||||
continue;
|
||||
|
||||
add_to_strlist (&user_id_list, uid->name);
|
||||
@ -3871,7 +3871,7 @@ tofu_set_policy (ctrl_t ctrl, kbnode_t kb, enum tofu_policy policy)
|
||||
continue;
|
||||
|
||||
user_id = kb->pkt->pkt.user_id;
|
||||
if (user_id->is_revoked)
|
||||
if (user_id->flags.revoked)
|
||||
/* Skip revoked user ids. (Don't skip expired user ids, the
|
||||
expiry can be changed.) */
|
||||
continue;
|
||||
|
10
g10/trust.c
10
g10/trust.c
@ -145,9 +145,9 @@ uid_trust_string_fixed (ctrl_t ctrl, PKT_public_key *key, PKT_user_id *uid)
|
||||
uid are both NULL, or neither are NULL. */
|
||||
return _("10 translator see trust.c:uid_trust_string_fixed");
|
||||
}
|
||||
else if(uid->is_revoked || (key && key->flags.revoked))
|
||||
else if(uid->flags.revoked || (key && key->flags.revoked))
|
||||
return _("[ revoked]");
|
||||
else if(uid->is_expired)
|
||||
else if(uid->flags.expired)
|
||||
return _("[ expired]");
|
||||
else if(key)
|
||||
{
|
||||
@ -703,7 +703,7 @@ clean_uid_from_key (kbnode_t keyblock, kbnode_t uidnode, int noisy)
|
||||
IDs if --allow-non-selfsigned-uid is set. */
|
||||
if (uid->created
|
||||
|| uid->flags.compacted
|
||||
|| (!uid->is_expired && !uid->is_revoked && opt.allow_non_selfsigned_uid))
|
||||
|| (!uid->flags.expired && !uid->flags.revoked && opt.allow_non_selfsigned_uid))
|
||||
return 0;
|
||||
|
||||
for (node=uidnode->next;
|
||||
@ -723,9 +723,9 @@ clean_uid_from_key (kbnode_t keyblock, kbnode_t uidnode, int noisy)
|
||||
const char *reason;
|
||||
char *user = utf8_to_native (uid->name, uid->len, 0);
|
||||
|
||||
if (uid->is_revoked)
|
||||
if (uid->flags.revoked)
|
||||
reason = _("revoked");
|
||||
else if (uid->is_expired)
|
||||
else if (uid->flags.expired)
|
||||
reason = _("expired");
|
||||
else
|
||||
reason = _("invalid");
|
||||
|
@ -1140,14 +1140,14 @@ tdb_get_validity_core (ctrl_t ctrl,
|
||||
}
|
||||
|
||||
/* If the user id is revoked or expired, then skip it. */
|
||||
if (user_id->is_revoked || user_id->is_expired)
|
||||
if (user_id->flags.revoked || user_id->flags.expired)
|
||||
{
|
||||
if (DBG_TRUST)
|
||||
{
|
||||
char *s;
|
||||
if (user_id->is_revoked && user_id->is_expired)
|
||||
if (user_id->flags.revoked && user_id->flags.expired)
|
||||
s = "revoked and expired";
|
||||
else if (user_id->is_revoked)
|
||||
else if (user_id->flags.revoked)
|
||||
s = "revoked";
|
||||
else
|
||||
s = "expire";
|
||||
@ -1156,7 +1156,7 @@ tdb_get_validity_core (ctrl_t ctrl,
|
||||
s, user_id->name);
|
||||
}
|
||||
|
||||
if (user_id->is_revoked)
|
||||
if (user_id->flags.revoked)
|
||||
continue;
|
||||
|
||||
expired = 1;
|
||||
@ -1645,8 +1645,8 @@ validate_one_keyblock (KBNODE kb, struct key_item *klist,
|
||||
resigned. -dshaw */
|
||||
|
||||
if (node->pkt->pkttype == PKT_USER_ID
|
||||
&& !node->pkt->pkt.user_id->is_revoked
|
||||
&& !node->pkt->pkt.user_id->is_expired)
|
||||
&& !node->pkt->pkt.user_id->flags.revoked
|
||||
&& !node->pkt->pkt.user_id->flags.expired)
|
||||
{
|
||||
if (uidnode && issigned)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user