Commit 7fdc10d9 authored by Bailey Berro's avatar Bailey Berro Committed by Commit Bot

Implement Kerberos-ChromAD remount in SmbService::Remount.

This change implements the logic to check whether a mount was originally
mounted with ChromAD Kerberos, and if so passes the user's username and
workgroup when attempting to remount.

Bug: chromium:757625
Change-Id: I3f1d4261d118f11cb410c7c44a8150423c99fbf9
Reviewed-on: https://chromium-review.googlesource.com/1098115
Commit-Queue: Bailey Berro <baileyberro@chromium.org>
Reviewed-by: default avatarZentaro Kavanagh <zentaro@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571906}
parent 6d7f9dd2
......@@ -176,12 +176,26 @@ void SmbService::Remount(const ProvidedFileSystemInfo& file_system_info) {
GetSharePathFromFileSystemId(file_system_info.file_system_id());
const int32_t mount_id =
GetMountIdFromFileSystemId(file_system_info.file_system_id());
const bool is_kerberos_chromad =
IsKerberosChromadFileSystemId(file_system_info.file_system_id());
std::string workgroup;
std::string username;
if (is_kerberos_chromad) {
user_manager::User* user =
chromeos::ProfileHelper::Get()->GetUserByProfile(profile_);
DCHECK(user);
DCHECK(user->IsActiveDirectoryUser());
ParseUserPrincipalName(user->GetDisplayEmail(), &username, &workgroup);
}
// An empty password is passed to Remount to conform with the credentials API
// which expects username & workgroup strings along with a password file
// descriptor.
GetSmbProviderClient()->Remount(
share_path, mount_id, "" /* workgroup */, "" /* username */,
share_path, mount_id, workgroup, username,
temp_file_manager_->WritePasswordToFile("" /* password */),
base::BindOnce(&SmbService::OnRemountResponse, AsWeakPtr(),
file_system_info.file_system_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