Unreviewed, rolling out r135201.
authorrakuco@webkit.org <rakuco@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Nov 2012 23:38:58 +0000 (23:38 +0000)
committerrakuco@webkit.org <rakuco@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Nov 2012 23:38:58 +0000 (23:38 +0000)
http://trac.webkit.org/changeset/135201
https://bugs.webkit.org/show_bug.cgi?id=102725

Broke all non-Mac WK2 builds. (Requested by rakuco on
#webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-11-19

* Shared/mac/PlatformCertificateInfo.h:
* Shared/mac/PlatformCertificateInfo.mm:
(WebKit):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/Authentication/AuthenticationManager.cpp:
* WebProcess/Authentication/AuthenticationManager.h:
(AuthenticationManager):
* WebProcess/Authentication/mac/AuthenticationManager.mac.mm: Copied from Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm.
(WebKit):
(WebKit::AuthenticationManager::tryUsePlatformCertificateInfoForChallenge):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135204 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/mac/PlatformCertificateInfo.h
Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp
Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h
Source/WebKit2/WebProcess/Authentication/mac/AuthenticationManager.mac.mm [new file with mode: 0644]

index 5442bb8..46e58f2 100644 (file)
@@ -1,3 +1,23 @@
+2012-11-19  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r135201.
+        http://trac.webkit.org/changeset/135201
+        https://bugs.webkit.org/show_bug.cgi?id=102725
+
+        Broke all non-Mac WK2 builds. (Requested by rakuco on
+        #webkit).
+
+        * Shared/mac/PlatformCertificateInfo.h:
+        * Shared/mac/PlatformCertificateInfo.mm:
+        (WebKit):
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/Authentication/AuthenticationManager.cpp:
+        * WebProcess/Authentication/AuthenticationManager.h:
+        (AuthenticationManager):
+        * WebProcess/Authentication/mac/AuthenticationManager.mac.mm: Copied from Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm.
+        (WebKit):
+        (WebKit::AuthenticationManager::tryUsePlatformCertificateInfoForChallenge):
+
 2012-11-19  Brady Eidson  <beidson@apple.com>
 
         Move tryUsePlatformCertificateInfoForChallenge from AuthenticationManager to PlatformCertificateInfo.
index 844b093..93f09f3 100644 (file)
@@ -34,10 +34,6 @@ namespace CoreIPC {
     class ArgumentEncoder;
 }
 
-namespace WebCore {
-    class AuthenticationChallenge;
-}
-
 namespace WebKit {
 
 class PlatformCertificateInfo {
@@ -59,8 +55,6 @@ private:
     RetainPtr<CFArrayRef> m_certificateChain;
 };
 
-bool tryUsePlatformCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const PlatformCertificateInfo&);
-
 } // namespace WebKit
 
 #endif // PlatformCertificateInfo_h
index d59042c..ecffbe6 100644 (file)
@@ -29,7 +29,6 @@
 #import "ArgumentCodersCF.h"
 #import "ArgumentDecoder.h"
 #import "ArgumentEncoder.h"
-#import <WebCore/AuthenticationChallenge.h>
 #import <WebKitSystemInterface.h>
 
 using namespace WebCore;
@@ -90,32 +89,4 @@ void PlatformCertificateInfo::dump() const
 }
 #endif
 
-bool tryUsePlatformCertificateInfoForChallenge(const AuthenticationChallenge& challenge, const PlatformCertificateInfo& certificateInfo)
-{
-    CFArrayRef chain = certificateInfo.certificateChain();
-    if (!chain)
-        return false;
-        
-    ASSERT(CFArrayGetCount(chain));
-
-    // The passed-in certificate chain includes the identity certificate at index 0, and additional certificates starting at index 1.
-    SecIdentityRef identity;
-    OSStatus result = SecIdentityCreateWithCertificate(NULL, (SecCertificateRef)CFArrayGetValueAtIndex(chain, 0), &identity);
-    if (result != errSecSuccess) {
-        LOG_ERROR("Unable to create SecIdentityRef with certificate - %i", result);
-        [challenge.sender() cancelAuthenticationChallenge:challenge.nsURLAuthenticationChallenge()];
-        return true;
-    }
-
-    CFIndex chainCount = CFArrayGetCount(chain);
-    NSArray *nsChain = chainCount > 1 ? [(NSArray *)chain subarrayWithRange:NSMakeRange(1, chainCount - 1)] : nil;
-
-    NSURLCredential *credential = [NSURLCredential credentialWithIdentity:identity
-                                                             certificates:nsChain
-                                                              persistence:NSURLCredentialPersistenceNone];
-
-    [challenge.sender() useCredential:credential forAuthenticationChallenge:challenge.nsURLAuthenticationChallenge()];
-    return true;
-}
-
 } // namespace WebKit
index 3cbac0a..76e2d2a 100644 (file)
                51B15A8513843A3900321AD8 /* EnvironmentUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B15A8313843A3900321AD8 /* EnvironmentUtilities.h */; };
                51B3005012529D0E000B5CA0 /* WebBackForwardListCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */; };
                51B3005112529D0E000B5CA0 /* WebPageProxyCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */; };
+               51C4032C136749D800DC972D /* AuthenticationManager.mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51C4032B136749D800DC972D /* AuthenticationManager.mac.mm */; };
                51CBBA0F165219B6005BE8FD /* NetworkResourceLoadParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51CBBA0D165219B6005BE8FD /* NetworkResourceLoadParameters.cpp */; };
                51CBBA10165219B6005BE8FD /* NetworkResourceLoadParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 51CBBA0E165219B6005BE8FD /* NetworkResourceLoadParameters.h */; };
                51D02F64132EC5B900BEAA96 /* WebIconDatabaseMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51D02F63132EC5B900BEAA96 /* WebIconDatabaseMessageReceiver.cpp */; };
                51B15A8313843A3900321AD8 /* EnvironmentUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EnvironmentUtilities.h; path = unix/EnvironmentUtilities.h; sourceTree = "<group>"; };
                51B3004E12529D0E000B5CA0 /* WebBackForwardListCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebBackForwardListCF.cpp; path = cf/WebBackForwardListCF.cpp; sourceTree = "<group>"; };
                51B3004F12529D0E000B5CA0 /* WebPageProxyCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPageProxyCF.cpp; path = cf/WebPageProxyCF.cpp; sourceTree = "<group>"; };
+               51C4032B136749D800DC972D /* AuthenticationManager.mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AuthenticationManager.mac.mm; path = mac/AuthenticationManager.mac.mm; sourceTree = "<group>"; };
                51CBBA0D165219B6005BE8FD /* NetworkResourceLoadParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkResourceLoadParameters.cpp; path = Network/NetworkResourceLoadParameters.cpp; sourceTree = "<group>"; };
                51CBBA0E165219B6005BE8FD /* NetworkResourceLoadParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkResourceLoadParameters.h; path = Network/NetworkResourceLoadParameters.h; sourceTree = "<group>"; };
                51D02F63132EC5B900BEAA96 /* WebIconDatabaseMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebIconDatabaseMessageReceiver.cpp; sourceTree = "<group>"; };
                512F588612A8834700629530 /* Authentication */ = {
                        isa = PBXGroup;
                        children = (
+                               51C4032A136749C400DC972D /* mac */,
                                512F588712A8836600629530 /* AuthenticationManager.cpp */,
                                512F588812A8836600629530 /* AuthenticationManager.h */,
                                512F588912A8836600629530 /* AuthenticationManager.messages.in */,
                        name = cf;
                        sourceTree = "<group>";
                };
+               51C4032A136749C400DC972D /* mac */ = {
+                       isa = PBXGroup;
+                       children = (
+                               51C4032B136749D800DC972D /* AuthenticationManager.mac.mm */,
+                       );
+                       name = mac;
+                       sourceTree = "<group>";
+               };
                51FBB9C1132E079200F327B4 /* IconDatabase */ = {
                        isa = PBXGroup;
                        children = (
                                512F589612A8838800629530 /* AuthenticationChallengeProxy.cpp in Sources */,
                                512F589812A8838800629530 /* AuthenticationDecisionListener.cpp in Sources */,
                                512F588A12A8836600629530 /* AuthenticationManager.cpp in Sources */,
+                               51C4032C136749D800DC972D /* AuthenticationManager.mac.mm in Sources */,
                                512F58A212A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp in Sources */,
                                1A64256912DE42EC00CAAE2C /* BackingStore.cpp in Sources */,
                                1A64292D12DE5F9800CAAE2C /* BackingStoreMac.mm in Sources */,
index dc11580..3850e64 100644 (file)
@@ -30,7 +30,6 @@
 #include "Download.h"
 #include "DownloadProxyMessages.h"
 #include "MessageID.h"
-#include "PlatformCertificateInfo.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebFrame.h"
 #include "WebPage.h"
index b97cf63..16708ce 100644 (file)
@@ -65,6 +65,8 @@ private:
     // CoreIPC::MessageReceiver
     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
     void didReceiveAuthenticationManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
+
+    bool tryUsePlatformCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const PlatformCertificateInfo&);
     
     typedef HashMap<uint64_t, WebCore::AuthenticationChallenge> AuthenticationChallengeMap;
     AuthenticationChallengeMap m_challenges;
diff --git a/Source/WebKit2/WebProcess/Authentication/mac/AuthenticationManager.mac.mm b/Source/WebKit2/WebProcess/Authentication/mac/AuthenticationManager.mac.mm
new file mode 100644 (file)
index 0000000..1a772c3
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AuthenticationManager.h"
+
+#if USE(SECURITY_FRAMEWORK)
+
+#include "PlatformCertificateInfo.h"
+#include <Security/SecIdentity.h>
+#include <WebCore/AuthenticationChallenge.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+bool AuthenticationManager::tryUsePlatformCertificateInfoForChallenge(const AuthenticationChallenge& challenge, const PlatformCertificateInfo& certificateInfo)
+{
+    // FIXME (NetworkProcess): This occurs in the WebProcess and therefore won't work.
+    // We need this to happen in the NetworkProcess.
+
+    CFArrayRef chain = certificateInfo.certificateChain();
+    if (!chain)
+        return false;
+        
+    ASSERT(CFArrayGetCount(chain));
+
+    // The passed-in certificate chain includes the identity certificate at index 0, and additional certificates starting at index 1.
+    SecIdentityRef identity;
+    OSStatus result = SecIdentityCreateWithCertificate(NULL, (SecCertificateRef)CFArrayGetValueAtIndex(chain, 0), &identity);
+    if (result != errSecSuccess) {
+        LOG_ERROR("Unable to create SecIdentityRef with certificate - %i", result);
+        [challenge.sender() cancelAuthenticationChallenge:challenge.nsURLAuthenticationChallenge()];
+        return true;
+    }
+
+    CFIndex chainCount = CFArrayGetCount(chain);
+    NSArray *nsChain = chainCount > 1 ? [(NSArray *)chain subarrayWithRange:NSMakeRange(1, chainCount - 1)] : nil;
+
+    NSURLCredential *credential = [NSURLCredential credentialWithIdentity:identity
+                                                             certificates:nsChain
+                                                              persistence:NSURLCredentialPersistenceNone];
+
+    [challenge.sender() useCredential:credential forAuthenticationChallenge:challenge.nsURLAuthenticationChallenge()];
+    return true;
+}
+
+} // namespace WebKit
+
+#endif // USE(SECURITY_FRAMEWORK)