Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
kdesu dolphin as root not possible [SOLVED-again]
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4, 5, 6  
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
psands
n00b
n00b


Joined: 12 Aug 2019
Posts: 6

PostPosted: Thu Dec 05, 2019 1:18 am    Post subject: Reply with quote

Thank you very much that worked great. The kate patch worked as well but not the kwrite patch.
Back to top
View user's profile Send private message
proteusx
Apprentice
Apprentice


Joined: 21 Jan 2008
Posts: 270

PostPosted: Thu Dec 05, 2019 2:18 am    Post subject: Reply with quote

kwrite-19.08.3-run-as-root.patch
Code:

--- a/kwrite/main.cpp
+++ b/kwrite/main.cpp
@@ -51,18 +51,6 @@
 
 extern "C" Q_DECL_EXPORT int main(int argc, char **argv)
 {
-#ifndef Q_OS_WIN
-    // 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;
-            return EXIT_FAILURE;
-        } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
-            std::cout << "Executing KWrite with kdesu is not possible due to unfixable security vulnerabilities." << std::endl;
-            return EXIT_FAILURE;
-        }
-    }
-#endif

     /**
      * Create application first
Back to top
View user's profile Send private message
psands
n00b
n00b


Joined: 12 Aug 2019
Posts: 6

PostPosted: Thu Dec 05, 2019 2:34 am    Post subject: Reply with quote

Thanks again
Back to top
View user's profile Send private message
wrc1944
Advocate
Advocate


Joined: 15 Aug 2002
Posts: 3319
Location: Gainesville, Florida

PostPosted: Thu Dec 05, 2019 6:42 pm    Post subject: Reply with quote

The dolphin-19.08.1 patch still works on all three of my ~amd64 Gentoo installs.

Code:
diff -Naur orig/src/dolphinviewcontainer.cpp patched/src/dolphinviewcontainer.cpp
--- orig/src/dolphinviewcontainer.cpp   2019-09-03 00:15:08.000000000 +0300
+++ patched/src/dolphinviewcontainer.cpp   2019-09-15 12:45:14.451444593 +0300
@@ -136,13 +136,6 @@
     m_messageWidget->setCloseButtonVisible(true);
     m_messageWidget->hide();
 
-#ifndef Q_OS_WIN
-    if (getuid() == 0) {
-
-        // We must be logged in as the root user; show a big scary warning
-        showMessage(i18n("Running Dolphin as root can be dangerous. Please be careful."), Warning);
-    }
-#endif
 
     // Initialize filter bar
     m_filterBar = new FilterBar(this);
diff -Naur orig/src/main.cpp patched/src/main.cpp
--- orig/src/main.cpp   2019-09-03 00:15:08.000000000 +0300
+++ patched/src/main.cpp   2019-09-15 12:43:55.923439868 +0300
@@ -46,19 +46,6 @@
 
 extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
 {
-#ifndef Q_OS_WIN
-    // 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;
-            return EXIT_FAILURE;
-        } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
-            std::cout << "Executing Dolphin with kdesu is not possible due to unfixable security vulnerabilities." << std::endl;
-            return EXIT_FAILURE;
-        }
-    }
-#endif
-
     QApplication app(argc, argv);
     app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
     app.setWindowIcon(QIcon::fromTheme(QStringLiteral("system-file-manager"), app.windowIcon()));

_________________
Main box- AsRock x370 Gaming K4
Ryzen 1700, 3.0GHz, 16GB GSkill Flare DDR4 3200mhz
Samsung SATA 1000GB, Radeon HD R7 350 2GB DDR5
Gentoo ~amd64 plasma, glibc-2.30-r3, gcc-9.2.0 kernel-5.4.12-gentoo USE=experimental
Back to top
View user's profile Send private message
wrc1944
Advocate
Advocate


Joined: 15 Aug 2002
Posts: 3319
Location: Gainesville, Florida

PostPosted: Fri Dec 13, 2019 3:19 am    Post subject: Reply with quote

Hmmm. Updated kde to 19.12.0, and again have dolphin as root (kdesu) problems. Rebuilt kde-cml and dolphin, but again kdesu dolphin, and the newest dolphin-as-root-19.08.3.patch can't work since kdesu seems to be non-functional. From a root konsole a plain dolphin opens up a root dolphin, but has the "Running Dolphin as root can be dangerous. Please be careful." message appears at top in window. (I'm running ~amd64 systems)

Here's the output where kdesu dolphin returns nothing, but root konsole dolphin at least works. What's the pinentry-qt.desktop" has Type= "Application" but no Exec line have to do with dolphin?
Code:
wrc@gentoo-main ~ $ kdesu dolphin
wrc@gentoo-main ~ $ su
Password:
gentoo-main ~ # dolphin
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
kf5.kservice.services: The desktop entry file "/usr/share/applications/org.gnupg.pinentry-qt.desktop" has Type= "Application" but no Exec line
kf5.kservice.sycoca: Invalid Service :  "/usr/share/applications/org.gnupg.pinentry-qt.desktop"
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
kf5.kio.kio_tags: tag fetch failed: "Failed to open the database"
kf5.kio.kio_tags: "tags:/" list() invalid url
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
kf5.kio.core: "Could not enter folder tags:/."
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Qt: Session management error: networkIdsList argument is NULL

_________________
Main box- AsRock x370 Gaming K4
Ryzen 1700, 3.0GHz, 16GB GSkill Flare DDR4 3200mhz
Samsung SATA 1000GB, Radeon HD R7 350 2GB DDR5
Gentoo ~amd64 plasma, glibc-2.30-r3, gcc-9.2.0 kernel-5.4.12-gentoo USE=experimental
Back to top
View user's profile Send private message
proteusx
Apprentice
Apprentice


Joined: 21 Jan 2008
Posts: 270

PostPosted: Fri Dec 13, 2019 4:41 am    Post subject: Reply with quote

dolphin-19.12.0-root.patch
Code:
--- a/src/dolphinviewcontainer.cpp
+++ b/src/dolphinviewcontainer.cpp
@@ -136,13 +136,6 @@
     m_messageWidget->setCloseButtonVisible(true);
     m_messageWidget->hide();
 
-#ifndef Q_OS_WIN
-    if (getuid() == 0) {
-
-        // We must be logged in as the root user; show a big scary warning
-        showMessage(i18n("Running Dolphin as root can be dangerous. Please be careful."), Warning);
-    }
-#endif
 
     // Initialize filter bar
     m_filterBar = new FilterBar(this);
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -46,19 +46,6 @@
 
 extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
 {
-#ifndef Q_OS_WIN
-    // 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;
-            return EXIT_FAILURE;
-        } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
-            std::cout << "Executing Dolphin with kdesu is not possible due to unfixable security vulnerabilities." << std::endl;
-            return EXIT_FAILURE;
-        }
-    }
-#endif
-
     /**
      * enable high dpi support
      */

EDIT: Deleted blank line from listing


Last edited by proteusx on Fri Dec 13, 2019 9:30 pm; edited 1 time in total
Back to top
View user's profile Send private message
wrc1944
Advocate
Advocate


Joined: 15 Aug 2002
Posts: 3319
Location: Gainesville, Florida

PostPosted: Fri Dec 13, 2019 5:00 am    Post subject: Reply with quote

WOW! Thanks very much for the light-speed response! :D
I'm sure lots of users (along with me) really appreciate you maintaining these great Dolphin and Kwrite patches.
_________________
Main box- AsRock x370 Gaming K4
Ryzen 1700, 3.0GHz, 16GB GSkill Flare DDR4 3200mhz
Samsung SATA 1000GB, Radeon HD R7 350 2GB DDR5
Gentoo ~amd64 plasma, glibc-2.30-r3, gcc-9.2.0 kernel-5.4.12-gentoo USE=experimental
Back to top
View user's profile Send private message
wrc1944
Advocate
Advocate


Joined: 15 Aug 2002
Posts: 3319
Location: Gainesville, Florida

PostPosted: Fri Dec 13, 2019 8:05 pm    Post subject: Reply with quote

proteusx,
Patch worked great on my three Gentoo installs, however I did notice a minor fuzz factor.
Doesn't seem to affect anything, or could it be only some problem on my systems?
Code:
unpacking source...
>>> Unpacking dolphin-19.12.0.tar.xz to /var/tmp/portage/kde-apps/dolphin-19.12.0/work
>>> Source unpacked in /var/tmp/portage/kde-apps/dolphin-19.12.0/work
>>> Preparing source in /var/tmp/portage/kde-apps/dolphin-19.12.0/work/dolphin-19.12.0 ...
 * Applying dolphin-19.12.0-root.patch ...
 *     /etc/portage/patches/kde-apps/dolphin/dolphin-19.12.0-root.patch: patch failed to apply without a fuzz factor, please rebase
patching file src/dolphinviewcontainer.cpp
patching file src/main.cpp
Hunk #1 succeeded at 46 with fuzz 1.                                                                                                              [ ok ]
 * User patches applied.
>>> Source prepared
.
_________________
Main box- AsRock x370 Gaming K4
Ryzen 1700, 3.0GHz, 16GB GSkill Flare DDR4 3200mhz
Samsung SATA 1000GB, Radeon HD R7 350 2GB DDR5
Gentoo ~amd64 plasma, glibc-2.30-r3, gcc-9.2.0 kernel-5.4.12-gentoo USE=experimental
Back to top
View user's profile Send private message
proteusx
Apprentice
Apprentice


Joined: 21 Jan 2008
Posts: 270

PostPosted: Fri Dec 13, 2019 9:30 pm    Post subject: Reply with quote

Probably copy/paste caused the patch to be out by one line.
Maybe it is the first blank line at the top.
Fixed now.


EDIT. No. It is not that. I cannot reproduce the error here.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6
Page 6 of 6

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum