1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

* options.h, g10.c (main), import.c (parse_import_options, import_one,

import_secret_one), keyserver.c (keyserver_refresh): Change --merge-only
to --import-option merge-only.  Deprecate --merge-only.
This commit is contained in:
David Shaw 2003-12-31 04:58:52 +00:00
parent 1228a48ab9
commit 2a785147be
5 changed files with 31 additions and 16 deletions

View File

@ -1,3 +1,10 @@
2003-12-30 David Shaw <dshaw@jabberwocky.com>
* options.h, g10.c (main), import.c (parse_import_options,
import_one, import_secret_one), keyserver.c (keyserver_refresh):
Change --merge-only to --import-option merge-only. Deprecate
--merge-only.
2003-12-29 David Shaw <dshaw@jabberwocky.com> 2003-12-29 David Shaw <dshaw@jabberwocky.com>
* misc.c (pull_in_libs): Dead code. Removed. * misc.c (pull_in_libs): Dead code. Removed.

View File

@ -2010,7 +2010,11 @@ main( int argc, char **argv )
case oOverrideSessionKey: case oOverrideSessionKey:
opt.override_session_key = pargs.r.ret_str; opt.override_session_key = pargs.r.ret_str;
break; break;
case oMergeOnly: opt.merge_only = 1; break; case oMergeOnly:
deprecated_warning(configname,configlineno,"--merge-only",
"--import-options ","merge-only");
opt.import_options|=IMPORT_MERGE_ONLY;
break;
case oAllowSecretKeyImport: /* obsolete */ break; case oAllowSecretKeyImport: /* obsolete */ break;
case oTryAllSecrets: opt.try_all_secrets = 1; break; case oTryAllSecrets: opt.try_all_secrets = 1; break;
case oTrustedKey: register_trusted_key( pargs.r.ret_str ); break; case oTrustedKey: register_trusted_key( pargs.r.ret_str ); break;

View File

@ -93,6 +93,7 @@ parse_import_options(char *str,unsigned int *options,int noisy)
{"repair-pks-subkey-bug",IMPORT_REPAIR_PKS_SUBKEY_BUG}, {"repair-pks-subkey-bug",IMPORT_REPAIR_PKS_SUBKEY_BUG},
{"fast-import",IMPORT_FAST_IMPORT}, {"fast-import",IMPORT_FAST_IMPORT},
{"convert-sk-to-pk",IMPORT_SK2PK}, {"convert-sk-to-pk",IMPORT_SK2PK},
{"merge-only",IMPORT_MERGE_ONLY},
{NULL,0} {NULL,0}
}; };
@ -625,12 +626,13 @@ import_one( const char *fname, KBNODE keyblock,
log_error( _("key %08lX: public key not found: %s\n"), log_error( _("key %08lX: public key not found: %s\n"),
(ulong)keyid[1], g10_errstr(rc)); (ulong)keyid[1], g10_errstr(rc));
} }
else if ( rc && opt.merge_only ) { else if ( rc && (opt.import_options&IMPORT_MERGE_ONLY) )
{
if( opt.verbose ) if( opt.verbose )
log_info( _("key %08lX: new key - skipped\n"), (ulong)keyid[1] ); log_info( _("key %08lX: new key - skipped\n"), (ulong)keyid[1] );
rc = 0; rc = 0;
stats->skipped_new_keys++; stats->skipped_new_keys++;
} }
else if( rc ) { /* insert this key */ else if( rc ) { /* insert this key */
KEYDB_HANDLE hd = keydb_new (0); KEYDB_HANDLE hd = keydb_new (0);
@ -903,27 +905,29 @@ import_secret_one( const char *fname, KBNODE keyblock,
/* do we have this key already in one of our secrings ? */ /* do we have this key already in one of our secrings ? */
rc = seckey_available( keyid ); rc = seckey_available( keyid );
if( rc == G10ERR_NO_SECKEY && !opt.merge_only ) { /* simply insert this key */ if( rc == G10ERR_NO_SECKEY && !(opt.import_options&IMPORT_MERGE_ONLY) )
{
/* simply insert this key */
KEYDB_HANDLE hd = keydb_new (1); KEYDB_HANDLE hd = keydb_new (1);
/* get default resource */ /* get default resource */
rc = keydb_locate_writable (hd, NULL); rc = keydb_locate_writable (hd, NULL);
if (rc) { if (rc) {
log_error (_("no default secret keyring: %s\n"), g10_errstr (rc)); log_error (_("no default secret keyring: %s\n"), g10_errstr (rc));
keydb_release (hd); keydb_release (hd);
return G10ERR_GENERAL; return G10ERR_GENERAL;
} }
rc = keydb_insert_keyblock (hd, keyblock ); rc = keydb_insert_keyblock (hd, keyblock );
if (rc) if (rc)
log_error (_("error writing keyring `%s': %s\n"), log_error (_("error writing keyring `%s': %s\n"),
keydb_get_resource_name (hd), g10_errstr(rc) ); keydb_get_resource_name (hd), g10_errstr(rc) );
keydb_release (hd); keydb_release (hd);
/* we are ready */ /* we are ready */
if( !opt.quiet ) if( !opt.quiet )
log_info( _("key %08lX: secret key imported\n"), (ulong)keyid[1]); log_info( _("key %08lX: secret key imported\n"), (ulong)keyid[1]);
stats->secret_imported++; stats->secret_imported++;
if (is_status_enabled ()) if (is_status_enabled ())
print_import_ok (NULL, sk, 1|16); print_import_ok (NULL, sk, 1|16);
if(options&IMPORT_SK2PK) if(options&IMPORT_SK2PK)
{ {
@ -934,7 +938,7 @@ import_secret_one( const char *fname, KBNODE keyblock,
release_kbnode(pub_keyblock); release_kbnode(pub_keyblock);
} }
} }
else if( !rc ) { /* we can't merge secret keys */ else if( !rc ) { /* we can't merge secret keys */
log_error( _("key %08lX: already in secret keyring\n"), log_error( _("key %08lX: already in secret keyring\n"),
(ulong)keyid[1]); (ulong)keyid[1]);

View File

@ -1411,7 +1411,7 @@ keyserver_refresh(STRLIST users)
/* We switch merge_only on during a refresh, as 'refresh' should /* We switch merge_only on during a refresh, as 'refresh' should
never import new keys, even if their keyids match. Is it worth never import new keys, even if their keyids match. Is it worth
preserving the old merge_only value here? */ preserving the old merge_only value here? */
opt.merge_only=1; opt.import_options|=IMPORT_MERGE_ONLY;
/* If refresh_add_fake_v3_keyids is on and it's a HKP or MAILTO /* If refresh_add_fake_v3_keyids is on and it's a HKP or MAILTO
scheme, then enable fake v3 keyid generation. */ scheme, then enable fake v3 keyid generation. */

View File

@ -172,7 +172,6 @@ struct {
int show_session_key; int show_session_key;
int use_agent; int use_agent;
const char *gpg_agent_info; const char *gpg_agent_info;
int merge_only;
int try_all_secrets; int try_all_secrets;
int no_expensive_trust_checks; int no_expensive_trust_checks;
int no_sig_cache; int no_sig_cache;
@ -207,7 +206,6 @@ struct {
#define DBG_EXTPROG_VALUE 1024 /* debug external program calls */ #define DBG_EXTPROG_VALUE 1024 /* debug external program calls */
#define DBG_CARD_IO_VALUE 2048 #define DBG_CARD_IO_VALUE 2048
#define DBG_PACKET (opt.debug & DBG_PACKET_VALUE) #define DBG_PACKET (opt.debug & DBG_PACKET_VALUE)
#define DBG_FILTER (opt.debug & DBG_FILTER_VALUE) #define DBG_FILTER (opt.debug & DBG_FILTER_VALUE)
#define DBG_CACHE (opt.debug & DBG_CACHE_VALUE) #define DBG_CACHE (opt.debug & DBG_CACHE_VALUE)
@ -216,6 +214,7 @@ struct {
#define DBG_EXTPROG (opt.debug & DBG_EXTPROG_VALUE) #define DBG_EXTPROG (opt.debug & DBG_EXTPROG_VALUE)
#define DBG_CARD_IO (opt.debug & DBG_CARD_IO_VALUE) #define DBG_CARD_IO (opt.debug & DBG_CARD_IO_VALUE)
#define GNUPG (opt.compliance==CO_GNUPG) #define GNUPG (opt.compliance==CO_GNUPG)
#define RFC1991 (opt.compliance==CO_RFC1991 || opt.compliance==CO_PGP2) #define RFC1991 (opt.compliance==CO_RFC1991 || opt.compliance==CO_PGP2)
#define RFC2440 (opt.compliance==CO_RFC2440) #define RFC2440 (opt.compliance==CO_RFC2440)
@ -230,6 +229,7 @@ struct {
#define IMPORT_REPAIR_PKS_SUBKEY_BUG (1<<1) #define IMPORT_REPAIR_PKS_SUBKEY_BUG (1<<1)
#define IMPORT_FAST_IMPORT (1<<2) #define IMPORT_FAST_IMPORT (1<<2)
#define IMPORT_SK2PK (1<<3) #define IMPORT_SK2PK (1<<3)
#define IMPORT_MERGE_ONLY (1<<4)
#define EXPORT_INCLUDE_NON_RFC (1<<0) #define EXPORT_INCLUDE_NON_RFC (1<<0)
#define EXPORT_INCLUDE_LOCAL_SIGS (1<<1) #define EXPORT_INCLUDE_LOCAL_SIGS (1<<1)