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

darwinssl: fix iOS build and CFArrayRef leak #1173

Closed
wants to merge 3 commits into from
Closed

darwinssl: fix iOS build and CFArrayRef leak #1173

wants to merge 3 commits into from

Conversation

chris-araman
Copy link
Contributor

@chris-araman chris-araman commented Dec 23, 2016

#1172

  • use SecCertificateCopySubjectSummary on iOS as we do in CopyCertSubject
  • retain the matching SecIdentityRef and release the others with CFRelease(keys_list)
  • move locals into #if CURL_BUILD_MAC_10_7 || CURL_BUILD_IOS block to avoid unused locals warnings on other targets
  • set status = 1 in case SecItemCopyMatching yields an empty set

I haven't been able to independently verify whether client certificate matching works on any version of iOS or macOS, before or after this change. @schweikert, @nickzman, would you be able to help with that? Presumably, this change is no worse for iOS than what we had before #1105.

@mention-bot
Copy link

@chris-araman, thanks for your PR! By analyzing the history of the files in this pull request, we identified @schweikert, @nickzman and @bagder to be potential reviewers.

@schweikert
Copy link
Contributor

schweikert commented Dec 23, 2016

Unfortunately I can't test this, because I don't have access to a web server requesting a client-certificate anymore. The patch looks good to me though.

Thanks for this, and sorry for breaking the build on iOS.

@chris-araman
Copy link
Contributor Author

No worries, @schweikert. Thanks for contributing!

@chris-araman chris-araman changed the title fix iOS build and CFArrayRef leak darwinssl: fix iOS build and CFArrayRef leak Dec 23, 2016
if(err == noErr) {
#if CURL_BUILD_IOS
common_name = SecCertificateCopySubjectSummary(cert);
#elif CURL_BUILD_MAC_10_7
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this just be #else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered that, but thought this would be clearer, especially if the outer #if ever changes. Feel free to change it, or require that I do.

Copy link
Member

@nickzman nickzman left a comment

Choose a reason for hiding this comment

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

Sorry for the late approval. The change looks okay to me, and doesn't break the build. I didn't have time to test this under iOS with a client certificate in the keychain, but in theory, this ought to work.

@chris-araman
Copy link
Contributor Author

No problem. Holiday and such. Thanks!

@bagder bagder closed this in e53f073 Dec 27, 2016
@bagder
Copy link
Member

bagder commented Dec 27, 2016

Thanks, both of you!

@chris-araman chris-araman deleted the issue-1172 branch December 27, 2016 21:36
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

None yet

5 participants