mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
* ksutil.h, ksutil.c (parse_ks_options): New keyserver-option exact-name.
The last of exact-name and exact-email overrides the earlier. * gpgkeys_ldap.c (search_key), gpgkeys_hkp.c (search_key): Use it here to do a name-only search.
This commit is contained in:
parent
2d353af65d
commit
70bf6d9204
@ -1,5 +1,12 @@
|
||||
2005-08-18 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* ksutil.h, ksutil.c (parse_ks_options): New keyserver-option
|
||||
exact-name. The last of exact-name and exact-email overrides the
|
||||
earlier.
|
||||
|
||||
* gpgkeys_ldap.c (search_key), gpgkeys_hkp.c (search_key): Use it
|
||||
here to do a name-only search.
|
||||
|
||||
* gpgkeys_ldap.c (ldap_quote): \-quote a string for LDAP.
|
||||
|
||||
* gpgkeys_ldap.c (search_key): Use it here to escape reserved
|
||||
|
@ -291,7 +291,25 @@ search_key(char *searchkey)
|
||||
char *searchkey_encoded=NULL;
|
||||
int ret=KEYSERVER_INTERNAL_ERROR;
|
||||
|
||||
if(opt->flags.exact_email)
|
||||
if(opt->flags.exact_name)
|
||||
{
|
||||
char *bracketed;
|
||||
|
||||
bracketed=malloc(strlen(searchkey)+2+1);
|
||||
if(!bracketed)
|
||||
{
|
||||
fprintf(console,"gpgkeys: out of memory\n");
|
||||
ret=KEYSERVER_NO_MEMORY;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
strcpy(bracketed,searchkey);
|
||||
strcat(bracketed," <");
|
||||
|
||||
searchkey_encoded=curl_escape(bracketed,0);
|
||||
free(bracketed);
|
||||
}
|
||||
else if(opt->flags.exact_email)
|
||||
{
|
||||
char *bracketed;
|
||||
|
||||
@ -341,7 +359,7 @@ search_key(char *searchkey)
|
||||
append_path(request,"/pks/lookup?op=index&options=mr&search=");
|
||||
strcat(request,searchkey_encoded);
|
||||
|
||||
if(opt->flags.exact_email)
|
||||
if(opt->flags.exact_name || opt->flags.exact_email)
|
||||
strcat(request,"&exact=on");
|
||||
|
||||
if(opt->verbose>2)
|
||||
|
@ -1158,6 +1158,9 @@ ldap_quote(char *buffer,const char *string)
|
||||
}
|
||||
}
|
||||
|
||||
if(buffer)
|
||||
*buffer='\0';
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@ -1173,7 +1176,7 @@ search_key(char *searchkey)
|
||||
/* The maximum size of the search, including the optional stuff and
|
||||
the trailing \0 */
|
||||
char *expanded_search;
|
||||
char search[2+12+1+MAX_LINE+1+2+15+14+1+1];
|
||||
char search[2+12+1+1+MAX_LINE+1+2+2+15+14+1+1];
|
||||
char *attrs[]={"pgpcertid","pgpuserid","pgprevoked","pgpdisabled",
|
||||
"pgpkeycreatetime","pgpkeyexpiretime","modifytimestamp",
|
||||
"pgpkeysize","pgpkeytype",NULL};
|
||||
@ -1192,11 +1195,13 @@ search_key(char *searchkey)
|
||||
|
||||
/* Build the search string */
|
||||
|
||||
sprintf(search,"%s(pgpuserid=*%s%s%s*)%s%s%s",
|
||||
sprintf(search,"%s(pgpuserid=%s%s%s%s%s*)%s%s%s",
|
||||
(!(opt->flags.include_disabled&&opt->flags.include_revoked))?"(&":"",
|
||||
opt->flags.exact_name?"":"*",
|
||||
opt->flags.exact_email?"<":"",
|
||||
expanded_search,
|
||||
opt->flags.exact_email?">":"",
|
||||
opt->flags.exact_name?" <":"",
|
||||
opt->flags.include_disabled?"":"(pgpdisabled=0)",
|
||||
opt->flags.include_revoked?"":"(pgprevoked=0)",
|
||||
!(opt->flags.include_disabled&&opt->flags.include_revoked)?")":"");
|
||||
|
@ -304,7 +304,20 @@ parse_ks_options(char *line,struct ks_options *opt)
|
||||
if(no)
|
||||
opt->flags.exact_email=0;
|
||||
else
|
||||
opt->flags.exact_email=1;
|
||||
{
|
||||
opt->flags.exact_email=1;
|
||||
opt->flags.exact_name=0;
|
||||
}
|
||||
}
|
||||
else if(strcasecmp(start,"exact-name")==0)
|
||||
{
|
||||
if(no)
|
||||
opt->flags.exact_name=0;
|
||||
else
|
||||
{
|
||||
opt->flags.exact_name=1;
|
||||
opt->flags.exact_email=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,6 +89,7 @@ struct ks_options
|
||||
unsigned int include_revoked:1;
|
||||
unsigned int include_subkeys:1;
|
||||
unsigned int check_cert:1;
|
||||
unsigned int exact_name:1;
|
||||
unsigned int exact_email:1;
|
||||
} flags;
|
||||
unsigned int verbose;
|
||||
|
Loading…
x
Reference in New Issue
Block a user