mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-01 16:33:02 +01:00
* options.h, keyserver.c (add_canonical_option): New.
(parse_keyserver_options): Moved from here. (parse_keyserver_uri): Use it here so each keyserver can have some private options in addition to the main keyserver-options (e.g. per-keyserver auth).
This commit is contained in:
parent
1ae024ef81
commit
c37453211c
@ -1,3 +1,11 @@
|
|||||||
|
2006-02-23 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* options.h, keyserver.c (add_canonical_option): New.
|
||||||
|
(parse_keyserver_options): Moved from here.
|
||||||
|
(parse_keyserver_uri): Use it here so each keyserver can have some
|
||||||
|
private options in addition to the main keyserver-options
|
||||||
|
(e.g. per-keyserver auth).
|
||||||
|
|
||||||
2006-02-22 David Shaw <dshaw@jabberwocky.com>
|
2006-02-22 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* options.h, keyserver-internal.h, keyserver.c
|
* options.h, keyserver-internal.h, keyserver.c
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
|
|
||||||
int parse_keyserver_options(char *options);
|
int parse_keyserver_options(char *options);
|
||||||
void free_keyserver_spec(struct keyserver_spec *keyserver);
|
void free_keyserver_spec(struct keyserver_spec *keyserver);
|
||||||
struct keyserver_spec *parse_keyserver_uri(const char *uri,int require_scheme,
|
struct keyserver_spec *parse_keyserver_uri(const char *string,
|
||||||
|
int require_scheme,
|
||||||
const char *configname,
|
const char *configname,
|
||||||
unsigned int configlineno);
|
unsigned int configlineno);
|
||||||
struct keyserver_spec *parse_preferred_keyserver(PKT_signature *sig);
|
struct keyserver_spec *parse_preferred_keyserver(PKT_signature *sig);
|
||||||
|
@ -104,6 +104,27 @@ static int keyserver_work(enum ks_action action,STRLIST list,
|
|||||||
|
|
||||||
static size_t max_cert_size=DEFAULT_MAX_CERT_SIZE;
|
static size_t max_cert_size=DEFAULT_MAX_CERT_SIZE;
|
||||||
|
|
||||||
|
static void
|
||||||
|
add_canonical_option(char *option,STRLIST *list)
|
||||||
|
{
|
||||||
|
char *arg=argsplit(option);
|
||||||
|
|
||||||
|
if(arg)
|
||||||
|
{
|
||||||
|
char *joined;
|
||||||
|
|
||||||
|
joined=xmalloc(strlen(option)+1+strlen(arg)+1);
|
||||||
|
/* Make a canonical name=value form with no spaces */
|
||||||
|
strcpy(joined,option);
|
||||||
|
strcat(joined,"=");
|
||||||
|
strcat(joined,arg);
|
||||||
|
add_to_strlist(list,joined);
|
||||||
|
xfree(joined);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
add_to_strlist(list,option);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
parse_keyserver_options(char *options)
|
parse_keyserver_options(char *options)
|
||||||
{
|
{
|
||||||
@ -152,23 +173,7 @@ parse_keyserver_options(char *options)
|
|||||||
{
|
{
|
||||||
/* All of the standard options have failed, so the option is
|
/* All of the standard options have failed, so the option is
|
||||||
destined for a keyserver plugin. */
|
destined for a keyserver plugin. */
|
||||||
char *arg=argsplit(tok);
|
add_canonical_option(tok,&opt.keyserver_options.other);
|
||||||
|
|
||||||
if(arg)
|
|
||||||
{
|
|
||||||
char *joined;
|
|
||||||
|
|
||||||
joined=xmalloc(strlen(tok)+1+strlen(arg)+1);
|
|
||||||
/* Make a canonical name=value form with no
|
|
||||||
spaces */
|
|
||||||
strcpy(joined,tok);
|
|
||||||
strcat(joined,"=");
|
|
||||||
strcat(joined,arg);
|
|
||||||
add_to_strlist(&opt.keyserver_options.other,joined);
|
|
||||||
xfree(joined);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
add_to_strlist(&opt.keyserver_options.other,tok);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,6 +198,7 @@ free_keyserver_spec(struct keyserver_spec *keyserver)
|
|||||||
xfree(keyserver->port);
|
xfree(keyserver->port);
|
||||||
xfree(keyserver->path);
|
xfree(keyserver->path);
|
||||||
xfree(keyserver->opaque);
|
xfree(keyserver->opaque);
|
||||||
|
free_strlist(keyserver->options);
|
||||||
xfree(keyserver);
|
xfree(keyserver);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,18 +207,33 @@ free_keyserver_spec(struct keyserver_spec *keyserver)
|
|||||||
keyserver/ksutil.c for limited use in gpgkeys_ldap or the like. */
|
keyserver/ksutil.c for limited use in gpgkeys_ldap or the like. */
|
||||||
|
|
||||||
struct keyserver_spec *
|
struct keyserver_spec *
|
||||||
parse_keyserver_uri(const char *uri,int require_scheme,
|
parse_keyserver_uri(const char *string,int require_scheme,
|
||||||
const char *configname,unsigned int configlineno)
|
const char *configname,unsigned int configlineno)
|
||||||
{
|
{
|
||||||
int assume_hkp=0;
|
int assume_hkp=0;
|
||||||
struct keyserver_spec *keyserver;
|
struct keyserver_spec *keyserver;
|
||||||
const char *idx;
|
const char *idx;
|
||||||
int count;
|
int count;
|
||||||
|
char *uri,*options;
|
||||||
|
|
||||||
assert(uri!=NULL);
|
assert(string!=NULL);
|
||||||
|
|
||||||
keyserver=xmalloc_clear(sizeof(struct keyserver_spec));
|
keyserver=xmalloc_clear(sizeof(struct keyserver_spec));
|
||||||
|
|
||||||
|
uri=xstrdup(string);
|
||||||
|
|
||||||
|
options=strchr(uri,' ');
|
||||||
|
if(options)
|
||||||
|
{
|
||||||
|
char *tok;
|
||||||
|
|
||||||
|
*options='\0';
|
||||||
|
options++;
|
||||||
|
|
||||||
|
while((tok=optsep(&options)))
|
||||||
|
add_canonical_option(tok,&keyserver->options);
|
||||||
|
}
|
||||||
|
|
||||||
/* Get the scheme */
|
/* Get the scheme */
|
||||||
|
|
||||||
for(idx=uri,count=0;*idx && *idx!=':';idx++)
|
for(idx=uri,count=0;*idx && *idx!=':';idx++)
|
||||||
@ -1038,6 +1059,9 @@ keyserver_spawn(enum ks_action action,STRLIST list,KEYDB_SEARCH_DESC *desc,
|
|||||||
for(temp=opt.keyserver_options.other;temp;temp=temp->next)
|
for(temp=opt.keyserver_options.other;temp;temp=temp->next)
|
||||||
fprintf(spawn->tochild,"OPTION %s\n",temp->d);
|
fprintf(spawn->tochild,"OPTION %s\n",temp->d);
|
||||||
|
|
||||||
|
for(temp=opt.keyserver->options;temp;temp=temp->next)
|
||||||
|
fprintf(spawn->tochild,"OPTION %s\n",temp->d);
|
||||||
|
|
||||||
switch(action)
|
switch(action)
|
||||||
{
|
{
|
||||||
case KS_GET:
|
case KS_GET:
|
||||||
|
@ -136,6 +136,7 @@ struct
|
|||||||
char *port;
|
char *port;
|
||||||
char *path;
|
char *path;
|
||||||
char *opaque;
|
char *opaque;
|
||||||
|
STRLIST options;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
unsigned int direct_uri:1;
|
unsigned int direct_uri:1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user