Changeset 140164 in webkit


Ignore:
Timestamp:
Jan 18, 2013 9:37:59 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[BlackBerry] Only clear credentials when purgeCredentials is called
https://bugs.webkit.org/show_bug.cgi?id=107124

Patch by Joe Mason <jmason@rim.com> on 2013-01-18
Reviewed by Yong Li.

Stop clearing credentials when sending out a request just in case they're wrong. That's stupid and
has race conditions. Only clear them when we know they're wrong.

Internal PR: 231158
Internal Reviewer: George Staikos

  • platform/network/blackberry/NetworkJob.cpp:

(WebCore::NetworkJob::sendRequestWithCredentials):
(WebCore::NetworkJob::purgeCredentials):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r140160 r140164  
     12013-01-18  Joe Mason  <jmason@rim.com>
     2
     3        [BlackBerry] Only clear credentials when purgeCredentials is called
     4        https://bugs.webkit.org/show_bug.cgi?id=107124
     5
     6        Reviewed by Yong Li.
     7
     8        Stop clearing credentials when sending out a request just in case they're wrong. That's stupid and
     9        has race conditions. Only clear them when we know they're wrong.
     10
     11        Internal PR: 231158
     12        Internal Reviewer: George Staikos
     13
     14        * platform/network/blackberry/NetworkJob.cpp:
     15        (WebCore::NetworkJob::sendRequestWithCredentials):
     16        (WebCore::NetworkJob::purgeCredentials):
     17
    1182013-01-18  Andrey Adaikin  <aandrey@chromium.org>
    219
  • trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp

    r140022 r140164  
    777777        return false;
    778778
     779    // IMPORTANT: if a new source of credentials is added to this method, be sure to handle it in
     780    // purgeCredentials as well!
     781
    779782    String host;
    780783    int port;
     
    847850
    848851        // Before asking the user for credentials, we check if the URL contains that.
    849         if (!username.isEmpty() || !password.isEmpty()) {
    850             // Prevent them from been used again if they are wrong.
    851             // If they are correct, they will be put into CredentialStorage.
    852             if (!proxyInfo.address.empty()) {
    853                 proxyInfo.username.clear();
    854                 proxyInfo.password.clear();
    855                 BlackBerry::Platform::Settings::instance()->storeProxyCredentials(proxyInfo);
    856             } else {
    857                 m_handle->getInternal()->m_user = "";
    858                 m_handle->getInternal()->m_pass = "";
    859             }
    860         } else {
     852        if (username.isEmpty() && password.isEmpty()) {
    861853            if (m_handle->firstRequest().targetType() != ResourceRequest::TargetIsMainFrame && BlackBerry::Platform::Settings::instance()->isChromeProcess())
    862854                return false;
     
    925917        return;
    926918
     919    const String& purgeUsername = challenge.proposedCredential().user();
     920    const String& purgePassword = challenge.proposedCredential().password();
     921
     922    // Since this credential didn't work, remove it from all sources which would return it
     923    // IMPORTANT: every source that is checked for a password in sendRequestWithCredentials should
     924    // be handled here!
     925
     926    if (challenge.protectionSpace().serverType() == ProtectionSpaceProxyHTTP || challenge.protectionSpace().serverType() == ProtectionSpaceProxyHTTPS) {
     927        BlackBerry::Platform::ProxyInfo proxyInfo = BlackBerry::Platform::Settings::instance()->proxyInfo(m_handle->firstRequest().url().string());
     928        if (!proxyInfo.address.empty() && purgeUsername == proxyInfo.username.c_str() && purgePassword == proxyInfo.password.c_str()) {
     929            proxyInfo.username.clear();
     930            proxyInfo.password.clear();
     931            BlackBerry::Platform::Settings::instance()->storeProxyCredentials(proxyInfo);
     932        }
     933    } else if (m_handle->getInternal()->m_user == purgeUsername && m_handle->getInternal()->m_pass == purgePassword) {
     934        m_handle->getInternal()->m_user = "";
     935        m_handle->getInternal()->m_pass = "";
     936    }
     937
    927938    CredentialStorage::remove(challenge.protectionSpace());
    928939    challenge.setStored(false);
Note: See TracChangeset for help on using the changeset viewer.