mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
* trustdb.h, keyedit.c (keyedit_menu, menu_select_uid_namehash): Allow
specifying user ID via the namehash from --with-colons --fixed-list-mode --list-keys. Suggested by Peter Palfrader.
This commit is contained in:
parent
7e9b6d2f66
commit
6d72a1c649
@ -1,3 +1,9 @@
|
||||
2005-04-24 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* trustdb.h, keyedit.c (keyedit_menu, menu_select_uid_namehash):
|
||||
Allow specifying user ID via the namehash from --with-colons
|
||||
--fixed-list-mode --list-keys. Suggested by Peter Palfrader.
|
||||
|
||||
2005-04-21 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* keyedit.c (sign_uids, keyedit_menu): When the user requests to
|
||||
|
@ -62,6 +62,7 @@ static int menu_set_preferences( KBNODE pub_keyblock, KBNODE sec_keyblock );
|
||||
static int menu_set_keyserver_url (const char *url,
|
||||
KBNODE pub_keyblock, KBNODE sec_keyblock );
|
||||
static int menu_select_uid( KBNODE keyblock, int idx );
|
||||
static int menu_select_uid_namehash( KBNODE keyblock, const char *namehash );
|
||||
static int menu_select_key( KBNODE keyblock, int idx );
|
||||
static int count_uids( KBNODE keyblock );
|
||||
static int count_uids_with_flag( KBNODE keyblock, unsigned flag );
|
||||
@ -1685,8 +1686,10 @@ keyedit_menu( const char *username, STRLIST locusr,
|
||||
break;
|
||||
|
||||
case cmdSELUID:
|
||||
if( menu_select_uid( cur_keyblock, arg_number ) )
|
||||
redisplay = 1;
|
||||
if(strlen(arg_string)==NAMEHASH_LEN*2)
|
||||
redisplay=menu_select_uid_namehash(cur_keyblock,arg_string);
|
||||
else
|
||||
redisplay=menu_select_uid(cur_keyblock,arg_number);
|
||||
break;
|
||||
|
||||
case cmdSELKEY:
|
||||
@ -3900,6 +3903,45 @@ menu_select_uid( KBNODE keyblock, int idx )
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Search in the keyblock for a uid that matches namehash */
|
||||
static int
|
||||
menu_select_uid_namehash( KBNODE keyblock, const char *namehash )
|
||||
{
|
||||
byte hash[NAMEHASH_LEN];
|
||||
KBNODE node;
|
||||
int i;
|
||||
|
||||
assert(strlen(namehash)==NAMEHASH_LEN*2);
|
||||
|
||||
for(i=0;i<NAMEHASH_LEN;i++)
|
||||
hash[i]=hextobyte(&namehash[i*2]);
|
||||
|
||||
for(node=keyblock->next;node;node=node->next)
|
||||
{
|
||||
if(node->pkt->pkttype==PKT_USER_ID)
|
||||
{
|
||||
namehash_from_uid(node->pkt->pkt.user_id);
|
||||
if(memcmp(node->pkt->pkt.user_id->namehash,hash,NAMEHASH_LEN)==0)
|
||||
{
|
||||
if(node->flag&NODFLG_SELUID)
|
||||
node->flag &= ~NODFLG_SELUID;
|
||||
else
|
||||
node->flag |= NODFLG_SELUID;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!node)
|
||||
{
|
||||
tty_printf(_("No user ID with hash %s\n"),namehash);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/****************
|
||||
* Select secondary keys
|
||||
* Returns: True if the selection changed;
|
||||
|
@ -37,6 +37,9 @@
|
||||
#define TRUST_FLAG_DISABLED 128 /* d: key/uid disabled */
|
||||
#define TRUST_FLAG_PENDING_CHECK 256 /* a check-trustdb is pending */
|
||||
|
||||
#define NAMEHASH_HASH DIGEST_ALGO_RMD160
|
||||
#define NAMEHASH_LEN 20
|
||||
|
||||
/*-- trustdb.c --*/
|
||||
void register_trusted_keyid(u32 *keyid);
|
||||
void register_trusted_key( const char *string );
|
||||
|
Loading…
x
Reference in New Issue
Block a user