If we use XDG_RUNTIME_DIR, then the directory should be owned by the
appropriate user, so it should not need to be world-writable. Hopefully this
won't break accessibility for administrative apps on some distro.
https://bugzilla.gnome.org/show_bug.cgi?id=678348
const char *retval = (g_getenv ("AT_SPI_CLIENT") ?
"":
spi_global_app_data->app_bus_addr);
const char *retval = (g_getenv ("AT_SPI_CLIENT") ?
"":
spi_global_app_data->app_bus_addr);
+ if (!retval)
+ retval = "";
dbus_message_append_args(reply, DBUS_TYPE_STRING, &retval, DBUS_TYPE_INVALID);
}
dbus_message_append_args(reply, DBUS_TYPE_STRING, &retval, DBUS_TYPE_INVALID);
}
DBusMessageIter iter;
DBusError error;
DBusPendingCall *pending;
DBusMessageIter iter;
DBusError error;
DBusPendingCall *pending;
- const int max_addr_length = 128; /* should be long enough */
dbus_error_init (&error);
dbus_error_init (&error);
if (message)
dbus_message_unref (message);
if (message)
dbus_message_unref (message);
- /* could this be better, we accept some amount of race in getting the temp name*/
- /* make sure the directory exists */
- mkdir ("/tmp/at-spi2/", S_IRWXU|S_IRWXG|S_IRWXO|S_ISVTX);
- chmod ("/tmp/at-spi2/", S_IRWXU|S_IRWXG|S_IRWXO|S_ISVTX);
- app->app_bus_addr = g_malloc(max_addr_length * sizeof(char));
- sprintf (app->app_bus_addr, "unix:path=/tmp/at-spi2/socket-%d-%d", getpid(),
- rand());
-#else
- app->app_bus_addr [0] = '\0';
+ 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);
dbus_connection_send (app->bus, message, NULL);
if (message)
dbus_message_unref (message);
dbus_connection_send (app->bus, message, NULL);
if (message)
dbus_message_unref (message);
+
+ if (app->app_bus_addr)
+ {
+ unlink (app->app_bus_addr);
+ g_free (app->app_bus_addr);
+ app->app_bus_addr = NULL;
+ }
+
+ if (app->app_tmp_dir)
+ {
+ rmdir (app->app_tmp_dir);
+ g_free (app->app_tmp_dir);
+ app->app_tmp_dir = NULL;
+ }
}
/*---------------------------------------------------------------------------*/
}
/*---------------------------------------------------------------------------*/
DBusServer *server;
DBusError err;
DBusServer *server;
DBusError err;
+ if (!spi_global_app_data->app_bus_addr)
+ return -1;
+
dbus_error_init(&err);
server = dbus_server_listen(spi_global_app_data->app_bus_addr, &err);
if (server == NULL)
dbus_error_init(&err);
server = dbus_server_listen(spi_global_app_data->app_bus_addr, &err);
if (server == NULL)
*/
gchar *desktop_name;
gchar *desktop_path;
*/
gchar *desktop_name;
gchar *desktop_path;
+gchar *app_tmp_dir;
+gchar *app_bus_addr;
GList *events;
gboolean events_initialized;
};
GList *events;
gboolean events_initialized;
};