Commit d9650c00 authored by Nate Graham's avatar Nate Graham Committed by Christoph Cullmann
Browse files

Tell user what to do instead of using sudo or kdesu

This warning shown when running Kate or KWrite using sudo or kdesu
is not very helpful, and leaves the user with the impression that
Kate and KWrite have no functionality for editing documents requiring
elevated privileges, when in fact the opposite is true. But we have
not told the user what to do instead of what they were trying to do,
so they do not know about it.

So let's tell the user what to do instead. :)
parent 231f95a6
......@@ -49,10 +49,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 Kate with sudo is not possible due to unfixable security vulnerabilities." << std::endl;
std::cout << "Executing Kate with sudo is not possible due to unfixable security vulnerabilities. "
"It is also not necessary; simply use Kate normally, and you will be prompted for "
"elevated privileges when saving documents if needed."
<< std::endl;
return EXIT_FAILURE;
} else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
std::cout << "Executing Kate with kdesu is not possible due to unfixable security vulnerabilities." << std::endl;
std::cout << "Executing Kate with kdesu is not possible due to unfixable security vulnerabilities. "
"It is also not necessary; simply use Kate normally, and you will be prompted for "
"elevated privileges when saving documents if needed."
<< std::endl;
return EXIT_FAILURE;
}
}
......
......@@ -41,10 +41,16 @@ extern "C" Q_DECL_EXPORT 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 KWrite with sudo is not possible due to unfixable security vulnerabilities." << std::endl;
std::cout << "Executing KWrite with sudo is not possible due to unfixable security vulnerabilities. "
"It is also not necessary; simply use KWrite normally, and you will be prompted for "
"elevated privileges when saving documents if needed."
<< std::endl;
return EXIT_FAILURE;
} else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
std::cout << "Executing KWrite with kdesu is not possible due to unfixable security vulnerabilities." << std::endl;
std::cout << "Executing KWrite with kdesu is not possible due to unfixable security vulnerabilities. "
"It is also not necessary; simply use KWrite normally, and you will be prompted for "
"elevated privileges when saving documents if needed."
<< std::endl;
return EXIT_FAILURE;
}
}
......
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