From aeb0d05f0e0f57998694535ce15e729d56e3c881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Mon, 19 Feb 2024 12:33:27 +0100 Subject: [PATCH] Rename StunPacket::Authenticate() to SetPassword() --- worker/include/RTC/StunPacket.hpp | 2 +- worker/src/RTC/IceServer.cpp | 6 +++--- worker/src/RTC/StunPacket.cpp | 26 +++++++++++++------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/worker/include/RTC/StunPacket.hpp b/worker/include/RTC/StunPacket.hpp index 665756051f..040fef4ef9 100644 --- a/worker/include/RTC/StunPacket.hpp +++ b/worker/include/RTC/StunPacket.hpp @@ -147,6 +147,7 @@ namespace RTC { return this->username; } + void SetPassword(const std::string& password); uint32_t GetPriority() const { return this->priority; @@ -197,7 +198,6 @@ namespace RTC const std::string& password); StunPacket* CreateSuccessResponse(); StunPacket* CreateErrorResponse(uint16_t errorCode); - void Authenticate(const std::string& password); void Serialize(uint8_t* buffer); private: diff --git a/worker/src/RTC/IceServer.cpp b/worker/src/RTC/IceServer.cpp index 0914a30d9c..5a0db76881 100644 --- a/worker/src/RTC/IceServer.cpp +++ b/worker/src/RTC/IceServer.cpp @@ -432,11 +432,11 @@ namespace RTC // Authenticate the response. if (this->oldPassword.empty()) { - response->Authenticate(this->password); + response->SetPassword(this->password); } else { - response->Authenticate(this->oldPassword); + response->SetPassword(this->oldPassword); } // Send back. @@ -1069,10 +1069,10 @@ namespace RTC const std::string username = this->remoteUsernameFragment + ":" + this->usernameFragment; request->SetUsername(username.c_str(), username.length()); + request->SetPassword(this->remotePassword); request->SetPriority(1u); request->SetIceControlled(1u); request->SetSoftware(SoftwareAttribute.c_str(), SoftwareAttribute.length()); - request->Authenticate(this->remotePassword); request->Serialize(StunSerializeBuffer); MS_DEBUG_DEV("sending ICE consent request"); diff --git a/worker/src/RTC/StunPacket.cpp b/worker/src/RTC/StunPacket.cpp index c71ef4c00d..74d92bf3e6 100644 --- a/worker/src/RTC/StunPacket.cpp +++ b/worker/src/RTC/StunPacket.cpp @@ -456,6 +456,19 @@ namespace RTC MS_DUMP(""); } + void StunPacket::SetPassword(const std::string& password) + { + // Just for request, indication and success response messages. + if (this->klass == Class::ERROR_RESPONSE) + { + MS_ERROR("cannot set password for error responses"); + + return; + } + + this->password = password; + } + StunPacket::Authentication StunPacket::CheckAuthentication( const std::string& usernameFragment1, const std::string& usernameFragment2, @@ -612,19 +625,6 @@ namespace RTC return response; } - void StunPacket::Authenticate(const std::string& password) - { - // Just for request, indication and success response messages. - if (this->klass == Class::ERROR_RESPONSE) - { - MS_ERROR("cannot set password for error responses"); - - return; - } - - this->password = password; - } - void StunPacket::Serialize(uint8_t* buffer) { MS_TRACE();