aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--g10/ChangeLog11
-rw-r--r--g10/g10.c4
-rw-r--r--g10/import.c32
-rw-r--r--g10/keyserver.c2
-rw-r--r--g10/main.h5
5 files changed, 33 insertions, 21 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index c752bc6f5..b7e5fb1ed 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,14 @@
+2002-09-23 Stefan Bellon <[email protected]>
+
+ * 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 <[email protected]>
* import.c (import_keys, import_keys_stream,
diff --git a/g10/g10.c b/g10/g10.c
index 625b614ac..b6ed4c60a 100644
--- a/g10/g10.c
+++ b/g10/g10.c
@@ -2241,9 +2241,9 @@ main( int argc, char **argv )
break;
case aFastImport:
+ opt.import_options |= IMPORT_FAST_IMPORT;
case aImport:
- import_keys( argc? argv:NULL, argc, (cmd == aFastImport),
- NULL, opt.import_options );
+ import_keys( argc? argv:NULL, argc, NULL, opt.import_options );
break;
case aExport:
diff --git a/g10/import.c b/g10/import.c
index 3af8cc7c9..dd8ab0e8f 100644
--- a/g10/import.c
+++ b/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 );
static int read_block( IOBUF a, PACKET **pending_pkt, KBNODE *ret_root );
static void revocation_present(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);
static int import_secret_one( const char *fname, KBNODE keyblock,
struct stats_s *stats );
@@ -97,6 +97,7 @@ parse_import_options(char *str,unsigned int *options)
{
{"allow-local-sigs",IMPORT_ALLOW_LOCAL_SIGS},
{"repair-hkp-subkey-bug",IMPORT_REPAIR_HKP_SUBKEY_BUG},
+ {"fast-import",IMPORT_FAST_IMPORT},
{NULL,0}
};
@@ -174,7 +175,7 @@ import_release_stats_handle (void *p)
*
*/
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 )
{
int i, rc = 0;
@@ -184,7 +185,7 @@ import_keys_internal( IOBUF inp, char **fnames, int nnames, int fast,
stats = import_new_stats_handle ();
if (inp) {
- rc = import( inp, fast, "[stream]", stats, options);
+ rc = import( inp, "[stream]", stats, options);
}
else {
if( !fnames && !nnames )
@@ -198,7 +199,7 @@ import_keys_internal( IOBUF inp, char **fnames, int nnames, int fast,
if( !inp )
log_error(_("can't open `%s': %s\n"), fname, strerror(errno) );
else {
- rc = import( inp, fast, fname, stats, options );
+ rc = import( inp, fname, stats, options );
iobuf_close(inp);
if( rc )
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
trustdb if the user specified by setting interactive or by
not setting no-auto-check-trustdb */
- if (!fast && (stats->imported || stats->n_uids ||
- stats->n_sigs || stats->n_revoc)) {
+ if (!(options&IMPORT_FAST_IMPORT) &&
+ (stats->imported || stats->n_uids ||
+ stats->n_sigs || stats->n_revoc)) {
if (opt.interactive)
update_trustdb();
else if (!opt.no_auto_check_trustdb)
@@ -227,21 +229,20 @@ import_keys_internal( IOBUF inp, char **fnames, int nnames, int fast,
}
void
-import_keys( char **fnames, int nnames, int fast,
+import_keys( char **fnames, int nnames,
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
-import_keys_stream( IOBUF inp, int fast,
- void *stats_handle, unsigned int options )
+import_keys_stream( IOBUF inp, 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
-import( IOBUF inp, int fast, const char* fname,
+import( IOBUF inp, const char* fname,
struct stats_s *stats, unsigned int options )
{
PACKET *pending_pkt = NULL;
@@ -259,7 +260,7 @@ import( IOBUF inp, int fast, const char* fname,
while( !(rc = read_block( inp, &pending_pkt, &keyblock) )) {
remove_bad_stuff (keyblock);
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 )
rc = import_secret_one( fname, keyblock, stats );
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.
*/
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 )
{
PKT_public_key *pk;
@@ -646,7 +647,6 @@ import_one( const char *fname, KBNODE keyblock, int fast,
if( opt.verbose )
log_info( _("key %08lX: new key - skipped\n"), (ulong)keyid[1] );
rc = 0;
- fast = 1; /* so that we don't get into the trustdb update */
stats->skipped_new_keys++;
}
else if( rc ) { /* insert this key */
diff --git a/g10/keyserver.c b/g10/keyserver.c
index f054acf5c..8f78912e0 100644
--- a/g10/keyserver.c
+++ b/g10/keyserver.c
@@ -605,7 +605,7 @@ keyserver_spawn(int action,STRLIST list,
way to do this could be to continue parsing this
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);
import_print_stats(stats_handle);
diff --git a/g10/main.h b/g10/main.h
index 4282a47c2..f16355bc8 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -152,11 +152,12 @@ KBNODE make_mpi_comment_node( const char *s, MPI a );
/*-- import.c --*/
#define IMPORT_ALLOW_LOCAL_SIGS 1
#define IMPORT_REPAIR_HKP_SUBKEY_BUG 2
+#define IMPORT_FAST_IMPORT 4
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 );
-int import_keys_stream( IOBUF inp, int fast,
+int import_keys_stream( IOBUF inp,
void *stats_hd, unsigned int options );
void *import_new_stats_handle (void);
void import_release_stats_handle (void *p);