diff options
author | David Shaw <dshaw@jabberwocky.com> | 2002-07-16 01:13:48 +0200 |
---|---|---|
committer | David Shaw <dshaw@jabberwocky.com> | 2002-07-16 01:13:48 +0200 |
commit | 29217218417ff96c50c5082a2dffe99db341ee00 (patch) | |
tree | c88760d52628f7334a0bf7bf1689f6a58c10ba9d /keyserver | |
parent | * options.h, keyserver.c (parse_keyserver_uri, keyserver_spawn, (diff) | |
download | gnupg2-29217218417ff96c50c5082a2dffe99db341ee00.tar.xz gnupg2-29217218417ff96c50c5082a2dffe99db341ee00.zip |
* gpgkeys_ldap.c (send_key, get_key, main): Consult the server version
string to determine whether to use pgpKey or pgpKeyV2.
Diffstat (limited to 'keyserver')
-rw-r--r-- | keyserver/ChangeLog | 5 | ||||
-rw-r--r-- | keyserver/gpgkeys_ldap.c | 38 |
2 files changed, 33 insertions, 10 deletions
diff --git a/keyserver/ChangeLog b/keyserver/ChangeLog index 881ba226c..31f19ea18 100644 --- a/keyserver/ChangeLog +++ b/keyserver/ChangeLog @@ -1,3 +1,8 @@ +2002-07-15 David Shaw <dshaw@jabberwocky.com> + + * gpgkeys_ldap.c (send_key, get_key, main): Consult the server + version string to determine whether to use pgpKey or pgpKeyV2. + 2002-07-09 David Shaw <dshaw@jabberwocky.com> * gpgkeys_mailto.in: Use new OPAQUE tag for non net-path URIs. diff --git a/keyserver/gpgkeys_ldap.c b/keyserver/gpgkeys_ldap.c index 7f13599a9..f6b9d2528 100644 --- a/keyserver/gpgkeys_ldap.c +++ b/keyserver/gpgkeys_ldap.c @@ -44,6 +44,7 @@ int verbose=0,include_disabled=0,include_revoked=0,include_subkeys=0; char *basekeyspacedn=NULL; char host[80]; char portstr[10]; +char *pgpkeystr="pgpKey"; FILE *input=NULL,*output=NULL,*console=NULL; LDAP *ldap=NULL; @@ -62,12 +63,12 @@ int send_key(void) char *key[2]={0,0}; char keyid[17]; #ifndef __riscos__ - LDAPMod mod={LDAP_MOD_ADD,"pgpKeyV2",{key}},*attrs[2]={&mod,NULL}; + LDAPMod mod={LDAP_MOD_ADD,pgpkeystr,{key}},*attrs[2]={&mod,NULL}; #else LDAPMod mod, *attrs[2]; mod.mod_op = LDAP_MOD_ADD; - mod.mod_type = "pgpKeyV2"; + mod.mod_type = pgpkeystr; mod.mod_values = 0; mod.mod_bvalues = 0; @@ -169,9 +170,16 @@ int get_key(char *getkey) int ret=-1,err,count; struct keylist *dupelist=NULL; char search[62]; - char *attrs[]={"pgpKeyV2","pgpuserid","pgpkeyid","pgpcertid","pgprevoked", +#ifndef __riscos__ + char *attrs[]={pgpkeystr,"pgpuserid","pgpkeyid","pgpcertid","pgprevoked", + "pgpdisabled","pgpkeycreatetime","modifytimestamp", + "pgpkeysize","pgpkeytype",NULL}; +#else + char *attrs[]={"foobar","pgpuserid","pgpkeyid","pgpcertid","pgprevoked", "pgpdisabled","pgpkeycreatetime","modifytimestamp", "pgpkeysize","pgpkeytype",NULL}; + attrs[0]=pgpkeystr; +#endif /* Build the search string */ @@ -380,7 +388,7 @@ int get_key(char *getkey) } } - vals=ldap_get_values(ldap,each,"pgpKeyV2"); + vals=ldap_get_values(ldap,each,pgpkeystr); if(vals==NULL) { fprintf(console,"gpgkeys: unable to retrieve key %s " @@ -858,13 +866,23 @@ int main(int argc,char *argv[]) fprintf(console,"Server: \t%s\n",vals[0]); ldap_value_free(vals); } + } - vals=ldap_get_values(ldap,res,"version"); - if(vals!=NULL) - { - fprintf(console,"Version:\t%s\n",vals[0]); - ldap_value_free(vals); - } + vals=ldap_get_values(ldap,res,"version"); + if(vals!=NULL) + { + if(verbose>1) + fprintf(console,"Version:\t%s\n",vals[0]); + + /* If the version is high enough, use the new pgpKeyV2 + attribute. This design if iffy at best, but it matches how + PGP does it. I figure the NAI folks assumed that there would + never be a LDAP keyserver vendor with a different numbering + scheme. */ + if(atoi(vals[0])>1) + pgpkeystr="pgpKeyV2"; + + ldap_value_free(vals); } /* This is always "OU=ACTIVE,O=PGP KEYSPACE,C=US", but it might not |