added check version support to remote mounts
This commit is contained in:
@@ -143,6 +143,8 @@ 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::uint32_t client_version{};
|
||||
if (response.decode(client_version) == 0) {
|
||||
std::string nonce;
|
||||
if (response.decode(nonce) == 0) {
|
||||
if (nonce == conn->nonce) {
|
||||
@@ -150,12 +152,15 @@ auto packet_server::handshake(std::shared_ptr<connection> conn) const -> bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
throw std::runtime_error("invalid nonce");
|
||||
throw std::runtime_error("nonce mismatch");
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
|
Reference in New Issue
Block a user