mirror of
git://git.gnupg.org/gnupg.git
synced 2025-03-28 22:49:59 +01:00
* 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.
This commit is contained in:
parent
4552115bbb
commit
a2914a1592
@ -1,5 +1,11 @@
|
|||||||
2004-07-28 David Shaw <dshaw@jabberwocky.com>
|
2004-07-28 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* 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.
|
* gpgkeys_ldap.c (join_two_modlists): New.
|
||||||
(send_key): Use new function so we can try a modify operation
|
(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
|
first, and fail over to an add if that fails. Add cannot cope
|
||||||
|
@ -466,6 +466,44 @@ build_attrs(LDAPMod ***modlist,char *line)
|
|||||||
make_one_attr(modlist,0,"pgpDisabled",disabled?"1":"0");
|
make_one_attr(modlist,0,"pgpDisabled",disabled?"1":"0");
|
||||||
make_one_attr(modlist,0,"pgpRevoked",revoked?"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)
|
else if(ascii_strcasecmp("uid",record)==0)
|
||||||
{
|
{
|
||||||
char *userid,*tok;
|
char *userid,*tok;
|
||||||
@ -1486,7 +1524,7 @@ main(int argc,char *argv[])
|
|||||||
{
|
{
|
||||||
int port=0,arg,err,action=-1,ret=KEYSERVER_INTERNAL_ERROR;
|
int port=0,arg,err,action=-1,ret=KEYSERVER_INTERNAL_ERROR;
|
||||||
char line[MAX_LINE];
|
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;
|
struct keylist *keylist=NULL,*keyptr=NULL;
|
||||||
|
|
||||||
console=stderr;
|
console=stderr;
|
||||||
@ -1833,6 +1871,8 @@ main(int argc,char *argv[])
|
|||||||
fail_all(keylist,action,ldap_err_to_gpg_err(err));
|
fail_all(keylist,action,ldap_err_to_gpg_err(err));
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
bound=1;
|
||||||
|
|
||||||
switch(action)
|
switch(action)
|
||||||
{
|
{
|
||||||
@ -1935,7 +1975,7 @@ main(int argc,char *argv[])
|
|||||||
if(output!=stdout)
|
if(output!=stdout)
|
||||||
fclose(output);
|
fclose(output);
|
||||||
|
|
||||||
if(ldap!=NULL)
|
if(ldap!=NULL && bound)
|
||||||
ldap_unbind_s(ldap);
|
ldap_unbind_s(ldap);
|
||||||
|
|
||||||
free(basekeyspacedn);
|
free(basekeyspacedn);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user