aboutsummaryrefslogtreecommitdiffstats
path: root/g10/keyedit.c
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2003-05-31 04:06:06 +0000
committerDavid Shaw <[email protected]>2003-05-31 04:06:06 +0000
commit9390fe676bbd619f37d147c86651f6f30a67fb9b (patch)
tree3f70cf87ffdc4f4dba5493bd22a175de32f528d6 /g10/keyedit.c
parent* gpgkeys_hkp.c, gpgkeys_ldap.c: #include <getopt.h> if it is available. (diff)
downloadgnupg-9390fe676bbd619f37d147c86651f6f30a67fb9b.tar.gz
gnupg-9390fe676bbd619f37d147c86651f6f30a67fb9b.zip
* keylist.c (list_one): Don't show the keyring filename when in
--with-colons mode. Actually translate "Keyring" string. * mainproc.c (proc_tree): We can't currently handle multiple signatures of different classes or digests (we'd pretty much have to run a different hash context for each), but if they are all the same, make an exception. This is Debian bug #194292. * sig-check.c (check_key_signature2): Make string translatable. * packet.h, getkey.c (fixup_uidnode): Mark real primary uids differently than assumed primaries. * keyedit.c (no_primary_warning): Use the differently marked primaries here in a new function to warn when an --edit-key command might rearrange the self-sig dates enough to change which uid is primary. (menu_expire, menu_set_preferences): Use no_primary_warning() here. * Makefile.am: Use @DLLIBS@ for -ldl.
Diffstat (limited to 'g10/keyedit.c')
-rw-r--r--g10/keyedit.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/g10/keyedit.c b/g10/keyedit.c
index 017e53e0c..e1a0ab83a 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -2194,6 +2194,40 @@ show_key_and_fingerprint( KBNODE keyblock )
}
+/* Show a warning if no uids on the key have the primary uid flag
+ set. */
+static void
+no_primary_warning(KBNODE keyblock, int uids)
+{
+ KBNODE node;
+ int select_all=1,have_uid=0,uid_count=0;
+
+ if(uids)
+ select_all=!count_selected_uids(keyblock);
+
+ /* TODO: if we ever start behaving differently with a primary or
+ non-primary attribute ID, we will need to check for attributes
+ here as well. */
+
+ for(node=keyblock; node; node = node->next)
+ {
+ if(node->pkt->pkttype==PKT_USER_ID
+ && node->pkt->pkt.user_id->attrib_data==NULL)
+ {
+ uid_count++;
+
+ if((select_all || (node->flag & NODFLG_SELUID))
+ && node->pkt->pkt.user_id->is_primary==2)
+ have_uid|=2;
+ else
+ have_uid|=1;
+ }
+ }
+
+ if(uid_count>1 && have_uid&1 && !(have_uid&2))
+ log_info(_("WARNING: no user ID has been marked as primary. This command "
+ "may\n cause a different user ID to become the assumed primary.\n"));
+}
/****************
* Ask for a new user id, do the selfsignature and put it into
@@ -2721,6 +2755,8 @@ menu_expire( KBNODE pub_keyblock, KBNODE sec_keyblock )
mainkey=1;
}
+ no_primary_warning(pub_keyblock,0);
+
expiredate = ask_expiredate();
node = find_kbnode( sec_keyblock, PKT_SECRET_KEY );
sk = copy_secret_key( NULL, node->pkt->pkt.secret_key);
@@ -2970,6 +3006,8 @@ menu_set_preferences (KBNODE pub_keyblock, KBNODE sec_keyblock )
int selected, select_all;
int modified = 0;
+ no_primary_warning(pub_keyblock,1);
+
select_all = !count_selected_uids (pub_keyblock);
node = find_kbnode( sec_keyblock, PKT_SECRET_KEY );