Commit 7b1dc231 authored by Jimmy Gong's avatar Jimmy Gong Committed by Commit Bot

Stop remounting SMB shares that require credentials

- Shares that require credentials are no longer remembered.
- Previously, all shares would be persisted regardless of whether or
  not they had credentials.
- A future CL will resume persistence on all shares.

Bug: chromium:913691
Test: emerges
Change-Id: I7dd5290d8b5af60bf6a9d14ac69e2bef5ba6c1c2
Reviewed-on: https://chromium-review.googlesource.com/c/1372915Reviewed-by: default avatarBailey Berro <baileyberro@chromium.org>
Reviewed-by: default avatarZentaro Kavanagh <zentaro@chromium.org>
Commit-Queue: Bailey Berro <baileyberro@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619796}
parent 40a45adb
......@@ -190,6 +190,10 @@ void SmbService::CallMount(const file_system_provider::MountOptions& options,
}
}
// TODO(jimmyxgong): Remove once authenticated dormant shares are
// implemented.
const bool has_credentials = !username.empty() || !password.empty();
SmbUrl parsed_url(share_path.value());
if (!parsed_url.IsValid()) {
FireMountCallback(
......@@ -210,8 +214,8 @@ void SmbService::CallMount(const file_system_provider::MountOptions& options,
temp_file_manager_->WritePasswordToFile(password),
base::BindOnce(&SmbService::OnMountResponse, AsWeakPtr(),
base::Passed(&callback), options, share_path,
use_chromad_kerberos,
should_open_file_manager_after_mount));
use_chromad_kerberos, should_open_file_manager_after_mount,
has_credentials));
profile_->GetPrefs()->SetString(prefs::kMostRecentlyUsedNetworkFileShareURL,
share_path.value());
......@@ -223,6 +227,7 @@ void SmbService::OnMountResponse(
const base::FilePath& share_path,
bool is_kerberos_chromad,
bool should_open_file_manager_after_mount,
bool has_credentials,
smbprovider::ErrorType error,
int32_t mount_id) {
if (error != smbprovider::ERROR_OK) {
......@@ -236,6 +241,11 @@ void SmbService::OnMountResponse(
mount_options.file_system_id =
CreateFileSystemId(mount_id, share_path, is_kerberos_chromad);
// Do not remount shares that have credentials since there is not yet a way
// to reprompt users for credentials.
// TODO(jimmyxgong): Remove once authenticated dormant shares are implemented.
mount_options.persistent = !has_credentials;
base::File::Error result =
GetProviderService()->MountFileSystem(provider_id_, mount_options);
......
......@@ -73,6 +73,7 @@ class SmbService : public KeyedService,
const base::FilePath& share_path,
bool is_kerberos_chromad,
bool should_open_file_manager_after_mount,
bool has_credentials,
smbprovider::ErrorType error,
int32_t mount_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment