Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cert: defer cert-find result post-processing #677

Closed
wants to merge 1 commit into from
Closed

cert: defer cert-find result post-processing #677

wants to merge 1 commit into from

Conversation

HonzaCholasta
Copy link
Contributor

@HonzaCholasta HonzaCholasta commented Mar 30, 2017

Rather than post-processing the results of each internal search,
post-process the combined result.

This avoids expensive per-certificate searches on certificates which won't
even be included in the combined result when cert-find is executed with the
--all option.

https://pagure.io/freeipa/issue/6808

@stlaz stlaz self-assigned this Mar 30, 2017
@@ -1469,18 +1451,17 @@ def _ldap_search(self, all, raw, pkey_only, no_members, **options):
try:
obj = result[key]
except KeyError:
obj = self._get_cert_obj(cert, all, raw, pkey_only)
obj = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this could be a bug right here. Previously, if raw was not specified, the obj variable would contain at least the parse of the certificate (even if pkey_only was specified). Now it's just empty if pkey_only=True.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, this is a bug. I added a user certificate. Now, when I do ipa cert-find --pkey-only, the result is:

-----------------------
11 certificates matched
-----------------------

...

-----------------------------
Number of entries returned 11
-----------------------------

but only 10 certificates are shown.

I would also expect that when I specify --pkey-only only primary keys are shown, which is not true but I suspect it's behaved like this for quite some time - only few certificates are displayed with limited information with the previous implementation. The --pkey-only option does not seem to have any effect with this patch, though, except that some certificates are not displayed at all.

Copy link
Contributor

@stlaz stlaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix display of LDAP-retrieved certificates.

@@ -1469,18 +1451,17 @@ def _ldap_search(self, all, raw, pkey_only, no_members, **options):
try:
obj = result[key]
except KeyError:
obj = self._get_cert_obj(cert, all, raw, pkey_only)
obj = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, this is a bug. I added a user certificate. Now, when I do ipa cert-find --pkey-only, the result is:

-----------------------
11 certificates matched
-----------------------

...

-----------------------------
Number of entries returned 11
-----------------------------

but only 10 certificates are shown.

I would also expect that when I specify --pkey-only only primary keys are shown, which is not true but I suspect it's behaved like this for quite some time - only few certificates are displayed with limited information with the previous implementation. The --pkey-only option does not seem to have any effect with this patch, though, except that some certificates are not displayed at all.

@stlaz
Copy link
Contributor

stlaz commented Apr 4, 2017

What worries me the most is that the tests are green even though this is potentially a serious problem.

@stlaz
Copy link
Contributor

stlaz commented Apr 6, 2017

The patched IPA works better than the current 4.4 and 4.5 branches in terms of options logic, that's good.
From the code I am not sure which searches we do miss, could you elaborate on that a bit, please?

Rather than post-processing the results of each internal search,
post-process the combined result.

This avoids expensive per-certificate searches when cert-find is executed
with the --all option on certificates which won't even be included in the
combined result.

https://pagure.io/freeipa/issue/6808
@stlaz stlaz added the ack Pull Request approved, can be merged label Apr 19, 2017
@stlaz
Copy link
Contributor

stlaz commented Apr 19, 2017

We may need these changes in 4.5 and 4.4, too since cert-find is rather broken there, too.

@HonzaCholasta
Copy link
Contributor Author

That might require backporting issue 6564 as well.

@HonzaCholasta
Copy link
Contributor Author

master:

  • eb6d4c3 cert: defer cert-find result post-processing

ipa-4-5:

  • 49f9d79 cert: defer cert-find result post-processing

@HonzaCholasta HonzaCholasta added the pushed Pull Request has already been pushed label Apr 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
2 participants