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