summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gorse <mgorse@suse.com>2012-07-03 20:52:25 -0500
committerMike Gorse <mgorse@suse.com>2012-07-03 20:56:45 -0500
commit7fc3c0ed67c52371855c5db456f26f27dfd22126 (patch)
tree3e5a5e5be8d0491d2e65a2b7aa9f5bb177d502f5
parent4a95bdda0d2113767c7d4665727edef2ca45ef68 (diff)
downloadat-spi2-atk-7fc3c0ed67c52371855c5db456f26f27dfd22126.tar.gz
Don't create a sub-directory for the socket when running as root
If an application is running as root but within a user's runtime directory, then creating a temporary directory will result in the directory being owned by root, and the user will not have permission to search the directory to access the socket, so an AT running as the normal user will not be able to connect to the application running as root. Fixes regression introduced by the fix for BGO#678348.
-rw-r--r--atk-adaptor/bridge.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c
index 8c9d6bc..9880639 100644
--- a/atk-adaptor/bridge.c
+++ b/atk-adaptor/bridge.c
@@ -298,15 +298,23 @@ register_application (SpiBridge * app)
dbus_message_unref (message);
#ifndef DISABLE_P2P
- app->app_tmp_dir = g_build_filename (g_get_user_runtime_dir (),
- "at-spi2-XXXXXX", NULL);
- if (!g_mkdtemp (app->app_tmp_dir))
+ if (getuid () != 0)
{
- g_free (app->app_tmp_dir);
- app->app_tmp_dir = NULL;
- return FALSE;
+ app->app_tmp_dir = g_build_filename (g_get_user_runtime_dir (),
+ "at-spi2-XXXXXX", NULL);
+ if (!g_mkdtemp (app->app_tmp_dir))
+ {
+ g_free (app->app_tmp_dir);
+ app->app_tmp_dir = NULL;
+ return FALSE;
+ }
}
- app->app_bus_addr = g_strdup_printf ("unix:path=%s/socket", app->app_tmp_dir);
+
+ if (app->app_tmp_dir)
+ app->app_bus_addr = g_strdup_printf ("unix:path=%s/socket", app->app_tmp_dir);
+ else
+ app->app_bus_addr = g_strdup_printf ("unix:path=%s/at-spi2-socket-%d",
+ g_get_user_runtime_dir (), getpid ());
#endif
return TRUE;