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

ctypes.util.find_library() replacement #1773

Closed
wants to merge 3 commits into from

Conversation

m3gat0nn4ge
Copy link
Contributor

component: ipaclient/csrgen_ffi.py, ipaserver/p11helper.py, ipaplatform/redhat/tasks.py

Create a dumbed down replacement for ctypes.util.find_library().. parses ldconfig output

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

Copy link
Member

@tiran tiran left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, but it's the wrong approach.

logger.debug("Checking ldconfig output for: %s", name)
process = subprocess.Popen(
"ldconfig -N -p | awk '{print $1, $NF}' | grep '^lib%s\.so.*'"
% name, shell=True, stdout=subprocess.PIPE,
Copy link
Member

Choose a reason for hiding this comment

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

This code is slower and less secure than find_library from ctypes. You are executing at least four programs. find_library starts only one binary. shell=True is also a security issue and makes the code vulnerable to shell injection attacks.

@felipevolpone felipevolpone added the re-run Trigger a new run of PR-CI label Apr 4, 2018
@freeipa-pr-ci2 freeipa-pr-ci2 removed the re-run Trigger a new run of PR-CI label Apr 4, 2018
@m3gat0nn4ge m3gat0nn4ge closed this Apr 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants