Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libfzssh for openSUSE:Factory 
checked in at 2026-11-16 09:08:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libfzssh (Old)
 and      /work/SRC/openSUSE:Factory/.libfzssh.new.1251 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libfzssh"

Mon Nov 16 09:08:14 2026 rev:5 rq:1397585 version:1.5.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/libfzssh/libfzssh.changes        2026-08-21 
16:59:34.987317769 +0200
+++ /work/SRC/openSUSE:Factory/.libfzssh.new.1251/libfzssh.changes      
2026-11-16 09:13:56.144546656 +0100
@@ -1,0 +2,23 @@
+Sat Nov 14 14:59:18 UTC 2026 - ecsos <[email protected]> - 1.5.2
+
+- Update to 1.5.2
+  * Fixed vulnerabilities:
+    - Fixed a crash parsing invalid RSA private keys and reduced
+      maximum allowed modulus size
+- Changes from 1.5.1
+  * New features:
+    - Added channel_flags allowing to request hgue channel windows
+      even in case of multiplexed transports
+  * Bugfixes and minor changes:
+    - Improved state tracking in the the socket interface representing
+      opened channels
+- Changes from 1.5.0
+  * New features:
+    - Added support for [email protected] extension
+    - Added sftp_client::initial_rtt() as estimate of initial channel
+      rtt
+  * Bugfixes and minor changes:
+    - Improved logging when processing File Attributes with malformed
+      extended attributes
+
+-------------------------------------------------------------------

Old:
----
  fzssh-1.4.0.tar.xz

New:
----
  fzssh-1.5.2.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libfzssh.spec ++++++
--- /var/tmp/diff_new_pack.F6GAUS/_old  2026-11-16 09:13:56.768572817 +0100
+++ /var/tmp/diff_new_pack.F6GAUS/_new  2026-11-16 09:13:56.770572901 +0100
@@ -16,15 +16,16 @@
 #
 
 
-%define sover          14
-%define soname         %{sover}_0_0
+%define sover_ma       16
+%define sover_mi       1
+%define soname         %{sover_ma}_%{sover_mi}_0
 %define libname                %{name}%{soname}
 %define develname      %{name}-devel
 
-%define libfilezillaversion 0.57.0
+%define libfilezillaversion 0.58.0
 
 Name:           libfzssh
-Version:        1.4.0
+Version:        1.5.2
 Release:        0
 Summary:        A C++ SSH/SFTP library based on libfilezilla
 License:        AGPL-3.0-or-later
@@ -79,9 +80,9 @@
 %files -n %{libname}
 %license agpl3.txt
 %doc README
-%{_libdir}/%{name}.so.%{sover}.0.0
-%{_libdir}/%{name}-client.so.%{sover}.0.0
-%{_libdir}/%{name}-crypt.so.%{sover}.0.0
+%{_libdir}/%{name}.so.%{sover_ma}.%{sover_mi}.0
+%{_libdir}/%{name}-client.so.%{sover_ma}.%{sover_mi}.0
+%{_libdir}/%{name}-crypt.so.%{sover_ma}.%{sover_mi}.0
 
 %files -n %{develname}
 %{_includedir}/fzssh/

++++++ fzssh-1.4.0.tar.xz -> fzssh-1.5.2.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/NEWS new/fzssh-1.5.2/NEWS
--- old/fzssh-1.4.0/NEWS        2026-08-18 17:04:46.000000000 +0200
+++ new/fzssh-1.5.2/NEWS        2026-11-13 18:54:24.000000000 +0100
@@ -1,3 +1,18 @@
+1.5.2 (2026-11-13)
+
+! Fixed a crash parsing invalid RSA private keys and reduced maximum allowed 
modulus size
+
+1.5.1 (2026-11-03)
+
++ Added channel_flags allowing to request hgue channel windows even in case of 
multiplexed transports
+- Improved state tracking in the the socket interface representing opened 
channels
+
+1.5.0 (2026-10-23)
+
++ Added support for [email protected] extension
++ Added sftp_client::initial_rtt() as estimate of initial channel rtt
+- Improved logging when processing File Attributes with malformed extended 
attributes
+
 1.4.0 (2026-08-18)
 
 + Added auth_password_change_request_event
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/buffer_util.cpp 
new/fzssh-1.5.2/lib/buffer_util.cpp
--- old/fzssh-1.4.0/lib/buffer_util.cpp 2026-08-18 17:04:46.000000000 +0200
+++ new/fzssh-1.5.2/lib/buffer_util.cpp 2026-11-13 18:54:24.000000000 +0100
@@ -58,10 +58,10 @@
 {
        uint32_t s{};
        if (!extract_uint32(packet, s)) {
-               return {extract_fail, "Bad length"sv};
+               return {extract_fail, "Could not extract string length"sv};
        }
        if (s > packet.size()) {
-               return {extract_fail, "Bad length"sv};
+               return {extract_fail, "Extracted string length exceeds 
available data"sv};
        }
        auto ret = packet.substr(0, s);
        packet.remove_prefix(s);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/client/client.cpp 
new/fzssh-1.5.2/lib/client/client.cpp
--- old/fzssh-1.4.0/lib/client/client.cpp       2026-08-18 17:04:46.000000000 
+0200
+++ new/fzssh-1.5.2/lib/client/client.cpp       2026-11-13 18:54:24.000000000 
+0100
@@ -23,9 +23,9 @@
        }
 }
 
-std::unique_ptr<socket_interface> client::open_channel(channel_type type, 
std::string_view const& cmd)
+std::unique_ptr<socket_interface> client::open_channel(channel_type type, 
std::string_view const& cmd, channel_flags flags)
 {
-       return 
static_cast<client_connection_protocol&>(*impl_->connection_protocol_).open_channel(type,
 cmd);
+       return 
static_cast<client_connection_protocol&>(*impl_->connection_protocol_).open_channel(type,
 cmd, flags);
 }
 
 void client::hostkey_decision(bool accept)
@@ -40,7 +40,7 @@
 
 void client::auth_with_key(std::unique_ptr<private_key> const& key, bool 
with_signature, std::string_view const& signature_algorithm)
 {
-       return static_cast<client_userauth&>(*impl_->auth_).auth_with_key(key, 
with_signature, signature_algorithm);
+       static_cast<client_userauth&>(*impl_->auth_).auth_with_key(key, 
with_signature, signature_algorithm);
 }
 
 void client::auth_with_key(std::unique_ptr<public_key> const& key, 
std::string_view const& signature_algorithm)
@@ -50,16 +50,21 @@
 
 void client::auth_with_password(std::string_view const& pw, std::string_view 
const& new_password)
 {
-       return 
static_cast<client_userauth&>(*impl_->auth_).auth_with_password(pw, 
new_password);
+       static_cast<client_userauth&>(*impl_->auth_).auth_with_password(pw, 
new_password);
 }
 
 void client::auth_keyboard_interactive()
 {
-       return 
static_cast<client_userauth&>(*impl_->auth_).auth_keyboard_interactive();
+       
static_cast<client_userauth&>(*impl_->auth_).auth_keyboard_interactive();
 }
 
 void client::auth_keyboard_interactive_response(std::vector<std::string> 
const& responses)
 {
-       return 
static_cast<client_userauth&>(*impl_->auth_).auth_keyboard_interactive_response(responses);
+       
static_cast<client_userauth&>(*impl_->auth_).auth_keyboard_interactive_response(responses);
+}
+
+void client::ping()
+{
+       static_cast<client_transport&>(*impl_).ping();
 }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/client/connection_protocol.cpp 
new/fzssh-1.5.2/lib/client/connection_protocol.cpp
--- old/fzssh-1.4.0/lib/client/connection_protocol.cpp  2026-08-18 
17:04:46.000000000 +0200
+++ new/fzssh-1.5.2/lib/client/connection_protocol.cpp  2026-11-13 
18:54:24.000000000 +0100
@@ -1,4 +1,5 @@
 #include "connection_protocol.hpp"
+#include "transport.hpp"
 
 #include "../buffer_util.hpp"
 
@@ -57,10 +58,13 @@
        channel.state_ = channel_state::pending_accept;
        channel.peer_id_ = peer_id;
 
+
        if (!channel.layer_) {
                return disconnect_channel(channel);
        }
 
+       channel.layer_->initial_rtt_ = monotonic_clock::now() - 
channel.layer_->rtt_measurement_start_;
+
        channel.window_out_ = no_flow_control_ ? 0xffffffffu : window_out;
        channel.max_packet_size_out_ = std::min(static_cast<size_t>(max_size), 
max_payload_size) - channel_overhead;
 
@@ -86,6 +90,8 @@
                return continuation::error;
        }
 
+       channel.layer_->rtt_measurement_start_ = monotonic_clock::now();
+
        return continuation::next;
 }
 
@@ -164,9 +170,12 @@
                logger_.log(logmsg::debug_warning, "Ignoring 
SSH_MSG_CHANNEL_SUCCESS on channel %u, wrong channel state."sv, 
channel.own_id_);
                return continuation::next;
        }
+
+
        channel.state_ = channel_state::active;
        had_valid_channel_ = true;
        if (channel.layer_) {
+               channel.layer_->initial_rtt_ = 
std::min(channel.layer_->initial_rtt_, (monotonic_clock::now() - 
channel.layer_->rtt_measurement_start_));
                if (channel.layer_->handler_) {
                        
channel.layer_->handler_->send_event<socket_event>(channel.layer_, 
socket_event_flag::connection, 0);
                }
@@ -186,10 +195,11 @@
                return continuation::next;
        }
        if (channel.layer_) {
-               channel.layer_->conn_ = nullptr;
                if (channel.layer_->handler_) {
                        
channel.layer_->handler_->send_event<socket_event>(channel.layer_, 
socket_event_flag::connection, ECONNREFUSED);
                }
+               channel.layer_->conn_ = nullptr;
+               channel.layer_ = nullptr;
        }
 
        disconnect_channel(channel);
@@ -197,7 +207,7 @@
        return continuation::next;
 }
 
-uint32_t client_connection_protocol::calculate_window_in_max()
+uint32_t client_connection_protocol::calculate_window_in_max(channel_flags 
flags)
 {
        // RFC 4254 mandates that every implementation MUST be able to handle
        // receive windows of 2^32 - 1 octets
@@ -210,7 +220,7 @@
        if (no_flow_control_) {
                return large_window_max;
        }
-       if (single_channel_) {
+       if (single_channel_ || flags & channel_flags::huge_window) {
                auto peer_version = transport_.peer_version();
 
                // Check for known-good
@@ -234,7 +244,7 @@
        return multi_channel_window;
 }
 
-std::unique_ptr<socket_interface> 
client_connection_protocol::open_channel(channel_type type, std::string_view 
const& cmd)
+std::unique_ptr<socket_interface> 
client_connection_protocol::open_channel(channel_type type, std::string_view 
const& cmd, channel_flags flags)
 {
        auto tname = to_string(type);
        if (tname.empty()) {
@@ -280,22 +290,25 @@
        channel.type_ = type;
        channel.cmd_ = cmd;
        channel.own_id_ = own_id;
-       channel.window_in_max_ = calculate_window_in_max();
+       channel.window_in_max_ = calculate_window_in_max(flags);
        channel.window_in_ = channel.window_in_max_;
 
+       auto layer = std::make_unique<ssh_channel_layer>(this, schannel);
+       channel.layer_ = layer.get();
+
        if (transport_.service_ != service_type::connection) {
                logger_.log(logmsg::debug_info, "Deferring channel request 
until authentication is complete"sv);
                channel.state_ = channel_state::pending_auth;
        }
        else {
                if (!send_channel_open(channel)) {
+                       // The transport has failed. Explicly unhook the 
channel to avoid some redundant logging
+                       channel.layer_ = nullptr;
+                       layer->data_ = nullptr;
                        return {};
                }
        }
 
-       auto layer = std::make_unique<ssh_channel_layer>(this, schannel);
-       channel.layer_ = layer.get();
-
        return layer;
 }
 
@@ -329,7 +342,13 @@
                }
        }
 
-       return b.commit();
+       bool ret =  b.commit();
+
+       if (channel.layer_) {
+               channel.layer_->rtt_measurement_start_ = monotonic_clock::now();
+       }
+
+       return ret;
 }
 
 continuation client_connection_protocol::on_auth_success()
@@ -347,4 +366,12 @@
        return continuation::next;
 }
 
+continuation 
client_connection_protocol::process_global_request_result(pending_request & 
req, bool /*success*/)
+{
+       if (req.type_ == "[email protected]"sv) {
+               
static_cast<client_transport&>(transport_).continue_process_pong(req.data_);
+       }
+       return continuation::next;
+}
+
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/client/connection_protocol.hpp 
new/fzssh-1.5.2/lib/client/connection_protocol.hpp
--- old/fzssh-1.4.0/lib/client/connection_protocol.hpp  2026-08-18 
17:04:46.000000000 +0200
+++ new/fzssh-1.5.2/lib/client/connection_protocol.hpp  2026-11-13 
18:54:24.000000000 +0100
@@ -16,13 +16,14 @@
        virtual continuation process_channel_request(channel_data & channel, 
std::string_view type, bool want_reply, std::string_view args) override;
        virtual continuation process_channel_success(channel_data & channel, 
std::string_view packet) override;
        virtual continuation process_channel_failure(channel_data & channel, 
std::string_view packet) override;
+       virtual continuation process_global_request_result(pending_request & 
req, bool success) override;
 
-       std::unique_ptr<socket_interface> open_channel(channel_type type, 
std::string_view const& cmd);
+       std::unique_ptr<socket_interface> open_channel(channel_type type, 
std::string_view const& cmd, channel_flags flags);
 
        continuation on_auth_success();
 
 private:
-       uint32_t calculate_window_in_max();
+       uint32_t calculate_window_in_max(channel_flags flags);
        bool send_channel_open(channel_data & channel);
 };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/client/sftp_client.cpp 
new/fzssh-1.5.2/lib/client/sftp_client.cpp
--- old/fzssh-1.4.0/lib/client/sftp_client.cpp  2026-08-18 17:04:46.000000000 
+0200
+++ new/fzssh-1.5.2/lib/client/sftp_client.cpp  2026-11-13 18:54:24.000000000 
+0100
@@ -76,6 +76,9 @@
        event_handler* waiting_for_on_can_send_{};
        bool is_retrying_process_in_queue_{};
 
+       monotonic_clock start_time_;
+       duration initial_rtt_;
+
        friend class request_builder;
 };
 
@@ -258,6 +261,7 @@
 void sftp_client_impl::on_connect()
 {
        if (!peer_version_) {
+               start_time_ = monotonic_clock::now();
                request_builder b(*this, message_type::SSH_FXP_INIT);
                write_uint32(b.buf_, 3);
        }
@@ -370,7 +374,7 @@
        }
 
        if (count > data.size() / 12) {
-               logger_.log(logmsg::error, "Nonsensical name count in received 
SSH_FXP_NAME packet"sv);
+               logger_.log(logmsg::error, "Nonsensical name count %u for %u 
byte(s) of remaining data in received SSH_FXP_NAME packet"sv, count, 
data.size());
                return handler->failure();
        }
 
@@ -476,6 +480,11 @@
 
 continuation sftp_client_impl::process_version(std::string_view data)
 {
+       initial_rtt_ = monotonic_clock::now() - start_time_;
+       if (channel_is_fzssh_) {
+               initial_rtt_ = std::min(initial_rtt_, 
static_cast<ssh_channel&>(*socket_).initial_rtt());
+       }
+
        if (!extract_uint32(data, peer_version_)) {
                logger_.log(logmsg::error, "Could not read peer SFTP 
version"sv);
                return continuation::error;
@@ -824,4 +833,9 @@
        impl_->disconnect();
 }
 
+duration sftp_client::initial_rtt()
+{
+       return impl_->initial_rtt_;
+}
+
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/client/transport.cpp 
new/fzssh-1.5.2/lib/client/transport.cpp
--- old/fzssh-1.4.0/lib/client/transport.cpp    2026-08-18 17:04:46.000000000 
+0200
+++ new/fzssh-1.5.2/lib/client/transport.cpp    2026-11-13 18:54:24.000000000 
+0100
@@ -80,6 +80,10 @@
                }
        }
 
+       if (ping_state_.timer_) {
+               ping_state_.interrupted_by_keying_ = true;
+       }
+
        if (kex_type_ == kex_type::dhge) {
                keying_ = keying_state::gex;
                packet_builder b(*this, message_id::SSH_MSG_KEX_DH_GEX_REQUEST);
@@ -273,6 +277,17 @@
        unblock_read();
 }
 
+void client_transport::check_peer_compatibility(bool preliminary)
+{
+       if (preliminary) {
+               // Mainly older versions that don't support the ping extension, 
but are known to properly handle global channel reqeuests
+               if (fz::starts_with(peer_version_, "SSH-2.0-OpenSSH_"sv) ||
+                       fz::starts_with(peer_version_, "SSH-2.0-fzssh_"sv))
+               {
+                       ping_state_.mode_ = ping_mode::fallback;
+               }
+       }
+}
 
 continuation client_transport::process_ext_info(std::string_view name, 
std::string_view value)
 {
@@ -299,6 +314,15 @@
                        logger_.log(logmsg::debug_warning, "Unsupported 
extension version, cannot use this extension."sv);
                }
        }
+       else if (name == "[email protected]"sv) {
+               if (value == "0"sv) {
+                       logger_.log(logmsg::debug_info, "Extension version is 
\"0\", enabling use of this extension."sv);
+                       ping_state_.mode_ = ping_mode::supported;
+               }
+               else {
+                       logger_.log(logmsg::debug_warning, "Unsupported 
extension version, cannot use this extension."sv);
+               }
+       }
 
        return continuation::next;
 }
@@ -311,4 +335,190 @@
        return 
static_cast<client_connection_protocol&>(*connection_protocol_).on_auth_success();
 }
 
+continuation client_transport::process_local_extension(message_id id, 
std::string_view packet)
+{
+       if (id == message_id::SSH_MSG_PONG) {
+               return process_pong(packet);
+       }
+
+       return continuation::error_unimplemented;
+}
+
+continuation client_transport::process_pong(std::string_view packet)
+{
+       if (!ping_state_.sent_ || ping_state_.mode_ != ping_mode::supported) {
+               logger_.log(logmsg::debug_info, "Ignoring unexpected or stale 
SSH_MSG_PONG."sv);
+               return continuation::next;
+       }
+
+       auto value = extract_blob(packet);
+       if (!value) {
+               logger_.log(logmsg::error, "Received malformed SSH_MSG_PONG, 
disabling ping functionality: %s"sv, *value);
+               ping_state_.mode_ = ping_mode::unsupported;
+               stop_ping({});
+               return continuation::next;
+       }
+
+       if (!packet.empty()) {
+               logger_.log(logmsg::debug_warning, "Received malformed 
SSH_MSG_PONG with trailing data, disabling ping functionality."sv);
+               ping_state_.mode_ = ping_mode::unsupported;
+               stop_ping({});
+               return continuation::next;
+       }
+
+       continue_process_pong(*value);
+       return continuation::next;
+}
+
+void client_transport::continue_process_pong(std::string_view data)
+{
+       if (!ping_state_.sent_) {
+               return;
+       }
+
+       if (data.size() != 4 || read_uint32(data.data()) != ping_state_.data_) {
+               logger_.log(logmsg::debug_info, "Ignoring stale pong."sv);
+               return;
+       }
+
+       if (ping_state_.interrupted_by_keying_) {
+               if (++ping_state_.retries_ > 2) {
+                       logger_.log(logmsg::debug_warning, "Too many retries, 
aborting ping"sv);
+                       stop_ping({});
+                       return;
+               }
+               logger_.log(logmsg::debug_info, "Ping got interrupted by 
re-keying, need to retry"sv);
+               ping_state_.sent_ = false;
+               send_ping(false);
+               return;
+       }
+
+       auto rtt = monotonic_clock::now() - ping_state_.start_;
+       logger_.log(logmsg::debug_info, "Measured transport layer RTT of %u 
ms", rtt.get_milliseconds());
+       stop_ping(rtt);
+}
+
+void client_transport::operator()(event_base const& ev)
+{
+       if (!fz::dispatch<timer_event>(ev, this, &client_transport::on_timer)) {
+               transport::operator ()(ev);
+       }
+}
+
+void client_transport::on_timer(timer_id t)
+{
+       if (t != ping_state_.timer_) {
+               return;
+       }
+
+       if (disconnecting_) {
+               stop_ping({});
+               return;
+       }
+
+       if ((fz::monotonic_clock::now() - ping_state_.start_) >= 
duration::from_seconds(3)) {
+               stop_ping({});
+               return;
+       }
+
+       if (ping_state_.mode_ == ping_mode::supported) {
+               if (ping_state_.sent_ && ping_state_.interrupted_by_keying_) {
+                       if (++ping_state_.retries_ > 2) {
+                               logger_.log(logmsg::debug_warning, "Too many 
retries, aborting ping"sv);
+                               stop_ping({});
+                               return;
+                       }
+                       logger_.log(logmsg::debug_info, "Ping got interrupted 
by re-keying, need to retry"sv);
+                       ping_state_.sent_ = false;
+               }
+       }
+       if (!ping_state_.sent_) {
+               send_ping(false);
+       }
+}
+
+void client_transport::ping()
+{
+       if (disconnecting_ || service_ != service_type::connection) {
+               return;
+       }
+
+       if (ping_state_.mode_ == ping_mode::unsupported || ping_state_.timer_) {
+               
handler_.send_event<pong_event>(static_cast<client*>(&session_), std::nullopt);
+               return;
+       }
+
+       ping_state_.timer_ = add_timer(duration::from_milliseconds(100), false);
+       ping_state_.start_ = fz::monotonic_clock::now();
+       send_ping(true);
+}
+
+void client_transport::stop_ping(std::optional<duration> const& rtt)
+{
+       if (ping_state_.timer_) {
+               if (!disconnecting_) {
+                       
handler_.send_event<pong_event>(static_cast<client*>(&session_), rtt);
+               }
+               stop_timer(ping_state_.timer_);
+       }
+       ping_state_.timer_ = timer_id{};
+       ping_state_.start_ = fz::monotonic_clock();
+       ping_state_.retries_ = 0;
+       ping_state_.sent_ = false;
+       ping_state_.interrupted_by_keying_ = false;
+}
+
+void client_transport::send_ping(bool  from_ping)
+{
+       if (keying_ != keying_state::no) {
+               if (from_ping) {
+                       logger_.log(logmsg::debug_verbose, "Deferring ping, 
keying in progress."sv);
+               }
+               return;
+       }
+
+       if (ping_state_.mode_ == ping_mode::fallback) {
+               for (auto const& req : 
connection_protocol_->pending_global_requests_) {
+                       if (req.type_ == "[email protected]"sv) {
+                               if (from_ping) {
+                                       logger_.log(logmsg::debug_verbose, 
"Deferring ping, there are still pending global requests."sv);
+                               }
+                               return;
+                       }
+               }
+       }
+
+       ping_state_.interrupted_by_keying_ = false;
+
+       ++ping_state_.data_;
+
+       ping_state_.start_ = fz::monotonic_clock::now();
+
+       if (ping_state_.mode_ == ping_mode::supported) {
+               packet_builder b(*this, message_id::SSH_MSG_PING);
+               write_uint32(b.buf_, 4);
+               write_uint32(b.buf_, ping_state_.data_);
+               if (!b.commit()) {
+                       stop_ping({});
+                       return;
+               }
+       }
+       else {
+               packet_builder b(*this, message_id::SSH_MSG_GLOBAL_REQUEST, 
"type=\"[email protected]\", want_reply=TRUE"sv);
+               write_string(b.buf_, "[email protected]"sv);
+               b.buf_.append(1);
+               if (!b.commit()) {
+                       stop_ping({});
+                       return;
+               }
+
+               connection_protocol::pending_request req;
+               req.type_ = "[email protected]"sv;
+               req.data_.resize(4);
+               write_uint32(req.data_.data(), ping_state_.data_);
+
+               
connection_protocol_->pending_global_requests_.emplace_back(std::move(req));
+       }
+       ping_state_.sent_ = true;
+}
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/client/transport.hpp 
new/fzssh-1.5.2/lib/client/transport.hpp
--- old/fzssh-1.4.0/lib/client/transport.hpp    2026-08-18 17:04:46.000000000 
+0200
+++ new/fzssh-1.5.2/lib/client/transport.hpp    2026-11-13 18:54:24.000000000 
+0100
@@ -18,8 +18,14 @@
 
        virtual continuation finalize_kexinit(std::string_view peer_hostkeys, 
bool bad_guess) override;
 
+       virtual void check_peer_compatibility(bool preliminary) override;
        virtual continuation process_ext_info(std::string_view name, 
std::string_view value) override;
 
+       virtual continuation process_local_extension(message_id id, 
std::string_view packet) override;
+
+       continuation process_pong(std::string_view packet);
+       void continue_process_pong(std::string_view data);
+
        continuation init_dh();
        virtual bool setup_hostkey() override;
        virtual std::string_view host_pubkey() const override;
@@ -30,6 +36,31 @@
 
        std::unique_ptr<public_key> host_pubkey_;
        std::string previous_hostkey_;
+
+       void ping();
+
+private:
+       void stop_ping(std::optional<duration> const& rtt);
+       void send_ping(bool from_ping);
+
+       virtual void operator()(event_base const& ev) override;
+       void on_timer(timer_id);
+
+       enum class ping_mode {
+               unsupported,
+               fallback,
+               supported
+       };
+       struct ping_state {
+               ping_mode mode_{ping_mode::unsupported};
+
+               timer_id timer_{};
+               fz::monotonic_clock start_;
+               uint32_t data_{};
+               size_t retries_{};
+               bool sent_{};
+               bool interrupted_by_keying_{};
+       } ping_state_;
 };
 
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/connection_protocol.cpp 
new/fzssh-1.5.2/lib/connection_protocol.cpp
--- old/fzssh-1.4.0/lib/connection_protocol.cpp 2026-08-18 17:04:46.000000000 
+0200
+++ new/fzssh-1.5.2/lib/connection_protocol.cpp 2026-11-13 18:54:24.000000000 
+0100
@@ -176,7 +176,20 @@
 
 socket_state ssh_channel_layer::get_state() const
 {
-       return socket_state::none;
+       if (!data_) {
+               return socket_state::failed;
+       }
+       else if (data_->out_eof_ == 2) {
+               return socket_state::shut_down;
+       }
+       else if (data_->out_eof_ == 1) {
+               return socket_state::shutting_down;
+       }
+       else if (!conn_) {
+               return socket_state::failed;
+       }
+
+       return (data_->state_ == channel_state::active) ? 
socket_state::connected : socket_state::connecting;
 }
 
 int ssh_channel_layer::shutdown()
@@ -260,7 +273,14 @@
 
 void ssh_channel_layer::want_more()
 {
-       wait_in_ = true;
+       if (conn_) {
+               wait_in_ = true;
+       }
+       else {
+               if (handler_) {
+                       handler_->send_event<socket_event>(this, 
socket_event_flag::read, ECONNABORTED);
+               }
+       }
 }
 
 connection_protocol::connection_protocol(transport & t)
@@ -273,9 +293,7 @@
 connection_protocol::~connection_protocol()
 {
        for (auto & channel : channels_) {
-               if (channel.second->layer_) {
-                       channel.second->layer_->conn_ = nullptr;
-               }
+               notify_disconnect(*channel.second);
        }
 }
 
@@ -606,12 +624,49 @@
 
 continuation 
connection_protocol::process_global_request_success(std::string_view)
 {
-       return 
transport_.send_disconnect(disconnect_reason::SSH_DISCONNECT_PROTOCOL_ERROR, 
"Received SSH_MSG_REQUEST_SUCCESS even though no request wanting a reply was 
sent."sv);
+       if (pending_global_requests_.empty()) {
+               return 
transport_.send_disconnect(disconnect_reason::SSH_DISCONNECT_PROTOCOL_ERROR, 
"Received SSH_MSG_REQUEST_SUCCESS even though no request wanting a reply was 
sent."sv);
+       }
+       continuation ret = 
process_global_request_result(pending_global_requests_.front(), true);
+       pending_global_requests_.pop_front();
+       return ret;
 }
 
 continuation 
connection_protocol::process_global_request_failure(std::string_view)
 {
-       return 
transport_.send_disconnect(disconnect_reason::SSH_DISCONNECT_PROTOCOL_ERROR, 
"Received SSH_MSG_REQUEST_FAILURE even though no request wanting a reply was 
sent."sv);
+       if (pending_global_requests_.empty()) {
+               return 
transport_.send_disconnect(disconnect_reason::SSH_DISCONNECT_PROTOCOL_ERROR, 
"Received SSH_MSG_REQUEST_FAILURE even though no request wanting a reply was 
sent."sv);
+       }
+       continuation ret = 
process_global_request_result(pending_global_requests_.front(), false);
+       pending_global_requests_.pop_front();
+       return ret;
+}
+
+void connection_protocol::notify_disconnect(channel_data & channel)
+{
+       if (!channel.layer_) {
+               return;
+       }
+
+       if (!transport_.server() && channel.state_ < channel_state::active) {
+               if (channel.layer_->handler_) {
+                       
channel.layer_->handler_->send_event<socket_event>(channel.layer_, 
socket_event_flag::connection, ECONNABORTED);
+               }
+       }
+       else if (channel.layer_->wait_in_) {
+               channel.layer_->wait_in_ = false;
+               if (channel.layer_->handler_) {
+                       
channel.layer_->handler_->send_event<socket_event>(channel.layer_, 
socket_event_flag::read, channel.in_buf_.empty() ? ECONNABORTED : 0);
+               }
+       }
+       else if (channel.layer_->wait_out_) {
+               channel.layer_->wait_out_ = false;
+               if (channel.layer_->handler_) {
+                       
channel.layer_->handler_->send_event<socket_event>(channel.layer_, 
socket_event_flag::write, ECONNABORTED);
+               }
+       }
+       channel.layer_->conn_ = nullptr;
+       channel.layer_ = nullptr;
 }
 
 continuation connection_protocol::disconnect_channel(channel_data & channel)
@@ -619,33 +674,22 @@
        logger_.log(logmsg::debug_info, "disconnect_channel(%u)"sv, 
channel.own_id_);
 
        if (channel.state_ == channel_state::closing) {
-               logger_.log(logmsg::debug_info, "Channel %u is already 
closing"sv, channel.own_id_);
+               if (!transport_.disconnecting_) {
+                       logger_.log(logmsg::debug_info, "Channel %u is already 
closing"sv, channel.own_id_);
+               }
                return continuation::next;
        }
 
-       if (channel.layer_) {
-               if (channel.layer_->wait_in_) {
-                       channel.layer_->wait_in_ = false;
-                       if (channel.layer_->handler_) {
-                               
channel.layer_->handler_->send_event<socket_event>(channel.layer_, 
socket_event_flag::read, channel.in_buf_.empty() ? ECONNABORTED : 0);
-                       }
-               }
-               else if (channel.layer_->wait_out_) {
-                       channel.layer_->wait_out_ = false;
-                       if (channel.layer_->handler_) {
-                               
channel.layer_->handler_->send_event<socket_event>(channel.layer_, 
socket_event_flag::write, ECONNABORTED);
-                       }
-               }
-               channel.layer_->conn_ = nullptr;
-               channel.layer_ = nullptr;
-       }
+       notify_disconnect(channel);
 
        if (channel.own_id_ == input_block_) {
                transport_.unblock_read();
        }
 
        if (channel.state_ == channel_state::pending_auth) {
-               logger_.log(logmsg::debug_info, "No need to send 
SSH_MSG_CHANNEL_CLOSE as SSH_MSG_CHANNEL_OPEN has not yet been sent"sv, 
channel.own_id_);
+               if (!transport_.disconnecting_) {
+                       logger_.log(logmsg::debug_info, "No need to send 
SSH_MSG_CHANNEL_CLOSE as SSH_MSG_CHANNEL_OPEN has not yet been sent"sv, 
channel.own_id_);
+               }
 
                auto id = channel.own_id_;
                erase_channel(id);
@@ -654,7 +698,9 @@
        }
 
        if (channel.state_ == channel_state::setup) {
-               logger_.log(logmsg::debug_info, "Cannot send 
SSH_MSG_CHANNEL_CLOSE on channel %u yet, still awaiting peer id"sv, 
channel.own_id_);
+               if (!transport_.disconnecting_) {
+                       logger_.log(logmsg::debug_info, "Cannot send 
SSH_MSG_CHANNEL_CLOSE on channel %u yet, still awaiting peer id"sv, 
channel.own_id_);
+               }
                return continuation::next;
        }
        channel.state_ = channel_state::closing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/connection_protocol.hpp 
new/fzssh-1.5.2/lib/connection_protocol.hpp
--- old/fzssh-1.4.0/lib/connection_protocol.hpp 2026-08-18 17:04:46.000000000 
+0200
+++ new/fzssh-1.5.2/lib/connection_protocol.hpp 2026-11-13 18:54:24.000000000 
+0100
@@ -5,6 +5,7 @@
 #include "fzssh/ssh.hpp"
 #include "transport.hpp"
 
+#include <list>
 #include <map>
 #include <set>
 
@@ -83,6 +84,12 @@
        // True after there has been at least one successfully opened channel
        bool had_valid_channel();
 
+       struct pending_request {
+               std::string type_;
+               std::string data_;
+       };
+       std::list<pending_request> pending_global_requests_;
+
 protected:
        friend class ssh_channel_layer;
        friend class transport;
@@ -94,6 +101,7 @@
        virtual continuation process_global_request(std::string_view const& 
type, bool want_reply, std::string_view packet);
        continuation process_global_request_success(std::string_view packet);
        continuation process_global_request_failure(std::string_view packet);
+       virtual continuation process_global_request_result(pending_request & 
/*req*/, bool /*success*/) { return continuation::next; }
        continuation process_channel_open(std::string_view packet);
        virtual continuation process_channel_open(std::string_view type, 
uint32_t peer_id, uint32_t window, uint32_t max_size, std::string_view packet) 
= 0;
        virtual continuation process_channel_open_confirmation(channel_data &, 
std::string_view) { return continuation::error_badside; }
@@ -111,6 +119,7 @@
        virtual bool send_close(channel_data & channel);
 
        continuation disconnect_channel(channel_data & channel);
+       void notify_disconnect(channel_data & channel);
        void erase_channel(uint32_t id);
 
        bool consumed_input(channel_data& channel);
@@ -128,7 +137,7 @@
        bool had_valid_channel_{};
 };
 
-class FZSSH_PUBLIC_SYMBOL ssh_channel_layer : public ssh_channel
+class FZSSH_PUBLIC_SYMBOL ssh_channel_layer final : public ssh_channel
 {
 public:
        ssh_channel_layer(connection_protocol* conn, 
std::shared_ptr<channel_data> const& data)
@@ -160,6 +169,11 @@
        virtual void consume_inbuf(size_t count) override;
        virtual void want_more() override;
 
+       // Only used client-side
+       virtual duration initial_rtt() override { return initial_rtt_; }
+       monotonic_clock rtt_measurement_start_;
+       duration initial_rtt_{};
+
        fz::event_handler * handler_{};
 
        connection_protocol* conn_;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/fzssh/channel.hpp 
new/fzssh-1.5.2/lib/fzssh/channel.hpp
--- old/fzssh-1.4.0/lib/fzssh/channel.hpp       2026-08-18 17:04:46.000000000 
+0200
+++ new/fzssh-1.5.2/lib/fzssh/channel.hpp       2026-11-13 18:54:24.000000000 
+0100
@@ -27,6 +27,10 @@
        virtual int inbuf(std::string_view &, int & error) = 0;
        virtual void consume_inbuf(size_t count) = 0;
        virtual void want_more() = 0;
+
+       /// An estimate of channel RTT. Only available client-side.
+       /// Measured during channel establishment, not updated afterwards.
+       virtual duration initial_rtt() = 0;
 };
 
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/fzssh/client.hpp 
new/fzssh-1.5.2/lib/fzssh/client.hpp
--- old/fzssh-1.4.0/lib/fzssh/client.hpp        2026-08-18 17:04:46.000000000 
+0200
+++ new/fzssh-1.5.2/lib/fzssh/client.hpp        2026-11-13 18:54:24.000000000 
+0100
@@ -5,6 +5,8 @@
 #include "ssh.hpp"
 #include "visibility_client.hpp"
 
+#include <libfilezilla/time.hpp>
+
 namespace fz {
 class logger_interface;
 class socket;
@@ -29,8 +31,8 @@
        client(client_parameters const& params, std::string_view username, 
socket_interface &, event_handler & h, logger_interface & logger);
        virtual ~client();
 
-       /// Make sure to destroy all channels prior to destroying the client
-       std::unique_ptr<socket_interface> open_channel(channel_type type, 
std::string_view const& name);
+       /// Wait for a read/write event before reading/writing on the channel
+       std::unique_ptr<socket_interface> open_channel(channel_type type, 
std::string_view const& name, channel_flags flags = channel_flags::none);
 
        /// Call after getting hostkey_verification_event
        void hostkey_decision(bool accept);
@@ -56,6 +58,13 @@
        ///
        /// Number of respones must be equal to number of prompts
        void auth_keyboard_interactive_response(std::vector<std::string> const& 
responses);
+
+       /// \brief Measure transport-level round-trip-time
+       ///
+       /// Will eventually result in pong_event
+       ///
+       /// Can only be called after authentication has succeeded.
+       void ping();
 };
 
 /// \private
@@ -92,6 +101,13 @@
 struct auth_keyboard_interactive_prompt_event_type;
 typedef event_with_source<auth_keyboard_interactive_prompt_event_type, 
client*, std::string /*name*/, std::string /*instruction*/, 
std::vector<keyboard_interactive_prompt> /*prompts*/> 
auth_keyboard_interactive_prompt_event;
 
+/// \private
+struct pong_event_type;
+/// The result of the RTT measurement.
+///
+/// If unsupported by the server, or during too frequent re-keying, pinging 
can fail and duration is not available.
+typedef event_with_source<pong_event_type, client*, std::optional<duration>> 
pong_event;
+
 }
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/fzssh/sftp/sftp_client.hpp 
new/fzssh-1.5.2/lib/fzssh/sftp/sftp_client.hpp
--- old/fzssh-1.4.0/lib/fzssh/sftp/sftp_client.hpp      2026-08-18 
17:04:46.000000000 +0200
+++ new/fzssh-1.5.2/lib/fzssh/sftp/sftp_client.hpp      2026-11-13 
18:54:24.000000000 +0100
@@ -22,6 +22,7 @@
        std::string_view longname_;
 };
 
+// Do not delete the sftp_client from inside the response handler. Instead 
return continuation::error and wait for done_event.
 class FZSSH_CLIENT_PUBLIC_SYMBOL response_handler
 {
 protected:
@@ -89,6 +90,9 @@
 
        void disconnect();
 
+       /// Returns an estimate of RTT, measured during initialization.
+       duration initial_rtt();
+
        struct done_event_type;
        typedef simple_event<done_event_type, sftp_client*> done_event;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/fzssh/ssh.hpp 
new/fzssh-1.5.2/lib/fzssh/ssh.hpp
--- old/fzssh-1.4.0/lib/fzssh/ssh.hpp   2026-08-18 17:04:46.000000000 +0200
+++ new/fzssh-1.5.2/lib/fzssh/ssh.hpp   2026-11-13 18:54:24.000000000 +0100
@@ -89,6 +89,26 @@
 
 bool FZSSH_PUBLIC_SYMBOL operator==(algorithm_info const& lhs, algorithm_info 
const& rhs);
 
+enum class channel_flags : unsigned
+{
+       none,
+
+       /// Even on SSH seession that may share multiple channels, force a huge 
window on the channel.
+       /// This may negatively affect interactivity on other channels
+       huge_window = 0x01
+};
+
+inline bool operator&(channel_flags lhs, channel_flags rhs) {
+       return (static_cast<std::underlying_type_t<channel_flags>>(lhs) & 
static_cast<std::underlying_type_t<channel_flags>>(rhs)) != 0;
+}
+inline channel_flags operator|(channel_flags lhs, channel_flags rhs) {
+       return 
static_cast<channel_flags>(static_cast<std::underlying_type_t<channel_flags>>(lhs)
 | static_cast<std::underlying_type_t<channel_flags>>(rhs));
+}
+inline channel_flags& operator|=(channel_flags & lhs, channel_flags rhs) {
+       lhs = lhs | rhs;
+       return lhs;
+}
+
 class transport;
 class FZSSH_PUBLIC_SYMBOL session : public event_source
 {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/privkey.cpp 
new/fzssh-1.5.2/lib/privkey.cpp
--- old/fzssh-1.4.0/lib/privkey.cpp     2026-08-18 17:04:46.000000000 +0200
+++ new/fzssh-1.5.2/lib/privkey.cpp     2026-11-13 18:54:24.000000000 +0100
@@ -913,7 +913,17 @@
 
        mpz_import(rsa_pub_.e, e.size(), 1, 1, 0, 0, reinterpret_cast<uint8_t 
const*>(e.data()));
        mpz_import(rsa_pub_.n, n.size(), 1, 1, 0, 0, reinterpret_cast<uint8_t 
const*>(n.data()));
-       if (mpz_sizeinbase(rsa_pub_.n, 2) < 1024) {
+
+       auto bits = mpz_sizeinbase(rsa_pub_.n, 2);
+       if (bits < 1024 || bits > 16384) {
+               return false;
+       }
+
+       if (mpz_cmp_ui(rsa_pub_.e, 1) <= 0 || !mpz_odd_p(rsa_pub_.e)) {
+               return false;
+       }
+
+       if (mpz_cmp(rsa_pub_.e, rsa_pub_.n) >= 0) {
                return false;
        }
 
@@ -926,6 +936,13 @@
        mpz_import(priv_.q, q.size(), 1, 1, 0, 0, reinterpret_cast<uint8_t 
const*>(q.data()));
        mpz_import(priv_.c, iqmp.size(), 1, 1, 0, 0, reinterpret_cast<uint8_t 
const*>(iqmp.data()));
 
+       if (mpz_cmp_ui(priv_.p, 1) <= 0) {
+               return false;
+       }
+       if (mpz_cmp_ui(priv_.q, 1) <= 0) {
+               return false;
+       }
+
        mpz p1;
        mpz_sub_ui(p1, priv_.p, 1);
        mpz_fdiv_r(priv_.a, priv_.d, p1);
@@ -936,6 +953,12 @@
        mpz_fdiv_r(priv_.b, priv_.d, q1);
        wipe(q1);
 
+       mpz pq;
+       mpz_mul(pq, priv_.p, priv_.q);
+       if (mpz_cmp(pq, rsa_pub_.n) != 0) {
+               return false;
+       }
+
        if (nettle_rsa_private_key_prepare(&priv_) != 1) {
                return false;
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/pubkey.cpp 
new/fzssh-1.5.2/lib/pubkey.cpp
--- old/fzssh-1.4.0/lib/pubkey.cpp      2026-08-18 17:04:46.000000000 +0200
+++ new/fzssh-1.5.2/lib/pubkey.cpp      2026-11-13 18:54:24.000000000 +0100
@@ -562,7 +562,19 @@
 
        mpz_import(pub_.e, e->size(), 1, 1, 0, 0, reinterpret_cast<uint8_t 
const*>(e->data()));
        mpz_import(pub_.n, n->size(), 1, 1, 0, 0, reinterpret_cast<uint8_t 
const*>(n->data()));
-       if (mpz_sizeinbase(pub_.n, 2) < 1024) {
+
+       auto bits = mpz_sizeinbase(pub_.n, 2);
+       if (bits < 1024 || bits > 16384) {
+               return false;
+       }
+
+       if (mpz_cmp_ui(pub_.e, 1) <= 0 || !mpz_odd_p(pub_.e)) {
+               return false;
+       }
+
+       // PKCS#1 requires e < n. While the SSH public keys on the wire aren't 
defined in terms of PKCS #1,
+       // and performance isn't affected unlike a huge n, reject large e 
anyhow.
+       if (mpz_cmp(pub_.e, pub_.n) >= 0) {
                return false;
        }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/sftp.cpp new/fzssh-1.5.2/lib/sftp.cpp
--- old/fzssh-1.4.0/lib/sftp.cpp        2026-08-18 17:04:46.000000000 +0200
+++ new/fzssh-1.5.2/lib/sftp.cpp        2026-11-13 18:54:24.000000000 +0100
@@ -537,9 +537,19 @@
                        logger.log(fz::logmsg::error, "Could not extract 
extended attribute count"sv);
                        return {};
                }
+               if (extended_count > data.size() / 8) { // Two strings per 
attribute
+                       logger.log(fz::logmsg::error, "Nonsensical extended 
attribute count %u for %u byte(s) of remaining data"sv, extended_count, 
data.size());
+                       return {};
+               }
                for (uint32_t j = 0; j < extended_count; ++j) {
-                       if (!extract_string(data, string_type::ascii, false) || 
!extract_string(data, string_type::blob, true)) {
-                               logger.log(fz::logmsg::error, "Could not 
extract extended attribute %u"sv, j);
+                       auto name = extract_string(data, string_type::ascii, 
false);
+                       if (!name) {
+                               logger.log(fz::logmsg::error, "Could not 
extract name of extended attribute %u of %u: %s"sv, j, extended_count, *name);
+                               return {};
+                       }
+                       auto value = extract_blob(data);
+                       if (!value) {
+                               logger.log(fz::logmsg::error, "Could not 
extract value of extended attribute %u of %u with name %s: %s"sv, j, 
extended_count, *name, *value);
                                return {};
                        }
                }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/sftp.hpp new/fzssh-1.5.2/lib/sftp.hpp
--- old/fzssh-1.4.0/lib/sftp.hpp        2026-08-18 17:04:46.000000000 +0200
+++ new/fzssh-1.5.2/lib/sftp.hpp        2026-11-13 18:54:24.000000000 +0100
@@ -7,8 +7,9 @@
 #include <libfilezilla/event_handler.hpp>
 #include <libfilezilla/socket.hpp>
 
-#include "fzssh/visibility.hpp"
+#include "fzssh/channel.hpp"
 #include "fzssh/sftp/sftp.hpp"
+#include "fzssh/visibility.hpp"
 
 namespace fz {
 
@@ -102,6 +103,8 @@
        buffer inbuf_;
 
        bool is_retrying_process_{};
+       bool channel_is_fzssh_{};
+
        compatibility_flags compatibility_flags_{};
 
 private:
@@ -114,7 +117,6 @@
 
        std::optional<packet_type> in_packet_;
 
-       bool channel_is_fzssh_{};
 };
 
 void FZSSH_PUBLIC_SYMBOL write_attributes(buffer& buf, attributes const& 
attrs);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/transport.cpp 
new/fzssh-1.5.2/lib/transport.cpp
--- old/fzssh-1.4.0/lib/transport.cpp   2026-08-18 17:04:46.000000000 +0200
+++ new/fzssh-1.5.2/lib/transport.cpp   2026-11-13 18:54:24.000000000 +0100
@@ -84,6 +84,9 @@
                idtos(SSH_MSG_CHANNEL_REQUEST);
                idtos(SSH_MSG_CHANNEL_SUCCESS);
                idtos(SSH_MSG_CHANNEL_FAILURE);
+
+               idtos(SSH_MSG_PING);
+               idtos(SSH_MSG_PONG);
        default:
                return {};
        }
@@ -108,6 +111,9 @@
        else if (id >= message_id::SSH_MSG_CONNECTION_MIN && id <= 
message_id::SSH_MSG_CONNECTION_MAX) {
                return message_type::connection;
        }
+       else if (id >= message_id::SSH_MSG_LOCAL_EXTENSION_MIN) {
+               return message_type::local_extension;
+       }
        return message_type::unknown;
 }
 
@@ -207,6 +213,11 @@
                }
        }
 }
+
+compatibility_flags sanitize(compatibility_flags flags)
+{
+       return 
static_cast<compatibility_flags>(static_cast<std::underlying_type_t<compatibility_flags>>(flags)
 & 0xffffffu);
+}
 }
 
 transport::transport(session &sess, parameters const& params, socket_interface 
& s, bool server, event_handler & h, logger_interface & logger)
@@ -216,7 +227,7 @@
     , handler_(h)
     , s_(s)
     , server_(server)
-    , compatibility_flags_(params.compatibility_flags_)
+    , compatibility_flags_(sanitize(params.compatibility_flags_))
     , read_event_(&s_, socket_event_flag::read, 0)
     , write_event_(&s_, socket_event_flag::write, 0)
 {
@@ -500,6 +511,7 @@
                                // Could verify/parse the rest here.
 
                                peer_version_ = line;
+                               check_peer_compatibility(true);
                                logger_.log(logmsg::debug_info, "Received 
protover: %s"sv, peer_version_);
                                inbuf_.consume(i);
                                decrypted_ = 0;
@@ -931,6 +943,9 @@
                else if (type == message_type::connection) {
                        return connection_protocol_->process_binary_packet(id, 
packet);
                }
+               else if (type == message_type::local_extension) {
+                       return process_local_extension(id, packet);
+               }
                return continuation::next;
        };
 
@@ -1902,6 +1917,10 @@
        if (id <= message_id::SSH_MSG_TRANSPORT_MAX && id != 
message_id::SSH_MSG_SERVICE_REQUEST && id != 
message_id::SSH_MSG_SERVICE_ACCEPT) {
                return false;
        }
+       else if (id == message_id::SSH_MSG_PING || id == 
message_id::SSH_MSG_PONG) {
+               // Timing is important, these cannot be queued
+               return false;
+       }
 
        return k != keying_state::no;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/lib/transport.hpp 
new/fzssh-1.5.2/lib/transport.hpp
--- old/fzssh-1.4.0/lib/transport.hpp   2026-08-18 17:04:46.000000000 +0200
+++ new/fzssh-1.5.2/lib/transport.hpp   2026-11-13 18:54:24.000000000 +0100
@@ -13,7 +13,6 @@
 
 #include <map>
 
-
 namespace fz {
 
 class logger_interface;
@@ -36,6 +35,7 @@
        userauth,
        userauth_method, // A subset of userauth
        connection,
+       local_extension,
 };
 
 enum class message_id : unsigned
@@ -82,7 +82,7 @@
        SSH_MSG_KEX_MIN = 30,
        SSH_MSG_KEX_MAX = 49,
 
-       SSH_MSG_TRANSPORT_MIN = 0,
+       SSH_MSG_TRANSPORT_MIN = 1,
        SSH_MSG_TRANSPORT_MAX = 49,
 
        // Userauth protocol
@@ -122,6 +122,12 @@
 
        SSH_MSG_CONNECTION_MIN = 80,
        SSH_MSG_CONNECTION_MAX = 127,
+
+       // Local extensions
+       SSH_MSG_LOCAL_EXTENSION_MIN = 192,
+
+       SSH_MSG_PING = 192,
+       SSH_MSG_PONG = 193
 };
 
 inline message_id operator&(message_id lhs, message_id rhs) {
@@ -224,6 +230,11 @@
        exclusive
 };
 
+namespace private_compatibility_flags
+{
+       constexpr auto chokes_on_hostkeys_advertisement = 
static_cast<compatibility_flags>(1u << 31);
+}
+
 class FZSSH_PUBLIC_SYMBOL transport : public event_handler
 {
 public:
@@ -263,6 +274,8 @@
 
        bool disconnecting_{};
 
+       bool server() const { return server_; }
+
 private:
        void on_socket_event(fz::socket_event_source*, fz::socket_event_flag 
type, int error);
 
@@ -281,7 +294,7 @@
        continuation process_ignore(std::string_view packet);
        continuation process_unimplemented(std::string_view packet);
        continuation process_debug(std::string_view packet);
-       continuation process_kexinit(std::string_view packet);
+       virtual continuation process_kexinit(std::string_view packet);
        virtual continuation process_dh_gex_request(std::string_view 
/*packet*/) { return continuation::error_badside; }
        virtual continuation process_dh_gex_group(std::string_view /*packet*/) 
{ return continuation::error_badside; }
        virtual continuation process_dh_init(std::string_view /*name*/, 
std::string_view /*packet*/) { return continuation::error_badside; }
@@ -291,9 +304,12 @@
        virtual continuation process_service_request(std::string_view 
/*packet*/) { return continuation::error_badside; }
        virtual continuation process_service_accept(std::string_view 
/*packet*/) { return continuation::error_badside; }
 
+       virtual void check_peer_compatibility(bool preliminary) = 0;
        continuation process_ext_info(std::string_view packet);
        virtual continuation process_ext_info(std::string_view /*name*/, 
std::string_view /*value*/) { return continuation::next; }
 
+       virtual continuation process_local_extension(message_id /*id*/, 
std::string_view /*packet*/) { return continuation::error_unimplemented; }
+
        virtual bool setup_hostkey() = 0;
 
        virtual continuation finalize_kexinit(std::string_view peer_hostkeys, 
bool bad_guess) = 0;
@@ -345,6 +361,9 @@
        compatibility_flags compatibility_flags_{};
        compatibility_flags used_compatibility_flags_{};
 
+       std::string own_version_;
+       std::string peer_version_;
+
 private:
        bool augment_message_id(message_id & id, message_type type);
        bool should_suppress_read_socket_error() const;
@@ -357,8 +376,6 @@
        hash_algorithm exchange_hash_alg_{};
        buffer peer_kex_payload_;
        buffer own_kex_payload_;
-       std::string own_version_;
-       std::string peer_version_;
        kex_init_data<std::string> own_kex_init_data_;
 
        bool strict_kex_extension_{};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/meson.build new/fzssh-1.5.2/meson.build
--- old/fzssh-1.4.0/meson.build 2026-08-18 17:05:42.687509800 +0200
+++ new/fzssh-1.5.2/meson.build 2026-11-13 19:22:40.433155300 +0100
@@ -1,6 +1,6 @@
 project('fzssh', ['cpp'],
        meson_version: '>=1.3',
-       version: '1.4.0',
+       version: '1.5.2',
        default_options: ['cpp_std=c++20,c++2a', 'b_pie=true', 
'warning_level=3']
 )
 
@@ -10,9 +10,9 @@
 # If any interfaces have been added since the last public release, then 
increment age.
 # If any interfaces have been removed or changed since the last public 
release, then set age to 0.
 # CURRENT:REVISION:AGE
-soversion = '14.0.0'
+soversion = '16.1.0'
 
-lfz_dep = dependency('libfilezilla', version: '>= 0.57.0')
+lfz_dep = dependency('libfilezilla', version: '>= 0.58.0')
 nettle_dep = dependency('nettle', version: '>= 3.10')
 hogweed_dep = dependency('hogweed', version: '>= 3.10')
 gmp_dep = dependency('gmp', version: '>= 6.2')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/fzssh-1.4.0/tests/keyfile_test.cpp 
new/fzssh-1.5.2/tests/keyfile_test.cpp
--- old/fzssh-1.4.0/tests/keyfile_test.cpp      2026-08-18 17:04:46.000000000 
+0200
+++ new/fzssh-1.5.2/tests/keyfile_test.cpp      2026-11-13 18:54:24.000000000 
+0100
@@ -1010,6 +1010,97 @@
        assert(test_key(fz::base64_decode_s(pfx_multiple_keys), logger, 
"storepass"sv, 2));
 }
 
+void test_badkeys(fz::logger_interface & logger)
+{
+       // n != pq
+       constexpr auto bad_rsa_key1 =
+               "-----BEGIN OPENSSH PRIVATE KEY-----\n"
+               
"b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAlwAAAAdzc2gtcn\n"
+               
"NhAAAAAwEAAQAAAIEAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAjQEjRWeBI0VngAAAAH\n"
+               
"c3NoLXJzYQAAAIEAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAQABAAAAAQEAAAABAQ\n"
+               
"AABAEAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAABAEAgAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               "AAAAAAAAAAAAAwAAABNwb2NAZXhhbXBsZS5pbnZhbGlkAQIDBAUG\n"
+               "-----END OPENSSH PRIVATE KEY-----\n"sv;
+
+       // p=1
+       constexpr auto bad_rsa_key2 =
+               "-----BEGIN OPENSSH PRIVATE KEY-----\n"
+               
"b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAlwAAAAdzc2gtcn\n"
+               
"NhAAAAAwEAAQAAAIEAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAATAEREREREREREAAAAH\n"
+               
"c3NoLXJzYQAAAIEAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAQABAAAAAQEAAAABAQ\n"
+               
"AAAAEBAAAEAQCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"
+               
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAABnBvYy1wMQECAw==\n"
+               "-----END OPENSSH PRIVATE KEY-----\n"sv;
+
+
+       assert(!test_key(bad_rsa_key1, logger));
+       assert(!test_key(bad_rsa_key2, logger));
+}
+
 }
 
 int main()
@@ -1027,5 +1118,7 @@
 
        test_pubkeys(log);
 
+       test_badkeys(log);
+
        return 0;
 }

Reply via email to