* passphrase.c (agent_get_passphrase): Use keystrs for agent strings, and
authorDavid Shaw <dshaw@jabberwocky.com>
Tue, 5 Oct 2004 14:33:02 +0000 (14:33 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Tue, 5 Oct 2004 14:33:02 +0000 (14:33 +0000)
fix sprintf warnings.

* keyserver.c (keyserver_spawn): Fix BUG() with certain sets of mixed
regular and preferred keyserver refreshes.  Noted by Sebastian Wiesinger.

* keyedit.c (show_key_with_all_names): Show uid validity in menu.

g10/ChangeLog
g10/keyedit.c
g10/keyserver.c
g10/passphrase.c

index b3646e7..71f56e5 100644 (file)
@@ -1,3 +1,14 @@
+2004-10-05  David Shaw  <dshaw@jabberwocky.com>
+
+       * passphrase.c (agent_get_passphrase): Use keystrs for agent
+       strings, and fix sprintf warnings.
+
+       * keyserver.c (keyserver_spawn): Fix BUG() with certain sets of
+       mixed regular and preferred keyserver refreshes.  Noted by
+       Sebastian Wiesinger.
+
+       * keyedit.c (show_key_with_all_names): Show uid validity in menu.
+
 2004-10-03  Timo Schulz  <twoaday@g10code.de>
 
        * apdu.c (apdu_open_remote_reader) [_WIN32]: Do not set ENOSYS.
index 5a81828..1ba8953 100644 (file)
@@ -2170,7 +2170,7 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker,
 {
     KBNODE node;
     int i;
-    int do_warn = 0, indent=0;
+    int do_warn = 0;
     byte pk_version=0;
     PKT_public_key *primary=NULL;
 
@@ -2324,17 +2324,6 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker,
     
     /* the user ids */
 
-    for( node = keyblock; node; node = node->next )
-      {
-       if(node->pkt->pkttype == PKT_USER_ID
-          && (node->pkt->pkt.user_id->is_revoked
-              || node->pkt->pkt.user_id->is_expired))
-         {
-           indent=1;
-           break;
-         }
-      }
-
     i = 0;
     for( node = keyblock; node; node = node->next ) {
        if( node->pkt->pkttype == PKT_USER_ID ) {
@@ -2345,11 +2334,9 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker,
                  tty_printf("[%8.8s] ",_("revoked"));
                else if(uid->is_expired)
                  tty_printf("[%8.8s] ",_("expired"));
-               else if(opt.list_options&LIST_SHOW_UID_VALIDITY && primary)
+               else if(primary)
                  tty_printf("[%8.8s] ",
                             trust_value_to_string(get_validity(primary,uid)));
-               else if(indent)
-                 tty_printf("           ");
                if( only_marked )
                   tty_printf("     ");
                else if( node->flag & NODFLG_SELUID )
index 1c7270d..f0147de 100644 (file)
@@ -884,6 +884,10 @@ keyserver_spawn(int action,STRLIST list,KEYDB_SEARCH_DESC *desc,
            else if(desc[i].mode==KEYDB_SEARCH_MODE_SHORT_KID)
              fprintf(spawn->tochild,"0x%08lX\n",
                      (ulong)desc[i].u.kid[1]);
+           else if(desc[i].mode==KEYDB_SEARCH_MODE_NONE)
+             continue;
+           else
+             BUG();
 
            log_info(_("requesting key %s from %s server %s\n"),
                     keystr_from_desc(&desc[i]),
index 7a3a394..4302075 100644 (file)
@@ -673,35 +673,41 @@ agent_get_passphrase ( u32 *keyid, int mode, const char *tryagain_text,
       const char *algo_name = pubkey_algo_to_string ( pk->pubkey_algo );
       const char *timestr;
       char *maink;
-      const char *fmtstr;
       
       if ( !algo_name )
         algo_name = "?";
-      
-      fmtstr = _(" (main key ID %08lX)");
-      maink = m_alloc ( strlen (fmtstr) + 20 );
+
+#define KEYIDSTRING _(" (main key ID %s)")
+
+      maink = m_alloc ( strlen (KEYIDSTRING) + keystrlen() + 20 );
       if( keyid[2] && keyid[3] && keyid[0] != keyid[2] 
           && keyid[1] != keyid[3] )
-        sprintf( maink, fmtstr, (ulong)keyid[3] );
+        sprintf( maink, KEYIDSTRING, keystr(&keyid[2]) );
       else
         *maink = 0;
       
       uid = get_user_id ( keyid, &uidlen ); 
       timestr = strtimestamp (pk->timestamp);
-      fmtstr = _("You need a passphrase to unlock the"
-                 " secret key for user:\n"
-                 "\"%.*s\"\n"
-                 "%u-bit %s key, ID %08lX, created %s%s\n" );
-      atext = m_alloc ( 100 + strlen (fmtstr)  
-                        + uidlen + 15 + strlen(algo_name) + 8
+
+#undef KEYIDSTRING
+
+#define PROMPTSTRING _("You need a passphrase to unlock the secret" \
+                      " key for user:\n" \
+                      "\"%.*s\"\n" \
+                      "%u-bit %s key, ID %s, created %s%s\n" )
+
+      atext = m_alloc ( 100 + strlen (PROMPTSTRING)  
+                        + uidlen + 15 + strlen(algo_name) + keystrlen()
                         + strlen (timestr) + strlen (maink) );
-      sprintf (atext, fmtstr,
+      sprintf (atext, PROMPTSTRING,
                uidlen, uid,
-               nbits_from_pk (pk), algo_name, (ulong)keyid[1], timestr,
+               nbits_from_pk (pk), algo_name, keystr(&keyid[0]), timestr,
                maink  );
       m_free (uid);
       m_free (maink);
-      
+
+#undef PROMPTSTRING
+
       { 
         size_t dummy;
         fingerprint_from_pk( pk, fpr, &dummy );