1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-18 00:49:50 +02:00

* packet.h: Move some flags to a bitfield. Change all callers.

This commit is contained in:
David Shaw 2005-11-10 22:50:46 +00:00
parent 477ded81a4
commit ce1ce8910e
6 changed files with 44 additions and 37 deletions

View File

@ -1,5 +1,7 @@
2005-11-10 David Shaw <dshaw@jabberwocky.com>
* packet.h: Move some flags to a bitfield. Change all callers.
* options.h, import.c (parse_import_options,
clean_sigs_from_all_uids, import_one): Add import-minimal option.
Similar to export-minimal, except it works on the way in.

View File

@ -1464,16 +1464,16 @@ fixup_uidnode ( KBNODE uidnode, KBNODE signode, u32 keycreated )
}
/* see whether we have the MDC feature */
uid->mdc_feature = 0;
uid->flags.mdc = 0;
p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_FEATURES, &n);
if (p && n && (p[0] & 0x01))
uid->mdc_feature = 1;
uid->flags.mdc = 1;
/* and the keyserver modify flag */
uid->ks_modify = 1;
uid->flags.ks_modify = 1;
p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_KS_FLAGS, &n);
if (p && n && (p[0] & 0x80))
uid->ks_modify = 0;
uid->flags.ks_modify = 0;
}
static void
@ -2170,7 +2170,7 @@ merge_selfsigs( KBNODE keyblock )
&& !k->pkt->pkt.user_id->attrib_data
&& k->pkt->pkt.user_id->is_primary) {
prefs = k->pkt->pkt.user_id->prefs;
mdc_feature = k->pkt->pkt.user_id->mdc_feature;
mdc_feature = k->pkt->pkt.user_id->flags.mdc;
break;
}
}

View File

@ -2350,17 +2350,17 @@ show_prefs (PKT_user_id *uid, PKT_signature *selfsig, int verbose)
}
tty_printf ("%s",compress_algo_to_string(COMPRESS_ALGO_NONE));
}
if(uid->mdc_feature || !uid->ks_modify)
if(uid->flags.mdc || !uid->flags.ks_modify)
{
tty_printf ("\n ");
tty_printf (_("Features: "));
any=0;
if(uid->mdc_feature)
if(uid->flags.mdc)
{
tty_printf ("MDC");
any=1;
}
if(!uid->ks_modify)
if(!uid->flags.ks_modify)
{
if(any)
tty_printf (", ");
@ -2393,9 +2393,9 @@ show_prefs (PKT_user_id *uid, PKT_signature *selfsig, int verbose)
prefs[i].type == PREFTYPE_ZIP ? 'Z':'?',
prefs[i].value);
}
if (uid->mdc_feature)
if (uid->flags.mdc)
tty_printf (" [mdc]");
if (!uid->ks_modify)
if (!uid->flags.ks_modify)
tty_printf (" [no-ks-modify]");
tty_printf("\n");
}
@ -2534,9 +2534,9 @@ show_key_with_all_names_colon (KBNODE keyblock)
prefs[j].type == PREFTYPE_ZIP ? 'Z':'?',
prefs[j].value);
}
if (uid->mdc_feature)
if (uid->flags.mdc)
printf (",mdc");
if (!uid->ks_modify)
if (!uid->flags.ks_modify)
printf (",no-ks-modify");
}
putchar (':');

View File

@ -530,8 +530,8 @@ PKT_user_id *keygen_get_std_prefs(void)
uid->prefs[j].type=PREFTYPE_NONE;
uid->prefs[j].value=0;
uid->mdc_feature=mdc_available;
uid->ks_modify=ks_modify;
uid->flags.mdc=mdc_available;
uid->flags.ks_modify=ks_modify;
return uid;
}

View File

@ -183,28 +183,33 @@ struct user_attribute {
u32 len;
};
typedef struct {
int ref; /* reference counter */
int len; /* length of the name */
struct user_attribute *attribs;
int numattribs;
byte *attrib_data; /* if this is not NULL, the packet is an attribute */
unsigned long attrib_len;
byte *namehash;
int help_key_usage;
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)*/
int mdc_feature;
int ks_modify;
u32 created; /* according to the self-signature */
byte selfsigversion;
char name[1];
typedef struct
{
int ref; /* reference counter */
int len; /* length of the name */
struct user_attribute *attribs;
int numattribs;
byte *attrib_data; /* if this is not NULL, the packet is an attribute */
unsigned long attrib_len;
byte *namehash;
int help_key_usage;
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 mdc:1;
unsigned ks_modify:1;
} flags;
char name[1];
} PKT_user_id;
struct revoke_info

View File

@ -1421,7 +1421,7 @@ select_mdc_from_pklist (PK_LIST pk_list)
int mdc;
if (pkr->pk->user_id) /* selected by user ID */
mdc = pkr->pk->user_id->mdc_feature;
mdc = pkr->pk->user_id->flags.mdc;
else
mdc = pkr->pk->mdc_feature;
if (!mdc)