Add a --fast option to --import and --recv-keys
Peter Pentchev
roam at ringlet.net
Fri Feb 8 10:01:01 CET 2002
Hi,
The attached patch adds the benefit of --import-fast to --recv-keys.
The new --fast option works with both --import and --recv-keys, only
importing the keys without updating the trustdb. --import-fast is
still a valid option, but all it does is set the new 'fast' option
and then fall back to the handling of --import.
This speeds up things a *lot* when fetching multiple keys from
a keyserver.
Any comments on the patch are appreciated.
G'luck,
Peter
--
Peter Pentchev roam at ringlet.net roam at FreeBSD.org
PGP key: http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553
What would this sentence be like if pi were 3?
Index: g10/g10.c
===================================================================
RCS file: /home/cvsroot/roam/c/contrib/sec/gnupg/g10/g10.c,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -r1.1.1.1 -r1.3
--- g10/g10.c 8 Feb 2002 06:56:03 -0000 1.1.1.1
+++ g10/g10.c 8 Feb 2002 07:33:51 -0000 1.3
@@ -208,6 +208,7 @@
oNoSigCreateCheck,
oEmu3DESS2KBug, /* will be removed in 1.1 */
oEmuMDEncodeBug,
+ oFast,
aTest };
@@ -406,6 +407,7 @@
{ aDeleteSecretAndPublicKey, "delete-secret-and-public-key",256, "@" },
{ oEmu3DESS2KBug, "emulate-3des-s2k-bug", 0, "@"},
{ oEmuMDEncodeBug, "emulate-md-encode-bug", 0, "@"},
+ { oFast, "fast", 0, "@" },
{0} };
@@ -751,8 +753,8 @@
switch( pargs.r_opt ) {
case aCheckKeys: set_cmd( &cmd, aCheckKeys); break;
case aListPackets: set_cmd( &cmd, aListPackets); break;
+ case aFastImport: opt.fast_import=1; /* FALLTHROUGH */
case aImport: set_cmd( &cmd, aImport); break;
- case aFastImport: set_cmd( &cmd, aFastImport); break;
case aSendKeys: set_cmd( &cmd, aSendKeys); break;
case aRecvKeys: set_cmd( &cmd, aRecvKeys); break;
case aExport: set_cmd( &cmd, aExport); break;
@@ -991,6 +993,7 @@
iobuf_enable_special_filenames (1);
break;
case oNoExpensiveTrustChecks: opt.no_expensive_trust_checks=1; break;
+ case oFast: opt.fast_import=1; break;
default : pargs.err = configfp? 1:2; break;
}
@@ -1370,9 +1373,8 @@
}
break;
- case aFastImport:
case aImport:
- import_keys( argc? argv:NULL, argc, (cmd == aFastImport) );
+ import_keys( argc? argv:NULL, argc, opt.fast_import );
break;
case aExport:
@@ -1385,7 +1387,7 @@
if( cmd == aSendKeys )
hkp_export( sl );
else if( cmd == aRecvKeys )
- hkp_import( sl );
+ hkp_import( sl , opt.fast_import );
else
export_pubkeys( sl, (cmd == aExport) );
free_strlist(sl);
Index: g10/hkp.c
===================================================================
RCS file: /home/cvsroot/roam/c/contrib/sec/gnupg/g10/hkp.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- g10/hkp.c 8 Feb 2002 06:56:03 -0000 1.1.1.1
+++ g10/hkp.c 8 Feb 2002 07:32:52 -0000 1.2
@@ -47,7 +47,7 @@
* or other error codes.
*/
int
-hkp_ask_import( u32 *keyid )
+hkp_ask_import( u32 *keyid, int fast )
{
struct http_context hd;
char *request;
@@ -85,7 +85,7 @@
: g10_errstr(rc) );
}
else {
- rc = import_keys_stream( hd.fp_read , 0 );
+ rc = import_keys_stream( hd.fp_read , fast );
http_close( &hd );
}
@@ -96,7 +96,7 @@
int
-hkp_import( STRLIST users )
+hkp_import( STRLIST users, int fast )
{
if( !opt.keyserver_name ) {
log_error(_("no keyserver known (use option --keyserver)\n"));
@@ -114,7 +114,7 @@
* errorcounter ist not increaed and the program will return
* with success - which is not good when this function is used.
*/
- if( hkp_ask_import( kid ) )
+ if( hkp_ask_import( kid , fast ) )
log_inc_errorcount();
}
return 0;
Index: g10/hkp.h
===================================================================
RCS file: /home/cvsroot/roam/c/contrib/sec/gnupg/g10/hkp.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- g10/hkp.h 8 Feb 2002 06:56:03 -0000 1.1.1.1
+++ g10/hkp.h 8 Feb 2002 07:32:52 -0000 1.2
@@ -23,7 +23,7 @@
int hkp_ask_import( u32 *keyid );
-int hkp_import( STRLIST users );
+int hkp_import( STRLIST users, int fast );
int hkp_export( STRLIST users );
Index: g10/options.h
===================================================================
RCS file: /home/cvsroot/roam/c/contrib/sec/gnupg/g10/options.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- g10/options.h 8 Feb 2002 06:56:03 -0000 1.1.1.1
+++ g10/options.h 8 Feb 2002 07:32:52 -0000 1.2
@@ -103,6 +103,7 @@
int no_expensive_trust_checks;
int no_sig_cache;
int no_sig_create_check;
+ int fast_import;
} opt;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 246 bytes
Desc: not available
Url : /pipermail/attachments/20020208/a97873b9/attachment.bin
More information about the Gnupg-devel
mailing list