Mailing List Archive

Patch for userSMIMECertificate
All,

The dirmngr component doesn't attempt to fetch or parse userSMIMECertificate
attributes within entries while fetching from LDAP, so I've attached a diff
against 0.9.0 which adds the capability [.Our directory stores
userSMIMECertificates to distinguish from our web client certificates].

Also - I think that line 680 in ldap_wrapper (ldap.c) which reads

ctrl->refcount++

should read:

if (ctrl) ctrl->refcount++

since ctrl is not guaranteed to be non-NULL when entering the ldap_wrapper
routine (try loading a CRL whose issuer certificate is not available in the
local store or via LDAP - I get a segfault).

Now the bad news: I can't get libksba (0.9.10) to parse the PKCS7 blob which
makes up a userSMIMECertificate - I just get "unsupported encoding" after the
first couple of calls to the PKCS7 parser. So, I had to use GnuTLS as the
PKCS7 unwrapper, which imposes a partial dependency on GnuTLS. The configure
script will continue if GnuTLS is not present, but the PKCS7 unwrapping will
be #ifdef'ed out.

Also - the code only takes the first certificate from the PKCS7 blob - which
is not necessarily the right thing to do (the chain may be presented root to
leaf, instead of the other way round).

If anyone knows how to get ksba to parse the certs in the blob (I've attached
a sample PKCS7 blob), then that would be a much better solution.

Cheers,

Neil
Re: Patch for userSMIMECertificate [ In reply to ]
On Fri, 28 Jan 2005 12:48:54 +0000, Neil Dunbar said:

> attributes within entries while fetching from LDAP, so I've attached a diff
> against 0.9.0 which adds the capability [.Our directory stores
> userSMIMECertificates to distinguish from our web client certificates].

Thanks, I'll have a look at it.

> Also - I think that line 680 in ldap_wrapper (ldap.c) which reads

ctrl-> refcount++

> should read:

> if (ctrl) ctrl->refcount++

> since ctrl is not guaranteed to be non-NULL when entering the
> ldap_wrapper

CTRL should always be initialized; if not I have to check what's
wrong. I'll check it.

> Now the bad news: I can't get libksba (0.9.10) to parse the PKCS7 blob which
> makes up a userSMIMECertificate - I just get "unsupported encoding" after the
> first couple of calls to the PKCS7 parser. So, I had to use GnuTLS as the

This is likely. Please give me a few days to fix this; I have a
simliar bug outstanding anyway.


Shalom-Salam,

Werner
Re: Patch for userSMIMECertificate [ In reply to ]
On Friday 28 January 2005 15:35, Werner Koch wrote:
> On Fri, 28 Jan 2005 12:48:54 +0000, Neil Dunbar said:
> > Also - I think that line 680 in ldap_wrapper (ldap.c) which reads
>
> ctrl-> refcount++
>
> > should read:
> >
> > if (ctrl) ctrl->refcount++
> >
> > since ctrl is not guaranteed to be non-NULL when entering the
> > ldap_wrapper
>
> CTRL should always be initialized; if not I have to check what's
> wrong. I'll check it.

I only see it getting initialised in start_command_handler (server.c) for
daemon and server mode and set to the assuan pointer.

The chain seems to go

main -> crl_cache_load -> crl_cache_insert ->
crl_parse_insert -> get_issuer_cert -> get_cert_local

Which, yielding nothing, will attempt an LDAP lookup, which causes
ctrl->refcount to be incremented.

Cheers,

Neil
Re: Patch for userSMIMECertificate [ In reply to ]
On Fri, 28 Jan 2005 12:48:54 +0000, Neil Dunbar said:

> The dirmngr component doesn't attempt to fetch or parse userSMIMECertificate
> attributes within entries while fetching from LDAP, so I've attached a diff
> against 0.9.0 which adds the capability [.Our directory stores
> userSMIMECertificates to distinguish from our web client certificates].

I have started to work on it but didn't finished it due to other bugs
I needed to track down first. As of now Libksba from CVS is able to
parse your data. dirmngr/src/ldap.c has not yet enabled and finished
code to handle userSMIMECertificates. Will continue work next week.

Werner