15120
|
1 |
diff -up GConf-2.24.0/gconf/gconf-internals.c.orig GConf-2.24.0/gconf/gconf-internals.c
|
|
2 |
--- GConf-2.24.0/gconf/gconf-internals.c.orig 2008-06-28 10:58:36.000000000 +0100
|
|
3 |
+++ GConf-2.24.0/gconf/gconf-internals.c 2008-10-10 15:33:56.494241754 +0100
|
|
4 |
@@ -2428,11 +2428,12 @@ get_ior (gboolean start_if_not_found,
|
|
5 |
DBusConnection *connection;
|
|
6 |
DBusError bus_error;
|
|
7 |
char *ior;
|
|
8 |
+ const char *dbus_address = NULL;
|
|
9 |
|
|
10 |
/* if the bus isn't running and we don't want to start gconfd then
|
|
11 |
* we don't want to autolaunch the bus either, so bail early.
|
|
12 |
*/
|
|
13 |
- if (g_getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL &&
|
|
14 |
+ if ( (dbus_address = g_getenv ("DBUS_SESSION_BUS_ADDRESS")) == NULL &&
|
|
15 |
(!start_if_not_found || g_getenv ("DISPLAY") == NULL)) {
|
|
16 |
if (failure_log)
|
|
17 |
g_string_append_printf (failure_log,
|
|
18 |
@@ -2440,6 +2441,32 @@ get_ior (gboolean start_if_not_found,
|
|
19 |
return NULL;
|
|
20 |
}
|
|
21 |
|
|
22 |
+ if ( dbus_address != NULL ) {
|
|
23 |
+ DBusAddressEntry **address_entries;
|
|
24 |
+ int address_entries_len = 0;
|
|
25 |
+ const char *method = NULL;
|
|
26 |
+
|
|
27 |
+ if ( dbus_parse_address( dbus_address, &address_entries, &address_entries_len, NULL ) ) {
|
|
28 |
+ for ( int i = 0; i < address_entries_len; i++ ) {
|
|
29 |
+ method = dbus_address_entry_get_method( address_entries[i] );
|
|
30 |
+
|
|
31 |
+ if ( method != NULL && strcmp( method, "unix" ) == 0 ) {
|
|
32 |
+ struct stat s;
|
|
33 |
+
|
|
34 |
+ const char *path = dbus_address_entry_get_value(address_entries[i], "path");
|
|
35 |
+ if ( path != NULL && stat( path, &s ) == 0 &&
|
|
36 |
+ s.st_uid != geteuid() ) {
|
|
37 |
+ /* The session bus isn't the same as the effective uid so
|
|
38 |
+ * it's highly likely to fail to connect to the server so
|
|
39 |
+ * don't use it, unset the environment variable.
|
|
40 |
+ */
|
|
41 |
+ g_unsetenv("DBUS_SESSION_BUS_ADDRESS");
|
|
42 |
+ }
|
|
43 |
+ }
|
|
44 |
+ }
|
|
45 |
+ }
|
|
46 |
+ }
|
|
47 |
+
|
|
48 |
dbus_error_init (&bus_error);
|
|
49 |
connection = dbus_bus_get (DBUS_BUS_SESSION, &bus_error);
|
|
50 |
|
|
51 |
|