summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2013-11-21 01:09:59 +0100
committerSlávek Banko <slavek.banko@axis.cz>2013-11-21 01:11:11 +0100
commit7d6186b592682b2a14c39b40a071f77d29fc8c7a (patch)
treeefa047163fc16d5b526d4485b7ba0a1fe831c8a7
parent266a2501dfc0b0c22b861bbb63db5be6ae0dd21a (diff)
downloadtdebase-7d6186b592682b2a14c39b40a071f77d29fc8c7a.tar.gz
tdebase-7d6186b592682b2a14c39b40a071f77d29fc8c7a.zip
Fix konsole super user sessions with sudo or su
This resolves Bug 853
-rw-r--r--CMakeLists.txt2
-rw-r--r--konsole/konsole/konsole.cpp4
-rw-r--r--konsole/other/CMakeLists.txt13
-rw-r--r--konsole/other/su.desktop.cmake (renamed from konsole/other/su.desktop)2
-rw-r--r--konsole/other/sumc.desktop.cmake (renamed from konsole/other/sumc.desktop)2
5 files changed, 17 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 409893484..57cf4a860 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -77,6 +77,7 @@ option( WITH_LIBART "Enable libart support (for SVG icons and wallpapers)" ${WIT
option( WITH_LIBUSB "Enable control of some mouse models through libusb" ${WITH_ALL_OPTIONS} )
option( WITH_LIBRAW1394 "Enable visualization of ieee1394 devices through libraw1394" ${WITH_ALL_OPTIONS} )
option( WITH_SUDO_TDESU_BACKEND "Use sudo as backend for tdesu (default is su)" OFF )
+option( WITH_SUDO_KONSOLE_SUPER_USER_COMMAND "Use sudo when launching Konsole super user sessions (default is su)" OFF )
option( WITH_PAM "tdm should use PAM" ${WITH_ALL_OPTIONS} )
option( WITH_SHADOW "tdm should use shadow passwords" ${WITH_ALL_OPTIONS} )
option( WITH_XDMCP "xdmcp support for tdm" ${WITH_ALL_OPTIONS} )
@@ -123,6 +124,7 @@ option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden"
# WITH_SHADOW affects tdm kcheckpass
# WITH_UPOWER affects ksmserver
# WITH_SUDO_TDESU_BACKEND affects tdesu
+# WITH_SUDO_KONSOLE_SUPER_USER_COMMAND affects launching Konsole super user sessions
# NOTE: WITH_SHADOW and WITH_PAM shouldn't be set concurrently
# WITH_PAM will override WITH_SHADOW
diff --git a/konsole/konsole/konsole.cpp b/konsole/konsole/konsole.cpp
index ef3079654..b76a5c4b1 100644
--- a/konsole/konsole/konsole.cpp
+++ b/konsole/konsole/konsole.cpp
@@ -3421,9 +3421,7 @@ void Konsole::addSessionCommand(const TQString &path)
// try to locate the binary
TQString exec= co->readPathEntry("Exec");
- if (exec.startsWith("sudo su -c \'")) {
- exec = exec.mid(12,exec.length()-13);
- }
+ exec.remove(TQRegExp("^(sudo )?su (- )?-c ?\'"));
exec = KRun::binaryName(exec, false);
exec = KShell::tildeExpand(exec);
diff --git a/konsole/other/CMakeLists.txt b/konsole/other/CMakeLists.txt
index 2dc3214b4..58dcd038b 100644
--- a/konsole/other/CMakeLists.txt
+++ b/konsole/other/CMakeLists.txt
@@ -14,6 +14,15 @@ add_subdirectory( wallpapers )
tde_install_icons( )
+if( WITH_SUDO_KONSOLE_SUPER_USER_COMMAND )
+ set( KONSOLE_SUPER_USER_COMMAND "sudo su" CACHE INTERNAL "" FORCE )
+else()
+ set( KONSOLE_SUPER_USER_COMMAND su CACHE INTERNAL "" FORCE )
+endif()
+
+configure_file( su.desktop.cmake su.desktop @ONLY )
+configure_file( sumc.desktop.cmake sumc.desktop @ONLY )
+
install( FILES
BlackOnLightColor.schema BlackOnLightYellow.schema
BlackOnWhite.schema Example.Schema GreenOnBlack.schema
@@ -22,7 +31,9 @@ install( FILES
LightPicture.schema Transparent.schema GreenTint.schema
Transparent_MC.schema GreenTint_MC.schema Transparent_lightbg.schema
Transparent_darkbg.schema LightPaper.schema linux.desktop
- mc.desktop shell.desktop su.desktop sumc.desktop
+ mc.desktop shell.desktop
+ ${CMAKE_CURRENT_BINARY_DIR}/su.desktop
+ ${CMAKE_CURRENT_BINARY_DIR}/sumc.desktop
linux.keytab vt100.keytab vt420pc.keytab x11r5.keytab
solaris.keytab README.Schema README.KeyTab README.default.Keytab
screen.desktop
diff --git a/konsole/other/su.desktop b/konsole/other/su.desktop.cmake
index 5d7b5287e..da55a8c0b 100644
--- a/konsole/other/su.desktop
+++ b/konsole/other/su.desktop.cmake
@@ -123,7 +123,7 @@ Comment[vi]=Mở một Trình giao diện Gốc mới
Comment[wa]=Novea shell root
Comment[zh_CN]=新建 Root Shell
Comment[zh_TW]=新增 Root Shell
-Exec=sudo su -
+Exec=@KONSOLE_SUPER_USER_COMMAND@ -
Schema=BlackOnLightYellow.schema
#Schema=Linux.schema
#VGA
diff --git a/konsole/other/sumc.desktop b/konsole/other/sumc.desktop.cmake
index b8a6ef535..fc5056f5e 100644
--- a/konsole/other/sumc.desktop
+++ b/konsole/other/sumc.desktop.cmake
@@ -139,7 +139,7 @@ Comment[wa]=Novea «Midnight Commander» e môde root
Comment[zh_CN]=新建 Root Midnight Commander
Comment[zh_TW]=新增 Root Midnight Commander
Comment[zu]=Umyaleli Waphakathi nobusuku Wempande Entsha
-Exec=sudo su -c 'mc -c'
+Exec=@KONSOLE_SUPER_USER_COMMAND@ - -c 'mc -c'
Schema=BlackOnLightYellow.schema
#VGA
#Font=6