mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-23 10:29:58 +01:00
* options.h, keyserver.c (keyserver_opts), g10.c (main): New keyserver
option "include-subkeys". This feature already existed, but now can be turned off. It defaults to on. * options.h, keyserver.c (parse_keyserver_options, keyserver_spawn): There are now enough options to justify making a structure for the keyserver options rather than a page of if-then-else-if-then-etc. * getkey.c (merge_keys_and_selfsig, merge_selfsigs_main): Fix bug in calculating key expiration dates.
This commit is contained in:
parent
3bff7c1d60
commit
6ae955f451
@ -1,3 +1,17 @@
|
||||
2002-06-10 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* options.h, keyserver.c (keyserver_opts), g10.c (main): New
|
||||
keyserver option "include-subkeys". This feature already existed,
|
||||
but now can be turned off. It defaults to on.
|
||||
|
||||
* options.h, keyserver.c (parse_keyserver_options,
|
||||
keyserver_spawn): There are now enough options to justify making a
|
||||
structure for the keyserver options rather than a page of
|
||||
if-then-else-if-then-etc.
|
||||
|
||||
* getkey.c (merge_keys_and_selfsig, merge_selfsigs_main): Fix bug
|
||||
in calculating key expiration dates.
|
||||
|
||||
2002-06-09 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* keydb.h, getkey.c (get_user_id_native), import.c (import_one):
|
||||
|
@ -907,6 +907,7 @@ main( int argc, char **argv )
|
||||
opt.pgp2_workarounds = 1;
|
||||
opt.force_v3_sigs = 1;
|
||||
opt.escape_from = 1;
|
||||
opt.keyserver_options.include_subkeys=1;
|
||||
#if defined (__MINGW32__) || defined (__CYGWIN32__)
|
||||
opt.homedir = read_w32_registry_string( NULL, "Software\\GNU\\GnuPG", "HomeDir" );
|
||||
#else
|
||||
|
@ -1084,10 +1084,12 @@ merge_keys_and_selfsig( KBNODE keyblock )
|
||||
}
|
||||
}
|
||||
|
||||
if(pk && (pk->expiredate==0 || pk->expiredate>pk->max_expiredate))
|
||||
if(pk && (pk->expiredate==0 ||
|
||||
(pk->max_expiredate && pk->expiredate>pk->max_expiredate)))
|
||||
pk->expiredate=pk->max_expiredate;
|
||||
|
||||
if(sk && (sk->expiredate==0 || sk->expiredate>sk->max_expiredate))
|
||||
if(sk && (sk->expiredate==0 ||
|
||||
(sk->max_expiredate && sk->expiredate>sk->max_expiredate)))
|
||||
sk->expiredate=sk->max_expiredate;
|
||||
}
|
||||
}
|
||||
@ -1527,7 +1529,7 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked )
|
||||
|
||||
/* Currently only v3 keys have a maximum expiration date, but I'll
|
||||
bet v5 keys get this feature again. */
|
||||
if(key_expire==0 || key_expire>pk->max_expiredate)
|
||||
if(key_expire==0 || (pk->max_expiredate && key_expire>pk->max_expiredate))
|
||||
key_expire=pk->max_expiredate;
|
||||
|
||||
pk->has_expired = key_expire >= curtime? 0 : key_expire;
|
||||
|
114
g10/keyserver.c
114
g10/keyserver.c
@ -44,6 +44,24 @@
|
||||
#define SEND 1
|
||||
#define SEARCH 2
|
||||
|
||||
struct kopts
|
||||
{
|
||||
char *name;
|
||||
int tell; /* tell remote process about this one */
|
||||
int *flag;
|
||||
} keyserver_opts[]=
|
||||
{
|
||||
{"include-revoked",1,&opt.keyserver_options.include_revoked},
|
||||
{"include-disabled",1,&opt.keyserver_options.include_disabled},
|
||||
{"include-subkeys",1,&opt.keyserver_options.include_subkeys},
|
||||
{"keep-temp-files",0,&opt.keyserver_options.keep_temp_files},
|
||||
{"honor-http-proxy",1,&opt.keyserver_options.honor_http_proxy},
|
||||
{"broken-http-proxy",1,&opt.keyserver_options.broken_http_proxy},
|
||||
{"refresh-add-fake-v3-keyids",0,&opt.keyserver_options.fake_v3_keyids},
|
||||
{"auto-key-retrieve",0,&opt.keyserver_options.auto_key_retrieve},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
void
|
||||
parse_keyserver_options(char *options)
|
||||
{
|
||||
@ -51,51 +69,47 @@ parse_keyserver_options(char *options)
|
||||
|
||||
do
|
||||
{
|
||||
if(ascii_strcasecmp(tok,"include-revoked")==0)
|
||||
opt.keyserver_options.include_revoked=1;
|
||||
else if(ascii_strcasecmp(tok,"no-include-revoked")==0)
|
||||
opt.keyserver_options.include_revoked=0;
|
||||
else if(ascii_strcasecmp(tok,"include-disabled")==0)
|
||||
opt.keyserver_options.include_disabled=1;
|
||||
else if(ascii_strcasecmp(tok,"no-include-disabled")==0)
|
||||
opt.keyserver_options.include_disabled=0;
|
||||
struct kopts *kopts=keyserver_opts;
|
||||
int i,hit=0;
|
||||
|
||||
for(i=0,kopts=keyserver_opts;kopts[i].name;i++)
|
||||
{
|
||||
if(ascii_strcasecmp(tok,kopts[i].name)==0)
|
||||
{
|
||||
*(kopts[i].flag)=1;
|
||||
hit=1;
|
||||
break;
|
||||
}
|
||||
else if(ascii_memcasecmp("no-",tok,3)==0 && strlen(tok)>3 &&
|
||||
ascii_strcasecmp(&tok[3],kopts[i].name)==0)
|
||||
{
|
||||
*(kopts[i].flag)=0;
|
||||
hit=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* These options need more than just a flag */
|
||||
if(!hit)
|
||||
{
|
||||
if(ascii_strcasecmp(tok,"verbose")==0)
|
||||
opt.keyserver_options.verbose++;
|
||||
else if(ascii_strcasecmp(tok,"no-verbose")==0)
|
||||
opt.keyserver_options.verbose--;
|
||||
#ifdef EXEC_TEMPFILE_ONLY
|
||||
else if(ascii_strcasecmp(tok,"use-temp-files")==0 ||
|
||||
ascii_strcasecmp(tok,"no-use-temp-files")==0)
|
||||
log_info(_("Warning: keyserver option \"%s\" is not used "
|
||||
"on this platform\n"),tok);
|
||||
else if(ascii_strcasecmp(tok,"use-temp-files")==0 ||
|
||||
ascii_strcasecmp(tok,"no-use-temp-files")==0)
|
||||
log_info(_("Warning: keyserver option \"%s\" is not used "
|
||||
"on this platform\n"),tok);
|
||||
#else
|
||||
else if(ascii_strcasecmp(tok,"use-temp-files")==0)
|
||||
opt.keyserver_options.use_temp_files=1;
|
||||
else if(ascii_strcasecmp(tok,"no-use-temp-files")==0)
|
||||
opt.keyserver_options.use_temp_files=0;
|
||||
else if(ascii_strcasecmp(tok,"use-temp-files")==0)
|
||||
opt.keyserver_options.use_temp_files=1;
|
||||
else if(ascii_strcasecmp(tok,"no-use-temp-files")==0)
|
||||
opt.keyserver_options.use_temp_files=0;
|
||||
#endif
|
||||
else if(ascii_strcasecmp(tok,"keep-temp-files")==0)
|
||||
opt.keyserver_options.keep_temp_files=1;
|
||||
else if(ascii_strcasecmp(tok,"no-keep-temp-files")==0)
|
||||
opt.keyserver_options.keep_temp_files=0;
|
||||
else if(ascii_strcasecmp(tok,"verbose")==0)
|
||||
opt.keyserver_options.verbose++;
|
||||
else if(ascii_strcasecmp(tok,"no-verbose")==0)
|
||||
opt.keyserver_options.verbose--;
|
||||
else if(ascii_strcasecmp(tok,"honor-http-proxy")==0)
|
||||
opt.keyserver_options.honor_http_proxy=1;
|
||||
else if(ascii_strcasecmp(tok,"no-honor-http-proxy")==0)
|
||||
opt.keyserver_options.honor_http_proxy=0;
|
||||
else if(ascii_strcasecmp(tok,"refresh-add-fake-v3-keyids")==0)
|
||||
opt.keyserver_options.refresh_add_fake_v3_keyids=1;
|
||||
else if(ascii_strcasecmp(tok,"no-refresh-add-fake-v3-keyids")==0)
|
||||
opt.keyserver_options.refresh_add_fake_v3_keyids=0;
|
||||
else if(ascii_strcasecmp(tok,"auto-key-retrieve")==0)
|
||||
opt.keyserver_options.auto_key_retrieve=1;
|
||||
else if(ascii_strcasecmp(tok,"no-auto-key-retrieve")==0)
|
||||
opt.keyserver_options.auto_key_retrieve=0;
|
||||
else if(ascii_strcasecmp(tok,"broken-http-proxy")==0)
|
||||
opt.keyserver_options.broken_http_proxy=1;
|
||||
else if(ascii_strcasecmp(tok,"no-broken-http-proxy")==0)
|
||||
opt.keyserver_options.broken_http_proxy=0;
|
||||
else if(strlen(tok)>0)
|
||||
add_to_strlist(&opt.keyserver_options.other,tok);
|
||||
else if(strlen(tok)>0)
|
||||
add_to_strlist(&opt.keyserver_options.other,tok);
|
||||
}
|
||||
|
||||
tok=strsep(&options," ,");
|
||||
}
|
||||
@ -117,9 +131,9 @@ 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");
|
||||
"x-broken-hkp");
|
||||
log_info(_("please use \"--keyserver-options %s\" instead\n"),
|
||||
"broken-http-proxy");
|
||||
"broken-http-proxy");
|
||||
opt.keyserver_scheme="hkp";
|
||||
opt.keyserver_options.broken_http_proxy=1;
|
||||
}
|
||||
@ -290,6 +304,7 @@ keyserver_spawn(int action,STRLIST list,
|
||||
unsigned int maxlen=256,buflen;
|
||||
char *command=NULL,*searchstr=NULL;
|
||||
byte *line=NULL;
|
||||
struct kopts *kopts;
|
||||
struct exec_info *spawn;
|
||||
|
||||
#ifdef EXEC_TEMPFILE_ONLY
|
||||
@ -335,11 +350,9 @@ keyserver_spawn(int action,STRLIST list,
|
||||
|
||||
/* Write options */
|
||||
|
||||
fprintf(spawn->tochild,"OPTION %sinclude-revoked\n",
|
||||
opt.keyserver_options.include_revoked?"":"no-");
|
||||
|
||||
fprintf(spawn->tochild,"OPTION %sinclude-disabled\n",
|
||||
opt.keyserver_options.include_disabled?"":"no-");
|
||||
for(i=0,kopts=keyserver_opts;kopts[i].name;i++)
|
||||
if(*(kopts[i].flag) && kopts[i].tell)
|
||||
fprintf(spawn->tochild,"OPTION %s\n",kopts[i].name);
|
||||
|
||||
for(i=0;i<opt.keyserver_options.verbose;i++)
|
||||
fprintf(spawn->tochild,"OPTION verbose\n");
|
||||
@ -874,8 +887,7 @@ keyserver_refresh(STRLIST users)
|
||||
|
||||
/* If refresh_add_fake_v3_keyids is on and it's a HKP or MAILTO
|
||||
scheme, then enable fake v3 keyid generation. */
|
||||
if(opt.keyserver_options.refresh_add_fake_v3_keyids &&
|
||||
opt.keyserver_scheme &&
|
||||
if(opt.keyserver_options.fake_v3_keyids && opt.keyserver_scheme &&
|
||||
(ascii_strcasecmp(opt.keyserver_scheme,"hkp")==0 ||
|
||||
ascii_strcasecmp(opt.keyserver_scheme,"mailto")==0))
|
||||
fakev3=1;
|
||||
|
@ -117,14 +117,15 @@ struct {
|
||||
struct
|
||||
{
|
||||
int verbose;
|
||||
int include_revoked:1;
|
||||
int include_disabled:1;
|
||||
int use_temp_files:1;
|
||||
int keep_temp_files:1;
|
||||
int refresh_add_fake_v3_keyids:1;
|
||||
int auto_key_retrieve:1;
|
||||
int honor_http_proxy:1;
|
||||
int broken_http_proxy:1;
|
||||
int include_revoked;
|
||||
int include_disabled;
|
||||
int include_subkeys;
|
||||
int honor_http_proxy;
|
||||
int broken_http_proxy;
|
||||
int use_temp_files;
|
||||
int keep_temp_files;
|
||||
int fake_v3_keyids;
|
||||
int auto_key_retrieve;
|
||||
STRLIST other;
|
||||
} keyserver_options;
|
||||
int exec_disable;
|
||||
|
Loading…
x
Reference in New Issue
Block a user