| Index: net/http/http_auth_sspi_win.cc
|
| diff --git a/net/http/http_auth_sspi_win.cc b/net/http/http_auth_sspi_win.cc
|
| index 8a0e49fff112888f136129109c76ba487e00637a..5d8c8d68bf20aabad4229839b304437e5424204d 100644
|
| --- a/net/http/http_auth_sspi_win.cc
|
| +++ b/net/http/http_auth_sspi_win.cc
|
| @@ -28,9 +28,8 @@ int MapAcquireCredentialsStatusToError(SECURITY_STATUS status,
|
| case SEC_E_INSUFFICIENT_MEMORY:
|
| return ERR_OUT_OF_MEMORY;
|
| case SEC_E_INTERNAL_ERROR:
|
| - LOG(WARNING)
|
| - << "AcquireCredentialsHandle returned unexpected status 0x"
|
| - << std::hex << status;
|
| + LOG(WARNING) << "AcquireCredentialsHandle returned unexpected status 0x"
|
| + << std::hex << status;
|
| return ERR_UNEXPECTED_SECURITY_LIBRARY_STATUS;
|
| case SEC_E_NO_CREDENTIALS:
|
| case SEC_E_NOT_OWNER:
|
| @@ -40,9 +39,8 @@ int MapAcquireCredentialsStatusToError(SECURITY_STATUS status,
|
| // This indicates that the SSPI configuration does not match expectations
|
| return ERR_UNSUPPORTED_AUTH_SCHEME;
|
| default:
|
| - LOG(WARNING)
|
| - << "AcquireCredentialsHandle returned undocumented status 0x"
|
| - << std::hex << status;
|
| + LOG(WARNING) << "AcquireCredentialsHandle returned undocumented status 0x"
|
| + << std::hex << status;
|
| return ERR_UNDOCUMENTED_SECURITY_LIBRARY_STATUS;
|
| }
|
| }
|
| @@ -69,20 +67,21 @@ int AcquireExplicitCredentials(SSPILibrary* library,
|
|
|
| // Pass the username/password to get the credentials handle.
|
| SECURITY_STATUS status = library->AcquireCredentialsHandle(
|
| - NULL, // pszPrincipal
|
| + NULL, // pszPrincipal
|
| const_cast<SEC_WCHAR*>(package), // pszPackage
|
| - SECPKG_CRED_OUTBOUND, // fCredentialUse
|
| - NULL, // pvLogonID
|
| - &identity, // pAuthData
|
| - NULL, // pGetKeyFn (not used)
|
| - NULL, // pvGetKeyArgument (not used)
|
| - cred, // phCredential
|
| - &expiry); // ptsExpiry
|
| + SECPKG_CRED_OUTBOUND, // fCredentialUse
|
| + NULL, // pvLogonID
|
| + &identity, // pAuthData
|
| + NULL, // pGetKeyFn (not used)
|
| + NULL, // pvGetKeyArgument (not used)
|
| + cred, // phCredential
|
| + &expiry); // ptsExpiry
|
|
|
| return MapAcquireCredentialsStatusToError(status, package);
|
| }
|
|
|
| -int AcquireDefaultCredentials(SSPILibrary* library, const SEC_WCHAR* package,
|
| +int AcquireDefaultCredentials(SSPILibrary* library,
|
| + const SEC_WCHAR* package,
|
| CredHandle* cred) {
|
| TimeStamp expiry;
|
|
|
| @@ -91,15 +90,15 @@ int AcquireDefaultCredentials(SSPILibrary* library, const SEC_WCHAR* package,
|
| // cached credentials for the logged in user, which can be used
|
| // for a single sign-on.
|
| SECURITY_STATUS status = library->AcquireCredentialsHandle(
|
| - NULL, // pszPrincipal
|
| + NULL, // pszPrincipal
|
| const_cast<SEC_WCHAR*>(package), // pszPackage
|
| - SECPKG_CRED_OUTBOUND, // fCredentialUse
|
| - NULL, // pvLogonID
|
| - NULL, // pAuthData
|
| - NULL, // pGetKeyFn (not used)
|
| - NULL, // pvGetKeyArgument (not used)
|
| - cred, // phCredential
|
| - &expiry); // ptsExpiry
|
| + SECPKG_CRED_OUTBOUND, // fCredentialUse
|
| + NULL, // pvLogonID
|
| + NULL, // pAuthData
|
| + NULL, // pGetKeyFn (not used)
|
| + NULL, // pvGetKeyArgument (not used)
|
| + cred, // phCredential
|
| + &expiry); // ptsExpiry
|
|
|
| return MapAcquireCredentialsStatusToError(status, package);
|
| }
|
| @@ -118,9 +117,8 @@ int MapInitializeSecurityContextStatusToError(SECURITY_STATUS status) {
|
| // These are return codes reported by InitializeSecurityContext
|
| // but not expected by Chrome (for example, INCOMPLETE_CREDENTIALS
|
| // and INCOMPLETE_MESSAGE are intended for schannel).
|
| - LOG(WARNING)
|
| - << "InitializeSecurityContext returned unexpected status 0x"
|
| - << std::hex << status;
|
| + LOG(WARNING) << "InitializeSecurityContext returned unexpected status 0x"
|
| + << std::hex << status;
|
| return ERR_UNEXPECTED_SECURITY_LIBRARY_STATUS;
|
| case SEC_E_INSUFFICIENT_MEMORY:
|
| return ERR_OUT_OF_MEMORY;
|
| @@ -158,9 +156,8 @@ int MapQuerySecurityPackageInfoStatusToError(SECURITY_STATUS status) {
|
| // during testing.
|
| return ERR_UNSUPPORTED_AUTH_SCHEME;
|
| default:
|
| - LOG(WARNING)
|
| - << "QuerySecurityPackageInfo returned undocumented status 0x"
|
| - << std::hex << status;
|
| + LOG(WARNING) << "QuerySecurityPackageInfo returned undocumented status 0x"
|
| + << std::hex << status;
|
| return ERR_UNDOCUMENTED_SECURITY_LIBRARY_STATUS;
|
| }
|
| }
|
| @@ -176,9 +173,8 @@ int MapFreeContextBufferStatusToError(SECURITY_STATUS status) {
|
| // only mentions that a non-zero (or non-SEC_E_OK) value is returned
|
| // if the function fails, and does not indicate what the failure
|
| // conditions are.
|
| - LOG(WARNING)
|
| - << "FreeContextBuffer returned undocumented status 0x"
|
| - << std::hex << status;
|
| + LOG(WARNING) << "FreeContextBuffer returned undocumented status 0x"
|
| + << std::hex << status;
|
| return ERR_UNDOCUMENTED_SECURITY_LIBRARY_STATUS;
|
| }
|
| }
|
| @@ -270,8 +266,7 @@ int HttpAuthSSPI::GenerateAuthToken(const AuthCredentials* credentials,
|
| int out_buf_len;
|
| int rv = GetNextSecurityToken(
|
| spn,
|
| - static_cast<void *>(const_cast<char *>(
|
| - decoded_server_auth_token_.c_str())),
|
| + static_cast<void*>(const_cast<char*>(decoded_server_auth_token_.c_str())),
|
| decoded_server_auth_token_.length(),
|
| &out_buf,
|
| &out_buf_len);
|
| @@ -295,8 +290,12 @@ int HttpAuthSSPI::OnFirstRound(const AuthCredentials* credentials) {
|
| base::string16 domain;
|
| base::string16 user;
|
| SplitDomainAndUser(credentials->username(), &domain, &user);
|
| - rv = AcquireExplicitCredentials(library_, security_package_, domain,
|
| - user, credentials->password(), &cred_);
|
| + rv = AcquireExplicitCredentials(library_,
|
| + security_package_,
|
| + domain,
|
| + user,
|
| + credentials->password(),
|
| + &cred_);
|
| if (rv != OK)
|
| return rv;
|
| } else {
|
| @@ -308,12 +307,11 @@ int HttpAuthSSPI::OnFirstRound(const AuthCredentials* credentials) {
|
| return rv;
|
| }
|
|
|
| -int HttpAuthSSPI::GetNextSecurityToken(
|
| - const std::string& spn,
|
| - const void* in_token,
|
| - int in_token_len,
|
| - void** out_token,
|
| - int* out_token_len) {
|
| +int HttpAuthSSPI::GetNextSecurityToken(const std::string& spn,
|
| + const void* in_token,
|
| + int in_token_len,
|
| + void** out_token,
|
| + int* out_token_len) {
|
| CtxtHandle* ctxt_ptr;
|
| SecBufferDesc in_buffer_desc, out_buffer_desc;
|
| SecBufferDesc* in_buffer_desc_ptr;
|
| @@ -361,18 +359,18 @@ int HttpAuthSSPI::GetNextSecurityToken(
|
| DWORD context_attribute;
|
| std::wstring spn_wide = base::ASCIIToWide(spn);
|
| SECURITY_STATUS status = library_->InitializeSecurityContext(
|
| - &cred_, // phCredential
|
| - ctxt_ptr, // phContext
|
| - const_cast<wchar_t *>(spn_wide.c_str()), // pszTargetName
|
| - context_flags, // fContextReq
|
| - 0, // Reserved1 (must be 0)
|
| - SECURITY_NATIVE_DREP, // TargetDataRep
|
| - in_buffer_desc_ptr, // pInput
|
| - 0, // Reserved2 (must be 0)
|
| - &ctxt_, // phNewContext
|
| - &out_buffer_desc, // pOutput
|
| - &context_attribute, // pfContextAttr
|
| - NULL); // ptsExpiry
|
| + &cred_, // phCredential
|
| + ctxt_ptr, // phContext
|
| + const_cast<wchar_t*>(spn_wide.c_str()), // pszTargetName
|
| + context_flags, // fContextReq
|
| + 0, // Reserved1 (must be 0)
|
| + SECURITY_NATIVE_DREP, // TargetDataRep
|
| + in_buffer_desc_ptr, // pInput
|
| + 0, // Reserved2 (must be 0)
|
| + &ctxt_, // phNewContext
|
| + &out_buffer_desc, // pOutput
|
| + &context_attribute, // pfContextAttr
|
| + NULL); // ptsExpiry
|
| int rv = MapInitializeSecurityContextStatusToError(status);
|
| if (rv != OK) {
|
| ResetSecurityContext();
|
| @@ -411,7 +409,7 @@ int DetermineMaxTokenLength(SSPILibrary* library,
|
| DCHECK(max_token_length);
|
| PSecPkgInfo pkg_info = NULL;
|
| SECURITY_STATUS status = library->QuerySecurityPackageInfo(
|
| - const_cast<wchar_t *>(package.c_str()), &pkg_info);
|
| + const_cast<wchar_t*>(package.c_str()), &pkg_info);
|
| int rv = MapQuerySecurityPackageInfoStatusToError(status);
|
| if (rv != OK)
|
| return rv;
|
|
|