Merge authors: Cody Russell (bratsche) Related merge proposals: https://code.launchpad.net/~bratsche/xsplash/setgid/+merge/12788 proposed by: Cody Russell (bratsche) review: Approve - Ted Gould (ted) ------------------------------------------------------------ revno: 81 [merge] committer: Cody Russell <[email protected]> branch nick: xsplash timestamp: Mon 2009-10-05 09:50:27 -0400 message: merge lp:~bratsche/xsplash/setgid to fix #439268 modified: src/xsplash.c
-- lp:xsplash https://code.launchpad.net/~xsplash-team/xsplash/trunk Your team ayatana-commits is subscribed to branch lp:xsplash. To unsubscribe from this branch go to https://code.launchpad.net/~xsplash-team/xsplash/trunk/+edit-subscription.
=== modified file 'src/xsplash.c' --- src/xsplash.c 2009-10-01 20:56:55 +0000 +++ src/xsplash.c 2009-10-04 00:13:32 +0000 @@ -17,10 +17,12 @@ * Cody Russell <[email protected]> */ +#define _GNU_SOURCE +#include <unistd.h> + #include <stdlib.h> #include <math.h> #include <string.h> -#include <unistd.h> #include <pwd.h> #include <dirent.h> @@ -913,14 +915,13 @@ int main (int argc, char *argv[]) { - XsplashServer *server; - GError *error = NULL; - GOptionContext *context; + XsplashServer *server; + GError *error = NULL; + GOptionContext *context; DBusGConnection *system_bus; DBusGProxy *bus_proxy; guint nameret = 0; - struct passwd *pwd; - uid_t uid; + struct passwd *pwd; pwd = getpwnam (XSPLASH_USER); if (pwd == NULL) @@ -929,9 +930,17 @@ return 1; } - uid = pwd->pw_uid; + if (setresgid (pwd->pw_gid, pwd->pw_gid, pwd->pw_gid)) + { + g_error ("Failed to setresgid to `%s'", XSPLASH_USER); + return 1; + } - setuid (uid); + if (setresuid (pwd->pw_uid, pwd->pw_uid, pwd->pw_uid)) + { + g_error ("Failed to setresuid to `%s'", XSPLASH_USER); + return 1; + } context = g_option_context_new ("xsplash"); g_option_context_add_main_entries (context,
_______________________________________________ Mailing list: https://launchpad.net/~ayatana-commits Post to : [email protected] Unsubscribe : https://launchpad.net/~ayatana-commits More help : https://help.launchpad.net/ListHelp

