mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-08 12:44:23 +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>
|
2005-04-21 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* keyedit.c (sign_uids, keyedit_menu): When the user requests to
|
* 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,
|
static int menu_set_keyserver_url (const char *url,
|
||||||
KBNODE pub_keyblock, KBNODE sec_keyblock );
|
KBNODE pub_keyblock, KBNODE sec_keyblock );
|
||||||
static int menu_select_uid( KBNODE keyblock, int idx );
|
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 menu_select_key( KBNODE keyblock, int idx );
|
||||||
static int count_uids( KBNODE keyblock );
|
static int count_uids( KBNODE keyblock );
|
||||||
static int count_uids_with_flag( KBNODE keyblock, unsigned flag );
|
static int count_uids_with_flag( KBNODE keyblock, unsigned flag );
|
||||||
@ -1685,8 +1686,10 @@ keyedit_menu( const char *username, STRLIST locusr,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case cmdSELUID:
|
case cmdSELUID:
|
||||||
if( menu_select_uid( cur_keyblock, arg_number ) )
|
if(strlen(arg_string)==NAMEHASH_LEN*2)
|
||||||
redisplay = 1;
|
redisplay=menu_select_uid_namehash(cur_keyblock,arg_string);
|
||||||
|
else
|
||||||
|
redisplay=menu_select_uid(cur_keyblock,arg_number);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case cmdSELKEY:
|
case cmdSELKEY:
|
||||||
@ -3900,6 +3903,45 @@ menu_select_uid( KBNODE keyblock, int idx )
|
|||||||
return 1;
|
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
|
* Select secondary keys
|
||||||
* Returns: True if the selection changed;
|
* Returns: True if the selection changed;
|
||||||
|
@ -37,6 +37,9 @@
|
|||||||
#define TRUST_FLAG_DISABLED 128 /* d: key/uid disabled */
|
#define TRUST_FLAG_DISABLED 128 /* d: key/uid disabled */
|
||||||
#define TRUST_FLAG_PENDING_CHECK 256 /* a check-trustdb is pending */
|
#define TRUST_FLAG_PENDING_CHECK 256 /* a check-trustdb is pending */
|
||||||
|
|
||||||
|
#define NAMEHASH_HASH DIGEST_ALGO_RMD160
|
||||||
|
#define NAMEHASH_LEN 20
|
||||||
|
|
||||||
/*-- trustdb.c --*/
|
/*-- trustdb.c --*/
|
||||||
void register_trusted_keyid(u32 *keyid);
|
void register_trusted_keyid(u32 *keyid);
|
||||||
void register_trusted_key( const char *string );
|
void register_trusted_key( const char *string );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user