diff options
author | David Shaw <[email protected]> | 2005-11-10 22:50:46 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2005-11-10 22:50:46 +0000 |
commit | ce1ce8910e334436bb213fe9f531208b7724dfc5 (patch) | |
tree | 38e3f35dfcba000ff3fbedc7a2dcb2bd21a88443 | |
parent | * options.h, import.c (parse_import_options, clean_sigs_from_all_uids, (diff) | |
download | gnupg-ce1ce8910e334436bb213fe9f531208b7724dfc5.tar.gz gnupg-ce1ce8910e334436bb213fe9f531208b7724dfc5.zip |
* packet.h: Move some flags to a bitfield. Change all callers.
Diffstat (limited to '')
-rw-r--r-- | g10/ChangeLog | 2 | ||||
-rw-r--r-- | g10/getkey.c | 10 | ||||
-rw-r--r-- | g10/keyedit.c | 14 | ||||
-rw-r--r-- | g10/keygen.c | 4 | ||||
-rw-r--r-- | g10/packet.h | 49 | ||||
-rw-r--r-- | g10/pkclist.c | 2 |
6 files changed, 44 insertions, 37 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 7c7dc3706..89b382f0f 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,7 @@ 2005-11-10 David Shaw <[email protected]> + * 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. diff --git a/g10/getkey.c b/g10/getkey.c index 35e74f1d5..48c881b82 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -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; } } diff --git a/g10/keyedit.c b/g10/keyedit.c index 18ae1f45c..98d666767 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -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 (':'); diff --git a/g10/keygen.c b/g10/keygen.c index 61f9bf871..637a1b3c4 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -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; } diff --git a/g10/packet.h b/g10/packet.h index 0fe87f7ce..11af544ce 100644 --- a/g10/packet.h +++ b/g10/packet.h @@ -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 diff --git a/g10/pkclist.c b/g10/pkclist.c index a2d34ad50..6824b7097 100644 --- a/g10/pkclist.c +++ b/g10/pkclist.c @@ -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) |