public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in kde-base/kdelibs/files: kdelibs-4.10.5-home.patch
@ 2013-07-22 11:16 Andreas HAttel (dilfridge)
  0 siblings, 0 replies; only message in thread
From: Andreas HAttel (dilfridge) @ 2013-07-22 11:16 UTC (permalink / raw
  To: gentoo-commits

dilfridge    13/07/22 11:16:13

  Added:                kdelibs-4.10.5-home.patch
  Log:
  Backport fix for bug 451454
  
  (Portage version: 2.1.12.2/cvs/Linux x86_64, signed Manifest commit with key 94BFDF4484AD142F)

Revision  Changes    Path
1.1                  kde-base/kdelibs/files/kdelibs-4.10.5-home.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/kde-base/kdelibs/files/kdelibs-4.10.5-home.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/kde-base/kdelibs/files/kdelibs-4.10.5-home.patch?rev=1.1&content-type=text/plain

Index: kdelibs-4.10.5-home.patch
===================================================================
From 176173b60c4611941566a87db438c1ff377a1c83 Mon Sep 17 00:00:00 2001
From: "Andreas K. Huettel (dilfridge)" <dilfridge@gentoo.org>
Date: Sun, 21 Jul 2013 16:44:20 +0200
Subject: [PATCH] Make sure HOME is never unset, to prevent creation of files
 in /

BUG: 249217
REVIEW: 110655
---
 kdecore/auth/kauthhelpersupport.cpp | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/kdecore/auth/kauthhelpersupport.cpp b/kdecore/auth/kauthhelpersupport.cpp
index 41b673b..f99b64d 100644
--- a/kdecore/auth/kauthhelpersupport.cpp
+++ b/kdecore/auth/kauthhelpersupport.cpp
@@ -23,6 +23,12 @@
 #include <cstdlib>
 #include <syslog.h>
 
+#ifdef Q_OS_UNIX
+#include <unistd.h>
+#include <sys/types.h>
+#include <pwd.h>
+#endif
+
 #include <QCoreApplication>
 #include <QTimer>
 
@@ -40,8 +46,27 @@ void helperDebugHandler(QtMsgType type, const char *msg);
 
 static bool remote_dbg = false;
 
+#ifdef Q_OS_UNIX
+static void fixEnvironment()
+{
+    //try correct HOME
+    char *home = "HOME";
+    if(getenv(home)==NULL)
+    {
+        struct passwd *pw = getpwuid(getuid());
+        int overwrite = 0;
+
+        if (pw!=NULL) setenv(home, pw->pw_dir, overwrite);
+    }
+}
+#endif
+
 int HelperSupport::helperMain(int argc, char **argv, const char *id, QObject *responder)
 {
+#ifdef Q_OS_UNIX
+    fixEnvironment();
+#endif
+
     openlog(id, 0, LOG_USER);
     qInstallMsgHandler(&HelperSupport::helperDebugHandler);
 
-- 
1.8.3.2






^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-07-22 11:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-22 11:16 [gentoo-commits] gentoo-x86 commit in kde-base/kdelibs/files: kdelibs-4.10.5-home.patch Andreas HAttel (dilfridge)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox