Changeset 160122 in webkit


Ignore:
Timestamp:
Dec 4, 2013 2:00:35 PM (10 years ago)
Author:
mitz@apple.com
Message:

[Mac] When NSError user info is missing NSErrorPeerCertificateChainKey, ArgumentCoder should extract it from NSURLErrorFailingURLPeerTrustErrorKey
https://bugs.webkit.org/show_bug.cgi?id=125251

Reviewed by Anders Carlsson.

  • Shared/mac/WebCoreArgumentCodersMac.mm:

(CoreIPC::::encodePlatformData): If the user info doesn’t include
NSURLErrorFailingURLPeerTrustErrorKey, copy the peer certificate chain from the peer trust
under NSURLErrorFailingURLPeerTrustErrorKey. On the decoding side, it will appear under the
NSURLErrorFailingURLPeerTrustErrorKey, because a trust object can’t be fully serialized.

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r160117 r160122  
     12013-12-04  Dan Bernstein  <mitz@apple.com>
     2
     3        [Mac] When NSError user info is missing NSErrorPeerCertificateChainKey, ArgumentCoder should extract it from NSURLErrorFailingURLPeerTrustErrorKey
     4        https://bugs.webkit.org/show_bug.cgi?id=125251
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * Shared/mac/WebCoreArgumentCodersMac.mm:
     9        (CoreIPC::::encodePlatformData): If the user info doesn’t include
     10        NSURLErrorFailingURLPeerTrustErrorKey, copy the peer certificate chain from the peer trust
     11        under NSURLErrorFailingURLPeerTrustErrorKey. On the decoding side, it will appear under the
     12        NSURLErrorFailingURLPeerTrustErrorKey, because a trust object can’t be fully serialized.
     13
    1142013-12-04  Dan Bernstein  <mitz@apple.com>
    215
  • trunk/Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm

    r159887 r160122  
    168168
    169169    id peerCertificateChain = [userInfo objectForKey:@"NSErrorPeerCertificateChainKey"];
     170    if (!peerCertificateChain) {
     171        if (SecTrustRef peerTrust = (SecTrustRef)userInfo[NSURLErrorFailingURLPeerTrustErrorKey]) {
     172            CFIndex count = SecTrustGetCertificateCount(peerTrust);
     173            peerCertificateChain = [NSMutableArray arrayWithCapacity:count];
     174            for (CFIndex i = 0; i < count; ++i)
     175                [peerCertificateChain addObject:(id)SecTrustGetCertificateAtIndex(peerTrust, i)];
     176        }
     177    }
    170178    ASSERT(!peerCertificateChain || [peerCertificateChain isKindOfClass:[NSArray class]]);
    171179    encoder << CertificateInfo((CFArrayRef)peerCertificateChain);
Note: See TracChangeset for help on using the changeset viewer.