| Index: net/http/http_auth_gssapi_posix_unittest.cc
|
| diff --git a/net/http/http_auth_gssapi_posix_unittest.cc b/net/http/http_auth_gssapi_posix_unittest.cc
|
| index 6f933349d7e5b4f6d48a70c04ccd656bf4571e6f..f8d4ed26ed647e09a421b89fb75efc55a7df64dc 100644
|
| --- a/net/http/http_auth_gssapi_posix_unittest.cc
|
| +++ b/net/http/http_auth_gssapi_posix_unittest.cc
|
| @@ -22,7 +22,7 @@ void ClearBuffer(gss_buffer_t dest) {
|
| if (!dest)
|
| return;
|
| dest->length = 0;
|
| - delete [] reinterpret_cast<char*>(dest->value);
|
| + delete[] reinterpret_cast<char*>(dest->value);
|
| dest->value = NULL;
|
| }
|
|
|
| @@ -52,23 +52,22 @@ const char kInitialAuthResponse[] = "Mary had a little lamb";
|
|
|
| void EstablishInitialContext(test::MockGSSAPILibrary* library) {
|
| test::GssContextMockImpl context_info(
|
| - "localhost", // Source name
|
| - "example.com", // Target name
|
| - 23, // Lifetime
|
| - *CHROME_GSS_SPNEGO_MECH_OID_DESC, // Mechanism
|
| - 0, // Context flags
|
| - 1, // Locally initiated
|
| - 0); // Open
|
| + "localhost", // Source name
|
| + "example.com", // Target name
|
| + 23, // Lifetime
|
| + *CHROME_GSS_SPNEGO_MECH_OID_DESC, // Mechanism
|
| + 0, // Context flags
|
| + 1, // Locally initiated
|
| + 0); // Open
|
| gss_buffer_desc in_buffer = {0, NULL};
|
| gss_buffer_desc out_buffer = {arraysize(kInitialAuthResponse),
|
| const_cast<char*>(kInitialAuthResponse)};
|
| - library->ExpectSecurityContext(
|
| - "Negotiate",
|
| - GSS_S_CONTINUE_NEEDED,
|
| - 0,
|
| - context_info,
|
| - in_buffer,
|
| - out_buffer);
|
| + library->ExpectSecurityContext("Negotiate",
|
| + GSS_S_CONTINUE_NEEDED,
|
| + 0,
|
| + context_info,
|
| + in_buffer,
|
| + out_buffer);
|
| }
|
|
|
| } // namespace
|
| @@ -96,36 +95,36 @@ TEST(HttpAuthGSSAPIPOSIXTest, GSSAPICycle) {
|
| mock_library->Init();
|
| const char kAuthResponse[] = "Mary had a little lamb";
|
| test::GssContextMockImpl context1(
|
| - "localhost", // Source name
|
| - "example.com", // Target name
|
| - 23, // Lifetime
|
| - *CHROME_GSS_SPNEGO_MECH_OID_DESC, // Mechanism
|
| - 0, // Context flags
|
| - 1, // Locally initiated
|
| - 0); // Open
|
| + "localhost", // Source name
|
| + "example.com", // Target name
|
| + 23, // Lifetime
|
| + *CHROME_GSS_SPNEGO_MECH_OID_DESC, // Mechanism
|
| + 0, // Context flags
|
| + 1, // Locally initiated
|
| + 0); // Open
|
| test::GssContextMockImpl context2(
|
| - "localhost", // Source name
|
| - "example.com", // Target name
|
| - 23, // Lifetime
|
| - *CHROME_GSS_SPNEGO_MECH_OID_DESC, // Mechanism
|
| - 0, // Context flags
|
| - 1, // Locally initiated
|
| - 1); // Open
|
| + "localhost", // Source name
|
| + "example.com", // Target name
|
| + 23, // Lifetime
|
| + *CHROME_GSS_SPNEGO_MECH_OID_DESC, // Mechanism
|
| + 0, // Context flags
|
| + 1, // Locally initiated
|
| + 1); // Open
|
| test::MockGSSAPILibrary::SecurityContextQuery queries[] = {
|
| - test::MockGSSAPILibrary::SecurityContextQuery(
|
| - "Negotiate", // Package name
|
| - GSS_S_CONTINUE_NEEDED, // Major response code
|
| - 0, // Minor response code
|
| - context1, // Context
|
| - NULL, // Expected input token
|
| - kAuthResponse), // Output token
|
| - test::MockGSSAPILibrary::SecurityContextQuery(
|
| - "Negotiate", // Package name
|
| - GSS_S_COMPLETE, // Major response code
|
| - 0, // Minor response code
|
| - context2, // Context
|
| - kAuthResponse, // Expected input token
|
| - kAuthResponse) // Output token
|
| + test::MockGSSAPILibrary::SecurityContextQuery(
|
| + "Negotiate", // Package name
|
| + GSS_S_CONTINUE_NEEDED, // Major response code
|
| + 0, // Minor response code
|
| + context1, // Context
|
| + NULL, // Expected input token
|
| + kAuthResponse), // Output token
|
| + test::MockGSSAPILibrary::SecurityContextQuery(
|
| + "Negotiate", // Package name
|
| + GSS_S_COMPLETE, // Major response code
|
| + 0, // Minor response code
|
| + context2, // Context
|
| + kAuthResponse, // Expected input token
|
| + kAuthResponse) // Output token
|
| };
|
|
|
| for (size_t i = 0; i < arraysize(queries); ++i) {
|
| @@ -146,9 +145,9 @@ TEST(HttpAuthGSSAPIPOSIXTest, GSSAPICycle) {
|
| OM_uint32 req_flags = 0;
|
| OM_uint32 time_req = 25;
|
| gss_channel_bindings_t input_chan_bindings = NULL;
|
| - gss_buffer_desc input_token = { 0, NULL };
|
| - gss_OID actual_mech_type= NULL;
|
| - gss_buffer_desc output_token = { 0, NULL };
|
| + gss_buffer_desc input_token = {0, NULL};
|
| + gss_OID actual_mech_type = NULL;
|
| + gss_buffer_desc output_token = {0, NULL};
|
| OM_uint32 ret_flags = 0;
|
| OM_uint32 time_rec = 0;
|
| for (size_t i = 0; i < arraysize(queries); ++i) {
|
| @@ -170,17 +169,16 @@ TEST(HttpAuthGSSAPIPOSIXTest, GSSAPICycle) {
|
| ClearBuffer(&output_token);
|
| }
|
| ClearBuffer(&input_token);
|
| - major_status = mock_library->delete_sec_context(&minor_status,
|
| - &context_handle,
|
| - GSS_C_NO_BUFFER);
|
| + major_status = mock_library->delete_sec_context(
|
| + &minor_status, &context_handle, GSS_C_NO_BUFFER);
|
| EXPECT_EQ(static_cast<OM_uint32>(GSS_S_COMPLETE), major_status);
|
| }
|
|
|
| TEST(HttpAuthGSSAPITest, ParseChallenge_FirstRound) {
|
| // The first round should just consist of an unadorned "Negotiate" header.
|
| test::MockGSSAPILibrary mock_library;
|
| - HttpAuthGSSAPI auth_gssapi(&mock_library, "Negotiate",
|
| - CHROME_GSS_SPNEGO_MECH_OID_DESC);
|
| + HttpAuthGSSAPI auth_gssapi(
|
| + &mock_library, "Negotiate", CHROME_GSS_SPNEGO_MECH_OID_DESC);
|
| std::string challenge_text = "Negotiate";
|
| HttpAuthChallengeTokenizer challenge(challenge_text.begin(),
|
| challenge_text.end());
|
| @@ -192,8 +190,8 @@ TEST(HttpAuthGSSAPITest, ParseChallenge_TwoRounds) {
|
| // The first round should just have "Negotiate", and the second round should
|
| // have a valid base64 token associated with it.
|
| test::MockGSSAPILibrary mock_library;
|
| - HttpAuthGSSAPI auth_gssapi(&mock_library, "Negotiate",
|
| - CHROME_GSS_SPNEGO_MECH_OID_DESC);
|
| + HttpAuthGSSAPI auth_gssapi(
|
| + &mock_library, "Negotiate", CHROME_GSS_SPNEGO_MECH_OID_DESC);
|
| std::string first_challenge_text = "Negotiate";
|
| HttpAuthChallengeTokenizer first_challenge(first_challenge_text.begin(),
|
| first_challenge_text.end());
|
| @@ -203,8 +201,9 @@ TEST(HttpAuthGSSAPITest, ParseChallenge_TwoRounds) {
|
| // Generate an auth token and create another thing.
|
| EstablishInitialContext(&mock_library);
|
| std::string auth_token;
|
| - EXPECT_EQ(OK, auth_gssapi.GenerateAuthToken(NULL, "HTTP/intranet.google.com",
|
| - &auth_token));
|
| + EXPECT_EQ(OK,
|
| + auth_gssapi.GenerateAuthToken(
|
| + NULL, "HTTP/intranet.google.com", &auth_token));
|
|
|
| std::string second_challenge_text = "Negotiate Zm9vYmFy";
|
| HttpAuthChallengeTokenizer second_challenge(second_challenge_text.begin(),
|
| @@ -217,8 +216,8 @@ TEST(HttpAuthGSSAPITest, ParseChallenge_UnexpectedTokenFirstRound) {
|
| // If the first round challenge has an additional authentication token, it
|
| // should be treated as an invalid challenge from the server.
|
| test::MockGSSAPILibrary mock_library;
|
| - HttpAuthGSSAPI auth_gssapi(&mock_library, "Negotiate",
|
| - CHROME_GSS_SPNEGO_MECH_OID_DESC);
|
| + HttpAuthGSSAPI auth_gssapi(
|
| + &mock_library, "Negotiate", CHROME_GSS_SPNEGO_MECH_OID_DESC);
|
| std::string challenge_text = "Negotiate Zm9vYmFy";
|
| HttpAuthChallengeTokenizer challenge(challenge_text.begin(),
|
| challenge_text.end());
|
| @@ -230,8 +229,8 @@ TEST(HttpAuthGSSAPITest, ParseChallenge_MissingTokenSecondRound) {
|
| // If a later-round challenge is simply "Negotiate", it should be treated as
|
| // an authentication challenge rejection from the server or proxy.
|
| test::MockGSSAPILibrary mock_library;
|
| - HttpAuthGSSAPI auth_gssapi(&mock_library, "Negotiate",
|
| - CHROME_GSS_SPNEGO_MECH_OID_DESC);
|
| + HttpAuthGSSAPI auth_gssapi(
|
| + &mock_library, "Negotiate", CHROME_GSS_SPNEGO_MECH_OID_DESC);
|
| std::string first_challenge_text = "Negotiate";
|
| HttpAuthChallengeTokenizer first_challenge(first_challenge_text.begin(),
|
| first_challenge_text.end());
|
| @@ -240,8 +239,9 @@ TEST(HttpAuthGSSAPITest, ParseChallenge_MissingTokenSecondRound) {
|
|
|
| EstablishInitialContext(&mock_library);
|
| std::string auth_token;
|
| - EXPECT_EQ(OK, auth_gssapi.GenerateAuthToken(NULL, "HTTP/intranet.google.com",
|
| - &auth_token));
|
| + EXPECT_EQ(OK,
|
| + auth_gssapi.GenerateAuthToken(
|
| + NULL, "HTTP/intranet.google.com", &auth_token));
|
| std::string second_challenge_text = "Negotiate";
|
| HttpAuthChallengeTokenizer second_challenge(second_challenge_text.begin(),
|
| second_challenge_text.end());
|
| @@ -253,8 +253,8 @@ TEST(HttpAuthGSSAPITest, ParseChallenge_NonBase64EncodedToken) {
|
| // If a later-round challenge has an invalid base64 encoded token, it should
|
| // be treated as an invalid challenge.
|
| test::MockGSSAPILibrary mock_library;
|
| - HttpAuthGSSAPI auth_gssapi(&mock_library, "Negotiate",
|
| - CHROME_GSS_SPNEGO_MECH_OID_DESC);
|
| + HttpAuthGSSAPI auth_gssapi(
|
| + &mock_library, "Negotiate", CHROME_GSS_SPNEGO_MECH_OID_DESC);
|
| std::string first_challenge_text = "Negotiate";
|
| HttpAuthChallengeTokenizer first_challenge(first_challenge_text.begin(),
|
| first_challenge_text.end());
|
| @@ -263,8 +263,9 @@ TEST(HttpAuthGSSAPITest, ParseChallenge_NonBase64EncodedToken) {
|
|
|
| EstablishInitialContext(&mock_library);
|
| std::string auth_token;
|
| - EXPECT_EQ(OK, auth_gssapi.GenerateAuthToken(NULL, "HTTP/intranet.google.com",
|
| - &auth_token));
|
| + EXPECT_EQ(OK,
|
| + auth_gssapi.GenerateAuthToken(
|
| + NULL, "HTTP/intranet.google.com", &auth_token));
|
| std::string second_challenge_text = "Negotiate =happyjoy=";
|
| HttpAuthChallengeTokenizer second_challenge(second_challenge_text.begin(),
|
| second_challenge_text.end());
|
|
|