From b0b2d21ca044770579b61ae7013d19a8004e511b Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 4 Mar 2026 15:26:33 +0100 Subject: [PATCH 1/5] silence more innocent websocket errors fixes #676 Signed-off-by: Robin Appelman --- src/connection.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/connection.rs b/src/connection.rs index e4cf55ae..91bdf564 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -226,6 +226,7 @@ pub async fn handle_user_socket( // hack while warp only has opaque error types match formatted.as_str() { "WebSocket protocol error: Connection reset without closing handshake" + | "Broken pipe (os error 32)" | "IO error: Connection reset by peer (os error 104)" => { log::debug!("websocket error: {e:#}") } From 7974727869dc2b26ab6e3ca36679b64ca5944e84 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 4 Mar 2026 15:36:34 +0100 Subject: [PATCH 2/5] fix: bind to ipv6 dualstack by default Signed-off-by: Robin Appelman --- src/config.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/config.rs b/src/config.rs index 1c0f2ec4..965b7dd1 100644 --- a/src/config.rs +++ b/src/config.rs @@ -20,7 +20,7 @@ use sqlx::any::AnyConnectOptions; use std::convert::{TryFrom, TryInto}; use std::env::var; use std::fmt::{Debug, Display, Formatter}; -use std::net::{IpAddr, Ipv4Addr, SocketAddr}; +use std::net::{IpAddr, Ipv6Addr, SocketAddr}; use std::path::{Path, PathBuf}; use std::str::FromStr; @@ -183,9 +183,7 @@ impl TryFrom for Config { let bind = match config.socket { Some(socket) => Bind::Unix(socket, socket_permissions), None => { - let ip = config - .bind - .unwrap_or_else(|| IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0))); + let ip = config.bind.unwrap_or(IpAddr::V6(Ipv6Addr::UNSPECIFIED)); let port = config.port.unwrap_or(7867); Bind::Tcp((ip, port).into()) } @@ -194,9 +192,7 @@ impl TryFrom for Config { let metrics_bind = match (config.metrics_socket, config.metrics_port) { (Some(socket), _) => Some(Bind::Unix(socket, socket_permissions)), (None, Some(port)) => { - let ip = config - .bind - .unwrap_or_else(|| IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0))); + let ip = config.bind.unwrap_or(IpAddr::V6(Ipv6Addr::UNSPECIFIED)); Some(Bind::Tcp((ip, port).into())) } _ => None, From 24e967c84db42cae1a959b462bd428134a42cd9d Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 4 Mar 2026 15:37:22 +0100 Subject: [PATCH 3/5] fix: trim incomming credentials Signed-off-by: Robin Appelman --- src/connection.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/connection.rs b/src/connection.rs index 91bdf564..2d458e94 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -263,11 +263,13 @@ async fn socket_auth( let username_msg = read_socket_auth_message(rx).await?; let username = username_msg .to_str() - .map_err(|_| AuthenticationError::InvalidMessage)?; + .map_err(|_| AuthenticationError::InvalidMessage)? + .trim(); let password_msg = read_socket_auth_message(rx).await?; let password = password_msg .to_str() - .map_err(|_| AuthenticationError::InvalidMessage)?; + .map_err(|_| AuthenticationError::InvalidMessage)? + .trim(); // cleanup all pre_auth tokens older than 15s let cutoff = Instant::now() - Duration::from_secs(15); From dc4ab75dfc4624704afcb3f9c7f6087c993aac7b Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 4 Mar 2026 15:39:36 +0100 Subject: [PATCH 4/5] chore: fix flake deprecation Signed-off-by: Robin Appelman --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index fb776f23..b4775e5a 100644 --- a/flake.nix +++ b/flake.nix @@ -27,7 +27,7 @@ }; lib = pkgs.lib; - hostTarget = pkgs.hostPlatform.config; + hostTarget = pkgs.stdenv.hostPlatform.config; targets = [ "x86_64-unknown-linux-musl" "i686-unknown-linux-musl" From 7f55d06223db7d0175b98d7cfe6f1a13bca5105c Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 6 Mar 2026 13:26:17 +0100 Subject: [PATCH 5/5] config parser 0.15.2 Signed-off-by: Robin Appelman --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 33c740d6..7c3c02a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -621,7 +621,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -2068,7 +2068,7 @@ dependencies = [ "once_cell", "socket2 0.6.3", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.60.2", ] [[package]] @@ -2341,7 +2341,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -2423,7 +2423,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 26a56a78..da387087 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ rand = { version = "0.8.5", features = ["small_rng"] } ahash = "0.8.12" flexi_logger = { version = "0.31.8", features = ["colors"] } tokio-stream = { version = "0.1.17", features = ["net"] } -nextcloud-config-parser = "0.15.1" +nextcloud-config-parser = "0.15.2" url = "2.5.4" clap = { version = "4.5.43", features = ["derive"] } sd-notify = { version = "0.5.0", optional = true }