mirror of
git://git.gnupg.org/gnupg.git
synced 2024-05-28 21:50:02 +02:00
added fast-import to import-options
This commit is contained in:
parent
77ffe357a9
commit
bbf5ea78c2
|
@ -1,3 +1,14 @@
|
||||||
|
2002-09-23 Stefan Bellon <sbellon@sbellon.de>
|
||||||
|
|
||||||
|
* main.h: Introduced fast-import as import option. Removed
|
||||||
|
fast as separate option from prototypes.
|
||||||
|
* import.c (parse_import_options): Added fast-import option.
|
||||||
|
(import_*): Removed fast as separate option.
|
||||||
|
* g10.c (main): Added option fast-import, removed old fast
|
||||||
|
as separate argument.
|
||||||
|
* keyserver.c (keyserver_spawn): Removed old fast as separate
|
||||||
|
argument.
|
||||||
|
|
||||||
2002-09-22 Stefan Bellon <sbellon@sbellon.de>
|
2002-09-22 Stefan Bellon <sbellon@sbellon.de>
|
||||||
|
|
||||||
* import.c (import_keys, import_keys_stream,
|
* import.c (import_keys, import_keys_stream,
|
||||||
|
|
|
@ -2241,9 +2241,9 @@ main( int argc, char **argv )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case aFastImport:
|
case aFastImport:
|
||||||
|
opt.import_options |= IMPORT_FAST_IMPORT;
|
||||||
case aImport:
|
case aImport:
|
||||||
import_keys( argc? argv:NULL, argc, (cmd == aFastImport),
|
import_keys( argc? argv:NULL, argc, NULL, opt.import_options );
|
||||||
NULL, opt.import_options );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case aExport:
|
case aExport:
|
||||||
|
|
32
g10/import.c
32
g10/import.c
|
@ -56,12 +56,12 @@ struct stats_s {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int import( IOBUF inp, int fast, const char* fname,
|
static int import( IOBUF inp, const char* fname,
|
||||||
struct stats_s *stats, unsigned int options );
|
struct stats_s *stats, unsigned int options );
|
||||||
static int read_block( IOBUF a, PACKET **pending_pkt, KBNODE *ret_root );
|
static int read_block( IOBUF a, PACKET **pending_pkt, KBNODE *ret_root );
|
||||||
static void revocation_present(KBNODE keyblock);
|
static void revocation_present(KBNODE keyblock);
|
||||||
static void remove_bad_stuff (KBNODE keyblock);
|
static void remove_bad_stuff (KBNODE keyblock);
|
||||||
static int import_one( const char *fname, KBNODE keyblock, int fast,
|
static int import_one( const char *fname, KBNODE keyblock,
|
||||||
struct stats_s *stats, unsigned int options);
|
struct stats_s *stats, unsigned int options);
|
||||||
static int import_secret_one( const char *fname, KBNODE keyblock,
|
static int import_secret_one( const char *fname, KBNODE keyblock,
|
||||||
struct stats_s *stats );
|
struct stats_s *stats );
|
||||||
|
@ -97,6 +97,7 @@ parse_import_options(char *str,unsigned int *options)
|
||||||
{
|
{
|
||||||
{"allow-local-sigs",IMPORT_ALLOW_LOCAL_SIGS},
|
{"allow-local-sigs",IMPORT_ALLOW_LOCAL_SIGS},
|
||||||
{"repair-hkp-subkey-bug",IMPORT_REPAIR_HKP_SUBKEY_BUG},
|
{"repair-hkp-subkey-bug",IMPORT_REPAIR_HKP_SUBKEY_BUG},
|
||||||
|
{"fast-import",IMPORT_FAST_IMPORT},
|
||||||
{NULL,0}
|
{NULL,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -174,7 +175,7 @@ import_release_stats_handle (void *p)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
import_keys_internal( IOBUF inp, char **fnames, int nnames, int fast,
|
import_keys_internal( IOBUF inp, char **fnames, int nnames,
|
||||||
void *stats_handle, unsigned int options )
|
void *stats_handle, unsigned int options )
|
||||||
{
|
{
|
||||||
int i, rc = 0;
|
int i, rc = 0;
|
||||||
|
@ -184,7 +185,7 @@ import_keys_internal( IOBUF inp, char **fnames, int nnames, int fast,
|
||||||
stats = import_new_stats_handle ();
|
stats = import_new_stats_handle ();
|
||||||
|
|
||||||
if (inp) {
|
if (inp) {
|
||||||
rc = import( inp, fast, "[stream]", stats, options);
|
rc = import( inp, "[stream]", stats, options);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if( !fnames && !nnames )
|
if( !fnames && !nnames )
|
||||||
|
@ -198,7 +199,7 @@ import_keys_internal( IOBUF inp, char **fnames, int nnames, int fast,
|
||||||
if( !inp )
|
if( !inp )
|
||||||
log_error(_("can't open `%s': %s\n"), fname, strerror(errno) );
|
log_error(_("can't open `%s': %s\n"), fname, strerror(errno) );
|
||||||
else {
|
else {
|
||||||
rc = import( inp, fast, fname, stats, options );
|
rc = import( inp, fname, stats, options );
|
||||||
iobuf_close(inp);
|
iobuf_close(inp);
|
||||||
if( rc )
|
if( rc )
|
||||||
log_error("import from `%s' failed: %s\n", fname,
|
log_error("import from `%s' failed: %s\n", fname,
|
||||||
|
@ -216,8 +217,9 @@ import_keys_internal( IOBUF inp, char **fnames, int nnames, int fast,
|
||||||
user ids, signatures or revocations, then update/check the
|
user ids, signatures or revocations, then update/check the
|
||||||
trustdb if the user specified by setting interactive or by
|
trustdb if the user specified by setting interactive or by
|
||||||
not setting no-auto-check-trustdb */
|
not setting no-auto-check-trustdb */
|
||||||
if (!fast && (stats->imported || stats->n_uids ||
|
if (!(options&IMPORT_FAST_IMPORT) &&
|
||||||
stats->n_sigs || stats->n_revoc)) {
|
(stats->imported || stats->n_uids ||
|
||||||
|
stats->n_sigs || stats->n_revoc)) {
|
||||||
if (opt.interactive)
|
if (opt.interactive)
|
||||||
update_trustdb();
|
update_trustdb();
|
||||||
else if (!opt.no_auto_check_trustdb)
|
else if (!opt.no_auto_check_trustdb)
|
||||||
|
@ -227,21 +229,20 @@ import_keys_internal( IOBUF inp, char **fnames, int nnames, int fast,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
import_keys( char **fnames, int nnames, int fast,
|
import_keys( char **fnames, int nnames,
|
||||||
void *stats_handle, unsigned int options )
|
void *stats_handle, unsigned int options )
|
||||||
{
|
{
|
||||||
import_keys_internal( NULL, fnames, nnames, fast, stats_handle, options);
|
import_keys_internal( NULL, fnames, nnames, stats_handle, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
import_keys_stream( IOBUF inp, int fast,
|
import_keys_stream( IOBUF inp, void *stats_handle, unsigned int options )
|
||||||
void *stats_handle, unsigned int options )
|
|
||||||
{
|
{
|
||||||
return import_keys_internal( inp, NULL, NULL, fast, stats_handle, options);
|
return import_keys_internal( inp, NULL, NULL, stats_handle, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
import( IOBUF inp, int fast, const char* fname,
|
import( IOBUF inp, const char* fname,
|
||||||
struct stats_s *stats, unsigned int options )
|
struct stats_s *stats, unsigned int options )
|
||||||
{
|
{
|
||||||
PACKET *pending_pkt = NULL;
|
PACKET *pending_pkt = NULL;
|
||||||
|
@ -259,7 +260,7 @@ import( IOBUF inp, int fast, const char* fname,
|
||||||
while( !(rc = read_block( inp, &pending_pkt, &keyblock) )) {
|
while( !(rc = read_block( inp, &pending_pkt, &keyblock) )) {
|
||||||
remove_bad_stuff (keyblock);
|
remove_bad_stuff (keyblock);
|
||||||
if( keyblock->pkt->pkttype == PKT_PUBLIC_KEY )
|
if( keyblock->pkt->pkttype == PKT_PUBLIC_KEY )
|
||||||
rc = import_one( fname, keyblock, fast, stats, options );
|
rc = import_one( fname, keyblock, stats, options );
|
||||||
else if( keyblock->pkt->pkttype == PKT_SECRET_KEY )
|
else if( keyblock->pkt->pkttype == PKT_SECRET_KEY )
|
||||||
rc = import_secret_one( fname, keyblock, stats );
|
rc = import_secret_one( fname, keyblock, stats );
|
||||||
else if( keyblock->pkt->pkttype == PKT_SIGNATURE
|
else if( keyblock->pkt->pkttype == PKT_SIGNATURE
|
||||||
|
@ -557,7 +558,7 @@ print_import_ok (PKT_public_key *pk, PKT_secret_key *sk, unsigned int reason)
|
||||||
* which called g10.
|
* which called g10.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
import_one( const char *fname, KBNODE keyblock, int fast,
|
import_one( const char *fname, KBNODE keyblock,
|
||||||
struct stats_s *stats, unsigned int options )
|
struct stats_s *stats, unsigned int options )
|
||||||
{
|
{
|
||||||
PKT_public_key *pk;
|
PKT_public_key *pk;
|
||||||
|
@ -646,7 +647,6 @@ import_one( const char *fname, KBNODE keyblock, int fast,
|
||||||
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;
|
||||||
fast = 1; /* so that we don't get into the trustdb update */
|
|
||||||
stats->skipped_new_keys++;
|
stats->skipped_new_keys++;
|
||||||
}
|
}
|
||||||
else if( rc ) { /* insert this key */
|
else if( rc ) { /* insert this key */
|
||||||
|
|
|
@ -605,7 +605,7 @@ keyserver_spawn(int action,STRLIST list,
|
||||||
way to do this could be to continue parsing this
|
way to do this could be to continue parsing this
|
||||||
line-by-line and make a temp iobuf for each key. */
|
line-by-line and make a temp iobuf for each key. */
|
||||||
|
|
||||||
import_keys_stream(spawn->fromchild,0,stats_handle,
|
import_keys_stream(spawn->fromchild,stats_handle,
|
||||||
opt.keyserver_options.import_options);
|
opt.keyserver_options.import_options);
|
||||||
|
|
||||||
import_print_stats(stats_handle);
|
import_print_stats(stats_handle);
|
||||||
|
|
|
@ -152,11 +152,12 @@ KBNODE make_mpi_comment_node( const char *s, MPI a );
|
||||||
/*-- import.c --*/
|
/*-- import.c --*/
|
||||||
#define IMPORT_ALLOW_LOCAL_SIGS 1
|
#define IMPORT_ALLOW_LOCAL_SIGS 1
|
||||||
#define IMPORT_REPAIR_HKP_SUBKEY_BUG 2
|
#define IMPORT_REPAIR_HKP_SUBKEY_BUG 2
|
||||||
|
#define IMPORT_FAST_IMPORT 4
|
||||||
|
|
||||||
int parse_import_options(char *str,unsigned int *options);
|
int parse_import_options(char *str,unsigned int *options);
|
||||||
void import_keys( char **fnames, int nnames, int fast,
|
void import_keys( char **fnames, int nnames,
|
||||||
void *stats_hd, unsigned int options );
|
void *stats_hd, unsigned int options );
|
||||||
int import_keys_stream( IOBUF inp, int fast,
|
int import_keys_stream( IOBUF inp,
|
||||||
void *stats_hd, unsigned int options );
|
void *stats_hd, unsigned int options );
|
||||||
void *import_new_stats_handle (void);
|
void *import_new_stats_handle (void);
|
||||||
void import_release_stats_handle (void *p);
|
void import_release_stats_handle (void *p);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user