#173 Use PK11_FindCertFromNickname to find certificates instead of looping over the list of slots
Merged by rcritten. Opened by rcritten.
rcritten/certmonger issue_8533  into  master

IPA encountered a DBus timeout when starting tracking of the CA subsystem certificates. It turned out that PK11_ListCertsInSlot() was sometimes taking 13-14 seconds to return. The hardcoded DBus timeout is just 25 seconds so generally things would fail if this occurred.

There is no reason to loop over all the certificates manually since PK11_FindCertFromNickname() will do that for us, including caching values. Some care is required to structure the nickname to distinguish between internal certificates and those on a different token but its straightforward.

This also fixes an NSS shutdown error discovered when reading keys due to not freeing an object.

Tested in PR https://github.com/freeipa/freeipa/pull/5180

logs http://freeipa-org-pr-ci.s3-website.eu-central-1.amazonaws.com/jobs/3c4b24d4-12fd-11eb-842a-fa163ec3b944/

Pull-Request has been merged by rcritten

Metadata