1
0
mirror of https://invent.kde.org/system/dolphin synced 2024-07-02 16:31:23 +00:00

Improve sudo/kdesu error message

Now that you can get elevated privileges while using the app, we can
display a more useful and descriptive error message when people try to
run Dolphin using `sudo` or `kdesu`.

Also bump the frameworks dependency to 5.90 since that's the KIO
version that includes this change, so we can be sure that the message is
always accurate.
This commit is contained in:
Nate Graham 2021-12-31 10:36:31 -07:00
parent c40fe3b886
commit 28ecfd5a34
2 changed files with 9 additions and 3 deletions

View File

@ -8,7 +8,7 @@ set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE
project(Dolphin VERSION ${RELEASE_SERVICE_VERSION})
set(QT_MIN_VERSION "5.15.0")
set(KF5_MIN_VERSION "5.89.0")
set(KF5_MIN_VERSION "5.90.0")
# ECM setup
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)

View File

@ -44,10 +44,16 @@ int main(int argc, char **argv)
// Prohibit using sudo or kdesu (but allow using the root user directly)
if (getuid() == 0) {
if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
std::cout << "Executing Dolphin with sudo is not possible due to unfixable security vulnerabilities." << std::endl;
std::cout << "Running Dolphin with sudo can cause bugs and expose you to security vulnerabilities. "
"Instead use Dolphin normally and you will be prompted for elevated privileges when "
"performing file operations that require them."
<< std::endl;
return EXIT_FAILURE;
} else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
std::cout << "Executing Dolphin with kdesu is not possible due to unfixable security vulnerabilities." << std::endl;
std::cout << "Running Dolphin with kdesu can cause bugs and expose you to security vulnerabilities. "
"Instead use Dolphin normally and you will be prompted for elevated privileges when "
"performing file operations that require them."
<< std::endl;
return EXIT_FAILURE;
}
}