1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-20 14:37:08 +01: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> 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, * options.h, import.c (parse_import_options,
clean_sigs_from_all_uids, import_one): Add import-minimal option. clean_sigs_from_all_uids, import_one): Add import-minimal option.
Similar to export-minimal, except it works on the way in. 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 */ /* see whether we have the MDC feature */
uid->mdc_feature = 0; uid->flags.mdc = 0;
p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_FEATURES, &n); p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_FEATURES, &n);
if (p && n && (p[0] & 0x01)) if (p && n && (p[0] & 0x01))
uid->mdc_feature = 1; uid->flags.mdc = 1;
/* and the keyserver modify flag */ /* and the keyserver modify flag */
uid->ks_modify = 1; uid->flags.ks_modify = 1;
p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_KS_FLAGS, &n); p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_KS_FLAGS, &n);
if (p && n && (p[0] & 0x80)) if (p && n && (p[0] & 0x80))
uid->ks_modify = 0; uid->flags.ks_modify = 0;
} }
static void static void
@ -2170,7 +2170,7 @@ merge_selfsigs( KBNODE keyblock )
&& !k->pkt->pkt.user_id->attrib_data && !k->pkt->pkt.user_id->attrib_data
&& k->pkt->pkt.user_id->is_primary) { && k->pkt->pkt.user_id->is_primary) {
prefs = k->pkt->pkt.user_id->prefs; 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; 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)); 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 ("\n ");
tty_printf (_("Features: ")); tty_printf (_("Features: "));
any=0; any=0;
if(uid->mdc_feature) if(uid->flags.mdc)
{ {
tty_printf ("MDC"); tty_printf ("MDC");
any=1; any=1;
} }
if(!uid->ks_modify) if(!uid->flags.ks_modify)
{ {
if(any) if(any)
tty_printf (", "); 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].type == PREFTYPE_ZIP ? 'Z':'?',
prefs[i].value); prefs[i].value);
} }
if (uid->mdc_feature) if (uid->flags.mdc)
tty_printf (" [mdc]"); tty_printf (" [mdc]");
if (!uid->ks_modify) if (!uid->flags.ks_modify)
tty_printf (" [no-ks-modify]"); tty_printf (" [no-ks-modify]");
tty_printf("\n"); tty_printf("\n");
} }
@ -2534,9 +2534,9 @@ show_key_with_all_names_colon (KBNODE keyblock)
prefs[j].type == PREFTYPE_ZIP ? 'Z':'?', prefs[j].type == PREFTYPE_ZIP ? 'Z':'?',
prefs[j].value); prefs[j].value);
} }
if (uid->mdc_feature) if (uid->flags.mdc)
printf (",mdc"); printf (",mdc");
if (!uid->ks_modify) if (!uid->flags.ks_modify)
printf (",no-ks-modify"); printf (",no-ks-modify");
} }
putchar (':'); putchar (':');

View File

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

View File

@ -183,7 +183,8 @@ struct user_attribute {
u32 len; u32 len;
}; };
typedef struct { typedef struct
{
int ref; /* reference counter */ int ref; /* reference counter */
int len; /* length of the name */ int len; /* length of the name */
struct user_attribute *attribs; struct user_attribute *attribs;
@ -200,10 +201,14 @@ typedef struct {
int is_expired; int is_expired;
u32 expiredate; /* expires at this date or 0 if not at all */ u32 expiredate; /* expires at this date or 0 if not at all */
prefitem_t *prefs; /* list of preferences (may be NULL)*/ prefitem_t *prefs; /* list of preferences (may be NULL)*/
int mdc_feature;
int ks_modify;
u32 created; /* according to the self-signature */ u32 created; /* according to the self-signature */
byte selfsigversion; byte selfsigversion;
struct
{
/* TODO: Move more flags here */
unsigned mdc:1;
unsigned ks_modify:1;
} flags;
char name[1]; char name[1];
} PKT_user_id; } PKT_user_id;

View File

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