Add a --fast option to --import and --recv-keys

Peter Pentchev roam@ringlet.net
Fri Feb 8 10:01:01 2002


--gBBFr7Ir9EOA20Yy
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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

--=20
Peter Pentchev	roam@ringlet.net	roam@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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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 };
=20
=20
@@ -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} };
=20
=20
@@ -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=3D1; /* 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=3D1;=
 break;
+	  case oFast: opt.fast_import=3D1; break;
=20
 	  default : pargs.err =3D configfp? 1:2; break;
 	}
@@ -1370,9 +1373,8 @@
 	}
 	break;
=20
-      case aFastImport:
       case aImport:
-	import_keys( argc? argv:NULL, argc, (cmd =3D=3D aFastImport) );
+	import_keys( argc? argv:NULL, argc, opt.fast_import );
 	break;
=20
       case aExport:
@@ -1385,7 +1387,7 @@
 	if( cmd =3D=3D aSendKeys )
 	    hkp_export( sl );
 	else if( cmd =3D=3D aRecvKeys )
-	    hkp_import( sl );
+	    hkp_import( sl , opt.fast_import );
 	else
 	    export_pubkeys( sl, (cmd =3D=3D aExport) );
 	free_strlist(sl);
Index: g10/hkp.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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 =3D import_keys_stream( hd.fp_read , 0 );
+	rc =3D import_keys_stream( hd.fp_read , fast );
 	http_close( &hd );
     }
=20
@@ -96,7 +96,7 @@
=20
=20
 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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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 @@
=20
=20
 int hkp_ask_import( u32 *keyid );
-int hkp_import( STRLIST users );
+int hkp_import( STRLIST users, int fast );
 int hkp_export( STRLIST users );
=20
=20
Index: g10/options.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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;
=20
=20

--gBBFr7Ir9EOA20Yy
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjxjkxYACgkQ7Ri2jRYZRVPbuQCfRbIW2nl+hJkgal5irMkbg+5w
aqIAn2rtZZMU0fFHoxColzbdAKVSmPBP
=C4jG
-----END PGP SIGNATURE-----

--gBBFr7Ir9EOA20Yy--