Skip to content

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

Closed
illume wants to merge 1 commit intosethmlarson:mainfrom
illume:SecTrustEvaluate
Closed

WIP: Fix for MacOS 10.13 and older to use SecTrustEvaluate#156
illume wants to merge 1 commit intosethmlarson:mainfrom
illume:SecTrustEvaluate

Conversation

@illume
Copy link
Copy Markdown
Contributor

@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
Copy Markdown
Contributor 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
Copy Markdown

@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.

Copy link
Copy Markdown

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!

Copy link
Copy Markdown

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.

Copy link
Copy Markdown

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?

Copy link
Copy Markdown

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
Copy Markdown

Looks like this will get superseded by #157 .

@sethmlarson
Copy link
Copy Markdown
Owner

Closed in favor of #157, thanks again!

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

3 participants