compositor: check if seteuid worked
authorAlexandru DAMIAN <alexandru.damian@intel.com>
Wed, 25 Sep 2013 13:47:47 +0000 (14:47 +0100)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 26 Sep 2013 23:18:11 +0000 (16:18 -0700)
Checking the return value from seteuid in
order to not launch clients with the wrong effective uid.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
src/compositor.c

index f619f82..a2c8725 100644 (file)
@@ -247,8 +247,11 @@ child_client_exec(int sockfd, const char *path)
        sigfillset(&allsigs);
        sigprocmask(SIG_UNBLOCK, &allsigs, NULL);
 
-       /* Launch clients as the user. */
-       seteuid(getuid());
+       /* Launch clients as the user. Do not lauch clients with wrong euid.*/
+       if (seteuid(getuid()) == -1) {
+               weston_log("compositor: failed seteuid\n");
+               return;
+       }
 
        /* SOCK_CLOEXEC closes both ends, so we dup the fd to get a
         * non-CLOEXEC fd to pass through exec. */