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

WIP: Fix for MacOS 10.13 and older to use SecTrustEvaluate #156

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

illume
Copy link

@illume illume commented Sep 15, 2024

Since SecTrustEvaluateWithError is 10.14+

Fixes #119

@illume illume marked this pull request as draft September 15, 2024 16:24
@illume illume changed the title Fix for MacOS 10.13 and older to use SecTrustEvaluate WIP: Fix for MacOS 10.13 and older to use SecTrustEvaluate Sep 15, 2024
@illume illume force-pushed the SecTrustEvaluate branch 2 times, most recently from 61439eb to e0a218c Compare September 15, 2024 16:33
Since SecTrustEvaluateWithError is 10.14+
@illume
Copy link
Author

illume commented Sep 15, 2024

It looks like the test failures in CI are pre-existing.

Toggling this line lets you run the code on a more modern mac.

        # if _mac_version_info <= (10, 13):
        if 1 or _mac_version_info <= (10, 13):

Comment on lines +439 to +442
try:
sec_trust_result = int(sec_trust_result)
except (TypeError, ValueError):
sec_trust_result = -1
Copy link

@ThomasWaldmann ThomasWaldmann Sep 30, 2024

Choose a reason for hiding this comment

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

I tried the code on macOS 10.12 where I was encountering the pip issues and it almost worked. Thanks for working on this!

440 needs to get changed to use sec_trust_result.value, otherwise it will be -1 (due to except block).

For c_uint types, .value is documented to be int, so maybe that int() is not even needed if the result type is always c_uint. Please check, I am not familiar with that stuff.

Choose a reason for hiding this comment

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

After that change, pip install ... worked!

Choose a reason for hiding this comment

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

It looks like that might be the reason for the github CI failing.

Choose a reason for hiding this comment

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

Ping @illume - can you try the fix I suggested?

Choose a reason for hiding this comment

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

Suggested change
try:
sec_trust_result = int(sec_trust_result)
except (TypeError, ValueError):
sec_trust_result = -1
try:
sec_trust_result = int(sec_trust_result.value)
except (TypeError, ValueError):
sec_trust_result = -1

@ThomasWaldmann
Copy link

Looks like this will get superseded by #157 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fallback on deprecated SecTrustEvaluate function on macOS 10.13 and earlier
2 participants