diff options
author | George Lebl <jirka@5z.com> | 2004-06-07 16:17:39 +0000 |
---|---|---|
committer | George Lebl <jirka@src.gnome.org> | 2004-06-07 16:17:39 +0000 |
commit | bf38ac499a94cfdb162f6841df7c2edaac1bce61 (patch) | |
tree | 099956167eaab4202df4f85013e621960f447b4d /gui | |
parent | 5982a3c1dd717a2606b2d4e6927f83692b840ce1 (diff) | |
download | gdm-bf38ac499a94cfdb162f6841df7c2edaac1bce61.tar.gz |
Add system-config-display and also check for system-config-mouse. FC2 is
Mon Jun 07 09:17:23 2004 George Lebl <jirka@5z.com>
* config/XKeepsCrashing: Add system-config-display and also check
for system-config-mouse. FC2 is utter shit when it comes to
failing X server anyway so on my test machine system-config-display
don't work none anyway, but such is life, maybe it'll work for
someone (but FC2 of course doesn't run that on X errors anyway).
* gui/gdmsetup.c: replace hacks with lesser hacks
Diffstat (limited to 'gui')
-rw-r--r-- | gui/gdmsetup.c | 89 |
1 files changed, 58 insertions, 31 deletions
diff --git a/gui/gdmsetup.c b/gui/gdmsetup.c index 4d52517a..867ed627 100644 --- a/gui/gdmsetup.c +++ b/gui/gdmsetup.c @@ -58,6 +58,23 @@ static GladeXML *xml; static GList *timeout_widgets = NULL; static void +simple_spawn_sync (char **argv) +{ + g_spawn_sync (NULL /* working_directory */, + argv, + NULL /* envp */, + G_SPAWN_SEARCH_PATH | + G_SPAWN_STDOUT_TO_DEV_NULL | + G_SPAWN_STDERR_TO_DEV_NULL, + NULL /* child_setup */, + NULL /* user_data */, + NULL /* stdout */, + NULL /* stderr */, + NULL /* exit status */, + NULL /* error */); +} + +static void setup_cursor (GdkCursorType type) { GdkCursor *cursor = gdk_cursor_new (type); @@ -1953,32 +1970,40 @@ install_response (GtkWidget *chooser, gint response, gpointer data) g_assert (untar_cmd != NULL); - if (chdir (theme_dir) == 0) { - if (system (untar_cmd) == 0) { - char *cmd; - char *quoted = ve_shell_quote_filename (dir); - char *chown = find_chown (); - char *chmod = find_chmod (); - success = TRUE; - - /* HACK! */ - cmd = g_strdup_printf ("%s -R root:root %s", chown, quoted); - system (cmd); - g_free (cmd); - - cmd = g_strdup_printf ("%s -R a+r %s", chmod, quoted); - system (cmd); - g_free (cmd); - - cmd = g_strdup_printf ("%s a+x %s", chmod, quoted); - system (cmd); - g_free (cmd); - - g_free (quoted); - g_free (chown); - g_free (chmod); - } - chdir (cwd); + if (chdir (theme_dir) == 0 && + /* this is a security sanity check */ + strchr (dir, '/') == NULL && + system (untar_cmd) == 0) { + char *argv[5]; + char *quoted = g_strconcat ("./", dir, NULL); + char *chown = find_chown (); + char *chmod = find_chmod (); + success = TRUE; + + /* HACK! */ + argv[0] = chown; + argv[1] = "-R"; + argv[2] = "root:root"; + argv[3] = quoted; + argv[4] = NULL; + simple_spawn_sync (argv); + + argv[0] = chmod; + argv[1] = "-R"; + argv[2] = "a+r"; + argv[3] = quoted; + argv[4] = NULL; + simple_spawn_sync (argv); + + argv[0] = chmod; + argv[1] = "a+x"; + argv[2] = quoted; + argv[3] = NULL; + simple_spawn_sync (argv); + + g_free (quoted); + g_free (chown); + g_free (chmod); } if ( ! success) { @@ -2137,12 +2162,14 @@ delete_theme (GtkWidget *button, gpointer data) strchr (dir, '/') == NULL) { /* HACK! */ DIR *dp; + char *argv[4]; GtkTreeIter *select_iter = NULL; - char *quoted = ve_shell_quote_filename (dir); - char *cmd = g_strdup_printf ("/bin/rm -fR %s", quoted); - system (cmd); - g_free (cmd); - g_free (quoted); + argv[0] = "/bin/rm"; + argv[1] = "-fR"; + argv[2] = g_strconcat ("./", dir, NULL); + argv[3] = NULL; + simple_spawn_sync (argv); + g_free (argv[2]); /* Update the list */ gtk_list_store_clear (store); |