mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-25 15:27:03 +01:00
* keyserver.c (keyserver_spawn): Handle CRLF endings from keyserver
helpers. Also don't leak the last line worth of memory from the keyserver response. * main.h, misc.c (deprecated_warning): New function to warn about deprecated options and commands. * g10.c (main), keyserver-internal.h, keyserver.c (parse_keyserver_uri): Use new deprecated function to warn about honor-http-proxy, auto-key-retrieve, and x-broken-hkp.
This commit is contained in:
parent
03d78479ff
commit
8ce53a679a
@ -1,3 +1,16 @@
|
||||
2002-06-12 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* keyserver.c (keyserver_spawn): Handle CRLF endings from
|
||||
keyserver helpers. Also don't leak the last line worth of memory
|
||||
from the keyserver response.
|
||||
|
||||
* main.h, misc.c (deprecated_warning): New function to warn about
|
||||
deprecated options and commands.
|
||||
|
||||
* g10.c (main), keyserver-internal.h, keyserver.c
|
||||
(parse_keyserver_uri): Use new deprecated function to warn about
|
||||
honor-http-proxy, auto-key-retrieve, and x-broken-hkp.
|
||||
|
||||
2002-06-11 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* Makefile.am: link gpg with NETLIBS for the built-in HKP access.
|
||||
|
23
g10/g10.c
23
g10/g10.c
@ -1328,7 +1328,7 @@ main( int argc, char **argv )
|
||||
#endif /* __riscos__ */
|
||||
break;
|
||||
case oKeyServer:
|
||||
if(parse_keyserver_uri(pargs.r.ret_str))
|
||||
if(parse_keyserver_uri(pargs.r.ret_str,configname,configlineno))
|
||||
log_error(_("could not parse keyserver URI\n"));
|
||||
break;
|
||||
case oKeyServerOptions:
|
||||
@ -1372,10 +1372,10 @@ main( int argc, char **argv )
|
||||
case oSetFilesize: opt.set_filesize = pargs.r.ret_ulong; break;
|
||||
case oHonorHttpProxy:
|
||||
opt.keyserver_options.honor_http_proxy = 1;
|
||||
log_info(_("WARNING: %s is a deprecated option.\n"),
|
||||
"--honor-http-proxy");
|
||||
log_info(_("please use \"--keyserver-options %s\" instead\n"),
|
||||
"honor-http-proxy");
|
||||
deprecated_warning(configname,configlineno,
|
||||
"--honor-http-proxy",
|
||||
"--keyserver-options ",
|
||||
"honor-http-proxy");
|
||||
break;
|
||||
case oFastListMode: opt.fast_list_mode = 1; break;
|
||||
case oFixedListMode: opt.fixed_list_mode = 1; break;
|
||||
@ -1388,13 +1388,12 @@ main( int argc, char **argv )
|
||||
case oNoAutoKeyRetrieve:
|
||||
opt.keyserver_options.auto_key_retrieve=
|
||||
(pargs.r_opt==oAutoKeyRetrieve);
|
||||
log_info(_("WARNING: %s is a deprecated option.\n"),
|
||||
pargs.r_opt==oAutoKeyRetrieve?
|
||||
"--auto-key-retrieve":"--no-auto-key-retrieve");
|
||||
log_info(_("please use \"--keyserver-options %s\" instead\n"),
|
||||
pargs.r_opt==oAutoKeyRetrieve?
|
||||
"auto-key-retrieve":"no-auto-key-retrieve");
|
||||
break;
|
||||
deprecated_warning(configname,configlineno,
|
||||
pargs.r_opt==oAutoKeyRetrieve?"--auto-key-retrieve":
|
||||
"--no-auto-key-retrieve","--keyserver-options ",
|
||||
pargs.r_opt==oAutoKeyRetrieve?"auto-key-retrieve":
|
||||
"no-auto-key-retrieve");
|
||||
break;
|
||||
case oShowSessionKey: opt.show_session_key = 1; break;
|
||||
case oOverrideSessionKey:
|
||||
opt.override_session_key = pargs.r.ret_str;
|
||||
|
@ -9,7 +9,8 @@
|
||||
#include "types.h"
|
||||
|
||||
void parse_keyserver_options(char *options);
|
||||
int parse_keyserver_uri(char *uri);
|
||||
int parse_keyserver_uri(char *uri,
|
||||
const char *configname,unsigned int configlineno);
|
||||
int keyserver_export(STRLIST users);
|
||||
int keyserver_import(STRLIST users);
|
||||
int keyserver_import_fprint(const byte *fprint,size_t fprint_len);
|
||||
|
@ -117,7 +117,7 @@ parse_keyserver_options(char *options)
|
||||
}
|
||||
|
||||
int
|
||||
parse_keyserver_uri(char *uri)
|
||||
parse_keyserver_uri(char *uri,const char *configname,unsigned int configlineno)
|
||||
{
|
||||
/* Get the scheme */
|
||||
|
||||
@ -130,10 +130,8 @@ parse_keyserver_uri(char *uri)
|
||||
|
||||
if(ascii_strcasecmp(opt.keyserver_scheme,"x-broken-hkp")==0)
|
||||
{
|
||||
log_info(_("WARNING: %s is a deprecated option.\n"),
|
||||
"x-broken-hkp");
|
||||
log_info(_("please use \"--keyserver-options %s\" instead\n"),
|
||||
"broken-http-proxy");
|
||||
deprecated_warning(configname,configlineno,"x-broken-hkp",
|
||||
"--keyserver-options ","broken-http-proxy");
|
||||
opt.keyserver_scheme="hkp";
|
||||
opt.keyserver_options.broken_http_proxy=1;
|
||||
}
|
||||
@ -491,39 +489,50 @@ keyserver_spawn(int action,STRLIST list,
|
||||
|
||||
/* Now handle the response */
|
||||
|
||||
do
|
||||
for(;;)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
if(iobuf_read_line(spawn->fromchild,&line,&buflen,&maxlen)==0)
|
||||
{
|
||||
ret=G10ERR_READ_FILE;
|
||||
goto fail; /* i.e. EOF */
|
||||
}
|
||||
|
||||
if(ascii_memcasecmp(line,"VERSION ",8)==0)
|
||||
ptr=line;
|
||||
|
||||
if(*ptr=='\r')
|
||||
ptr++;
|
||||
|
||||
if(*ptr=='\n')
|
||||
ptr++;
|
||||
|
||||
if(*ptr=='\0')
|
||||
break;
|
||||
|
||||
if(ascii_memcasecmp(ptr,"VERSION ",8)==0)
|
||||
{
|
||||
gotversion=1;
|
||||
|
||||
if(atoi(&line[8])!=KEYSERVER_PROTO_VERSION)
|
||||
if(atoi(&ptr[8])!=KEYSERVER_PROTO_VERSION)
|
||||
{
|
||||
log_error(_("invalid keyserver protocol (us %d!=handler %d)\n"),
|
||||
KEYSERVER_PROTO_VERSION,atoi(&line[8]));
|
||||
KEYSERVER_PROTO_VERSION,atoi(&ptr[8]));
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
if(ascii_memcasecmp(line,"PROGRAM ",8)==0)
|
||||
else if(ascii_memcasecmp(ptr,"PROGRAM ",8)==0)
|
||||
{
|
||||
line[strlen(line)-1]='\0';
|
||||
if(ascii_strcasecmp(&line[8],VERSION)!=0)
|
||||
ptr[strlen(ptr)-1]='\0';
|
||||
if(ascii_strcasecmp(&ptr[8],VERSION)!=0)
|
||||
log_info(_("Warning: keyserver handler from a different "
|
||||
"version of GnuPG (%s)\n"),&line[8]);
|
||||
"version of GnuPG (%s)\n"),&ptr[8]);
|
||||
}
|
||||
|
||||
/* Currently the only OPTION */
|
||||
if(ascii_memcasecmp(line,"OPTION OUTOFBAND",16)==0)
|
||||
outofband=1;
|
||||
else if(ascii_memcasecmp(ptr,"OPTION OUTOFBAND",16)==0)
|
||||
outofband=1; /* Currently the only OPTION */
|
||||
}
|
||||
while(line[0]!='\n');
|
||||
|
||||
m_free(line);
|
||||
|
||||
if(!gotversion)
|
||||
{
|
||||
|
@ -83,6 +83,8 @@ struct expando_args
|
||||
|
||||
char *pct_expando(const char *string,struct expando_args *args);
|
||||
int hextobyte( const char *s );
|
||||
void deprecated_warning(const char *configname,unsigned int configlineno,
|
||||
const char *option,const char *repl1,const char *repl2);
|
||||
|
||||
/*-- helptext.c --*/
|
||||
void display_online_help( const char *keyword );
|
||||
|
21
g10/misc.c
21
g10/misc.c
@ -637,3 +637,24 @@ hextobyte( const char *s )
|
||||
return -1;
|
||||
return c;
|
||||
}
|
||||
|
||||
void
|
||||
deprecated_warning(const char *configname,unsigned int configlineno,
|
||||
const char *option,const char *repl1,const char *repl2)
|
||||
{
|
||||
if(configname)
|
||||
{
|
||||
if(strncmp("--",option,2)==0)
|
||||
option+=2;
|
||||
|
||||
if(strncmp("--",repl1,2)==0)
|
||||
repl1+=2;
|
||||
|
||||
log_info(_("%s:%d: deprecated option \"%s\"\n"),
|
||||
configname,configlineno,option);
|
||||
}
|
||||
else
|
||||
log_info(_("WARNING: \"%s\" is a deprecated option\n"),option);
|
||||
|
||||
log_info(_("please use \"%s%s\" instead\n"),repl1,repl2);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user