#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/ntlm/ntlm_client.h"
#include <string>
#include "base/containers/span.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "net/ntlm/ntlm.h"
#include "net/ntlm/ntlm_buffer_reader.h"
#include "net/ntlm/ntlm_buffer_writer.h"
#include "net/ntlm/ntlm_test_data.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net::ntlm {
namespace {
std::vector<uint8_t> GenerateAuthMsg(const NtlmClient& client,
base::span<const uint8_t> challenge_msg) { … }
std::vector<uint8_t> GenerateAuthMsg(const NtlmClient& client,
const NtlmBufferWriter& challenge_writer) { … }
bool GetAuthMsgResult(const NtlmClient& client,
const NtlmBufferWriter& challenge_writer) { … }
bool ReadBytesPayload(NtlmBufferReader* reader, base::span<uint8_t> buffer) { … }
bool ReadStringPayload(NtlmBufferReader* reader, std::string* str) { … }
bool ReadString16Payload(NtlmBufferReader* reader, std::u16string* str) { … }
void MakeV2ChallengeMessage(size_t target_info_len, std::vector<uint8_t>* out) { … }
}
TEST(NtlmClientTest, SimpleConstructionV1) { … }
TEST(NtlmClientTest, VerifyNegotiateMessageV1) { … }
TEST(NtlmClientTest, MinimalStructurallyValidChallenge) { … }
TEST(NtlmClientTest, MinimalStructurallyValidChallengeZeroOffset) { … }
TEST(NtlmClientTest, ChallengeMsgTooShort) { … }
TEST(NtlmClientTest, ChallengeMsgNoSig) { … }
TEST(NtlmClientTest, ChallengeMsgWrongMessageType) { … }
TEST(NtlmClientTest, ChallengeWithNoTargetName) { … }
TEST(NtlmClientTest, Type2MessageWithTargetName) { … }
TEST(NtlmClientTest, NoTargetNameOverflowFromOffset) { … }
TEST(NtlmClientTest, NoTargetNameOverflowFromLength) { … }
TEST(NtlmClientTest, Type3UnicodeWithSessionSecuritySpecTest) { … }
TEST(NtlmClientTest, Type3WithoutUnicode) { … }
TEST(NtlmClientTest, ClientDoesNotDowngradeSessionSecurity) { … }
TEST(NtlmClientTest, SimpleConstructionV2) { … }
TEST(NtlmClientTest, VerifyNegotiateMessageV2) { … }
TEST(NtlmClientTest, VerifyAuthenticateMessageV2) { … }
TEST(NtlmClientTest,
VerifyAuthenticateMessageInResponseToChallengeWithoutTargetInfoV2) { … }
TEST(NtlmClientTest, AvPairsOverflow) { … }
}