1086f5b12c34116e2429b3f25a210309f0b2d78f
[AGL/meta-agl.git] / meta-security / recipes-core / dbus-cynara / dbus-cynara / 0004-Add-own-rule-result-unavailability-handling.patch
1 From 5bf7f759a738a451ea70732731d9a1b3e064353b Mon Sep 17 00:00:00 2001
2 From: Jacek Bukarewicz <j.bukarewicz@samsung.com>
3 Date: Thu, 27 Nov 2014 11:26:21 +0100
4 Subject: [PATCH 4/5] Add own rule result unavailability handling
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Own rule result unavailability is handled like send rules - dispatching
10 messages from the sender is blocked and resumed when result becomes
11 available.
12
13 Handler of "RequestName" method needs to return BUS_RESULT_LATER when
14 policy result is not known therefore its return type is modified.
15 Since bus message handlers are put into function pointer array other
16 message handler function singatures are also affected.
17
18 Change-Id: I4c2cbd4585e41fccd8a30f825a8f0d342ab56755
19
20 Cherry-picked from 35ef89cd6777ea2430077fc621d21bd01df92349 by Jose.bollo
21
22 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
23 ---
24  bus/dispatch.c |  11 ++-
25  bus/driver.c   | 259 ++++++++++++++++++++++++++++++---------------------------
26  bus/driver.h   |   2 +-
27  bus/policy.c   |  51 +++++++++---
28  bus/policy.h   |   6 +-
29  bus/services.c |  26 ++++--
30  bus/services.h |   3 +-
31  bus/stats.c    |  28 +++----
32  bus/stats.h    |   6 +-
33  9 files changed, 229 insertions(+), 163 deletions(-)
34
35 diff --git a/bus/dispatch.c b/bus/dispatch.c
36 index e32c9263..4d57c556 100644
37 --- a/bus/dispatch.c
38 +++ b/bus/dispatch.c
39 @@ -513,8 +513,17 @@ bus_dispatch (DBusConnection *connection,
40          }
41  
42        _dbus_verbose ("Giving message to %s\n", DBUS_SERVICE_DBUS);
43 -      if (!bus_driver_handle_message (connection, transaction, message, &error))
44 +      res = bus_driver_handle_message (connection, transaction, message, &error);
45 +      if (res == BUS_RESULT_FALSE)
46          goto out;
47 +      else if (res == BUS_RESULT_LATER)
48 +        {
49 +          /* connection has been disabled in message handler */
50 +          bus_transaction_cancel_and_free (transaction);
51 +          transaction = NULL;
52 +          result = DBUS_HANDLER_RESULT_LATER;
53 +          goto out;
54 +        }
55      }
56    else if (!bus_connection_is_active (connection)) /* clients must talk to bus driver first */
57      {
58 diff --git a/bus/driver.c b/bus/driver.c
59 index 5acdd62a..bc4ce0b5 100644
60 --- a/bus/driver.c
61 +++ b/bus/driver.c
62 @@ -427,7 +427,7 @@ create_unique_client_name (BusRegistry *registry,
63    return TRUE;
64  }
65  
66 -static dbus_bool_t
67 +static BusResult
68  bus_driver_handle_hello (DBusConnection *connection,
69                           BusTransaction *transaction,
70                           DBusMessage    *message,
71 @@ -435,7 +435,7 @@ bus_driver_handle_hello (DBusConnection *connection,
72  {
73    DBusString unique_name;
74    BusService *service;
75 -  dbus_bool_t retval;
76 +  BusResult retval;
77    BusRegistry *registry;
78    BusConnections *connections;
79  
80 @@ -446,7 +446,7 @@ bus_driver_handle_hello (DBusConnection *connection,
81        /* We already handled an Hello message for this connection. */
82        dbus_set_error (error, DBUS_ERROR_FAILED,
83                        "Already handled an Hello message");
84 -      return FALSE;
85 +      return BUS_RESULT_FALSE;
86      }
87  
88    /* Note that when these limits are exceeded we don't disconnect the
89 @@ -460,16 +460,16 @@ bus_driver_handle_hello (DBusConnection *connection,
90                                       error))
91      {
92        _DBUS_ASSERT_ERROR_IS_SET (error);
93 -      return FALSE;
94 +      return BUS_RESULT_FALSE;
95      }
96  
97    if (!_dbus_string_init (&unique_name))
98      {
99        BUS_SET_OOM (error);
100 -      return FALSE;
101 +      return BUS_RESULT_FALSE;
102      }
103  
104 -  retval = FALSE;
105 +  retval = BUS_RESULT_FALSE;
106  
107    registry = bus_connection_get_registry (connection);
108  
109 @@ -502,7 +502,7 @@ bus_driver_handle_hello (DBusConnection *connection,
110      goto out_0;
111  
112    _dbus_assert (bus_connection_is_active (connection));
113 -  retval = TRUE;
114 +  retval = BUS_RESULT_TRUE;
115  
116   out_0:
117    _dbus_string_free (&unique_name);
118 @@ -554,7 +554,7 @@ bus_driver_send_welcome_message (DBusConnection *connection,
119      }
120  }
121  
122 -static dbus_bool_t
123 +static BusResult
124  bus_driver_handle_list_services (DBusConnection *connection,
125                                   BusTransaction *transaction,
126                                   DBusMessage    *message,
127 @@ -576,14 +576,14 @@ bus_driver_handle_list_services (DBusConnection *connection,
128    if (reply == NULL)
129      {
130        BUS_SET_OOM (error);
131 -      return FALSE;
132 +      return BUS_RESULT_FALSE;
133      }
134  
135    if (!bus_registry_list_services (registry, &services, &len))
136      {
137        dbus_message_unref (reply);
138        BUS_SET_OOM (error);
139 -      return FALSE;
140 +      return BUS_RESULT_FALSE;
141      }
142  
143    dbus_message_iter_init_append (reply, &iter);
144 @@ -595,7 +595,7 @@ bus_driver_handle_list_services (DBusConnection *connection,
145        dbus_free_string_array (services);
146        dbus_message_unref (reply);
147        BUS_SET_OOM (error);
148 -      return FALSE;
149 +      return BUS_RESULT_FALSE;
150      }
151  
152    {
153 @@ -607,7 +607,7 @@ bus_driver_handle_list_services (DBusConnection *connection,
154          dbus_free_string_array (services);
155          dbus_message_unref (reply);
156          BUS_SET_OOM (error);
157 -        return FALSE;
158 +        return BUS_RESULT_FALSE;
159        }
160    }
161  
162 @@ -620,7 +620,7 @@ bus_driver_handle_list_services (DBusConnection *connection,
163            dbus_free_string_array (services);
164            dbus_message_unref (reply);
165            BUS_SET_OOM (error);
166 -          return FALSE;
167 +          return BUS_RESULT_FALSE;
168          }
169        ++i;
170      }
171 @@ -631,23 +631,23 @@ bus_driver_handle_list_services (DBusConnection *connection,
172      {
173        dbus_message_unref (reply);
174        BUS_SET_OOM (error);
175 -      return FALSE;
176 +      return BUS_RESULT_FALSE;
177      }
178  
179    if (!bus_transaction_send_from_driver (transaction, connection, reply))
180      {
181        dbus_message_unref (reply);
182        BUS_SET_OOM (error);
183 -      return FALSE;
184 +      return BUS_RESULT_FALSE;
185      }
186    else
187      {
188        dbus_message_unref (reply);
189 -      return TRUE;
190 +      return BUS_RESULT_TRUE;
191      }
192  }
193  
194 -static dbus_bool_t
195 +static BusResult
196  bus_driver_handle_list_activatable_services (DBusConnection *connection,
197                                              BusTransaction *transaction,
198                                              DBusMessage    *message,
199 @@ -669,14 +669,14 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection,
200    if (reply == NULL)
201      {
202        BUS_SET_OOM (error);
203 -      return FALSE;
204 +      return BUS_RESULT_FALSE;
205      }
206  
207    if (!bus_activation_list_services (activation, &services, &len))
208      {
209        dbus_message_unref (reply);
210        BUS_SET_OOM (error);
211 -      return FALSE;
212 +      return BUS_RESULT_FALSE;
213      }
214  
215    dbus_message_iter_init_append (reply, &iter);
216 @@ -688,7 +688,7 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection,
217        dbus_free_string_array (services);
218        dbus_message_unref (reply);
219        BUS_SET_OOM (error);
220 -      return FALSE;
221 +      return BUS_RESULT_FALSE;
222      }
223  
224    {
225 @@ -700,7 +700,7 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection,
226         dbus_free_string_array (services);
227         dbus_message_unref (reply);
228         BUS_SET_OOM (error);
229 -       return FALSE;
230 +       return BUS_RESULT_FALSE;
231        }
232    }
233  
234 @@ -713,7 +713,7 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection,
235           dbus_free_string_array (services);
236           dbus_message_unref (reply);
237           BUS_SET_OOM (error);
238 -         return FALSE;
239 +         return BUS_RESULT_FALSE;
240         }
241        ++i;
242      }
243 @@ -724,23 +724,23 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection,
244      {
245        dbus_message_unref (reply);
246        BUS_SET_OOM (error);
247 -      return FALSE;
248 +      return BUS_RESULT_FALSE;
249      }
250  
251    if (!bus_transaction_send_from_driver (transaction, connection, reply))
252      {
253        dbus_message_unref (reply);
254        BUS_SET_OOM (error);
255 -      return FALSE;
256 +      return BUS_RESULT_FALSE;
257      }
258    else
259      {
260        dbus_message_unref (reply);
261 -      return TRUE;
262 +      return BUS_RESULT_TRUE;
263      }
264  }
265  
266 -static dbus_bool_t
267 +static BusResult
268  bus_driver_handle_acquire_service (DBusConnection *connection,
269                                     BusTransaction *transaction,
270                                     DBusMessage    *message,
271 @@ -751,7 +751,8 @@ bus_driver_handle_acquire_service (DBusConnection *connection,
272    const char *name;
273    dbus_uint32_t service_reply;
274    dbus_uint32_t flags;
275 -  dbus_bool_t retval;
276 +  BusResult retval;
277 +  BusResult res;
278    BusRegistry *registry;
279  
280    _DBUS_ASSERT_ERROR_IS_CLEAR (error);
281 @@ -762,20 +763,24 @@ bus_driver_handle_acquire_service (DBusConnection *connection,
282                                DBUS_TYPE_STRING, &name,
283                                DBUS_TYPE_UINT32, &flags,
284                                DBUS_TYPE_INVALID))
285 -    return FALSE;
286 +    return BUS_RESULT_FALSE;
287  
288    _dbus_verbose ("Trying to own name %s with flags 0x%x\n", name, flags);
289  
290 -  retval = FALSE;
291 +  retval = BUS_RESULT_FALSE;
292    reply = NULL;
293  
294    _dbus_string_init_const (&service_name, name);
295  
296 -  if (!bus_registry_acquire_service (registry, connection,
297 -                                     &service_name, flags,
298 -                                     &service_reply, transaction,
299 -                                     error))
300 -    goto out;
301 +  res = bus_registry_acquire_service (registry, connection, message,
302 +                                       &service_name, flags,
303 +                                       &service_reply, transaction,
304 +                                       error);
305 +  if (res != BUS_RESULT_TRUE)
306 +    {
307 +      retval = res;
308 +      goto out;
309 +    }
310  
311    reply = dbus_message_new_method_return (message);
312    if (reply == NULL)
313 @@ -796,7 +801,7 @@ bus_driver_handle_acquire_service (DBusConnection *connection,
314        goto out;
315      }
316  
317 -  retval = TRUE;
318 +  retval = BUS_RESULT_TRUE;
319  
320   out:
321    if (reply)
322 @@ -804,7 +809,7 @@ bus_driver_handle_acquire_service (DBusConnection *connection,
323    return retval;
324  }
325  
326 -static dbus_bool_t
327 +static BusResult
328  bus_driver_handle_release_service (DBusConnection *connection,
329                                     BusTransaction *transaction,
330                                     DBusMessage    *message,
331 @@ -814,7 +819,7 @@ bus_driver_handle_release_service (DBusConnection *connection,
332    DBusString service_name;
333    const char *name;
334    dbus_uint32_t service_reply;
335 -  dbus_bool_t retval;
336 +  BusResult retval;
337    BusRegistry *registry;
338  
339    _DBUS_ASSERT_ERROR_IS_CLEAR (error);
340 @@ -824,11 +829,11 @@ bus_driver_handle_release_service (DBusConnection *connection,
341    if (!dbus_message_get_args (message, error,
342                                DBUS_TYPE_STRING, &name,
343                                DBUS_TYPE_INVALID))
344 -    return FALSE;
345 +    return BUS_RESULT_FALSE;
346  
347    _dbus_verbose ("Trying to release name %s\n", name);
348  
349 -  retval = FALSE;
350 +  retval = BUS_RESULT_FALSE;
351    reply = NULL;
352  
353    _dbus_string_init_const (&service_name, name);
354 @@ -857,7 +862,7 @@ bus_driver_handle_release_service (DBusConnection *connection,
355        goto out;
356      }
357  
358 -  retval = TRUE;
359 +  retval = BUS_RESULT_TRUE;
360  
361   out:
362    if (reply)
363 @@ -865,7 +870,7 @@ bus_driver_handle_release_service (DBusConnection *connection,
364    return retval;
365  }
366  
367 -static dbus_bool_t
368 +static BusResult
369  bus_driver_handle_service_exists (DBusConnection *connection,
370                                    BusTransaction *transaction,
371                                    DBusMessage    *message,
372 @@ -876,7 +881,7 @@ bus_driver_handle_service_exists (DBusConnection *connection,
373    BusService *service;
374    dbus_bool_t service_exists;
375    const char *name;
376 -  dbus_bool_t retval;
377 +  BusResult retval;
378    BusRegistry *registry;
379  
380    _DBUS_ASSERT_ERROR_IS_CLEAR (error);
381 @@ -886,9 +891,9 @@ bus_driver_handle_service_exists (DBusConnection *connection,
382    if (!dbus_message_get_args (message, error,
383                                DBUS_TYPE_STRING, &name,
384                                DBUS_TYPE_INVALID))
385 -    return FALSE;
386 +    return BUS_RESULT_FALSE;
387  
388 -  retval = FALSE;
389 +  retval = BUS_RESULT_FALSE;
390  
391    if (strcmp (name, DBUS_SERVICE_DBUS) == 0)
392      {
393 @@ -922,7 +927,7 @@ bus_driver_handle_service_exists (DBusConnection *connection,
394        goto out;
395      }
396  
397 -  retval = TRUE;
398 +  retval = BUS_RESULT_TRUE;
399  
400   out:
401    if (reply)
402 @@ -931,7 +936,7 @@ bus_driver_handle_service_exists (DBusConnection *connection,
403    return retval;
404  }
405  
406 -static dbus_bool_t
407 +static BusResult
408  bus_driver_handle_activate_service (DBusConnection *connection,
409                                      BusTransaction *transaction,
410                                      DBusMessage    *message,
411 @@ -939,7 +944,7 @@ bus_driver_handle_activate_service (DBusConnection *connection,
412  {
413    dbus_uint32_t flags;
414    const char *name;
415 -  dbus_bool_t retval;
416 +  BusResult retval;
417    BusActivation *activation;
418  
419    _DBUS_ASSERT_ERROR_IS_CLEAR (error);
420 @@ -953,10 +958,10 @@ bus_driver_handle_activate_service (DBusConnection *connection,
421      {
422        _DBUS_ASSERT_ERROR_IS_SET (error);
423        _dbus_verbose ("No memory to get arguments to StartServiceByName\n");
424 -      return FALSE;
425 +      return BUS_RESULT_FALSE;
426      }
427  
428 -  retval = FALSE;
429 +  retval = BUS_RESULT_FALSE;
430  
431    if (!bus_activation_activate_service (activation, connection, transaction, FALSE,
432                                          message, name, error))
433 @@ -966,7 +971,7 @@ bus_driver_handle_activate_service (DBusConnection *connection,
434        goto out;
435      }
436  
437 -  retval = TRUE;
438 +  retval = BUS_RESULT_TRUE;
439  
440   out:
441    return retval;
442 @@ -1068,13 +1073,13 @@ bus_driver_send_or_activate (BusTransaction *transaction,
443    return TRUE;
444  }
445  
446 -static dbus_bool_t
447 +static BusResult
448  bus_driver_handle_update_activation_environment (DBusConnection *connection,
449                                                   BusTransaction *transaction,
450                                                   DBusMessage    *message,
451                                                   DBusError      *error)
452  {
453 -  dbus_bool_t retval;
454 +  BusResult retval;
455    BusActivation *activation;
456    BusContext *context;
457    DBusMessageIter iter;
458 @@ -1090,7 +1095,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
459    _DBUS_ASSERT_ERROR_IS_CLEAR (error);
460  
461    if (!bus_driver_check_message_is_for_us (message, error))
462 -    return FALSE;
463 +    return BUS_RESULT_FALSE;
464  
465  #ifdef DBUS_UNIX
466      {
467 @@ -1100,7 +1105,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
468         */
469        if (!bus_driver_check_caller_is_privileged (connection, transaction,
470                                                    message, error))
471 -        return FALSE;
472 +        return BUS_RESULT_FALSE;
473      }
474  #endif
475  
476 @@ -1111,7 +1116,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
477        dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
478                        "Cannot change activation environment "
479                        "on a system bus.");
480 -      return FALSE;
481 +      return BUS_RESULT_FALSE;
482      }
483  
484    activation = bus_connection_get_activation (connection);
485 @@ -1125,7 +1130,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
486  
487    dbus_message_iter_recurse (&iter, &dict_iter);
488  
489 -  retval = FALSE;
490 +  retval = BUS_RESULT_FALSE;
491    systemd_message = NULL;
492  
493    /* Then loop through the sent dictionary, add the location of
494 @@ -1291,7 +1296,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
495                         message, error))
496      goto out;
497  
498 -  retval = TRUE;
499 +  retval = BUS_RESULT_TRUE;
500  
501   out:
502    if (systemd_message != NULL)
503 @@ -1301,7 +1306,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection,
504    return retval;
505  }
506  
507 -static dbus_bool_t
508 +static BusResult
509  bus_driver_handle_add_match (DBusConnection *connection,
510                               BusTransaction *transaction,
511                               DBusMessage    *message,
512 @@ -1367,16 +1372,16 @@ bus_driver_handle_add_match (DBusConnection *connection,
513  
514    bus_match_rule_unref (rule);
515  
516 -  return TRUE;
517 +  return BUS_RESULT_TRUE;
518  
519   failed:
520    _DBUS_ASSERT_ERROR_IS_SET (error);
521    if (rule)
522      bus_match_rule_unref (rule);
523 -  return FALSE;
524 +  return BUS_RESULT_FALSE;
525  }
526  
527 -static dbus_bool_t
528 +static BusResult
529  bus_driver_handle_remove_match (DBusConnection *connection,
530                                  BusTransaction *transaction,
531                                  DBusMessage    *message,
532 @@ -1420,16 +1425,16 @@ bus_driver_handle_remove_match (DBusConnection *connection,
533  
534    bus_match_rule_unref (rule);
535  
536 -  return TRUE;
537 +  return BUS_RESULT_TRUE;
538  
539   failed:
540    _DBUS_ASSERT_ERROR_IS_SET (error);
541    if (rule)
542      bus_match_rule_unref (rule);
543 -  return FALSE;
544 +  return BUS_RESULT_FALSE;
545  }
546  
547 -static dbus_bool_t
548 +static BusResult
549  bus_driver_handle_get_service_owner (DBusConnection *connection,
550                                      BusTransaction *transaction,
551                                      DBusMessage    *message,
552 @@ -1499,7 +1504,7 @@ bus_driver_handle_get_service_owner (DBusConnection *connection,
553  
554    dbus_message_unref (reply);
555  
556 -  return TRUE;
557 +  return BUS_RESULT_TRUE;
558  
559   oom:
560    BUS_SET_OOM (error);
561 @@ -1508,10 +1513,10 @@ bus_driver_handle_get_service_owner (DBusConnection *connection,
562    _DBUS_ASSERT_ERROR_IS_SET (error);
563    if (reply)
564      dbus_message_unref (reply);
565 -  return FALSE;
566 +  return BUS_RESULT_FALSE;
567  }
568  
569 -static dbus_bool_t
570 +static BusResult
571  bus_driver_handle_list_queued_owners (DBusConnection *connection,
572                                       BusTransaction *transaction,
573                                       DBusMessage    *message,
574 @@ -1602,7 +1607,7 @@ bus_driver_handle_list_queued_owners (DBusConnection *connection,
575  
576    dbus_message_unref (reply);
577  
578 -  return TRUE;
579 +  return BUS_RESULT_TRUE;
580  
581   oom:
582    BUS_SET_OOM (error);
583 @@ -1615,10 +1620,10 @@ bus_driver_handle_list_queued_owners (DBusConnection *connection,
584    if (base_names)
585      _dbus_list_clear (&base_names);
586  
587 -  return FALSE;
588 +  return BUS_RESULT_FALSE;
589  }
590  
591 -static dbus_bool_t
592 +static BusResult
593  bus_driver_handle_get_connection_unix_user (DBusConnection *connection,
594                                              BusTransaction *transaction,
595                                              DBusMessage    *message,
596 @@ -1673,7 +1678,7 @@ bus_driver_handle_get_connection_unix_user (DBusConnection *connection,
597  
598    dbus_message_unref (reply);
599  
600 -  return TRUE;
601 +  return BUS_RESULT_TRUE;
602  
603   oom:
604    BUS_SET_OOM (error);
605 @@ -1682,10 +1687,10 @@ bus_driver_handle_get_connection_unix_user (DBusConnection *connection,
606    _DBUS_ASSERT_ERROR_IS_SET (error);
607    if (reply)
608      dbus_message_unref (reply);
609 -  return FALSE;
610 +  return BUS_RESULT_FALSE;
611  }
612  
613 -static dbus_bool_t
614 +static BusResult
615  bus_driver_handle_get_connection_unix_process_id (DBusConnection *connection,
616                                                   BusTransaction *transaction,
617                                                   DBusMessage    *message,
618 @@ -1740,7 +1745,7 @@ bus_driver_handle_get_connection_unix_process_id (DBusConnection *connection,
619  
620    dbus_message_unref (reply);
621  
622 -  return TRUE;
623 +  return BUS_RESULT_TRUE;
624  
625   oom:
626    BUS_SET_OOM (error);
627 @@ -1749,10 +1754,10 @@ bus_driver_handle_get_connection_unix_process_id (DBusConnection *connection,
628    _DBUS_ASSERT_ERROR_IS_SET (error);
629    if (reply)
630      dbus_message_unref (reply);
631 -  return FALSE;
632 +  return BUS_RESULT_FALSE;
633  }
634  
635 -static dbus_bool_t
636 +static BusResult
637  bus_driver_handle_get_adt_audit_session_data (DBusConnection *connection,
638                                               BusTransaction *transaction,
639                                               DBusMessage    *message,
640 @@ -1803,7 +1808,7 @@ bus_driver_handle_get_adt_audit_session_data (DBusConnection *connection,
641  
642    dbus_message_unref (reply);
643  
644 -  return TRUE;
645 +  return BUS_RESULT_TRUE;
646  
647   oom:
648    BUS_SET_OOM (error);
649 @@ -1812,10 +1817,10 @@ bus_driver_handle_get_adt_audit_session_data (DBusConnection *connection,
650    _DBUS_ASSERT_ERROR_IS_SET (error);
651    if (reply)
652      dbus_message_unref (reply);
653 -  return FALSE;
654 +  return BUS_RESULT_FALSE;
655  }
656  
657 -static dbus_bool_t
658 +static BusResult
659  bus_driver_handle_get_connection_selinux_security_context (DBusConnection *connection,
660                                                            BusTransaction *transaction,
661                                                            DBusMessage    *message,
662 @@ -1863,7 +1868,7 @@ bus_driver_handle_get_connection_selinux_security_context (DBusConnection *conne
663  
664    dbus_message_unref (reply);
665  
666 -  return TRUE;
667 +  return BUS_RESULT_TRUE;
668  
669   oom:
670    BUS_SET_OOM (error);
671 @@ -1872,10 +1877,10 @@ bus_driver_handle_get_connection_selinux_security_context (DBusConnection *conne
672    _DBUS_ASSERT_ERROR_IS_SET (error);
673    if (reply)
674      dbus_message_unref (reply);
675 -  return FALSE;
676 +  return BUS_RESULT_FALSE;
677  }
678  
679 -static dbus_bool_t
680 +static BusResult
681  bus_driver_handle_get_connection_credentials (DBusConnection *connection,
682                                                BusTransaction *transaction,
683                                                DBusMessage    *message,
684 @@ -1987,7 +1992,7 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection,
685  
686    dbus_message_unref (reply);
687  
688 -  return TRUE;
689 +  return BUS_RESULT_TRUE;
690  
691   oom:
692    BUS_SET_OOM (error);
693 @@ -2001,10 +2006,10 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection,
694        dbus_message_unref (reply);
695      }
696  
697 -  return FALSE;
698 +  return BUS_RESULT_FALSE;
699  }
700  
701 -static dbus_bool_t
702 +static BusResult
703  bus_driver_handle_reload_config (DBusConnection *connection,
704                                  BusTransaction *transaction,
705                                  DBusMessage    *message,
706 @@ -2029,7 +2034,7 @@ bus_driver_handle_reload_config (DBusConnection *connection,
707      goto oom;
708  
709    dbus_message_unref (reply);
710 -  return TRUE;
711 +  return BUS_RESULT_TRUE;
712  
713   oom:
714    BUS_SET_OOM (error);
715 @@ -2038,11 +2043,11 @@ bus_driver_handle_reload_config (DBusConnection *connection,
716    _DBUS_ASSERT_ERROR_IS_SET (error);
717    if (reply)
718      dbus_message_unref (reply);
719 -  return FALSE;
720 +  return BUS_RESULT_FALSE;
721  }
722  
723  #ifdef DBUS_ENABLE_VERBOSE_MODE
724 -static dbus_bool_t
725 +static BusResult
726  bus_driver_handle_enable_verbose (DBusConnection *connection,
727                                    BusTransaction *transaction,
728                                    DBusMessage    *message,
729 @@ -2062,7 +2067,7 @@ bus_driver_handle_enable_verbose (DBusConnection *connection,
730      _dbus_set_verbose(TRUE);
731  
732      dbus_message_unref (reply);
733 -    return TRUE;
734 +    return BUS_RESULT_TRUE;
735  
736     oom:
737      _DBUS_ASSERT_ERROR_IS_CLEAR (error);
738 @@ -2071,10 +2076,10 @@ bus_driver_handle_enable_verbose (DBusConnection *connection,
739  
740      if (reply)
741        dbus_message_unref (reply);
742 -    return FALSE;
743 +    return BUS_RESULT_FALSE;
744  }
745  
746 -static dbus_bool_t
747 +static BusResult
748  bus_driver_handle_disable_verbose (DBusConnection *connection,
749                                     BusTransaction *transaction,
750                                     DBusMessage    *message,
751 @@ -2094,7 +2099,7 @@ bus_driver_handle_disable_verbose (DBusConnection *connection,
752      _dbus_set_verbose(FALSE);
753  
754      dbus_message_unref (reply);
755 -    return TRUE;
756 +    return BUS_RESULT_TRUE;
757  
758     oom:
759      _DBUS_ASSERT_ERROR_IS_CLEAR (error);
760 @@ -2103,11 +2108,11 @@ bus_driver_handle_disable_verbose (DBusConnection *connection,
761  
762      if (reply)
763        dbus_message_unref (reply);
764 -    return FALSE;
765 +    return BUS_RESULT_FALSE;
766  }
767  #endif
768  
769 -static dbus_bool_t
770 +static BusResult
771  bus_driver_handle_get_id (DBusConnection *connection,
772                            BusTransaction *transaction,
773                            DBusMessage    *message,
774 @@ -2123,7 +2128,7 @@ bus_driver_handle_get_id (DBusConnection *connection,
775    if (!_dbus_string_init (&uuid))
776      {
777        BUS_SET_OOM (error);
778 -      return FALSE;
779 +      return BUS_RESULT_FALSE;
780      }
781  
782    reply = NULL;
783 @@ -2149,7 +2154,7 @@ bus_driver_handle_get_id (DBusConnection *connection,
784  
785    _dbus_string_free (&uuid);
786    dbus_message_unref (reply);
787 -  return TRUE;
788 +  return BUS_RESULT_TRUE;
789  
790   oom:
791    _DBUS_ASSERT_ERROR_IS_CLEAR (error);
792 @@ -2159,10 +2164,10 @@ bus_driver_handle_get_id (DBusConnection *connection,
793    if (reply)
794      dbus_message_unref (reply);
795    _dbus_string_free (&uuid);
796 -  return FALSE;
797 +  return BUS_RESULT_FALSE;
798  }
799  
800 -static dbus_bool_t
801 +static BusResult
802  bus_driver_handle_become_monitor (DBusConnection *connection,
803                                    BusTransaction *transaction,
804                                    DBusMessage    *message,
805 @@ -2178,7 +2183,7 @@ bus_driver_handle_become_monitor (DBusConnection *connection,
806    int i;
807    int n_match_rules;
808    dbus_uint32_t flags;
809 -  dbus_bool_t ret = FALSE;
810 +  BusResult ret = BUS_RESULT_FALSE;
811  
812    _DBUS_ASSERT_ERROR_IS_CLEAR (error);
813  
814 @@ -2258,10 +2263,10 @@ bus_driver_handle_become_monitor (DBusConnection *connection,
815    if (!bus_connection_be_monitor (connection, transaction, &rules, error))
816      goto out;
817  
818 -  ret = TRUE;
819 +  ret = BUS_RESULT_TRUE;
820  
821  out:
822 -  if (ret)
823 +  if (ret == BUS_RESULT_TRUE)
824      _DBUS_ASSERT_ERROR_IS_CLEAR (error);
825    else
826      _DBUS_ASSERT_ERROR_IS_SET (error);
827 @@ -2282,10 +2287,10 @@ typedef struct
828    const char *name;
829    const char *in_args;
830    const char *out_args;
831 -  dbus_bool_t (* handler) (DBusConnection *connection,
832 -                           BusTransaction *transaction,
833 -                           DBusMessage    *message,
834 -                           DBusError      *error);
835 +  BusResult (* handler) (DBusConnection *connection,
836 +                         BusTransaction *transaction,
837 +                         DBusMessage    *message,
838 +                         DBusError      *error);
839  } MessageHandler;
840  
841  /* For speed it might be useful to sort this in order of
842 @@ -2370,7 +2375,7 @@ static const MessageHandler dbus_message_handlers[] = {
843    { NULL, NULL, NULL, NULL }
844  };
845  
846 -static dbus_bool_t bus_driver_handle_introspect (DBusConnection *,
847 +static BusResult bus_driver_handle_introspect (DBusConnection *,
848      BusTransaction *, DBusMessage *, DBusError *);
849  
850  static const MessageHandler introspectable_message_handlers[] = {
851 @@ -2514,7 +2519,7 @@ bus_driver_generate_introspect_string (DBusString *xml)
852    return TRUE;
853  }
854  
855 -static dbus_bool_t
856 +static BusResult
857  bus_driver_handle_introspect (DBusConnection *connection,
858                                BusTransaction *transaction,
859                                DBusMessage    *message,
860 @@ -2534,13 +2539,13 @@ bus_driver_handle_introspect (DBusConnection *connection,
861                                DBUS_TYPE_INVALID))
862      {
863        _DBUS_ASSERT_ERROR_IS_SET (error);
864 -      return FALSE;
865 +      return BUS_RESULT_FALSE;
866      }
867  
868    if (!_dbus_string_init (&xml))
869      {
870        BUS_SET_OOM (error);
871 -      return FALSE;
872 +      return BUS_RESULT_FALSE;
873      }
874  
875    if (!bus_driver_generate_introspect_string (&xml))
876 @@ -2563,7 +2568,7 @@ bus_driver_handle_introspect (DBusConnection *connection,
877    dbus_message_unref (reply);
878    _dbus_string_free (&xml);
879  
880 -  return TRUE;
881 +  return BUS_RESULT_TRUE;
882  
883   oom:
884    BUS_SET_OOM (error);
885 @@ -2573,7 +2578,7 @@ bus_driver_handle_introspect (DBusConnection *connection,
886  
887    _dbus_string_free (&xml);
888  
889 -  return FALSE;
890 +  return BUS_RESULT_FALSE;
891  }
892  
893  /*
894 @@ -2608,7 +2613,7 @@ bus_driver_check_message_is_for_us (DBusMessage *message,
895    return TRUE;
896  }
897  
898 -dbus_bool_t
899 +BusResult
900  bus_driver_handle_message (DBusConnection *connection,
901                             BusTransaction *transaction,
902                            DBusMessage    *message,
903 @@ -2618,6 +2623,7 @@ bus_driver_handle_message (DBusConnection *connection,
904    const InterfaceHandler *ih;
905    const MessageHandler *mh;
906    dbus_bool_t found_interface = FALSE;
907 +  BusResult res;
908  
909    _DBUS_ASSERT_ERROR_IS_CLEAR (error);
910  
911 @@ -2633,7 +2639,7 @@ bus_driver_handle_message (DBusConnection *connection,
912                                                    transaction,
913                                                    message,
914                                                    error))
915 -        return FALSE;
916 +        return BUS_RESULT_FALSE;
917  
918        context = bus_connection_get_context (connection);
919        systemd = bus_driver_get_owner_of_name (connection,
920 @@ -2650,7 +2656,7 @@ bus_driver_handle_message (DBusConnection *connection,
921                             attacker ? attacker : "(unauthenticated)",
922                             bus_connection_get_loginfo (connection));
923            /* ignore it */
924 -          return TRUE;
925 +          return BUS_RESULT_TRUE;
926          }
927  
928        if (!bus_context_get_systemd_activation (context))
929 @@ -2658,16 +2664,16 @@ bus_driver_handle_message (DBusConnection *connection,
930            bus_context_log (context, DBUS_SYSTEM_LOG_WARNING,
931                             "Ignoring unexpected ActivationFailure message "
932                             "while not using systemd activation");
933 -          return FALSE;
934 +          return BUS_RESULT_FALSE;
935          }
936  
937 -      return dbus_activation_systemd_failure(bus_context_get_activation(context), message);
938 +      return dbus_activation_systemd_failure(bus_context_get_activation(context), message) == TRUE ? BUS_RESULT_TRUE : BUS_RESULT_FALSE;
939      }
940  
941    if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_CALL)
942      {
943        _dbus_verbose ("Driver got a non-method-call message, ignoring\n");
944 -      return TRUE; /* we just ignore this */
945 +      return BUS_RESULT_TRUE; /* we just ignore this */
946      }
947  
948    /* may be NULL, which means "any interface will do" */
949 @@ -2709,20 +2715,27 @@ bus_driver_handle_message (DBusConnection *connection,
950                                name, dbus_message_get_signature (message),
951                                mh->in_args);
952                _DBUS_ASSERT_ERROR_IS_SET (error);
953 -              return FALSE;
954 +              return BUS_RESULT_FALSE;
955              }
956  
957 -          if ((* mh->handler) (connection, transaction, message, error))
958 +          res = (* mh->handler) (connection, transaction, message, error);
959 +          if (res == BUS_RESULT_TRUE)
960              {
961                _DBUS_ASSERT_ERROR_IS_CLEAR (error);
962                _dbus_verbose ("Driver handler succeeded\n");
963 -              return TRUE;
964 +              return BUS_RESULT_TRUE;
965              }
966 -          else
967 +          else if (res == BUS_RESULT_FALSE)
968              {
969                _DBUS_ASSERT_ERROR_IS_SET (error);
970                _dbus_verbose ("Driver handler returned failure\n");
971 -              return FALSE;
972 +              return BUS_RESULT_FALSE;
973 +            }
974 +          else if (res == BUS_RESULT_LATER)
975 +            {
976 +              _DBUS_ASSERT_ERROR_IS_CLEAR (error);
977 +              _dbus_verbose ("Driver handler delayed message processing due to policy check\n");
978 +              return BUS_RESULT_LATER;
979              }
980          }
981      }
982 @@ -2734,7 +2747,7 @@ bus_driver_handle_message (DBusConnection *connection,
983                    "%s does not understand message %s",
984                    DBUS_SERVICE_DBUS, name);
985  
986 -  return FALSE;
987 +  return BUS_RESULT_FALSE;
988  }
989  
990  void
991 diff --git a/bus/driver.h b/bus/driver.h
992 index 201709c4..3ff4ff15 100644
993 --- a/bus/driver.h
994 +++ b/bus/driver.h
995 @@ -28,7 +28,7 @@
996  #include "connection.h"
997  
998  void        bus_driver_remove_connection     (DBusConnection *connection);
999 -dbus_bool_t bus_driver_handle_message        (DBusConnection *connection,
1000 +BusResult   bus_driver_handle_message        (DBusConnection *connection,
1001                                                BusTransaction *transaction,
1002                                                DBusMessage    *message,
1003                                                DBusError      *error);
1004 diff --git a/bus/policy.c b/bus/policy.c
1005 index 47bd1a24..7244a46f 100644
1006 --- a/bus/policy.c
1007 +++ b/bus/policy.c
1008 @@ -1323,18 +1323,21 @@ bus_client_policy_check_can_receive (BusClientPolicy     *policy,
1009  
1010  
1011  
1012 -static dbus_bool_t
1013 +static BusResult
1014  bus_rules_check_can_own (DBusList *rules,
1015 -                         const DBusString *service_name)
1016 +                         const DBusString *service_name,
1017 +                         DBusConnection   *connection,
1018 +                         DBusMessage      *message)
1019  {
1020    DBusList *link;
1021 -  dbus_bool_t allowed;
1022 +  BusResult result;
1023 +  const char *privilege;
1024    
1025    /* rules is in the order the rules appeared
1026     * in the config file, i.e. last rule that applies wins
1027     */
1028  
1029 -  allowed = FALSE;
1030 +  result = BUS_RESULT_FALSE;
1031    link = _dbus_list_get_first_link (&rules);
1032    while (link != NULL)
1033      {
1034 @@ -1370,17 +1373,45 @@ bus_rules_check_can_own (DBusList *rules,
1035          }
1036  
1037        /* Use this rule */
1038 -      allowed = rule->access == BUS_POLICY_RULE_ACCESS_ALLOW;
1039 +      switch (rule->access)
1040 +      {
1041 +      case BUS_POLICY_RULE_ACCESS_ALLOW:
1042 +        result = BUS_RESULT_TRUE;
1043 +        break;
1044 +      case BUS_POLICY_RULE_ACCESS_DENY:
1045 +        result = BUS_RESULT_FALSE;
1046 +        break;
1047 +      case BUS_POLICY_RULE_ACCESS_CHECK:
1048 +        result = BUS_RESULT_LATER;
1049 +        privilege = rule->privilege;
1050 +        break;
1051 +      }
1052      }
1053  
1054 -  return allowed;
1055 +  if (result == BUS_RESULT_LATER)
1056 +    {
1057 +      BusContext *context = bus_connection_get_context(connection);
1058 +      BusCheck *check = bus_context_get_check(context);
1059 +      BusDeferredMessage *deferred_message;
1060 +
1061 +      result = bus_check_privilege(check, message, connection, NULL, NULL,
1062 +          privilege, BUS_DEFERRED_MESSAGE_CHECK_OWN, &deferred_message);
1063 +      if (result == BUS_RESULT_LATER)
1064 +        {
1065 +          bus_deferred_message_disable_sender(deferred_message);
1066 +        }
1067 +    }
1068 +
1069 +  return result;
1070  }
1071  
1072 -dbus_bool_t
1073 +BusResult
1074  bus_client_policy_check_can_own (BusClientPolicy  *policy,
1075 -                                 const DBusString *service_name)
1076 +                                 const DBusString *service_name,
1077 +                                 DBusConnection   *connection,
1078 +                                 DBusMessage      *message)
1079  {
1080 -  return bus_rules_check_can_own (policy->rules, service_name);
1081 +  return bus_rules_check_can_own (policy->rules, service_name, connection, message);
1082  }
1083  
1084  #ifdef DBUS_ENABLE_EMBEDDED_TESTS
1085 @@ -1388,7 +1419,7 @@ dbus_bool_t
1086  bus_policy_check_can_own (BusPolicy  *policy,
1087                            const DBusString *service_name)
1088  {
1089 -  return bus_rules_check_can_own (policy->default_rules, service_name);
1090 +  return bus_rules_check_can_own (policy->default_rules, service_name, NULL, NULL) == BUS_RESULT_TRUE;
1091  }
1092  #endif /* DBUS_ENABLE_EMBEDDED_TESTS */
1093  
1094 diff --git a/bus/policy.h b/bus/policy.h
1095 index e9f193af..1f234310 100644
1096 --- a/bus/policy.h
1097 +++ b/bus/policy.h
1098 @@ -170,8 +170,10 @@ BusResult        bus_client_policy_check_can_receive (BusClientPolicy     *polic
1099                                                        dbus_int32_t        *toggles,
1100                                                        const char         **privilege_param,
1101                                                        BusDeferredMessage **deferred_message);
1102 -dbus_bool_t      bus_client_policy_check_can_own     (BusClientPolicy  *policy,
1103 -                                                      const DBusString *service_name);
1104 +BusResult        bus_client_policy_check_can_own     (BusClientPolicy  *policy,
1105 +                                                      const DBusString *service_name,
1106 +                                                      DBusConnection   *connection,
1107 +                                                      DBusMessage      *message);
1108  dbus_bool_t      bus_client_policy_append_rule       (BusClientPolicy  *policy,
1109                                                        BusPolicyRule    *rule);
1110  void             bus_client_policy_optimize          (BusClientPolicy  *policy);
1111 diff --git a/bus/services.c b/bus/services.c
1112 index 6a4c8848..fcc2d261 100644
1113 --- a/bus/services.c
1114 +++ b/bus/services.c
1115 @@ -376,24 +376,26 @@ bus_registry_list_services (BusRegistry *registry,
1116    return FALSE;
1117  }
1118  
1119 -dbus_bool_t
1120 +BusResult
1121  bus_registry_acquire_service (BusRegistry      *registry,
1122                                DBusConnection   *connection,
1123 +                              DBusMessage      *message,
1124                                const DBusString *service_name,
1125                                dbus_uint32_t     flags,
1126                                dbus_uint32_t    *result,
1127                                BusTransaction   *transaction,
1128                                DBusError        *error)
1129  {
1130 -  dbus_bool_t retval;
1131 +  BusResult retval;
1132    DBusConnection *old_owner_conn;
1133    BusClientPolicy *policy;
1134    BusService *service;
1135    BusActivation  *activation;
1136    BusSELinuxID *sid;
1137    BusOwner *primary_owner;
1138 +  BusResult res;
1139   
1140 -  retval = FALSE;
1141 +  retval = BUS_RESULT_FALSE;
1142  
1143    if (!_dbus_validate_bus_name (service_name, 0,
1144                                  _dbus_string_get_length (service_name)))
1145 @@ -466,7 +468,8 @@ bus_registry_acquire_service (BusRegistry      *registry,
1146                                              _dbus_string_get_const_data (service_name), error))
1147      goto out;
1148    
1149 -  if (!bus_client_policy_check_can_own (policy, service_name))
1150 +  res = bus_client_policy_check_can_own (policy, service_name, connection, message);
1151 +  if (res == BUS_RESULT_FALSE)
1152      {
1153        dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
1154                        "Connection \"%s\" is not allowed to own the service \"%s\" due "
1155 @@ -477,6 +480,11 @@ bus_registry_acquire_service (BusRegistry      *registry,
1156                        _dbus_string_get_const_data (service_name));
1157        goto out;
1158      }
1159 +  else if (res == BUS_RESULT_LATER)
1160 +    {
1161 +      retval = BUS_RESULT_LATER;
1162 +      goto out;
1163 +    }
1164  
1165    if (bus_connection_get_n_services_owned (connection) >=
1166        bus_context_get_max_services_per_connection (registry->context))
1167 @@ -593,11 +601,13 @@ bus_registry_acquire_service (BusRegistry      *registry,
1168      }
1169  
1170    activation = bus_context_get_activation (registry->context);
1171 -  retval = bus_activation_send_pending_auto_activation_messages (activation,
1172 +  
1173 +  if (bus_activation_send_pending_auto_activation_messages (activation,
1174                                                                  service,
1175 -                                                                transaction);
1176 -  if (!retval)
1177 -    BUS_SET_OOM (error);
1178 +                                                                transaction))
1179 +      retval = BUS_RESULT_TRUE;
1180 +  else
1181 +      BUS_SET_OOM (error);
1182    
1183   out:
1184    return retval;
1185 diff --git a/bus/services.h b/bus/services.h
1186 index 056dd9fa..3df3dd7d 100644
1187 --- a/bus/services.h
1188 +++ b/bus/services.h
1189 @@ -50,8 +50,9 @@ void         bus_registry_foreach         (BusRegistry                 *registry
1190  dbus_bool_t  bus_registry_list_services   (BusRegistry                 *registry,
1191                                             char                      ***listp,
1192                                             int                         *array_len);
1193 -dbus_bool_t  bus_registry_acquire_service (BusRegistry                 *registry,
1194 +BusResult    bus_registry_acquire_service (BusRegistry                 *registry,
1195                                             DBusConnection              *connection,
1196 +                                           DBusMessage                 *message,
1197                                             const DBusString            *service_name,
1198                                             dbus_uint32_t                flags,
1199                                             dbus_uint32_t               *result,
1200 diff --git a/bus/stats.c b/bus/stats.c
1201 index dace0e29..aab0e5c9 100644
1202 --- a/bus/stats.c
1203 +++ b/bus/stats.c
1204 @@ -36,7 +36,7 @@
1205  
1206  #ifdef DBUS_ENABLE_STATS
1207  
1208 -dbus_bool_t
1209 +BusResult
1210  bus_stats_handle_get_stats (DBusConnection *connection,
1211                              BusTransaction *transaction,
1212                              DBusMessage    *message,
1213 @@ -52,7 +52,7 @@ bus_stats_handle_get_stats (DBusConnection *connection,
1214    _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1215  
1216    if (!bus_driver_check_message_is_for_us (message, error))
1217 -    return FALSE;
1218 +    return BUS_RESULT_FALSE;
1219  
1220    context = bus_transaction_get_context (transaction);
1221    connections = bus_context_get_connections (context);
1222 @@ -107,17 +107,17 @@ bus_stats_handle_get_stats (DBusConnection *connection,
1223      goto oom;
1224  
1225    dbus_message_unref (reply);
1226 -  return TRUE;
1227 +  return BUS_RESULT_TRUE;
1228  
1229  oom:
1230    if (reply != NULL)
1231      dbus_message_unref (reply);
1232  
1233    BUS_SET_OOM (error);
1234 -  return FALSE;
1235 +  return BUS_RESULT_FALSE;
1236  }
1237  
1238 -dbus_bool_t
1239 +BusResult
1240  bus_stats_handle_get_connection_stats (DBusConnection *caller_connection,
1241                                         BusTransaction *transaction,
1242                                         DBusMessage    *message,
1243 @@ -137,14 +137,14 @@ bus_stats_handle_get_connection_stats (DBusConnection *caller_connection,
1244    _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1245  
1246    if (!bus_driver_check_message_is_for_us (message, error))
1247 -    return FALSE;
1248 +    return BUS_RESULT_FALSE;
1249  
1250    registry = bus_connection_get_registry (caller_connection);
1251  
1252    if (! dbus_message_get_args (message, error,
1253                                 DBUS_TYPE_STRING, &bus_name,
1254                                 DBUS_TYPE_INVALID))
1255 -      return FALSE;
1256 +      return BUS_RESULT_FALSE;
1257  
1258    _dbus_string_init_const (&bus_name_str, bus_name);
1259    service = bus_registry_lookup (registry, &bus_name_str);
1260 @@ -153,7 +153,7 @@ bus_stats_handle_get_connection_stats (DBusConnection *caller_connection,
1261      {
1262        dbus_set_error (error, DBUS_ERROR_NAME_HAS_NO_OWNER,
1263                        "Bus name '%s' has no owner", bus_name);
1264 -      return FALSE;
1265 +      return BUS_RESULT_FALSE;
1266      }
1267  
1268    stats_connection = bus_service_get_primary_owners_connection (service);
1269 @@ -215,18 +215,18 @@ bus_stats_handle_get_connection_stats (DBusConnection *caller_connection,
1270      goto oom;
1271  
1272    dbus_message_unref (reply);
1273 -  return TRUE;
1274 +  return BUS_RESULT_TRUE;
1275  
1276  oom:
1277    if (reply != NULL)
1278      dbus_message_unref (reply);
1279  
1280    BUS_SET_OOM (error);
1281 -  return FALSE;
1282 +  return BUS_RESULT_FALSE;
1283  }
1284  
1285  
1286 -dbus_bool_t
1287 +BusResult
1288  bus_stats_handle_get_all_match_rules (DBusConnection *caller_connection,
1289                                        BusTransaction *transaction,
1290                                        DBusMessage    *message,
1291 @@ -250,7 +250,7 @@ bus_stats_handle_get_all_match_rules (DBusConnection *caller_connection,
1292    matchmaker = bus_context_get_matchmaker (context);
1293  
1294    if (!bus_registry_list_services (registry, &services, &services_len))
1295 -    return FALSE;
1296 +    return BUS_RESULT_FALSE;
1297  
1298    reply = dbus_message_new_method_return (message);
1299    if (reply == NULL)
1300 @@ -329,7 +329,7 @@ bus_stats_handle_get_all_match_rules (DBusConnection *caller_connection,
1301  
1302    dbus_message_unref (reply);
1303    dbus_free_string_array (services);
1304 -  return TRUE;
1305 +  return BUS_RESULT_TRUE;
1306  
1307  oom:
1308    if (reply != NULL)
1309 @@ -338,7 +338,7 @@ oom:
1310    dbus_free_string_array (services);
1311  
1312    BUS_SET_OOM (error);
1313 -  return FALSE;
1314 +  return BUS_RESULT_FALSE;
1315  }
1316  
1317  #endif
1318 diff --git a/bus/stats.h b/bus/stats.h
1319 index dcb022c4..683fa175 100644
1320 --- a/bus/stats.h
1321 +++ b/bus/stats.h
1322 @@ -25,17 +25,17 @@
1323  
1324  #define BUS_INTERFACE_STATS "org.freedesktop.DBus.Debug.Stats"
1325  
1326 -dbus_bool_t bus_stats_handle_get_stats (DBusConnection *connection,
1327 +BusResult bus_stats_handle_get_stats (DBusConnection *connection,
1328                                          BusTransaction *transaction,
1329                                          DBusMessage    *message,
1330                                          DBusError      *error);
1331  
1332 -dbus_bool_t bus_stats_handle_get_connection_stats (DBusConnection *connection,
1333 +BusResult bus_stats_handle_get_connection_stats (DBusConnection *connection,
1334                                                     BusTransaction *transaction,
1335                                                     DBusMessage    *message,
1336                                                     DBusError      *error);
1337  
1338 -dbus_bool_t bus_stats_handle_get_all_match_rules (DBusConnection *caller_connection,
1339 +BusResult bus_stats_handle_get_all_match_rules (DBusConnection *caller_connection,
1340                                                    BusTransaction *transaction,
1341                                                    DBusMessage    *message,
1342                                                    DBusError      *error);
1343 -- 
1344 2.14.3
1345