diff options
author | David Shaw <[email protected]> | 2004-07-28 19:55:21 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2004-07-28 19:55:21 +0000 |
commit | a2914a1592169cbca8e65b8b788f20f49ee9e9d7 (patch) | |
tree | f0b9651c67d217a0417d3d4949b08490812eb07c | |
parent | * gpgkeys_ldap.c (join_two_modlists): New. (send_key): Use new function so (diff) | |
download | gnupg-a2914a1592169cbca8e65b8b788f20f49ee9e9d7.tar.gz gnupg-a2914a1592169cbca8e65b8b788f20f49ee9e9d7.zip |
* gpgkeys_ldap.c (build_attrs): Add "pgpKeySize" and "pgpSubKeyID"
attributes so we can do subkey searches.
* gpgkeys_ldap.c (main): Under certain error conditions, we might try and
unbind twice. Don't.
Diffstat (limited to '')
-rw-r--r-- | keyserver/ChangeLog | 6 | ||||
-rw-r--r-- | keyserver/gpgkeys_ldap.c | 44 |
2 files changed, 48 insertions, 2 deletions
diff --git a/keyserver/ChangeLog b/keyserver/ChangeLog index 1780d3717..9fea68780 100644 --- a/keyserver/ChangeLog +++ b/keyserver/ChangeLog @@ -1,5 +1,11 @@ 2004-07-28 David Shaw <[email protected]> + * gpgkeys_ldap.c (build_attrs): Add "pgpKeySize" and "pgpSubKeyID" + attributes so we can do subkey searches. + + * gpgkeys_ldap.c (main): Under certain error conditions, we might + try and unbind twice. Don't. + * gpgkeys_ldap.c (join_two_modlists): New. (send_key): Use new function so we can try a modify operation first, and fail over to an add if that fails. Add cannot cope diff --git a/keyserver/gpgkeys_ldap.c b/keyserver/gpgkeys_ldap.c index 8d1014179..d72802a24 100644 --- a/keyserver/gpgkeys_ldap.c +++ b/keyserver/gpgkeys_ldap.c @@ -466,6 +466,44 @@ build_attrs(LDAPMod ***modlist,char *line) make_one_attr(modlist,0,"pgpDisabled",disabled?"1":"0"); make_one_attr(modlist,0,"pgpRevoked",revoked?"1":"0"); } + else if(ascii_strcasecmp("sub",record)==0) + { + char *tok; + + /* The long keyid */ + if((tok=strsep(&line,":"))==NULL) + return; + + if(strlen(tok)==16) + make_one_attr(modlist,0,"pgpSubKeyID",tok); + else + return; + + /* The subkey algo */ + if((tok=strsep(&line,":"))==NULL) + return; + + /* Size of subkey */ + if((tok=strsep(&line,":"))==NULL) + return; + + if(atoi(tok)>0) + { + char padded[6]; + int val=atoi(tok); + + /* We zero pad this on the left to make PGP happy. */ + + if(val<99999 && val>0) + { + sprintf(padded,"%05u",atoi(tok)); + make_one_attr(modlist,0,"pgpKeySize",padded); + } + } + + /* Ignore the rest of the items for subkeys since the LDAP + schema doesn't store them. */ + } else if(ascii_strcasecmp("uid",record)==0) { char *userid,*tok; @@ -1486,7 +1524,7 @@ main(int argc,char *argv[]) { int port=0,arg,err,action=-1,ret=KEYSERVER_INTERNAL_ERROR; char line[MAX_LINE]; - int version,failed=0,use_ssl=0,use_tls=0; + int version,failed=0,use_ssl=0,use_tls=0,bound=0; struct keylist *keylist=NULL,*keyptr=NULL; console=stderr; @@ -1833,6 +1871,8 @@ main(int argc,char *argv[]) fail_all(keylist,action,ldap_err_to_gpg_err(err)); goto fail; } + else + bound=1; switch(action) { @@ -1935,7 +1975,7 @@ main(int argc,char *argv[]) if(output!=stdout) fclose(output); - if(ldap!=NULL) + if(ldap!=NULL && bound) ldap_unbind_s(ldap); free(basekeyspacedn); |