]> git.pld-linux.org Git - packages/dbus.git/blame - dbus-hello.patch
- check for SESSION_BUS_X_SESSION and launch dbus session daemon while start X session
[packages/dbus.git] / dbus-hello.patch
CommitLineData
ef9f2457
MK
1diff -u -r1.52 -r1.55
2--- bus/driver.c 10 Aug 2004 03:06:59 -0000 1.52
3+++ bus/driver.c 17 Sep 2004 09:14:49 -0000 1.55
4@@ -278,6 +278,14 @@
5
6 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
7
8+ if (bus_connection_is_active (connection))
9+ {
10+ /* We already handled an Hello message for this connection. */
11+ dbus_set_error (error, DBUS_ERROR_FAILED,
12+ "Already handled an Hello message");
13+ return FALSE;
14+ }
15+
16 /* Note that when these limits are exceeded we don't disconnect the
17 * connection; we just sort of leave it hanging there until it times
18 * out or disconnects itself or is dropped due to the max number of
19@@ -447,7 +455,7 @@
20 DBusString service_name;
21 char *name;
22 int service_reply;
23- int flags;
24+ dbus_uint32_t flags;
25 dbus_bool_t retval;
26 BusRegistry *registry;
27
28@@ -511,6 +519,7 @@
29 DBusMessage *reply;
30 DBusString service_name;
31 BusService *service;
32+ dbus_bool_t service_exists;
33 char *name;
34 dbus_bool_t retval;
35 BusRegistry *registry;
36@@ -525,10 +534,18 @@
37 return FALSE;
38
39 retval = FALSE;
40+
41+ if (strcmp (name, DBUS_SERVICE_ORG_FREEDESKTOP_DBUS) == 0)
42+ {
43+ service_exists = TRUE;
44+ }
45+ else
46+ {
47+ _dbus_string_init_const (&service_name, name);
48+ service = bus_registry_lookup (registry, &service_name);
49+ service_exists = service != NULL;
50+ }
51
52- _dbus_string_init_const (&service_name, name);
53- service = bus_registry_lookup (registry, &service_name);
54-
55 reply = dbus_message_new_method_return (message);
56 if (reply == NULL)
57 {
58@@ -537,7 +554,7 @@
59 }
60
61 if (!dbus_message_append_args (reply,
62- DBUS_TYPE_BOOLEAN, service != NULL,
63+ DBUS_TYPE_BOOLEAN, service_exists,
64 0))
65 {
66 BUS_SET_OOM (error);
67@@ -842,7 +859,6 @@
68 DBusConnection *conn;
69 DBusMessage *reply;
70 unsigned long uid;
71- const char *base_name;
72
73 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
74
75@@ -919,7 +935,6 @@
76 DBusConnection *conn;
77 DBusMessage *reply;
78 unsigned long pid;
79- const char *base_name;
80
81 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
82
83diff -u -r1.61 -r1.62
84--- bus/dispatch.c 10 Aug 2004 03:06:59 -0000 1.61
85+++ bus/dispatch.c 17 Sep 2004 09:14:49 -0000 1.62
86@@ -934,6 +934,96 @@
87 * but the correct thing may include OOM errors.
88 */
89 static dbus_bool_t
90+check_double_hello_message (BusContext *context,
91+ DBusConnection *connection)
92+{
93+ DBusMessage *message;
94+ dbus_uint32_t serial;
95+ dbus_bool_t retval;
96+ DBusError error;
97+
98+ retval = FALSE;
99+ dbus_error_init (&error);
100+ message = NULL;
101+
102+ _dbus_verbose ("check_double_hello_message for %p\n", connection);
103+
104+ message = dbus_message_new_method_call (DBUS_SERVICE_ORG_FREEDESKTOP_DBUS,
105+ DBUS_PATH_ORG_FREEDESKTOP_DBUS,
106+ DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS,
107+ "Hello");
108+
109+ if (message == NULL)
110+ return TRUE;
111+
112+ if (!dbus_connection_send (connection, message, &serial))
113+ {
114+ dbus_message_unref (message);
115+ return TRUE;
116+ }
117+
118+ dbus_message_unref (message);
119+ message = NULL;
120+
121+ /* send our message */
122+ bus_test_run_clients_loop (TRUE);
123+
124+ dbus_connection_ref (connection); /* because we may get disconnected */
125+ block_connection_until_message_from_bus (context, connection);
126+
127+ if (!dbus_connection_get_is_connected (connection))
128+ {
129+ _dbus_verbose ("connection was disconnected\n");
130+
131+ dbus_connection_unref (connection);
132+
133+ return TRUE;
134+ }
135+
136+ dbus_connection_unref (connection);
137+
138+ message = pop_message_waiting_for_memory (connection);
139+ if (message == NULL)
140+ {
141+ _dbus_warn ("Did not receive a reply to %s %d on %p\n",
142+ "Hello", serial, connection);
143+ goto out;
144+ }
145+
146+ verbose_message_received (connection, message);
147+
148+ if (!dbus_message_has_sender (message, DBUS_SERVICE_ORG_FREEDESKTOP_DBUS))
149+ {
150+ _dbus_warn ("Message has wrong sender %s\n",
151+ dbus_message_get_sender (message) ?
152+ dbus_message_get_sender (message) : "(none)");
153+ goto out;
154+ }
155+
156+ if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_ERROR)
157+ {
158+ warn_unexpected (connection, message, "method return for Hello");
159+ goto out;
160+ }
161+
162+ if (!check_no_leftovers (context))
163+ goto out;
164+
165+ retval = TRUE;
166+
167+ out:
168+ dbus_error_free (&error);
169+
170+ if (message)
171+ dbus_message_unref (message);
172+
173+ return retval;
174+}
175+
176+/* returns TRUE if the correct thing happens,
177+ * but the correct thing may include OOM errors.
178+ */
179+static dbus_bool_t
180 check_get_connection_unix_user (BusContext *context,
181 DBusConnection *connection)
182 {
183@@ -2243,7 +2333,9 @@
184 ; /* good, this is a valid response */
185 }
186 else if (dbus_message_is_error (message,
187- DBUS_ERROR_SPAWN_CHILD_EXITED))
188+ DBUS_ERROR_SPAWN_CHILD_EXITED) ||
189+ dbus_message_is_error (message,
190+ DBUS_ERROR_SPAWN_EXEC_FAILED))
191 {
192 ; /* good, this is expected also */
193 }
194@@ -2917,6 +3009,9 @@
195 if (!check_hello_message (context, foo))
196 _dbus_assert_not_reached ("hello message failed");
197
198+ if (!check_double_hello_message (context, foo))
199+ _dbus_assert_not_reached ("double hello message failed");
200+
201 if (!check_add_match_all (context, foo))
202 _dbus_assert_not_reached ("AddMatch message failed");
203
This page took 0.095522 seconds and 4 git commands to generate.