diff --git a/Cargo.lock b/Cargo.lock index 09cd85183..a62ea5ce5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -608,9 +608,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bitvec" @@ -820,9 +820,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.98" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" +checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc" [[package]] name = "cfb-mode" @@ -3733,16 +3733,16 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "libc", "redox_syscall 0.4.1", ] [[package]] name = "libsqlite3-sys" -version = "0.28.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" dependencies = [ "cc", "openssl-sys", @@ -4060,7 +4060,7 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "cfg-if", "cfg_aliases", "libc", @@ -4283,7 +4283,7 @@ version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -4999,7 +4999,7 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "lazy_static", "num-traits", "rand 0.8.5", @@ -5290,7 +5290,7 @@ version = "11.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e29830cbb1290e404f24c73af91c5d8d631ce7e128691e9477556b540cd01ecd" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", ] [[package]] @@ -5637,11 +5637,11 @@ dependencies = [ [[package]] name = "rusqlite" -version = "0.31.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" +checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -5691,7 +5691,7 @@ version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -5795,7 +5795,7 @@ version = "14.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7803e8936da37efd9b6d4478277f4b2b9bb5cdb37a113e8d63222e58da647e63" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "cfg-if", "clipboard-win", "fd-lock", @@ -6218,7 +6218,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01607fe2e61894468c6dc0b26103abb073fb08b79a3d9e4b6d76a1a341549958" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", ] [[package]] @@ -6576,7 +6576,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "658bc6ee10a9b4fcf576e9b0819d95ec16f4d2c02d39fd83ac1c8789785c4a42" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.6.0", "core-foundation", "system-configuration-sys 0.6.0", ] diff --git a/Cargo.toml b/Cargo.toml index 95d951a3b..15457d84b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -172,7 +172,7 @@ num-traits = "0.2" once_cell = "1.18.0" rand = "0.8" regex = "1.10" -rusqlite = "0.31" +rusqlite = "0.32" sanitize-filename = "0.5" serde_json = "1" serde = "1.0" diff --git a/src/sql.rs b/src/sql.rs index 17c19606b..c1f37b48a 100644 --- a/src/sql.rs +++ b/src/sql.rs @@ -105,9 +105,11 @@ impl Sql { // Test that the key is correct using a single connection. let connection = Connection::open(&self.dbfile)?; - connection - .pragma_update(None, "key", &passphrase) - .context("failed to set PRAGMA key")?; + if !passphrase.is_empty() { + connection + .pragma_update(None, "key", &passphrase) + .context("Failed to set PRAGMA key")?; + } let key_is_correct = connection .query_row("SELECT count(*) FROM sqlite_master", [], |_row| Ok(())) .is_ok(); @@ -324,8 +326,10 @@ impl Sql { let pool = lock.take().context("SQL connection pool is not open")?; let conn = pool.get().await?; - conn.pragma_update(None, "rekey", passphrase.clone()) - .context("failed to set PRAGMA rekey")?; + if !passphrase.is_empty() { + conn.pragma_update(None, "rekey", passphrase.clone()) + .context("Failed to set PRAGMA rekey")?; + } drop(pool); *lock = Some(Self::new_pool(&self.dbfile, passphrase.to_string())?); @@ -697,7 +701,9 @@ fn new_connection(path: &Path, passphrase: &str) -> Result { conn.pragma_update(None, "temp_store", "memory")?; } - conn.pragma_update(None, "key", passphrase)?; + if !passphrase.is_empty() { + conn.pragma_update(None, "key", passphrase)?; + } // Try to enable auto_vacuum. This will only be // applied if the database is new or after successful // VACUUM, which usually happens before backup export.