summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kdm/kfrontend/kgapp.cpp16
-rw-r--r--kwin/kompmgr/kompmgr.c30
2 files changed, 39 insertions, 7 deletions
diff --git a/kdm/kfrontend/kgapp.cpp b/kdm/kfrontend/kgapp.cpp
index b57b4371d..677b5ec2a 100644
--- a/kdm/kfrontend/kgapp.cpp
+++ b/kdm/kfrontend/kgapp.cpp
@@ -366,13 +366,15 @@ kg_main( const char *argv0 )
// Change process UID
// Get user UID
passwd* userinfo = getpwnam(login_user.ascii());
- TQString newuid = TQString("%1").arg(userinfo->pw_uid);
- // kompmgr allows us to change its uid in this manner:
- // 1.) Send SIGUSER1
- // 2.) Send the new UID to it on the command line
- comp->kill(SIGUSR1);
- comp->writeStdin(newuid.ascii(), newuid.length());
- usleep(50000); // Give the above function some time to execute. Note that on REALLY slow systems this could fail, leaving kompmgr running as root. TODO: Look into ways to make this more robust.
+ if (userinfo) {
+ TQString newuid = TQString("%1").arg(userinfo->pw_uid);
+ // kompmgr allows us to change its uid in this manner:
+ // 1.) Send SIGUSER1
+ // 2.) Send the new UID to it on the command line
+ comp->kill(SIGUSR1);
+ comp->writeStdin(newuid.ascii(), newuid.length());
+ usleep(50000); // Give the above function some time to execute. Note that on REALLY slow systems this could fail, leaving kompmgr running as root. TODO: Look into ways to make this more robust.
+ }
}
comp->closeStdin();
comp->detach();
diff --git a/kwin/kompmgr/kompmgr.c b/kwin/kompmgr/kompmgr.c
index 2aef59772..cb7ab2f59 100644
--- a/kwin/kompmgr/kompmgr.c
+++ b/kwin/kompmgr/kompmgr.c
@@ -74,6 +74,12 @@ check baghira.sf.net for more infos
#define _BOTTOMHEIGHT_(x) ((x >> 8) & 0xff)
#define _LEFTWIDTH_(x) (x & 0xff)
+/* #define USE_ENV_HOME */
+
+#ifndef USE_ENV_HOME
+#include <pwd.h>
+#endif
+
typedef struct _ignore {
struct _ignore *next;
unsigned long sequence;
@@ -289,6 +295,30 @@ void handle_siguser (int sig)
printf("Setting kompmgr process uid to %d...\n\r", uidnum); fflush(stdout);
#endif
setuid(uidnum);
+
+#ifdef USE_ENV_HOME
+ const char *home = getenv("HOME");
+#else
+ const char *home;
+ struct passwd *p;
+ p = getpwuid(uidnum);
+ if (p)
+ home = p->pw_dir;
+ else
+ home = getenv("HOME");
+#endif
+ const char *filename;
+ const char *configfile = "/.xcompmgrrc";
+ int n = strlen(home)+strlen(configfile)+1;
+ filename = (char*)malloc(n*sizeof(char));
+ memset(filename,0,n);
+ strcat(filename, home);
+ strcat(filename, configfile);
+
+ loadConfig(filename); /* reload the configuration file */
+
+ free(filename);
+ filename = NULL;
}
fade *