Files
main/desktop/kde/applications/kate/files/kwrite-17.04.0-allow-root.patch
2025-01-22 22:36:28 +03:00

37 lines
1.4 KiB
Diff
Executable File

diff -Nuar a/apps/kwrite/main.cpp b/apps/kwrite/main.cpp
--- a/apps/kwrite/main.cpp 2022-09-04 17:28:00.000000000 +0300
+++ b/apps/kwrite/main.cpp 2022-09-24 14:35:55.673928905 +0300
@@ -16,32 +16,9 @@
#include <QCommandLineParser>
#include <QStandardPaths>
-#ifndef Q_OS_WIN
-#include <unistd.h>
-#endif
-
-#include <iostream>
extern "C" Q_DECL_EXPORT int main(int argc, char **argv)
{
-#if !defined(Q_OS_WIN) && !defined(Q_OS_HAIKU)
- // Prohibit using sudo or kdesu (but allow using the root user directly)
- if (getuid() == 0) {
- if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
- std::cout << "Running KWrite with sudo can cause bugs and expose you to security vulnerabilities. "
- "Instead 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 << "Running KWrite with kdesu can cause bugs and expose you to security vulnerabilities. "
- "Instead use KWrite normally and you will be prompted for elevated privileges when "
- "saving documents if needed."
- << std::endl;
- return EXIT_FAILURE;
- }
- }
-#endif
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
/**