| Server IP : 82.208.35.60 / Your IP : 216.73.216.238 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/ports/www/iridium/files/ |
Upload File : |
--- chrome/browser/download/download_prefs.cc.orig 2022-10-05 07:34:01 UTC
+++ chrome/browser/download/download_prefs.cc
@@ -13,6 +13,7 @@
#include "base/callback_helpers.h"
#include "base/check.h"
#include "base/cxx17_backports.h"
+#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/files/file_util.h"
#include "base/no_destructor.h"
@@ -61,6 +62,10 @@
#include "chrome/browser/ui/pdf/adobe_reader_info_win.h"
#endif
+#if BUILDFLAG(IS_OPENBSD)
+#include "sandbox/policy/openbsd/sandbox_openbsd.h"
+#endif
+
using content::BrowserContext;
using content::BrowserThread;
using content::DownloadManager;
@@ -71,7 +76,7 @@ namespace {
// Consider downloads 'dangerous' if they go to the home directory on Linux and
// to the desktop on any platform.
bool DownloadPathIsDangerous(const base::FilePath& download_path) {
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
base::FilePath home_dir = base::GetHomeDir();
if (download_path == home_dir) {
return true;
@@ -182,7 +187,7 @@ DownloadPrefs::DownloadPrefs(Profile* profile) : profi
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
- BUILDFLAG(IS_MAC)
+ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
should_open_pdf_in_system_reader_ =
prefs->GetBoolean(prefs::kOpenPdfDownloadInSystemReader);
#endif
@@ -302,7 +307,7 @@ void DownloadPrefs::RegisterProfilePrefs(
registry->RegisterTimePref(prefs::kDownloadLastCompleteTime,
/*default_value=*/base::Time());
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
- BUILDFLAG(IS_MAC)
+ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
registry->RegisterBooleanPref(prefs::kOpenPdfDownloadInSystemReader, false);
#endif
#if BUILDFLAG(IS_ANDROID)
@@ -483,7 +488,7 @@ void DownloadPrefs::DisableAutoOpenByUserBasedOnExtens
}
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
- BUILDFLAG(IS_MAC)
+ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
void DownloadPrefs::SetShouldOpenPdfInSystemReader(bool should_open) {
if (should_open_pdf_in_system_reader_ == should_open)
return;
@@ -515,7 +520,7 @@ bool DownloadPrefs::ShouldOpenPdfInSystemReader() cons
void DownloadPrefs::ResetAutoOpenByUser() {
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
- BUILDFLAG(IS_MAC)
+ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
SetShouldOpenPdfInSystemReader(false);
#endif
auto_open_by_user_.clear();
@@ -546,7 +551,7 @@ void DownloadPrefs::SaveAutoOpenState() {
bool DownloadPrefs::CanPlatformEnableAutoOpenForPdf() const {
#if BUILDFLAG(IS_CHROMEOS)
return false; // There is no UI for auto-open on ChromeOS.
-#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
+#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
return ShouldOpenPdfInSystemReader();
#else
return false;
@@ -670,7 +675,14 @@ base::FilePath DownloadPrefs::SanitizeDownloadTargetPa
#else
// If the stored download directory is an absolute path, we presume it's
// correct; there's not really much more validation we can do here.
+#if BUILDFLAG(IS_OPENBSD)
+ // If unveil(2) is used, force the file dialog directory to something we
+ // know is available.
+ auto* sandbox = sandbox::policy::SandboxLinux::GetInstance();
+ if (!sandbox->unveil_initialized() && path.IsAbsolute())
+#else
if (path.IsAbsolute())
+#endif
return path;
// When the default download directory is *not* an absolute path, we use the