Ensure that business connections are created only for bots.

This commit is contained in:
levlam 2024-03-07 22:49:23 +03:00
parent f2687a31dc
commit c2130b3d3b
2 changed files with 6 additions and 1 deletions

View File

@ -6,6 +6,7 @@
//
#include "td/telegram/BusinessConnectionManager.h"
#include "td/telegram/AuthManager.h"
#include "td/telegram/ContactsManager.h"
#include "td/telegram/Global.h"
#include "td/telegram/net/DcId.h"
@ -117,6 +118,10 @@ void BusinessConnectionManager::on_update_bot_business_connect(
LOG(ERROR) << "Receive invalid " << to_string(connection);
return;
}
if (!td_->auth_manager_->is_bot()) {
LOG(ERROR) << "Receive " << to_string(connection);
return;
}
auto &stored_connection = business_connections_[business_connection->connection_id_];
stored_connection = std::move(business_connection);

View File

@ -8641,7 +8641,7 @@ void Td::on_request(uint64 id, const td_api::hideSuggestedAction &request) {
}
void Td::on_request(uint64 id, td_api::getBusinessConnection &request) {
CHECK_IS_USER();
CHECK_IS_BOT();
CLEAN_INPUT_STRING(request.connection_id_);
CREATE_REQUEST_PROMISE();
business_connection_manager_->get_business_connection(BusinessConnectionId(std::move(request.connection_id_)),