[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#741228: kdelibs-bin: kauth helpers creates .config in /



> > However, it doesn't really solve the problem, just moves the
> > offending directory from / to /root where it also doesn't belong
> > because root-as-a-user is not involved. (Maybe that's somehow
> > different in 4.11, or it's still buggy there.) In fact, the user
> > doing the login is known at the time, so the file should be created
> > in their home directory -- or not at all (since it doesn't contain
> > any valuable information anyway, as seen by the fact that's it gets
> > happily recreated at every login when it's removed).
> 
> The patch only sets the HOME environment variable if not set, maybe we could
> simply set the HOME variable in the kdm init script to /var/lib/kdm.
>
> Could you prepare and test such a patch?

That's what I tried first, but alas, no success. I tried to trace
what happens during the initialization, but it's very complex. The
offending files are written by some dbus program, but according to
the thread at KDE and to my own tests, dbus doesn't seem at fault,
but the KDE auth tool provides that wrong path to the dbus tool.
Somewhere between calling the init script and the auth tool, the
HOME variable gets erased (which by itself may be understandable, as
we're talking about a login program here), so I see no easy place to
inject the setting of HOME.

I'd really like to make a one-line fix in some script, but I haven't
been able to create one. At least I've now modified the patch to
move the files to /run/kdelibs, see below. I've tested it and it
works for me. (If you prefer /var/lib/kdm instead, you can put it
there, of course. I don't think it's data worth preserving as /var
implies, but I really don't mind.)

--- kdecore/auth/kauthhelpersupport.cpp
+++ kdecore/auth/kauthhelpersupport.cpp
@@ -40,8 +46,23 @@ void helperDebugHandler(QtMsgType type, const char *msg);
 
 static bool remote_dbg = false;
 
+#ifdef Q_OS_UNIX
+static void fixEnvironment()
+{
+    // put run files below /run if no HOME available
+    char *home = "HOME";
+    if(getenv(home)==NULL) {
+        setenv(home, "/run/kdelibs", 0);
+    }
+}
+#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);
 


Reply to: