mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-17 15:44:34 +02:00
* g10.c (main, rm_group): Add --ungroup command to remove a particular
group. (add_group): When adding a group with the same name as an already existing group, merge the two groups. (list_config): Show an error message when listing a config item that doesn't exist. (main): Replace -z0 trick for no compression. * packet.h, keyedit.c (show_key_with_all_names_colon), keylist.c (list_keyblock_colon), mainproc.c (list_node, proc_tree): Minor cleanup to remove local_id, which is no longer used.
This commit is contained in:
parent
654ba16db5
commit
0030198cad
@ -1,3 +1,17 @@
|
|||||||
|
2004-01-30 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* g10.c (main, rm_group): Add --ungroup command to remove a
|
||||||
|
particular group.
|
||||||
|
(add_group): When adding a group with the same name as an already
|
||||||
|
existing group, merge the two groups.
|
||||||
|
(list_config): Show an error message when listing a config item
|
||||||
|
that doesn't exist.
|
||||||
|
(main): Replace -z0 trick for no compression.
|
||||||
|
|
||||||
|
* packet.h, keyedit.c (show_key_with_all_names_colon), keylist.c
|
||||||
|
(list_keyblock_colon), mainproc.c (list_node, proc_tree): Minor
|
||||||
|
cleanup to remove local_id, which is no longer used.
|
||||||
|
|
||||||
2004-01-27 David Shaw <dshaw@jabberwocky.com>
|
2004-01-27 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* getkey.c: Set MAX_PK_CACHE_ENTRIES and MAX_UID_CACHE_ENTRIES to
|
* getkey.c: Set MAX_PK_CACHE_ENTRIES and MAX_UID_CACHE_ENTRIES to
|
||||||
|
66
g10/g10.c
66
g10/g10.c
@ -323,6 +323,7 @@ enum cmd_and_opt_values
|
|||||||
oLCctype,
|
oLCctype,
|
||||||
oLCmessages,
|
oLCmessages,
|
||||||
oGroup,
|
oGroup,
|
||||||
|
oUnGroup,
|
||||||
oNoGroups,
|
oNoGroups,
|
||||||
oStrict,
|
oStrict,
|
||||||
oNoStrict,
|
oNoStrict,
|
||||||
@ -647,6 +648,7 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
{ oLCctype, "lc-ctype", 2, "@" },
|
{ oLCctype, "lc-ctype", 2, "@" },
|
||||||
{ oLCmessages, "lc-messages", 2, "@" },
|
{ oLCmessages, "lc-messages", 2, "@" },
|
||||||
{ oGroup, "group", 2, "@" },
|
{ oGroup, "group", 2, "@" },
|
||||||
|
{ oUnGroup, "ungroup", 2, "@" },
|
||||||
{ oNoGroups, "no-groups", 0, "@" },
|
{ oNoGroups, "no-groups", 0, "@" },
|
||||||
{ oStrict, "strict", 0, "@" },
|
{ oStrict, "strict", 0, "@" },
|
||||||
{ oNoStrict, "no-strict", 0, "@" },
|
{ oNoStrict, "no-strict", 0, "@" },
|
||||||
@ -939,7 +941,6 @@ add_group(char *string)
|
|||||||
{
|
{
|
||||||
char *name,*value;
|
char *name,*value;
|
||||||
struct groupitem *item;
|
struct groupitem *item;
|
||||||
STRLIST values=NULL;
|
|
||||||
|
|
||||||
/* Break off the group name */
|
/* Break off the group name */
|
||||||
name=strsep(&string,"=");
|
name=strsep(&string,"=");
|
||||||
@ -951,21 +952,52 @@ add_group(char *string)
|
|||||||
|
|
||||||
trim_trailing_ws(name,strlen(name));
|
trim_trailing_ws(name,strlen(name));
|
||||||
|
|
||||||
|
/* Does this group already exist? */
|
||||||
|
for(item=opt.grouplist;item;item=item->next)
|
||||||
|
if(strcasecmp(item->name,name)==0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if(!item)
|
||||||
|
{
|
||||||
|
item=m_alloc(sizeof(struct groupitem));
|
||||||
|
item->name=name;
|
||||||
|
item->next=opt.grouplist;
|
||||||
|
item->values=NULL;
|
||||||
|
opt.grouplist=item;
|
||||||
|
}
|
||||||
|
|
||||||
/* Break apart the values */
|
/* Break apart the values */
|
||||||
while ((value= strsep(&string," \t")))
|
while ((value= strsep(&string," \t")))
|
||||||
{
|
{
|
||||||
if (*value)
|
if (*value)
|
||||||
add_to_strlist2 (&values,value,utf8_strings);
|
add_to_strlist2(&item->values,value,utf8_strings);
|
||||||
}
|
}
|
||||||
|
|
||||||
item=m_alloc(sizeof(struct groupitem));
|
|
||||||
item->name=name;
|
|
||||||
item->values=values;
|
|
||||||
item->next=opt.grouplist;
|
|
||||||
|
|
||||||
opt.grouplist=item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
rm_group(char *name)
|
||||||
|
{
|
||||||
|
struct groupitem *item,*last=NULL;
|
||||||
|
|
||||||
|
trim_trailing_ws(name,strlen(name));
|
||||||
|
|
||||||
|
for(item=opt.grouplist;item;last=item,item=item->next)
|
||||||
|
{
|
||||||
|
if(strcasecmp(item->name,name)==0)
|
||||||
|
{
|
||||||
|
if(last)
|
||||||
|
last->next=item->next;
|
||||||
|
else
|
||||||
|
opt.grouplist=item->next;
|
||||||
|
|
||||||
|
free_strlist(item->values);
|
||||||
|
m_free(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* We need to check three things.
|
/* We need to check three things.
|
||||||
|
|
||||||
0) The homedir. It must be x00, a directory, and owned by the
|
0) The homedir. It must be x00, a directory, and owned by the
|
||||||
@ -1205,6 +1237,8 @@ list_config(char *items)
|
|||||||
|
|
||||||
while(show_all || (name=strsep(&items," ")))
|
while(show_all || (name=strsep(&items," ")))
|
||||||
{
|
{
|
||||||
|
int any=0;
|
||||||
|
|
||||||
if(show_all || ascii_strcasecmp(name,"group")==0)
|
if(show_all || ascii_strcasecmp(name,"group")==0)
|
||||||
{
|
{
|
||||||
struct groupitem *iter;
|
struct groupitem *iter;
|
||||||
@ -1226,6 +1260,8 @@ list_config(char *items)
|
|||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
any=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(show_all || ascii_strcasecmp(name,"version")==0)
|
if(show_all || ascii_strcasecmp(name,"version")==0)
|
||||||
@ -1233,6 +1269,7 @@ list_config(char *items)
|
|||||||
printf("cfg:version:");
|
printf("cfg:version:");
|
||||||
print_string(stdout,VERSION,strlen(VERSION),':');
|
print_string(stdout,VERSION,strlen(VERSION),':');
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
any=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(show_all || ascii_strcasecmp(name,"pubkey")==0)
|
if(show_all || ascii_strcasecmp(name,"pubkey")==0)
|
||||||
@ -1240,6 +1277,7 @@ list_config(char *items)
|
|||||||
printf("cfg:pubkey:");
|
printf("cfg:pubkey:");
|
||||||
print_algo_numbers(check_pubkey_algo);
|
print_algo_numbers(check_pubkey_algo);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
any=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(show_all || ascii_strcasecmp(name,"cipher")==0)
|
if(show_all || ascii_strcasecmp(name,"cipher")==0)
|
||||||
@ -1247,6 +1285,7 @@ list_config(char *items)
|
|||||||
printf("cfg:cipher:");
|
printf("cfg:cipher:");
|
||||||
print_algo_numbers(check_cipher_algo);
|
print_algo_numbers(check_cipher_algo);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
any=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(show_all
|
if(show_all
|
||||||
@ -1256,6 +1295,7 @@ list_config(char *items)
|
|||||||
printf("cfg:digest:");
|
printf("cfg:digest:");
|
||||||
print_algo_numbers(check_digest_algo);
|
print_algo_numbers(check_digest_algo);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
any=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(show_all || ascii_strcasecmp(name,"compress")==0)
|
if(show_all || ascii_strcasecmp(name,"compress")==0)
|
||||||
@ -1263,10 +1303,14 @@ list_config(char *items)
|
|||||||
printf("cfg:compress:");
|
printf("cfg:compress:");
|
||||||
print_algo_numbers(check_compress_algo);
|
print_algo_numbers(check_compress_algo);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
any=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(show_all)
|
if(show_all)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if(!any)
|
||||||
|
log_error(_("unknown configuration item \"%s\"\n"),name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2202,6 +2246,7 @@ main( int argc, char **argv )
|
|||||||
case oLCctype: opt.lc_ctype = pargs.r.ret_str; break;
|
case oLCctype: opt.lc_ctype = pargs.r.ret_str; break;
|
||||||
case oLCmessages: opt.lc_messages = pargs.r.ret_str; break;
|
case oLCmessages: opt.lc_messages = pargs.r.ret_str; break;
|
||||||
case oGroup: add_group(pargs.r.ret_str); break;
|
case oGroup: add_group(pargs.r.ret_str); break;
|
||||||
|
case oUnGroup: rm_group(pargs.r.ret_str); break;
|
||||||
case oNoGroups:
|
case oNoGroups:
|
||||||
while(opt.grouplist)
|
while(opt.grouplist)
|
||||||
{
|
{
|
||||||
@ -2496,6 +2541,9 @@ main( int argc, char **argv )
|
|||||||
if( log_get_errorcount(0) )
|
if( log_get_errorcount(0) )
|
||||||
g10_exit(2);
|
g10_exit(2);
|
||||||
|
|
||||||
|
if(opt.compress_level==0)
|
||||||
|
opt.compress_algo=COMPRESS_ALGO_NONE;
|
||||||
|
|
||||||
/* Check our chosen algorithms against the list of legal
|
/* Check our chosen algorithms against the list of legal
|
||||||
algorithms. */
|
algorithms. */
|
||||||
|
|
||||||
|
@ -1880,15 +1880,12 @@ show_key_with_all_names_colon (KBNODE keyblock)
|
|||||||
putchar (trust);
|
putchar (trust);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf (":%u:%d:%08lX%08lX:%lu:%lu:",
|
printf (":%u:%d:%08lX%08lX:%lu:%lu::",
|
||||||
nbits_from_pk (pk),
|
nbits_from_pk (pk),
|
||||||
pk->pubkey_algo,
|
pk->pubkey_algo,
|
||||||
(ulong)keyid[0], (ulong)keyid[1],
|
(ulong)keyid[0], (ulong)keyid[1],
|
||||||
(ulong)pk->timestamp,
|
(ulong)pk->timestamp,
|
||||||
(ulong)pk->expiredate );
|
(ulong)pk->expiredate );
|
||||||
if (pk->local_id)
|
|
||||||
printf ("%lu", pk->local_id);
|
|
||||||
putchar (':');
|
|
||||||
if (node->pkt->pkttype==PKT_PUBLIC_KEY
|
if (node->pkt->pkttype==PKT_PUBLIC_KEY
|
||||||
&& !(opt.fast_list_mode || opt.no_expensive_trust_checks ))
|
&& !(opt.fast_list_mode || opt.no_expensive_trust_checks ))
|
||||||
putchar(get_ownertrust_info (pk));
|
putchar(get_ownertrust_info (pk));
|
||||||
|
@ -949,15 +949,12 @@ list_keyblock_colon( KBNODE keyblock, int secret, int fpr )
|
|||||||
ulti_hack = 1;
|
ulti_hack = 1;
|
||||||
putchar(trustletter);
|
putchar(trustletter);
|
||||||
}
|
}
|
||||||
printf(":%u:%d:%08lX%08lX:%s:%s:",
|
printf(":%u:%d:%08lX%08lX:%s:%s::",
|
||||||
nbits_from_pk( pk ),
|
nbits_from_pk( pk ),
|
||||||
pk->pubkey_algo,
|
pk->pubkey_algo,
|
||||||
(ulong)keyid[0],(ulong)keyid[1],
|
(ulong)keyid[0],(ulong)keyid[1],
|
||||||
colon_datestr_from_pk( pk ),
|
colon_datestr_from_pk( pk ),
|
||||||
colon_strtime (pk->expiredate) );
|
colon_strtime (pk->expiredate) );
|
||||||
if( pk->local_id )
|
|
||||||
printf("%lu", pk->local_id );
|
|
||||||
putchar(':');
|
|
||||||
if( !opt.fast_list_mode && !opt.no_expensive_trust_checks )
|
if( !opt.fast_list_mode && !opt.no_expensive_trust_checks )
|
||||||
putchar( get_ownertrust_info(pk) );
|
putchar( get_ownertrust_info(pk) );
|
||||||
putchar(':');
|
putchar(':');
|
||||||
@ -1079,7 +1076,7 @@ list_keyblock_colon( KBNODE keyblock, int secret, int fpr )
|
|||||||
if(trustletter)
|
if(trustletter)
|
||||||
printf("%c", trustletter );
|
printf("%c", trustletter );
|
||||||
}
|
}
|
||||||
printf(":%u:%d:%08lX%08lX:%s:%s:",
|
printf(":%u:%d:%08lX%08lX:%s:%s:::::",
|
||||||
nbits_from_pk( pk2 ),
|
nbits_from_pk( pk2 ),
|
||||||
pk2->pubkey_algo,
|
pk2->pubkey_algo,
|
||||||
(ulong)keyid2[0],(ulong)keyid2[1],
|
(ulong)keyid2[0],(ulong)keyid2[1],
|
||||||
@ -1087,12 +1084,6 @@ list_keyblock_colon( KBNODE keyblock, int secret, int fpr )
|
|||||||
colon_strtime (pk2->expiredate)
|
colon_strtime (pk2->expiredate)
|
||||||
/* fixme: add LID and ownertrust here */
|
/* fixme: add LID and ownertrust here */
|
||||||
);
|
);
|
||||||
if( pk->local_id ) /* use the local_id of the main key??? */
|
|
||||||
printf("%lu", pk->local_id );
|
|
||||||
putchar(':');
|
|
||||||
putchar(':');
|
|
||||||
putchar(':');
|
|
||||||
putchar(':');
|
|
||||||
print_capabilities (pk2, NULL, NULL);
|
print_capabilities (pk2, NULL, NULL);
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
if( fpr > 1 )
|
if( fpr > 1 )
|
||||||
|
@ -70,7 +70,6 @@ struct mainproc_context {
|
|||||||
int have_data;
|
int have_data;
|
||||||
IOBUF iobuf; /* used to get the filename etc. */
|
IOBUF iobuf; /* used to get the filename etc. */
|
||||||
int trustletter; /* temp usage in list_node */
|
int trustletter; /* temp usage in list_node */
|
||||||
ulong local_id; /* ditto */
|
|
||||||
ulong symkeys;
|
ulong symkeys;
|
||||||
struct kidlist_item *pkenc_list; /* list of encryption packets */
|
struct kidlist_item *pkenc_list; /* list of encryption packets */
|
||||||
struct {
|
struct {
|
||||||
@ -843,23 +842,18 @@ list_node( CTX c, KBNODE node )
|
|||||||
if( opt.with_colons ) {
|
if( opt.with_colons ) {
|
||||||
u32 keyid[2];
|
u32 keyid[2];
|
||||||
keyid_from_pk( pk, keyid );
|
keyid_from_pk( pk, keyid );
|
||||||
if( mainkey ) {
|
if( mainkey )
|
||||||
c->local_id = pk->local_id;
|
|
||||||
c->trustletter = opt.fast_list_mode?
|
c->trustletter = opt.fast_list_mode?
|
||||||
0 : get_validity_info( pk, NULL );
|
0 : get_validity_info( pk, NULL );
|
||||||
}
|
|
||||||
printf("%s:", mainkey? "pub":"sub" );
|
printf("%s:", mainkey? "pub":"sub" );
|
||||||
if( c->trustletter )
|
if( c->trustletter )
|
||||||
putchar( c->trustletter );
|
putchar( c->trustletter );
|
||||||
printf(":%u:%d:%08lX%08lX:%s:%s:",
|
printf(":%u:%d:%08lX%08lX:%s:%s::",
|
||||||
nbits_from_pk( pk ),
|
nbits_from_pk( pk ),
|
||||||
pk->pubkey_algo,
|
pk->pubkey_algo,
|
||||||
(ulong)keyid[0],(ulong)keyid[1],
|
(ulong)keyid[0],(ulong)keyid[1],
|
||||||
colon_datestr_from_pk( pk ),
|
colon_datestr_from_pk( pk ),
|
||||||
colon_strtime (pk->expiredate) );
|
colon_strtime (pk->expiredate) );
|
||||||
if( c->local_id )
|
|
||||||
printf("%lu", c->local_id );
|
|
||||||
putchar(':');
|
|
||||||
if( mainkey && !opt.fast_list_mode )
|
if( mainkey && !opt.fast_list_mode )
|
||||||
putchar( get_ownertrust_info (pk) );
|
putchar( get_ownertrust_info (pk) );
|
||||||
putchar(':');
|
putchar(':');
|
||||||
@ -1658,7 +1652,6 @@ proc_tree( CTX c, KBNODE node )
|
|||||||
if (!node)
|
if (!node)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
c->local_id = 0;
|
|
||||||
c->trustletter = ' ';
|
c->trustletter = ' ';
|
||||||
if( node->pkt->pkttype == PKT_PUBLIC_KEY
|
if( node->pkt->pkttype == PKT_PUBLIC_KEY
|
||||||
|| node->pkt->pkttype == PKT_PUBLIC_SUBKEY ) {
|
|| node->pkt->pkttype == PKT_PUBLIC_SUBKEY ) {
|
||||||
|
@ -122,7 +122,6 @@ struct revocation_key {
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ulong local_id; /* internal use, valid if > 0 */
|
|
||||||
struct {
|
struct {
|
||||||
unsigned checked:1; /* signature has been checked */
|
unsigned checked:1; /* signature has been checked */
|
||||||
unsigned valid:1; /* signature is good (if checked is set) */
|
unsigned valid:1; /* signature is good (if checked is set) */
|
||||||
@ -211,7 +210,6 @@ typedef struct {
|
|||||||
without the key to check it */
|
without the key to check it */
|
||||||
int is_valid; /* key (especially subkey) is valid */
|
int is_valid; /* key (especially subkey) is valid */
|
||||||
int dont_cache; /* do not cache this */
|
int dont_cache; /* do not cache this */
|
||||||
ulong local_id; /* internal use, valid if > 0 */
|
|
||||||
u32 main_keyid[2]; /* keyid of the primary key */
|
u32 main_keyid[2]; /* keyid of the primary key */
|
||||||
u32 keyid[2]; /* calculated by keyid_from_pk() */
|
u32 keyid[2]; /* calculated by keyid_from_pk() */
|
||||||
byte is_primary;
|
byte is_primary;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user