added check version support to remote mounts

This commit is contained in:
2025-09-22 11:35:18 -05:00
parent 87c539628d
commit 23f869f464

View File

@@ -143,17 +143,22 @@ auto packet_server::handshake(std::shared_ptr<connection> conn) const -> bool {
if (total_read == to_read) {
packet response(conn->buffer);
if (response.decrypt(encryption_token_) == 0) {
std::string nonce;
if (response.decode(nonce) == 0) {
if (nonce == conn->nonce) {
conn->generate_nonce();
return true;
std::uint32_t client_version{};
if (response.decode(client_version) == 0) {
std::string nonce;
if (response.decode(nonce) == 0) {
if (nonce == conn->nonce) {
conn->generate_nonce();
return true;
}
throw std::runtime_error("nonce mismatch");
}
throw std::runtime_error("invalid nonce");
}
throw std::runtime_error("invalid nonce");
throw std::runtime_error("invalid client version");
}
throw std::runtime_error("decryption failed");
@@ -283,7 +288,7 @@ void packet_server::read_packet(std::shared_ptr<connection> conn,
ret = request->decode(nonce);
if (ret == 0) {
if (nonce != conn->nonce) {
throw std::runtime_error("invalid nonce");
throw std::runtime_error("nonce mismatch");
}
conn->generate_nonce();