diff options
author | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-02 14:37:14 +0000 |
---|---|---|
committer | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-02 14:37:14 +0000 |
commit | e5925962c61dbb9c8f5a5425ca2dc2953fb6a3e1 (patch) | |
tree | 4101ee59b290871dd2d0984a7669070a2eff89f7 | |
parent | 43ff60d3580e5dc6c81497e62746b8c4a5d8ab94 (diff) | |
download | chromium_src-e5925962c61dbb9c8f5a5425ca2dc2953fb6a3e1.zip chromium_src-e5925962c61dbb9c8f5a5425ca2dc2953fb6a3e1.tar.gz chromium_src-e5925962c61dbb9c8f5a5425ca2dc2953fb6a3e1.tar.bz2 |
Adds a new error (ERR_NETWORK_ACCESS_DENIED) for when network
operations return an access is denied error.
This is in preparation for adding new error text suggesting
a firewall may be causing the problem, which would be a little
embarrassing to do when an SSPI logon fails, or when trying to
open a local file one doesn't have permissions to.
BUG=57108
TEST=Install firewall, block Chrome, verify that you get
ERR_NETWORK_ACCESS_DENIED. Unblock it, fail an SSPI logon
(Or any other event that should generate an ERR_ACCESS_DENIED)
and verify that you still get an ERR_ACCESS_DENIED.
Review URL: http://codereview.chromium.org/3976004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64744 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/base/net_error_list.h | 9 | ||||
-rw-r--r-- | net/ftp/ftp_network_transaction.cc | 1 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_nss.cc | 1 | ||||
-rw-r--r-- | net/socket/tcp_client_socket_libevent.cc | 2 | ||||
-rw-r--r-- | net/socket/tcp_client_socket_win.cc | 6 |
5 files changed, 15 insertions, 4 deletions
diff --git a/net/base/net_error_list.h b/net/base/net_error_list.h index d7ae9d1..500228b 100644 --- a/net/base/net_error_list.h +++ b/net/base/net_error_list.h @@ -50,7 +50,7 @@ NET_ERROR(FILE_TOO_BIG, -8) // invalid assumption. NET_ERROR(UNEXPECTED, -9) -// Permission to access a resource was denied. +// Permission to access a resource, other than the network, was denied. NET_ERROR(ACCESS_DENIED, -10) // The operation failed because of unimplemented functionality. @@ -66,7 +66,7 @@ NET_ERROR(OUT_OF_MEMORY, -13) // from the expectation. NET_ERROR(UPLOAD_FILE_CHANGED, -14) -// The socket is not connected +// The socket is not connected. NET_ERROR(SOCKET_NOT_CONNECTED, -15) // A connection was closed (corresponding to a TCP FIN). @@ -208,6 +208,11 @@ NET_ERROR(PROXY_CERTIFICATE_INVALID, -136) // An error occurred when trying to do a name resolution (DNS). NET_ERROR(NAME_RESOLUTION_FAILED, -137) +// Permission to access the network was denied. This is used to distinguish +// errors that were most likely caused by a firewall from other access denied +// errors. See also ERR_ACCESS_DENIED. +NET_ERROR(NETWORK_ACCESS_DENIED, -138) + // Certificate error codes // // The values of certificate error codes must be consecutive. diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc index 295754d..bc1c2a9 100644 --- a/net/ftp/ftp_network_transaction.cc +++ b/net/ftp/ftp_network_transaction.cc @@ -1304,6 +1304,7 @@ void FtpNetworkTransaction::RecordDataConnectionError(int result) { type = NET_ERROR_OK; break; case ERR_ACCESS_DENIED: + case ERR_NETWORK_ACCESS_DENIED: type = NET_ERROR_ACCESS_DENIED; break; case ERR_TIMED_OUT: diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc index 37d2642..5e60778 100644 --- a/net/socket/ssl_client_socket_nss.cc +++ b/net/socket/ssl_client_socket_nss.cc @@ -1352,6 +1352,7 @@ static PRErrorCode MapErrorToNSS(int result) { case ERR_IO_PENDING: return PR_WOULD_BLOCK_ERROR; case ERR_ACCESS_DENIED: + case ERR_NETWORK_ACCESS_DENIED: // For connect, this could be mapped to PR_ADDRESS_NOT_SUPPORTED_ERROR. return PR_NO_ACCESS_RIGHTS_ERROR; case ERR_INTERNET_DISCONNECTED: // Equivalent to ENETDOWN. diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc index 30f7bc2..1367433 100644 --- a/net/socket/tcp_client_socket_libevent.cc +++ b/net/socket/tcp_client_socket_libevent.cc @@ -86,6 +86,8 @@ int MapPosixError(int os_error) { int MapConnectError(int os_error) { switch (os_error) { + case EACCES: + return ERR_NETWORK_ACCESS_DENIED; case ETIMEDOUT: return ERR_CONNECTION_TIMED_OUT; default: { diff --git a/net/socket/tcp_client_socket_win.cc b/net/socket/tcp_client_socket_win.cc index 740b249..b3b79a0 100644 --- a/net/socket/tcp_client_socket_win.cc +++ b/net/socket/tcp_client_socket_win.cc @@ -64,8 +64,6 @@ int MapWinsockError(int os_error) { // There are numerous Winsock error codes, but these are the ones we thus far // find interesting. switch (os_error) { - // connect fails with WSAEACCES when Windows Firewall blocks the - // connection. case WSAEACCES: return ERR_ACCESS_DENIED; case WSAENETDOWN: @@ -104,6 +102,10 @@ int MapWinsockError(int os_error) { int MapConnectError(int os_error) { switch (os_error) { + // connect fails with WSAEACCES when Windows Firewall blocks the + // connection. + case WSAEACCES: + return ERR_NETWORK_ACCESS_DENIED; case WSAETIMEDOUT: return ERR_CONNECTION_TIMED_OUT; default: { |