mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02: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
15 changed files with 90 additions and 92 deletions
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue