aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--g10/ChangeLog17
-rw-r--r--g10/g10.c9
-rw-r--r--g10/hkp.c4
-rw-r--r--g10/import.c11
-rw-r--r--g10/keyserver.c5
-rw-r--r--g10/main.h2
6 files changed, 38 insertions, 10 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index b04586171..67d71ac3a 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,20 @@
+2003-04-08 David Shaw <[email protected]>
+
+ * hkp.c (dehtmlize): Fix bug #121 (memory corruption on some
+ platforms). Special thanks to Michael C. Toren for his help in
+ lining up a sparc to test this fix on.
+
+ * keyserver.c (keyserver_work): Call out error for keyserver
+ helper with a different version than us.
+
+ * main.h, g10.c (main), import.c (parse_import_options,
+ fix_pks_corruption): It's really PKS corruption, not HKP
+ corruption. Keep the old repair-hkp-subkey-bug command as an
+ alias.
+
+ * g10.c (main): Rename --no-version to --no-emit-version for
+ consistency. Keep --no-version as an alias.
+
2003-04-04 David Shaw <[email protected]>
* pkclist.c (algo_available): PGP 8 can use the SHA-256 hash.
diff --git a/g10/g10.c b/g10/g10.c
index 6de44a14e..25db4d407 100644
--- a/g10/g10.c
+++ b/g10/g10.c
@@ -155,8 +155,8 @@ enum cmd_and_opt_values { aNull = 0,
oAttributeFile, /* only used with risc os */
oSKComments,
oNoSKComments,
- oNoVersion,
oEmitVersion,
+ oNoEmitVersion,
oCompletesNeeded,
oMarginalsNeeded,
oMaxCertDepth,
@@ -530,8 +530,9 @@ static ARGPARSE_OPTS opts[] = {
{ oNoShowNotation, "no-show-notation", 0, "@" },
{ oComment, "comment", 2, "@" },
{ oDefaultComment, "default-comment", 0, "@" },
- { oNoVersion, "no-version", 0, "@"},
{ oEmitVersion, "emit-version", 0, "@"},
+ { oNoEmitVersion, "no-emit-version", 0, "@"},
+ { oNoEmitVersion, "no-version", 0, "@"}, /* alias */
{ oNotDashEscaped, "not-dash-escaped", 0, "@" },
{ oEscapeFrom, "escape-from-lines", 0, "@" },
{ oNoEscapeFrom, "no-escape-from-lines", 0, "@" },
@@ -1108,7 +1109,7 @@ main( int argc, char **argv )
opt.import_options=0;
opt.export_options=
EXPORT_INCLUDE_NON_RFC|EXPORT_INCLUDE_ATTRIBUTES;
- opt.keyserver_options.import_options=IMPORT_REPAIR_HKP_SUBKEY_BUG;
+ opt.keyserver_options.import_options=IMPORT_REPAIR_PKS_SUBKEY_BUG;
opt.keyserver_options.export_options=
EXPORT_INCLUDE_NON_RFC|EXPORT_INCLUDE_ATTRIBUTES;
opt.keyserver_options.include_subkeys=1;
@@ -1379,8 +1380,8 @@ main( int argc, char **argv )
case oQuickRandom: quick_random_gen(1); break;
case oSKComments: opt.sk_comments=1; break;
case oNoSKComments: opt.sk_comments=0; break;
- case oNoVersion: opt.no_version=1; break;
case oEmitVersion: opt.no_version=0; break;
+ case oNoEmitVersion: opt.no_version=1; break;
case oCompletesNeeded: opt.completes_needed = pargs.r.ret_int; break;
case oMarginalsNeeded: opt.marginals_needed = pargs.r.ret_int; break;
case oMaxCertDepth: opt.max_cert_depth = pargs.r.ret_int; break;
diff --git a/g10/hkp.c b/g10/hkp.c
index 142b3a0f2..745154c77 100644
--- a/g10/hkp.c
+++ b/g10/hkp.c
@@ -320,6 +320,8 @@ dehtmlize(char *line)
while(isspace(((unsigned char*)parsed)[parsedindex]))
{
parsed[parsedindex]='\0';
+ if(parsedindex==0)
+ break;
parsedindex--;
}
}
@@ -411,7 +413,7 @@ parse_hkp_index(IOBUF buffer,char *line)
line+=4;
tok=strsep(&line,"/");
- if(tok==NULL)
+ if(tok==NULL || strlen(tok)==0)
return ret;
if(tok[strlen(tok)-1]=='R')
diff --git a/g10/import.c b/g10/import.c
index 62e15eaa2..8e39517ad 100644
--- a/g10/import.c
+++ b/g10/import.c
@@ -96,7 +96,8 @@ parse_import_options(char *str,unsigned int *options)
} import_opts[]=
{
{"allow-local-sigs",IMPORT_ALLOW_LOCAL_SIGS},
- {"repair-hkp-subkey-bug",IMPORT_REPAIR_HKP_SUBKEY_BUG},
+ {"repair-hkp-subkey-bug",IMPORT_REPAIR_PKS_SUBKEY_BUG},
+ {"repair-pks-subkey-bug",IMPORT_REPAIR_PKS_SUBKEY_BUG},
{NULL,0}
};
@@ -452,7 +453,7 @@ remove_bad_stuff (KBNODE keyblock)
}
}
-/* Walk through the subkeys on a pk to find if we have the HKP
+/* Walk through the subkeys on a pk to find if we have the PKS
disease: multiple subkeys with their binding sigs stripped, and the
sig for the first subkey placed after the last subkey. That is,
instead of "pk uid sig sub1 bind1 sub2 bind2 sub3 bind3" we have
@@ -462,7 +463,7 @@ remove_bad_stuff (KBNODE keyblock)
sub2 sub3". Returns TRUE if the keyblock was modified. */
static int
-fix_hkp_corruption(KBNODE keyblock)
+fix_pks_corruption(KBNODE keyblock)
{
int changed=0,keycount=0;
KBNODE node,last=NULL,sknode=NULL;
@@ -627,7 +628,9 @@ import_one( const char *fname, KBNODE keyblock, int fast,
clear_kbnode_flags( keyblock );
- if((options&IMPORT_REPAIR_HKP_SUBKEY_BUG) && fix_hkp_corruption(keyblock))
+ /* It's really PKS corruption, not HKP corruption, but I won't
+ change the string in stable. */
+ if((options&IMPORT_REPAIR_PKS_SUBKEY_BUG) && fix_pks_corruption(keyblock))
log_info(_("key %08lX: HKP subkey corruption repaired\n"),
(ulong)keyid[1]);
diff --git a/g10/keyserver.c b/g10/keyserver.c
index a0bc064f9..aba5dfbd9 100644
--- a/g10/keyserver.c
+++ b/g10/keyserver.c
@@ -728,6 +728,11 @@ keyserver_work(int action,STRLIST list,KEYDB_SEARCH_DESC *desc,int count)
action==SEARCH?"search":"unknown",
opt.keyserver_scheme);
+ case KEYSERVER_VERSION_ERROR:
+ log_error(_("gpgkeys_%s does not support handler version %d\n"),
+ opt.keyserver_scheme,KEYSERVER_PROTO_VERSION);
+ break;
+
case KEYSERVER_INTERNAL_ERROR:
default:
log_error(_("keyserver internal error\n"));
diff --git a/g10/main.h b/g10/main.h
index 2b64b9c86..a55f4ed4e 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -153,7 +153,7 @@ 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_REPAIR_PKS_SUBKEY_BUG 2
int parse_import_options(char *str,unsigned int *options);
void import_keys( char **fnames, int nnames, int fast,