improve how the dbus address is handled
authorTrevor Saunders <trev.saunders@gmail.com>
Thu, 5 Aug 2010 23:11:34 +0000 (19:11 -0400)
committerMike Gorse <mgorse@novell.com>
Tue, 31 Aug 2010 01:12:16 +0000 (21:12 -0400)
Create unique socket names of the form
/tmp/at-spi2/socket-<pid>-<random number> This should be much safer
than the old method since each process should have only one dbus
server socket, and the random number should protect against uncleaned
up sockets.

Also set permissions on directory for dbus server sockets.

atk-adaptor/bridge.c

index 80d3f8e..86dcc82 100644 (file)
@@ -32,6 +32,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
+#include<sys/stat.h>
 #include <atk/atk.h>
 
 #include <droute/droute.h>
@@ -332,8 +333,10 @@ register_application (SpiBridge * app)
 
 /* could this be better, we accept some amount of race in getting the temp name*/
 /* make sure the directory exists */
-mkdir("/tmp/at-spi2/", 0);
-app->app_bus_addr = mktemp(file_template);
+mkdir("/tmp/at-spi2/", S_IRWXU);
+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
     {