diff --git a/Cargo.lock b/Cargo.lock index 33c740d..7c3c02a 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 26a56a7..da38708 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 } diff --git a/flake.nix b/flake.nix index fb776f2..b4775e5 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" diff --git a/src/config.rs b/src/config.rs index 1c0f2ec..965b7dd 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, diff --git a/src/connection.rs b/src/connection.rs index e4cf55a..2d458e9 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:#}") } @@ -262,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);