summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2020-08-12 11:08:36 +0200
committerDavid Lönnhager <david.l@mullvad.net>2020-08-13 13:34:43 +0200
commit3ba3cce571514d5bdb877915d4f171b1904fa152 (patch)
tree44054648425ab64cf5e426a064fd8e4453ec9425
parent1a293e8167561105d3ef0194f180e72fa367caea (diff)
downloadmullvadvpn-3ba3cce571514d5bdb877915d4f171b1904fa152.tar.xz
mullvadvpn-3ba3cce571514d5bdb877915d4f171b1904fa152.zip
Check ownership of windows.old rather than the specific appdata directory
-rw-r--r--mullvad-daemon/src/settings.rs21
1 files changed, 9 insertions, 12 deletions
diff --git a/mullvad-daemon/src/settings.rs b/mullvad-daemon/src/settings.rs
index 5c20938ef4..96b83626f1 100644
--- a/mullvad-daemon/src/settings.rs
+++ b/mullvad-daemon/src/settings.rs
@@ -327,19 +327,11 @@ mod windows {
let prefix = components.next().ok_or(Error::NothingToMigrate)?;
let root = components.next().ok_or(Error::NothingToMigrate)?;
- let source_settings_dir = Path::new(&prefix)
- .join(&root)
- .join(MIGRATION_DIRNAME)
- .join(&components);
- if !source_settings_dir.exists() {
- return Err(Error::NothingToMigrate);
- }
+ let windows_old_dir = Path::new(&prefix).join(&root).join(MIGRATION_DIRNAME);
- let security_info = SecurityInformation::from_file(
- &source_settings_dir.as_path(),
- OWNER_SECURITY_INFORMATION,
- )
- .map_err(Error::SecurityInformation)?;
+ let security_info =
+ SecurityInformation::from_file(windows_old_dir.as_path(), OWNER_SECURITY_INFORMATION)
+ .map_err(Error::SecurityInformation)?;
let owner_sid = security_info.owner().ok_or(Error::WrongOwner)?;
@@ -349,6 +341,11 @@ mod windows {
return Err(Error::WrongOwner);
}
+ let source_settings_dir = Path::new(&windows_old_dir).join(&components);
+ if !source_settings_dir.exists() {
+ return Err(Error::NothingToMigrate);
+ }
+
if !destination_settings_dir.exists() {
fs::create_dir_all(&destination_settings_dir).map_err(Error::IoError)?;
}