[g10]
[gnupg.git] / g10 / keyedit.c
index ee2088c..f877ace 100644 (file)
@@ -1,6 +1,6 @@
 /* keyedit.c - keyedit stuff
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- *               2006, 2007 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+ *               2008 Free Software Foundation, Inc.
  *
  * This file is part of GnuPG.
  *
@@ -1151,7 +1151,15 @@ change_passphrase( KBNODE keyblock )
            no_primary_secrets = 1;
        }
        else {
+            u32 keyid[2];
+
            tty_printf(_("Key is protected.\n"));
+            
+            /* Clear the passphrase cache so that the user is required
+               to enter the old passphrase.  */
+            keyid_from_sk (sk, keyid);
+            passphrase_clear_cache (keyid, NULL, 0);
+
            rc = check_secret_key( sk, 0 );
            if( !rc )
                passphrase = get_last_passphrase();
@@ -1233,7 +1241,17 @@ change_passphrase( KBNODE keyblock )
                    log_error("protect_secret_key failed: %s\n",
                               g10_errstr(rc) );
                else
+                  {
+                    u32 keyid[2];
+                    
+                    /* Clear the cahce again so that the user is
+                       required to enter the new passphrase at the
+                       next operation.  */
+                    keyid_from_sk (sk, keyid);
+                    passphrase_clear_cache (keyid, NULL, 0);
+
                    changed++;
+                  }
                break;
            }
        }
@@ -1494,6 +1512,8 @@ keyedit_completion(const char *text, int start, int end)
   /* If we are at the start of a line, we try and command-complete.
      If not, just do nothing for now. */
 
+  (void)end;
+
   if(start==0)
     return rl_completion_matches(text,command_generator);
 
@@ -1878,8 +1898,11 @@ keyedit_menu( const char *username, strlist_t locusr,
            switch ( count_selected_keys (sec_keyblock) )
              {
              case 0:
-               if (cpr_get_answer_is_yes("keyedit.keytocard.use_primary",
-                                    _("Really move the primary key? (y/N) ")))
+                if (cpr_get_answer_is_yes 
+                    ("keyedit.keytocard.use_primary",
+                     /* TRANSLATORS: Please take care: This is about
+                        moving the key and not about removing it.  */
+                     _("Really move the primary key? (y/N) ")))
                  node = sec_keyblock;
                break;
              case 1:
@@ -2502,6 +2525,17 @@ show_key_with_all_names_colon (KBNODE keyblock)
              && !(opt.fast_list_mode || opt.no_expensive_trust_checks ))
            putchar(get_ownertrust_info (pk));
           putchar(':');
+          putchar (':');
+          putchar (':');
+          /* Print capabilities.  */
+          if ( (pk->pubkey_usage & PUBKEY_USAGE_ENC) )
+            putchar ('e');
+          if ( (pk->pubkey_usage & PUBKEY_USAGE_SIG) )
+            putchar ('s');
+          if ( (pk->pubkey_usage & PUBKEY_USAGE_CERT) )
+            putchar ('c');
+          if ( (pk->pubkey_usage & PUBKEY_USAGE_AUTH) )
+            putchar ('a');
           putchar('\n');
           
           print_fingerprint (pk, NULL, 0);
@@ -4427,7 +4461,7 @@ menu_select_uid( KBNODE keyblock, int idx )
        }
     }
     else { /* reset all */
-       for( i=0, node = keyblock; node; node = node->next ) {
+       for (node = keyblock; node; node = node->next) {
            if( node->pkt->pkttype == PKT_USER_ID )
                node->flag &= ~NODFLG_SELUID;
        }
@@ -4512,7 +4546,7 @@ menu_select_key( KBNODE keyblock, int idx )
        }
     }
     else { /* reset all */
-       for( i=0, node = keyblock; node; node = node->next ) {
+       for ( node = keyblock; node; node = node->next ) {
            if( node->pkt->pkttype == PKT_PUBLIC_SUBKEY
                || node->pkt->pkttype == PKT_SECRET_SUBKEY )
                node->flag &= ~NODFLG_SELKEY;
@@ -5103,7 +5137,7 @@ menu_showphoto( KBNODE keyblock )
                                   "key %s (uid %d)\n"),
                                 image_type_to_string(type,1),
                                 (ulong)size,keystr_from_pk(pk),count);
-                     show_photos(&uid->attribs[i],1,pk,NULL);
+                     show_photos(&uid->attribs[i],1,pk,NULL,uid);
                    }
                }
            }