kdesu patch

Stephan Kulow coolo at kde.org
Tue Jun 4 10:37:18 BST 2002


Hi!

Some tools expect /sbin to be part of the root path as "su"
adds them (I'm not sure if it's set by some environment files
or if it's added by su itself - "su -" surely sets it through the
profile)

Anyway, kdesu doesn't behave like that, so /sbin is missing.
Anyone objecting against the following patch?

Greetings, Stephan

--- stub.cpp    2002/03/04 00:59:16     1.17
+++ stub.cpp    2002/06/04 09:33:20
@@ -118,7 +118,13 @@
        } else if (line == "command") {
            writeLine(m_Command);
        } else if (line == "path") {
-           writeLine(getenv("PATH"));
+           QCString path = getenv("PATH");
+           if (m_User == "root")
+               if (!path.isEmpty())
+                   path = "/sbin:/usr/sbin:" + path;
+               else
+                   path = "/sbin:/usr/sbin";
+           writeLine(path);
        } else if (line == "user") {
            writeLine(m_User);
        } else if (line == "priority") {





More information about the kde-core-devel mailing list