Commit 607c2083 authored by Bailey Berro's avatar Bailey Berro Committed by Commit Bot

Check NetBios Discovery policy when adding host locators

This change enforces the NetBiosShareDiscoveryEnabled policy. If enforced,
no NetBios discovery will be set up or performed when by the SmbService.

Bug: 757625
Change-Id: I8bcd8d049dc597db208f9c38fae5a17b8069dd28
Reviewed-on: https://chromium-review.googlesource.com/1185405
Commit-Queue: Bailey Berro <baileyberro@chromium.org>
Reviewed-by: default avatarZentaro Kavanagh <zentaro@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585516}
parent 22b7bf72
...@@ -320,7 +320,11 @@ void SmbService::FireMountCallback(MountResponse callback, ...@@ -320,7 +320,11 @@ void SmbService::FireMountCallback(MountResponse callback,
void SmbService::RegisterHostLocators() { void SmbService::RegisterHostLocators() {
SetUpMdnsHostLocator(); SetUpMdnsHostLocator();
SetUpNetBiosHostLocator(); if (IsNetBiosDiscoveryEnabled()) {
SetUpNetBiosHostLocator();
} else {
LOG(WARNING) << "SmbService: NetBios discovery disabled.";
}
} }
void SmbService::SetUpMdnsHostLocator() { void SmbService::SetUpMdnsHostLocator() {
...@@ -342,6 +346,10 @@ bool SmbService::IsAllowedByPolicy() const { ...@@ -342,6 +346,10 @@ bool SmbService::IsAllowedByPolicy() const {
return profile_->GetPrefs()->GetBoolean(prefs::kNetworkFileSharesAllowed); return profile_->GetPrefs()->GetBoolean(prefs::kNetworkFileSharesAllowed);
} }
bool SmbService::IsNetBiosDiscoveryEnabled() const {
return profile_->GetPrefs()->GetBoolean(prefs::kNetBiosShareDiscoveryEnabled);
}
void SmbService::RecordMountCount() const { void SmbService::RecordMountCount() const {
const std::vector<ProvidedFileSystemInfo> file_systems = const std::vector<ProvidedFileSystemInfo> file_systems =
GetProviderService()->GetProvidedFileSystemInfoList(provider_id_); GetProviderService()->GetProvidedFileSystemInfoList(provider_id_);
......
...@@ -138,6 +138,9 @@ class SmbService : public KeyedService, ...@@ -138,6 +138,9 @@ class SmbService : public KeyedService,
// Whether Network File Shares are allowed to be used. Controlled via policy. // Whether Network File Shares are allowed to be used. Controlled via policy.
bool IsAllowedByPolicy() const; bool IsAllowedByPolicy() const;
// Whether NetBios discovery should be used. Controlled via policy.
bool IsNetBiosDiscoveryEnabled() const;
// Records metrics on the number of SMB mounts a user has. // Records metrics on the number of SMB mounts a user has.
void RecordMountCount() const; void RecordMountCount() const;
......
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