diff options
| author | David Lönnhager <david.l@mullvad.net> | 2020-09-21 12:50:05 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2020-09-22 13:34:47 +0200 |
| commit | a0cb0636a460999f67363fb2160ee0144fcc3642 (patch) | |
| tree | c1d8883f60c5f6943d9aba01aa2635e6785f84e2 | |
| parent | f51dbeaa2cd060d4c7be1bbe86e3ced3f697b3f4 (diff) | |
| download | mullvadvpn-a0cb0636a460999f67363fb2160ee0144fcc3642.tar.xz mullvadvpn-a0cb0636a460999f67363fb2160ee0144fcc3642.zip | |
Upgrade dbus-rs
| -rw-r--r-- | Cargo.lock | 6 | ||||
| -rw-r--r-- | talpid-core/Cargo.toml | 2 | ||||
| -rw-r--r-- | talpid-core/src/dns/linux/network_manager.rs | 12 | ||||
| -rw-r--r-- | talpid-core/src/dns/linux/systemd_resolved.rs | 28 |
4 files changed, 27 insertions, 21 deletions
diff --git a/Cargo.lock b/Cargo.lock index edc513700a..41b4eba987 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -337,7 +337,7 @@ dependencies = [ [[package]] name = "dbus" -version = "0.6.5" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.77 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2305,7 +2305,7 @@ dependencies = [ "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", - "dbus 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "dbus 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "duct 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)", "err-derive 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3158,7 +3158,7 @@ dependencies = [ "checksum darling 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" "checksum darling_core 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" "checksum darling_macro 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" -"checksum dbus 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "48b5f0f36f1eebe901b0e6bee369a77ed3396334bf3f09abd46454a576f71819" +"checksum dbus 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "22c08adfeb70c940c14d8af988fa854dcb5529e6141f2397e4e0fa4c9375d094" "checksum derive-try-from-primitive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "81dbd65eb15734b6d50dc6ac86f14f928462be0a5df6bda17761e909071ede5d" "checksum derive_builder 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2658621297f2cf68762a6f7dc0bb7e1ff2cfd6583daef8ee0fed6f7ec468ec0" "checksum derive_builder_core 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2791ea3e372c8495c0bc2033991d76b512cd799d07491fbd6890124db9458bef" diff --git a/talpid-core/Cargo.toml b/talpid-core/Cargo.toml index b978fdd5aa..1f374152c6 100644 --- a/talpid-core/Cargo.toml +++ b/talpid-core/Cargo.toml @@ -47,7 +47,7 @@ jnix = { version = "0.2.3", features = ["derive"] } [target.'cfg(target_os = "linux")'.dependencies] -dbus = "0.6" +dbus = "0.9" failure = "0.1" notify = "4.0" resolv-conf = "0.6.1" diff --git a/talpid-core/src/dns/linux/network_manager.rs b/talpid-core/src/dns/linux/network_manager.rs index db58ed6994..f2b2f6d7fb 100644 --- a/talpid-core/src/dns/linux/network_manager.rs +++ b/talpid-core/src/dns/linux/network_manager.rs @@ -1,7 +1,8 @@ use dbus::{ arg::{Append, RefArg, Variant}, - stdintf::*, - BusType, Member, Message, + ffidisp::{stdintf::*, BusType, ConnPath, Connection}, + message::Message, + strings::Member, }; use lazy_static::lazy_static; use std::{ @@ -72,7 +73,7 @@ lazy_static! { } pub struct NetworkManager { - dbus_connection: dbus::Connection, + dbus_connection: Connection, device: Option<dbus::Path<'static>>, settings_backup: Option<HashMap<String, HashMap<String, Variant<Box<dyn RefArg>>>>>, } @@ -80,8 +81,7 @@ pub struct NetworkManager { impl NetworkManager { pub fn new() -> Result<Self> { - let dbus_connection = - dbus::Connection::get_private(BusType::System).map_err(Error::Dbus)?; + let dbus_connection = Connection::get_private(BusType::System).map_err(Error::Dbus)?; let manager = NetworkManager { dbus_connection, device: None, @@ -134,7 +134,7 @@ impl NetworkManager { Ok(()) } - fn as_manager(&self) -> dbus::ConnPath<'_, &dbus::Connection> { + fn as_manager(&self) -> ConnPath<'_, &Connection> { self.dbus_connection .with_path(NM_BUS, NM_OBJECT_PATH, RPC_TIMEOUT_MS) } diff --git a/talpid-core/src/dns/linux/systemd_resolved.rs b/talpid-core/src/dns/linux/systemd_resolved.rs index 1c0d2ae0fb..8039b9b112 100644 --- a/talpid-core/src/dns/linux/systemd_resolved.rs +++ b/talpid-core/src/dns/linux/systemd_resolved.rs @@ -1,7 +1,13 @@ use super::RESOLV_CONF_PATH; use crate::linux::iface_index; use dbus::{ - arg::RefArg, stdintf::*, BusType, Interface, Member, Message, MessageItem, MessageItemArray, + arg::{ + messageitem::{MessageItem, MessageItemArray}, + RefArg, + }, + ffidisp::{stdintf::*, BusType, ConnPath, Connection}, + message::Message, + strings::{Interface, Member}, Signature, }; use lazy_static::lazy_static; @@ -63,17 +69,17 @@ const RPC_TIMEOUT_MS: i32 = 1000; lazy_static! { static ref LINK_INTERFACE: Interface<'static> = - Interface::from_slice(b"org.freedesktop.resolve1.Link").unwrap(); + Interface::from_slice("org.freedesktop.resolve1.Link\0").unwrap(); static ref MANAGER_INTERFACE: Interface<'static> = - Interface::from_slice(b"org.freedesktop.resolve1.Manager").unwrap(); - static ref GET_LINK_METHOD: Member<'static> = Member::from_slice(b"GetLink").unwrap(); - static ref SET_DNS_METHOD: Member<'static> = Member::from_slice(b"SetDNS").unwrap(); - static ref SET_DOMAINS_METHOD: Member<'static> = Member::from_slice(b"SetDomains").unwrap(); - static ref REVERT_METHOD: Member<'static> = Member::from_slice(b"Revert").unwrap(); + Interface::from_slice("org.freedesktop.resolve1.Manager\0").unwrap(); + static ref GET_LINK_METHOD: Member<'static> = Member::from_slice("GetLink\0").unwrap(); + static ref SET_DNS_METHOD: Member<'static> = Member::from_slice("SetDNS\0").unwrap(); + static ref SET_DOMAINS_METHOD: Member<'static> = Member::from_slice("SetDomains\0").unwrap(); + static ref REVERT_METHOD: Member<'static> = Member::from_slice("Revert\0").unwrap(); } pub struct SystemdResolved { - dbus_connection: dbus::Connection, + dbus_connection: Connection, interface_link: Option<(String, dbus::Path<'static>)>, } @@ -81,7 +87,7 @@ impl SystemdResolved { pub fn new() -> Result<Self> { let result = (|| { let dbus_connection = - dbus::Connection::get_private(BusType::System).map_err(Error::ConnectDBus)?; + Connection::get_private(BusType::System).map_err(Error::ConnectDBus)?; let systemd_resolved = SystemdResolved { dbus_connection, interface_link: None, @@ -144,7 +150,7 @@ impl SystemdResolved { } } - fn as_manager_object(&self) -> dbus::ConnPath<'_, &dbus::Connection> { + fn as_manager_object(&self) -> ConnPath<'_, &Connection> { self.dbus_connection .with_path(RESOLVED_BUS, "/org/freedesktop/resolve1", RPC_TIMEOUT_MS) } @@ -152,7 +158,7 @@ impl SystemdResolved { fn as_link_object<'a>( &'a self, link_object_path: dbus::Path<'a>, - ) -> dbus::ConnPath<'a, &'a dbus::Connection> { + ) -> ConnPath<'a, &'a Connection> { self.dbus_connection .with_path(RESOLVED_BUS, link_object_path, RPC_TIMEOUT_MS) } |
