diff options
author | Werner Koch <[email protected]> | 1999-09-03 08:15:32 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 1999-09-03 08:15:32 +0000 |
commit | 39fe1cbfdee9399dfab923d524fda9eae75cc0d2 (patch) | |
tree | 6403bc9d283ec7f4a47a06c2d7dd2896d1b6ab3b /g10/pkclist.c | |
parent | oops, found two serious problems after setting version to .11; (diff) | |
download | gnupg-39fe1cbfdee9399dfab923d524fda9eae75cc0d2.tar.gz gnupg-39fe1cbfdee9399dfab923d524fda9eae75cc0d2.zip |
See ChangeLog: Fri Sep 3 10:06:06 CEST 1999 Werner KochV0-9-11
Diffstat (limited to 'g10/pkclist.c')
-rw-r--r-- | g10/pkclist.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/g10/pkclist.c b/g10/pkclist.c index fb0d3cd41..fab2f13a7 100644 --- a/g10/pkclist.c +++ b/g10/pkclist.c @@ -751,11 +751,18 @@ build_pk_list( STRLIST remusr, PK_LIST *ret_pk_list, unsigned use ) tty_printf(_("No such user ID.\n")); else if( !(rc=check_pubkey_algo2(pk->pubkey_algo, use)) ) { if( have_def_rec ) { - PK_LIST r = m_alloc( sizeof *r ); - r->pk = pk; pk = NULL; - r->next = pk_list; - r->mark = 0; - pk_list = r; + if (key_present_in_pk_list(pk_list, pk) == 0) { + free_public_key(pk); pk = NULL; + log_info(_("skipped: public key " + "already set as default recipient\n") ); + } + else { + PK_LIST r = m_alloc( sizeof *r ); + r->pk = pk; pk = NULL; + r->next = pk_list; + r->mark = 0; + pk_list = r; + } any_recipients = 1; break; } @@ -771,13 +778,22 @@ build_pk_list( STRLIST remusr, PK_LIST *ret_pk_list, unsigned use ) tty_printf(_("Public key is disabled.\n") ); } else if( do_we_trust_pre( pk, trustlevel ) ) { - PK_LIST r; - - r = m_alloc( sizeof *r ); - r->pk = pk; pk = NULL; - r->next = pk_list; - r->mark = 0; - pk_list = r; + /* Skip the actual key if the key is already present + * in the list */ + if (key_present_in_pk_list(pk_list, pk) == 0) { + free_public_key(pk); pk = NULL; + log_info(_("skipped: public key " + "already set with --encrypt-to\n") ); + } + else { + PK_LIST r; + + r = m_alloc( sizeof *r ); + r->pk = pk; pk = NULL; + r->next = pk_list; + r->mark = 0; + pk_list = r; + } any_recipients = 1; break; } |