Coverage report for bus/driver.c.gcov

        -:    0:Source:driver.c
        -:    0:Graph:driver.gcno
        -:    0:Data:driver.gcda
        -:    0:Runs:10118
        -:    0:Programs:2
        -:    1:/* -*- mode: C; c-file-style: "gnu" -*- */
        -:    2:/* driver.c  Bus client (driver)
        -:    3: *
        -:    4: * Copyright (C) 2003 CodeFactory AB
        -:    5: * Copyright (C) 2003, 2004, 2005 Red Hat, Inc.
        -:    6: *
        -:    7: * Licensed under the Academic Free License version 2.1
        -:    8: * 
        -:    9: * This program is free software; you can redistribute it and/or modify
        -:   10: * it under the terms of the GNU General Public License as published by
        -:   11: * the Free Software Foundation; either version 2 of the License, or
        -:   12: * (at your option) any later version.
        -:   13: *
        -:   14: * This program is distributed in the hope that it will be useful,
        -:   15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
        -:   16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        -:   17: * GNU General Public License for more details.
        -:   18: * 
        -:   19: * You should have received a copy of the GNU General Public License
        -:   20: * along with this program; if not, write to the Free Software
        -:   21: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
        -:   22: *
        -:   23: */
        -:   24:
        -:   25:#include "activation.h"
        -:   26:#include "connection.h"
        -:   27:#include "driver.h"
        -:   28:#include "dispatch.h"
        -:   29:#include "services.h"
        -:   30:#include "selinux.h"
        -:   31:#include "signals.h"
        -:   32:#include "utils.h"
        -:   33:#include <dbus/dbus-string.h>
        -:   34:#include <dbus/dbus-internals.h>
        -:   35:#include <dbus/dbus-marshal-recursive.h>
        -:   36:#include <string.h>
        -:   37:
        -:   38:static dbus_bool_t bus_driver_send_welcome_message (DBusConnection *connection,
        -:   39:                                                    DBusMessage    *hello_message,
        -:   40:                                                    BusTransaction *transaction,
        -:   41:                                                    DBusError      *error);
        -:   42:
        -:   43:dbus_bool_t
        -:   44:bus_driver_send_service_owner_changed (const char     *service_name,
        -:   45:				       const char     *old_owner,
        -:   46:				       const char     *new_owner,
        -:   47:				       BusTransaction *transaction,
        -:   48:				       DBusError      *error)
function bus_driver_send_service_owner_changed called 15110 returned 100% blocks executed 97%
    15110:   49:{
        -:   50:  DBusMessage *message;
        -:   51:  dbus_bool_t retval;
        -:   52:  const char *null_service;
        -:   53:
    15110:   54:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
        -:   55:
    15110:   56:  null_service = "";
    15110:   57:  _dbus_verbose ("sending name owner changed: %s [%s -> %s]\n",
branch  0 taken 52% (fallthrough)
branch  1 taken 48%
branch  2 taken 48% (fallthrough)
branch  3 taken 52%
call    4 returned 100%
        -:   58:                 service_name, 
        -:   59:                 old_owner ? old_owner : null_service, 
        -:   60:                 new_owner ? new_owner : null_service);
        -:   61:
    15110:   62:  message = dbus_message_new_signal (DBUS_PATH_DBUS,
call    0 returned 100%
        -:   63:                                     DBUS_INTERFACE_DBUS,
        -:   64:                                     "NameOwnerChanged");
        -:   65:  
    15110:   66:  if (message == NULL)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
        -:   67:    {
       33:   68:      BUS_SET_OOM (error);
call    0 returned 100%
       33:   69:      return FALSE;
        -:   70:    }
        -:   71:  
    15077:   72:  if (!dbus_message_set_sender (message, DBUS_SERVICE_DBUS))
call    0 returned 100%
branch  1 taken 99% (fallthrough)
branch  2 taken 1%
        9:   73:    goto oom;
        -:   74:
    15068:   75:  if (!dbus_message_append_args (message,
branch  0 taken 52% (fallthrough)
branch  1 taken 48%
branch  2 taken 48% (fallthrough)
branch  3 taken 52%
call    4 returned 100%
branch  5 taken 3% (fallthrough)
branch  6 taken 97%
        -:   76:                                 DBUS_TYPE_STRING, &service_name,
        -:   77:                                 DBUS_TYPE_STRING, old_owner ? &old_owner : &null_service,
        -:   78:                                 DBUS_TYPE_STRING, new_owner ? &new_owner : &null_service,
        -:   79:                                 DBUS_TYPE_INVALID))
      397:   80:    goto oom;
        -:   81:
    14671:   82:  _dbus_assert (dbus_message_has_signature (message, "sss"));
call    0 returned 100%
call    1 returned 100%
        -:   83:  
    14671:   84:  retval = bus_dispatch_matches (transaction, NULL, NULL, message, error);
call    0 returned 100%
    14671:   85:  dbus_message_unref (message);
call    0 returned 100%
        -:   86:
    14671:   87:  return retval;
        -:   88:
      406:   89: oom:
      406:   90:  dbus_message_unref (message);
call    0 returned 100%
      406:   91:  BUS_SET_OOM (error);
call    0 returned 100%
      406:   92:  return FALSE;
        -:   93:}
        -:   94:
        -:   95:dbus_bool_t
        -:   96:bus_driver_send_service_lost (DBusConnection *connection,
        -:   97:			      const char     *service_name,
        -:   98:                              BusTransaction *transaction,
        -:   99:                              DBusError      *error)
function bus_driver_send_service_lost called 7335 returned 100% blocks executed 88%
     7335:  100:{
        -:  101:  DBusMessage *message;
        -:  102:
     7335:  103:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
        -:  104:  
     7335:  105:  message = dbus_message_new_signal (DBUS_PATH_DBUS,
call    0 returned 100%
        -:  106:                                     DBUS_INTERFACE_DBUS,
        -:  107:                                     "NameLost");
        -:  108:  
     7335:  109:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -:  110:    {
    #####:  111:      BUS_SET_OOM (error);
call    0 never executed
    #####:  112:      return FALSE;
        -:  113:    }
        -:  114:  
     7335:  115:  if (!dbus_message_set_destination (message, bus_connection_get_name (connection)) ||
call    0 returned 100%
call    1 returned 100%
branch  2 taken 100% (fallthrough)
branch  3 taken 0%
call    4 returned 100%
branch  5 taken 1% (fallthrough)
branch  6 taken 99%
        -:  116:      !dbus_message_append_args (message,
        -:  117:                                 DBUS_TYPE_STRING, &service_name,
        -:  118:                                 DBUS_TYPE_INVALID))
        -:  119:    {
       21:  120:      dbus_message_unref (message);
call    0 returned 100%
       21:  121:      BUS_SET_OOM (error);
call    0 returned 100%
       21:  122:      return FALSE;
        -:  123:    }
        -:  124:
     7314:  125:  if (!bus_transaction_send_from_driver (transaction, connection, message))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:  126:    {
       95:  127:      dbus_message_unref (message);
call    0 returned 100%
       95:  128:      BUS_SET_OOM (error);
call    0 returned 100%
       95:  129:      return FALSE;
        -:  130:    }
        -:  131:  else
        -:  132:    {
     7219:  133:      dbus_message_unref (message);
call    0 returned 100%
     7219:  134:      return TRUE;
        -:  135:    }
        -:  136:}
        -:  137:
        -:  138:dbus_bool_t
        -:  139:bus_driver_send_service_acquired (DBusConnection *connection,
        -:  140:                                  const char     *service_name,
        -:  141:                                  BusTransaction *transaction,
        -:  142:                                  DBusError      *error)
function bus_driver_send_service_acquired called 7404 returned 100% blocks executed 96%
     7404:  143:{
        -:  144:  DBusMessage *message;
        -:  145:
     7404:  146:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
        -:  147:  
     7404:  148:  message = dbus_message_new_signal (DBUS_PATH_DBUS,
call    0 returned 100%
        -:  149:                                     DBUS_INTERFACE_DBUS,
        -:  150:                                     "NameAcquired");
        -:  151:
     7404:  152:  if (message == NULL)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
        -:  153:    {
       98:  154:      BUS_SET_OOM (error);
call    0 returned 100%
       98:  155:      return FALSE;
        -:  156:    }
        -:  157:  
     7306:  158:  if (!dbus_message_set_destination (message, bus_connection_get_name (connection)) ||
call    0 returned 100%
call    1 returned 100%
branch  2 taken 99% (fallthrough)
branch  3 taken 1%
call    4 returned 100%
branch  5 taken 1% (fallthrough)
branch  6 taken 99%
        -:  159:      !dbus_message_append_args (message,
        -:  160:                                 DBUS_TYPE_STRING, &service_name,
        -:  161:                                 DBUS_TYPE_INVALID))
        -:  162:    {
       69:  163:      dbus_message_unref (message);
call    0 returned 100%
       69:  164:      BUS_SET_OOM (error);
call    0 returned 100%
       69:  165:      return FALSE;
        -:  166:    }
        -:  167:
     7237:  168:  if (!bus_transaction_send_from_driver (transaction, connection, message))
call    0 returned 100%
branch  1 taken 3% (fallthrough)
branch  2 taken 97%
        -:  169:    {
      181:  170:      dbus_message_unref (message);
call    0 returned 100%
      181:  171:      BUS_SET_OOM (error);
call    0 returned 100%
      181:  172:      return FALSE;
        -:  173:    }
        -:  174:  else
        -:  175:    {
     7056:  176:      dbus_message_unref (message);
call    0 returned 100%
     7056:  177:      return TRUE;
        -:  178:    }
        -:  179:}
        -:  180:
        -:  181:static dbus_bool_t
        -:  182:create_unique_client_name (BusRegistry *registry,
        -:  183:                           DBusString  *str)
function create_unique_client_name called 6177 returned 100% blocks executed 85%
     6177:  184:{
        -:  185:  /* We never want to use the same unique client name twice, because
        -:  186:   * we want to guarantee that if you send a message to a given unique
        -:  187:   * name, you always get the same application. So we use two numbers
        -:  188:   * for INT_MAX * INT_MAX combinations, should be pretty safe against
        -:  189:   * wraparound.
        -:  190:   */
        -:  191:  /* FIXME these should be in BusRegistry rather than static vars */
        -:  192:  static int next_major_number = 0;
        -:  193:  static int next_minor_number = 0;
        -:  194:  int len;
        -:  195:  
     6177:  196:  len = _dbus_string_get_length (str);
call    0 returned 100%
        -:  197:  
        -:  198:  while (TRUE)
        -:  199:    {
        -:  200:      /* start out with 1-0, go to 1-1, 1-2, 1-3,
        -:  201:       * up to 1-MAXINT, then 2-0, 2-1, etc.
        -:  202:       */
     6177:  203:      if (next_minor_number <= 0)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
        -:  204:        {
        2:  205:          next_major_number += 1;
        2:  206:          next_minor_number = 0;
        2:  207:          if (next_major_number <= 0)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  208:            _dbus_assert_not_reached ("INT_MAX * INT_MAX clients were added");
call    0 never executed
        -:  209:        }
        -:  210:
     6177:  211:      _dbus_assert (next_major_number > 0);
call    0 returned 100%
     6177:  212:      _dbus_assert (next_minor_number >= 0);
call    0 returned 100%
        -:  213:
        -:  214:      /* appname:MAJOR-MINOR */
        -:  215:      
     6177:  216:      if (!_dbus_string_append (str, ":"))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
       11:  217:        return FALSE;
        -:  218:      
     6166:  219:      if (!_dbus_string_append_int (str, next_major_number))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        7:  220:        return FALSE;
        -:  221:
     6159:  222:      if (!_dbus_string_append (str, "."))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  223:        return FALSE;
        -:  224:      
     6159:  225:      if (!_dbus_string_append_int (str, next_minor_number))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        7:  226:        return FALSE;
        -:  227:
     6152:  228:      next_minor_number += 1;
        -:  229:      
        -:  230:      /* Check if a client with the name exists */
     6152:  231:      if (bus_registry_lookup (registry, str) == NULL)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
     6152:  232:	break;
        -:  233:
        -:  234:      /* drop the number again, try the next one. */
    #####:  235:      _dbus_string_set_length (str, len);
call    0 never executed
    #####:  236:    }
        -:  237:
     6152:  238:  return TRUE;
        -:  239:}
        -:  240:
        -:  241:static dbus_bool_t
        -:  242:bus_driver_handle_hello (DBusConnection *connection,
        -:  243:                         BusTransaction *transaction,
        -:  244:                         DBusMessage    *message,
        -:  245:                         DBusError      *error)
function bus_driver_handle_hello called 6185 returned 100% blocks executed 80%
     6185:  246:{
        -:  247:  DBusString unique_name;
        -:  248:  BusService *service;
        -:  249:  dbus_bool_t retval;
        -:  250:  BusRegistry *registry;
        -:  251:  BusConnections *connections;
        -:  252:
     6185:  253:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
        -:  254:
     6185:  255:  if (bus_connection_is_active (connection))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:  256:    {
        -:  257:      /* We already handled an Hello message for this connection. */
        1:  258:      dbus_set_error (error, DBUS_ERROR_FAILED,
call    0 returned 100%
        -:  259:                      "Already handled an Hello message");
        1:  260:      return FALSE;
        -:  261:    }
        -:  262:
        -:  263:  /* Note that when these limits are exceeded we don't disconnect the
        -:  264:   * connection; we just sort of leave it hanging there until it times
        -:  265:   * out or disconnects itself or is dropped due to the max number of
        -:  266:   * incomplete connections. It's even OK if the connection wants to
        -:  267:   * retry the hello message, we support that.
        -:  268:   */
     6184:  269:  connections = bus_connection_get_connections (connection);
call    0 returned 100%
     6184:  270:  if (!bus_connections_check_limits (connections, connection,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  271:                                     error))
        -:  272:    {
    #####:  273:      _DBUS_ASSERT_ERROR_IS_SET (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
    #####:  274:      return FALSE;
        -:  275:    }
        -:  276:  
     6184:  277:  if (!_dbus_string_init (&unique_name))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:  278:    {
        7:  279:      BUS_SET_OOM (error);
call    0 returned 100%
        7:  280:      return FALSE;
        -:  281:    }
        -:  282:
     6177:  283:  retval = FALSE;
        -:  284:
     6177:  285:  registry = bus_connection_get_registry (connection);
call    0 returned 100%
        -:  286:  
     6177:  287:  if (!create_unique_client_name (registry, &unique_name))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:  288:    {
       25:  289:      BUS_SET_OOM (error);
call    0 returned 100%
       25:  290:      goto out_0;
        -:  291:    }
        -:  292:
     6152:  293:  if (!bus_connection_complete (connection, &unique_name, error))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:  294:    {
       56:  295:      _DBUS_ASSERT_ERROR_IS_SET (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
       56:  296:      goto out_0;
        -:  297:    }
        -:  298:  
     6096:  299:  if (!dbus_message_set_sender (message,
call    0 returned 100%
call    1 returned 100%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
        -:  300:                                bus_connection_get_name (connection)))
        -:  301:    {
    #####:  302:      BUS_SET_OOM (error);
call    0 never executed
    #####:  303:      goto out_0;
        -:  304:    }
        -:  305:  
     6096:  306:  if (!bus_driver_send_welcome_message (connection, message, transaction, error))
call    0 returned 100%
branch  1 taken 2% (fallthrough)
branch  2 taken 98%
      133:  307:    goto out_0;
        -:  308:
        -:  309:  /* Create the service */
     5963:  310:  service = bus_registry_ensure (registry,
call    0 returned 100%
        -:  311:                                 &unique_name, connection, 0, transaction, error);
     5963:  312:  if (service == NULL)
branch  0 taken 11% (fallthrough)
branch  1 taken 89%
      632:  313:    goto out_0;
        -:  314:  
     5331:  315:  _dbus_assert (bus_connection_is_active (connection));
call    0 returned 100%
call    1 returned 100%
     5331:  316:  retval = TRUE;
        -:  317:  
     6177:  318: out_0:
     6177:  319:  _dbus_string_free (&unique_name);
call    0 returned 100%
     6177:  320:  return retval;
        -:  321:}
        -:  322:
        -:  323:static dbus_bool_t
        -:  324:bus_driver_send_welcome_message (DBusConnection *connection,
        -:  325:                                 DBusMessage    *hello_message,
        -:  326:                                 BusTransaction *transaction,
        -:  327:                                 DBusError      *error)
function bus_driver_send_welcome_message called 6096 returned 100% blocks executed 89%
     6096:  328:{
        -:  329:  DBusMessage *welcome;
        -:  330:  const char *name;
        -:  331:
     6096:  332:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
        -:  333:  
     6096:  334:  name = bus_connection_get_name (connection);
call    0 returned 100%
     6096:  335:  _dbus_assert (name != NULL);
call    0 returned 100%
        -:  336:  
     6096:  337:  welcome = dbus_message_new_method_return (hello_message);
call    0 returned 100%
     6096:  338:  if (welcome == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -:  339:    {
    #####:  340:      BUS_SET_OOM (error);
call    0 never executed
    #####:  341:      return FALSE;
        -:  342:    }
        -:  343:  
     6096:  344:  if (!dbus_message_append_args (welcome,
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:  345:                                 DBUS_TYPE_STRING, &name,
        -:  346:                                 DBUS_TYPE_INVALID))
        -:  347:    {
       14:  348:      dbus_message_unref (welcome);
call    0 returned 100%
       14:  349:      BUS_SET_OOM (error);
call    0 returned 100%
       14:  350:      return FALSE;
        -:  351:    }
        -:  352:
     6082:  353:  _dbus_assert (dbus_message_has_signature (welcome, DBUS_TYPE_STRING_AS_STRING));
call    0 returned 100%
call    1 returned 100%
        -:  354:  
     6082:  355:  if (!bus_transaction_send_from_driver (transaction, connection, welcome))
call    0 returned 100%
branch  1 taken 2% (fallthrough)
branch  2 taken 98%
        -:  356:    {
      119:  357:      dbus_message_unref (welcome);
call    0 returned 100%
      119:  358:      BUS_SET_OOM (error);
call    0 returned 100%
      119:  359:      return FALSE;
        -:  360:    }
        -:  361:  else
        -:  362:    {
     5963:  363:      dbus_message_unref (welcome);
call    0 returned 100%
     5963:  364:      return TRUE;
        -:  365:    }
        -:  366:}
        -:  367:
        -:  368:static dbus_bool_t
        -:  369:bus_driver_handle_list_services (DBusConnection *connection,
        -:  370:                                 BusTransaction *transaction,
        -:  371:                                 DBusMessage    *message,
        -:  372:                                 DBusError      *error)
function bus_driver_handle_list_services called 0 returned 0% blocks executed 0%
    #####:  373:{
        -:  374:  DBusMessage *reply;
        -:  375:  int len;
        -:  376:  char **services;
        -:  377:  BusRegistry *registry;
        -:  378:  int i;
        -:  379:  DBusMessageIter iter;
        -:  380:  DBusMessageIter sub;
        -:  381:
    #####:  382:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
        -:  383:  
    #####:  384:  registry = bus_connection_get_registry (connection);
call    0 never executed
        -:  385:  
    #####:  386:  reply = dbus_message_new_method_return (message);
call    0 never executed
    #####:  387:  if (reply == NULL)
branch  0 never executed
branch  1 never executed
        -:  388:    {
    #####:  389:      BUS_SET_OOM (error);
call    0 never executed
    #####:  390:      return FALSE;
        -:  391:    }
        -:  392:
    #####:  393:  if (!bus_registry_list_services (registry, &services, &len))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  394:    {
    #####:  395:      dbus_message_unref (reply);
call    0 never executed
    #####:  396:      BUS_SET_OOM (error);
call    0 never executed
    #####:  397:      return FALSE;
        -:  398:    }
        -:  399:
    #####:  400:  dbus_message_iter_init_append (reply, &iter);
call    0 never executed
        -:  401:  
    #####:  402:  if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY,
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  403:                                         DBUS_TYPE_STRING_AS_STRING,
        -:  404:                                         &sub))
        -:  405:    {
    #####:  406:      dbus_free_string_array (services);
call    0 never executed
    #####:  407:      dbus_message_unref (reply);
call    0 never executed
    #####:  408:      BUS_SET_OOM (error);
call    0 never executed
    #####:  409:      return FALSE;
        -:  410:    }
        -:  411:
        -:  412:  {
        -:  413:    /* Include the bus driver in the list */
    #####:  414:    const char *v_STRING = DBUS_SERVICE_DBUS;
    #####:  415:    if (!dbus_message_iter_append_basic (&sub, DBUS_TYPE_STRING,
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  416:                                         &v_STRING))
        -:  417:      {
    #####:  418:        dbus_free_string_array (services);
call    0 never executed
    #####:  419:        dbus_message_unref (reply);
call    0 never executed
    #####:  420:        BUS_SET_OOM (error);
call    0 never executed
    #####:  421:        return FALSE;
        -:  422:      }
        -:  423:  }
        -:  424:  
    #####:  425:  i = 0;
    #####:  426:  while (i < len)
branch  0 never executed
branch  1 never executed
        -:  427:    {
    #####:  428:      if (!dbus_message_iter_append_basic (&sub, DBUS_TYPE_STRING,
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  429:                                           &services[i]))
        -:  430:        {
    #####:  431:          dbus_free_string_array (services);
call    0 never executed
    #####:  432:          dbus_message_unref (reply);
call    0 never executed
    #####:  433:          BUS_SET_OOM (error);
call    0 never executed
    #####:  434:          return FALSE;
        -:  435:        }
    #####:  436:      ++i;
        -:  437:    }
        -:  438:
    #####:  439:  if (!dbus_message_iter_close_container (&iter, &sub))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  440:    {
    #####:  441:      dbus_free_string_array (services);
call    0 never executed
    #####:  442:      dbus_message_unref (reply);
call    0 never executed
    #####:  443:      BUS_SET_OOM (error);
call    0 never executed
    #####:  444:      return FALSE;
        -:  445:    }
        -:  446:  
    #####:  447:  dbus_free_string_array (services);
call    0 never executed
        -:  448:  
    #####:  449:  if (!bus_transaction_send_from_driver (transaction, connection, reply))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  450:    {
    #####:  451:      dbus_message_unref (reply);
call    0 never executed
    #####:  452:      BUS_SET_OOM (error);
call    0 never executed
    #####:  453:      return FALSE;
        -:  454:    }
        -:  455:  else
        -:  456:    {
    #####:  457:      dbus_message_unref (reply);
call    0 never executed
    #####:  458:      return TRUE;
        -:  459:    }
        -:  460:}
        -:  461:
        -:  462:static dbus_bool_t
        -:  463:bus_driver_handle_acquire_service (DBusConnection *connection,
        -:  464:                                   BusTransaction *transaction,
        -:  465:                                   DBusMessage    *message,
        -:  466:                                   DBusError      *error)
function bus_driver_handle_acquire_service called 1950 returned 100% blocks executed 94%
     1950:  467:{
        -:  468:  DBusMessage *reply;
        -:  469:  DBusString service_name;
        -:  470:  const char *name;
        -:  471:  dbus_uint32_t service_reply;
        -:  472:  dbus_uint32_t flags;
        -:  473:  dbus_bool_t retval;
        -:  474:  BusRegistry *registry;
        -:  475:
     1950:  476:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
        -:  477:  
     1950:  478:  registry = bus_connection_get_registry (connection);
call    0 returned 100%
        -:  479:  
     1950:  480:  if (!dbus_message_get_args (message, error,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  481:                              DBUS_TYPE_STRING, &name,
        -:  482:                              DBUS_TYPE_UINT32, &flags,
        -:  483:                              DBUS_TYPE_INVALID))
    #####:  484:    return FALSE;
        -:  485:  
     1950:  486:  _dbus_verbose ("Trying to own name %s with flags 0x%x\n", name, flags);
call    0 returned 100%
        -:  487:  
     1950:  488:  retval = FALSE;
     1950:  489:  reply = NULL;
        -:  490:
     1950:  491:  _dbus_string_init_const (&service_name, name);
call    0 returned 100%
        -:  492:
     1950:  493:  if (!bus_registry_acquire_service (registry, connection,
call    0 returned 100%
branch  1 taken 16% (fallthrough)
branch  2 taken 84%
        -:  494:                                     &service_name, flags,
        -:  495:                                     &service_reply, transaction,
        -:  496:                                     error))
      314:  497:    goto out;
        -:  498:  
     1636:  499:  reply = dbus_message_new_method_return (message);
call    0 returned 100%
     1636:  500:  if (reply == NULL)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
        -:  501:    {
       20:  502:      BUS_SET_OOM (error);
call    0 returned 100%
       20:  503:      goto out;
        -:  504:    }
        -:  505:
     1616:  506:  if (!dbus_message_append_args (reply, DBUS_TYPE_UINT32, &service_reply, DBUS_TYPE_INVALID))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:  507:    {
       12:  508:      BUS_SET_OOM (error);
call    0 returned 100%
       12:  509:      goto out;
        -:  510:    }
        -:  511:
     1604:  512:  if (!bus_transaction_send_from_driver (transaction, connection, reply))
call    0 returned 100%
branch  1 taken 3% (fallthrough)
branch  2 taken 97%
        -:  513:    {
       54:  514:      BUS_SET_OOM (error);
call    0 returned 100%
       54:  515:      goto out;
        -:  516:    }
        -:  517:
     1550:  518:  retval = TRUE;
        -:  519:  
     1950:  520: out:
     1950:  521:  if (reply)
branch  0 taken 83% (fallthrough)
branch  1 taken 17%
     1616:  522:    dbus_message_unref (reply);
call    0 returned 100%
     1950:  523:  return retval;
        -:  524:} 
        -:  525:
        -:  526:static dbus_bool_t
        -:  527:bus_driver_handle_release_service (DBusConnection *connection,
        -:  528:                                   BusTransaction *transaction,
        -:  529:                                   DBusMessage    *message,
        -:  530:                                   DBusError      *error)
function bus_driver_handle_release_service called 0 returned 0% blocks executed 0%
    #####:  531:{
        -:  532:  DBusMessage *reply;
        -:  533:  DBusString service_name;
        -:  534:  const char *name;
        -:  535:  dbus_uint32_t service_reply;
        -:  536:  dbus_bool_t retval;
        -:  537:  BusRegistry *registry;
        -:  538:
    #####:  539:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
        -:  540:
    #####:  541:  registry = bus_connection_get_registry (connection);
call    0 never executed
        -:  542:
    #####:  543:  if (!dbus_message_get_args (message, error,
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  544:                              DBUS_TYPE_STRING, &name,
        -:  545:                              DBUS_TYPE_INVALID))
    #####:  546:    return FALSE;
        -:  547:
    #####:  548:  _dbus_verbose ("Trying to release name %s\n", name);
call    0 never executed
        -:  549:
    #####:  550:  retval = FALSE;
    #####:  551:  reply = NULL;
        -:  552:
    #####:  553:  _dbus_string_init_const (&service_name, name);
call    0 never executed
        -:  554:
    #####:  555:  if (!bus_registry_release_service (registry, connection,
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  556:                                     &service_name, &service_reply,
        -:  557:                                     transaction, error))
    #####:  558:    goto out;
        -:  559:
    #####:  560:  reply = dbus_message_new_method_return (message);
call    0 never executed
    #####:  561:  if (reply == NULL)
branch  0 never executed
branch  1 never executed
        -:  562:    {
    #####:  563:      BUS_SET_OOM (error);
call    0 never executed
    #####:  564:      goto out;
        -:  565:    }
        -:  566:
    #####:  567:  if (!dbus_message_append_args (reply, DBUS_TYPE_UINT32, &service_reply, DBUS_TYPE_INVALID))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  568:    {
    #####:  569:      BUS_SET_OOM (error);
call    0 never executed
    #####:  570:      goto out;
        -:  571:    }
        -:  572:
    #####:  573:  if (!bus_transaction_send_from_driver (transaction, connection, reply))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  574:    {
    #####:  575:      BUS_SET_OOM (error);
call    0 never executed
    #####:  576:      goto out;
        -:  577:    }
        -:  578:
    #####:  579:  retval = TRUE;
        -:  580:
    #####:  581: out:
    #####:  582:  if (reply)
branch  0 never executed
branch  1 never executed
    #####:  583:    dbus_message_unref (reply);
call    0 never executed
    #####:  584:  return retval;
        -:  585:}
        -:  586:
        -:  587:static dbus_bool_t
        -:  588:bus_driver_handle_service_exists (DBusConnection *connection,
        -:  589:                                  BusTransaction *transaction,
        -:  590:                                  DBusMessage    *message,
        -:  591:                                  DBusError      *error)
function bus_driver_handle_service_exists called 0 returned 0% blocks executed 0%
    #####:  592:{
        -:  593:  DBusMessage *reply;
        -:  594:  DBusString service_name;
        -:  595:  BusService *service;
        -:  596:  dbus_bool_t service_exists;
        -:  597:  const char *name;
        -:  598:  dbus_bool_t retval;
        -:  599:  BusRegistry *registry;
        -:  600:
    #####:  601:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
        -:  602:  
    #####:  603:  registry = bus_connection_get_registry (connection);
call    0 never executed
        -:  604:  
    #####:  605:  if (!dbus_message_get_args (message, error,
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  606:                              DBUS_TYPE_STRING, &name,
        -:  607:                              DBUS_TYPE_INVALID))
    #####:  608:    return FALSE;
        -:  609:
    #####:  610:  retval = FALSE;
        -:  611:
    #####:  612:  if (strcmp (name, DBUS_SERVICE_DBUS) == 0)
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  613:    {
    #####:  614:      service_exists = TRUE;
        -:  615:    }
        -:  616:  else
        -:  617:    {
    #####:  618:      _dbus_string_init_const (&service_name, name);
call    0 never executed
    #####:  619:      service = bus_registry_lookup (registry, &service_name);
call    0 never executed
    #####:  620:      service_exists = service != NULL;
        -:  621:    }
        -:  622:  
    #####:  623:  reply = dbus_message_new_method_return (message);
call    0 never executed
    #####:  624:  if (reply == NULL)
branch  0 never executed
branch  1 never executed
        -:  625:    {
    #####:  626:      BUS_SET_OOM (error);
call    0 never executed
    #####:  627:      goto out;
        -:  628:    }
        -:  629:
    #####:  630:  if (!dbus_message_append_args (reply,
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  631:                                 DBUS_TYPE_BOOLEAN, &service_exists,
        -:  632:                                 0))
        -:  633:    {
    #####:  634:      BUS_SET_OOM (error);
call    0 never executed
    #####:  635:      goto out;
        -:  636:    }
        -:  637:
    #####:  638:  if (!bus_transaction_send_from_driver (transaction, connection, reply))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  639:    {
    #####:  640:      BUS_SET_OOM (error);
call    0 never executed
    #####:  641:      goto out;
        -:  642:    }
        -:  643:
    #####:  644:  retval = TRUE;
        -:  645:  
    #####:  646: out:
    #####:  647:  if (reply)
branch  0 never executed
branch  1 never executed
    #####:  648:    dbus_message_unref (reply);
call    0 never executed
        -:  649:
    #####:  650:  return retval;
        -:  651:}
        -:  652:
        -:  653:static dbus_bool_t
        -:  654:bus_driver_handle_activate_service (DBusConnection *connection,
        -:  655:                                    BusTransaction *transaction,
        -:  656:                                    DBusMessage    *message,
        -:  657:                                    DBusError      *error)
function bus_driver_handle_activate_service called 3804 returned 100% blocks executed 67%
     3804:  658:{
        -:  659:  dbus_uint32_t flags;
        -:  660:  const char *name;
        -:  661:  dbus_bool_t retval;
        -:  662:  BusActivation *activation;
        -:  663:
     3804:  664:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
        -:  665:  
     3804:  666:  activation = bus_connection_get_activation (connection);
call    0 returned 100%
        -:  667:  
     3804:  668:  if (!dbus_message_get_args (message, error,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  669:                              DBUS_TYPE_STRING, &name,
        -:  670:                              DBUS_TYPE_UINT32, &flags,
        -:  671:                              DBUS_TYPE_INVALID))
        -:  672:    {
    #####:  673:      _DBUS_ASSERT_ERROR_IS_SET (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
    #####:  674:      _dbus_verbose ("No memory to get arguments to StartServiceByName\n");
call    0 never executed
    #####:  675:      return FALSE;
        -:  676:    }
        -:  677:
     3804:  678:  retval = FALSE;
        -:  679:
     3804:  680:  if (!bus_activation_activate_service (activation, connection, transaction, FALSE,
call    0 returned 100%
branch  1 taken 29% (fallthrough)
branch  2 taken 71%
        -:  681:                                        message, name, error))
        -:  682:    {
     1099:  683:      _DBUS_ASSERT_ERROR_IS_SET (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
     1099:  684:      _dbus_verbose ("bus_activation_activate_service() failed\n");
call    0 returned 100%
     1099:  685:      goto out;
        -:  686:    }
        -:  687:
     2705:  688:  retval = TRUE;
        -:  689:  
     3804:  690: out:
     3804:  691:  return retval;
        -:  692:}
        -:  693:
        -:  694:static dbus_bool_t
        -:  695:send_ack_reply (DBusConnection *connection,
        -:  696:                BusTransaction *transaction,
        -:  697:                DBusMessage    *message,
        -:  698:                DBusError      *error)
function send_ack_reply called 3308 returned 100% blocks executed 83%
     3308:  699:{
        -:  700:  DBusMessage *reply;
        -:  701:
     3308:  702:  reply = dbus_message_new_method_return (message);
call    0 returned 100%
     3308:  703:  if (reply == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -:  704:    {
    #####:  705:      BUS_SET_OOM (error);
call    0 never executed
    #####:  706:      return FALSE;
        -:  707:    }
        -:  708:
     3308:  709:  if (!bus_transaction_send_from_driver (transaction, connection, reply))
call    0 returned 100%
branch  1 taken 2% (fallthrough)
branch  2 taken 98%
        -:  710:    {
       52:  711:      BUS_SET_OOM (error);
call    0 returned 100%
       52:  712:      dbus_message_unref (reply);
call    0 returned 100%
       52:  713:      return FALSE;
        -:  714:    }
        -:  715:
     3256:  716:  dbus_message_unref (reply);
call    0 returned 100%
        -:  717:  
     3256:  718:  return TRUE;
        -:  719:}
        -:  720:
        -:  721:static dbus_bool_t
        -:  722:bus_driver_handle_add_match (DBusConnection *connection,
        -:  723:                             BusTransaction *transaction,
        -:  724:                             DBusMessage    *message,
        -:  725:                             DBusError      *error)
function bus_driver_handle_add_match called 3328 returned 100% blocks executed 76%
     3328:  726:{
        -:  727:  BusMatchRule *rule;
        -:  728:  const char *text;
        -:  729:  DBusString str;
        -:  730:  BusMatchmaker *matchmaker;
        -:  731:  
     3328:  732:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
        -:  733:
     3328:  734:  text = NULL;
     3328:  735:  rule = NULL;
        -:  736:
     3328:  737:  if (bus_connection_get_n_match_rules (connection) >=
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
branch  3 taken 0% (fallthrough)
branch  4 taken 100%
        -:  738:      bus_context_get_max_match_rules_per_connection (bus_transaction_get_context (transaction)))
        -:  739:    {
    #####:  740:      dbus_set_error (error, DBUS_ERROR_LIMITS_EXCEEDED,
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
        -:  741:                      "Connection \"%s\" is not allowed to add more match rules "
        -:  742:                      "(increase limits in configuration file if required)",
        -:  743:                      bus_connection_is_active (connection) ?
        -:  744:                      bus_connection_get_name (connection) :
        -:  745:                      "(inactive)");
    #####:  746:      goto failed;
        -:  747:    }
        -:  748:  
     3328:  749:  if (!dbus_message_get_args (message, error,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  750:                              DBUS_TYPE_STRING, &text,
        -:  751:                              DBUS_TYPE_INVALID))
        -:  752:    {
    #####:  753:      _dbus_verbose ("No memory to get arguments to AddMatch\n");
call    0 never executed
    #####:  754:      goto failed;
        -:  755:    }
        -:  756:
     3328:  757:  _dbus_string_init_const (&str, text);
call    0 returned 100%
        -:  758:
     3328:  759:  rule = bus_match_rule_parse (connection, &str, error);
call    0 returned 100%
     3328:  760:  if (rule == NULL)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
       12:  761:    goto failed;
        -:  762:
     3316:  763:  matchmaker = bus_connection_get_matchmaker (connection);
call    0 returned 100%
        -:  764:
     3316:  765:  if (!bus_matchmaker_add_rule (matchmaker, rule))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:  766:    {
        8:  767:      BUS_SET_OOM (error);
call    0 returned 100%
        8:  768:      goto failed;
        -:  769:    }
        -:  770:
     3308:  771:  if (!send_ack_reply (connection, transaction,
call    0 returned 100%
branch  1 taken 2% (fallthrough)
branch  2 taken 98%
        -:  772:                       message, error))
        -:  773:    {
       52:  774:      bus_matchmaker_remove_rule (matchmaker, rule);
call    0 returned 100%
       52:  775:      goto failed;
        -:  776:    }
        -:  777:  
     3256:  778:  bus_match_rule_unref (rule);
call    0 returned 100%
        -:  779:  
     3256:  780:  return TRUE;
        -:  781:
       72:  782: failed:
       72:  783:  _DBUS_ASSERT_ERROR_IS_SET (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
       72:  784:  if (rule)
branch  0 taken 83% (fallthrough)
branch  1 taken 17%
       60:  785:    bus_match_rule_unref (rule);
call    0 returned 100%
       72:  786:  return FALSE;
        -:  787:}
        -:  788:
        -:  789:static dbus_bool_t
        -:  790:bus_driver_handle_remove_match (DBusConnection *connection,
        -:  791:                                BusTransaction *transaction,
        -:  792:                                DBusMessage    *message,
        -:  793:                                DBusError      *error)
function bus_driver_handle_remove_match called 0 returned 0% blocks executed 0%
    #####:  794:{
        -:  795:  BusMatchRule *rule;
        -:  796:  const char *text;
        -:  797:  DBusString str;
        -:  798:  BusMatchmaker *matchmaker;
        -:  799:  
    #####:  800:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
        -:  801:
    #####:  802:  text = NULL;
    #####:  803:  rule = NULL;
        -:  804:  
    #####:  805:  if (!dbus_message_get_args (message, error,
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  806:                              DBUS_TYPE_STRING, &text,
        -:  807:                              DBUS_TYPE_INVALID))
        -:  808:    {
    #####:  809:      _dbus_verbose ("No memory to get arguments to RemoveMatch\n");
call    0 never executed
    #####:  810:      goto failed;
        -:  811:    }
        -:  812:
    #####:  813:  _dbus_string_init_const (&str, text);
call    0 never executed
        -:  814:
    #####:  815:  rule = bus_match_rule_parse (connection, &str, error);
call    0 never executed
    #####:  816:  if (rule == NULL)
branch  0 never executed
branch  1 never executed
    #####:  817:    goto failed;
        -:  818:
        -:  819:  /* Send the ack before we remove the rule, since the ack is undone
        -:  820:   * on transaction cancel, but rule removal isn't.
        -:  821:   */
    #####:  822:  if (!send_ack_reply (connection, transaction,
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  823:                       message, error))
    #####:  824:    goto failed;
        -:  825:  
    #####:  826:  matchmaker = bus_connection_get_matchmaker (connection);
call    0 never executed
        -:  827:
    #####:  828:  if (!bus_matchmaker_remove_rule_by_value (matchmaker, rule, error))
call    0 never executed
branch  1 never executed
branch  2 never executed
    #####:  829:    goto failed;
        -:  830:
    #####:  831:  bus_match_rule_unref (rule);
call    0 never executed
        -:  832:  
    #####:  833:  return TRUE;
        -:  834:
    #####:  835: failed:
    #####:  836:  _DBUS_ASSERT_ERROR_IS_SET (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
    #####:  837:  if (rule)
branch  0 never executed
branch  1 never executed
    #####:  838:    bus_match_rule_unref (rule);
call    0 never executed
    #####:  839:  return FALSE;
        -:  840:}
        -:  841:
        -:  842:static dbus_bool_t
        -:  843:bus_driver_handle_get_service_owner (DBusConnection *connection,
        -:  844:				     BusTransaction *transaction,
        -:  845:				     DBusMessage    *message,
        -:  846:				     DBusError      *error)
function bus_driver_handle_get_service_owner called 0 returned 0% blocks executed 0%
    #####:  847:{
        -:  848:  const char *text;
        -:  849:  const char *base_name;
        -:  850:  DBusString str;
        -:  851:  BusRegistry *registry;
        -:  852:  BusService *service;
        -:  853:  DBusMessage *reply;
        -:  854:  
    #####:  855:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
        -:  856:
    #####:  857:  registry = bus_connection_get_registry (connection);
call    0 never executed
        -:  858:
    #####:  859:  text = NULL;
    #####:  860:  reply = NULL;
        -:  861:
    #####:  862:  if (! dbus_message_get_args (message, error,
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  863:			       DBUS_TYPE_STRING, &text,
        -:  864:			       DBUS_TYPE_INVALID))
    #####:  865:      goto failed;
        -:  866:
    #####:  867:  _dbus_string_init_const (&str, text);
call    0 never executed
    #####:  868:  service = bus_registry_lookup (registry, &str);
call    0 never executed
    #####:  869:  if (service == NULL &&
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
        -:  870:      _dbus_string_equal_c_str (&str, DBUS_SERVICE_DBUS))
        -:  871:    {
        -:  872:      /* ORG_FREEDESKTOP_DBUS owns itself */
    #####:  873:      base_name = DBUS_SERVICE_DBUS;
        -:  874:    }
    #####:  875:  else if (service == NULL)
branch  0 never executed
branch  1 never executed
        -:  876:    {
    #####:  877:      dbus_set_error (error, 
call    0 never executed
        -:  878:                      DBUS_ERROR_NAME_HAS_NO_OWNER,
        -:  879:                      "Could not get owner of name '%s': no such name", text);
    #####:  880:      goto failed;
        -:  881:    }
        -:  882:  else
        -:  883:    {
    #####:  884:      base_name = bus_connection_get_name (bus_service_get_primary_owners_connection (service));
call    0 never executed
call    1 never executed
    #####:  885:      if (base_name == NULL)
branch  0 never executed
branch  1 never executed
        -:  886:        {
        -:  887:          /* FIXME - how is this error possible? */
    #####:  888:          dbus_set_error (error,
call    0 never executed
        -:  889:                          DBUS_ERROR_FAILED,
        -:  890:                          "Could not determine unique name for '%s'", text);
    #####:  891:          goto failed;
        -:  892:        }
    #####:  893:      _dbus_assert (*base_name == ':');      
call    0 never executed
        -:  894:    }
        -:  895:
    #####:  896:  _dbus_assert (base_name != NULL);
call    0 never executed
        -:  897:
    #####:  898:  reply = dbus_message_new_method_return (message);
call    0 never executed
    #####:  899:  if (reply == NULL)
branch  0 never executed
branch  1 never executed
    #####:  900:    goto oom;
        -:  901:
    #####:  902:  if (! dbus_message_append_args (reply, 
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  903:				  DBUS_TYPE_STRING, &base_name,
        -:  904:				  DBUS_TYPE_INVALID))
    #####:  905:    goto oom;
        -:  906:  
    #####:  907:  if (! bus_transaction_send_from_driver (transaction, connection, reply))
call    0 never executed
branch  1 never executed
branch  2 never executed
    #####:  908:    goto oom;
        -:  909:
    #####:  910:  dbus_message_unref (reply);
call    0 never executed
        -:  911:
    #####:  912:  return TRUE;
        -:  913:
    #####:  914: oom:
    #####:  915:  BUS_SET_OOM (error);
call    0 never executed
        -:  916:
    #####:  917: failed:
    #####:  918:  _DBUS_ASSERT_ERROR_IS_SET (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
    #####:  919:  if (reply)
branch  0 never executed
branch  1 never executed
    #####:  920:    dbus_message_unref (reply);
call    0 never executed
    #####:  921:  return FALSE;
        -:  922:}
        -:  923:
        -:  924:static dbus_bool_t
        -:  925:bus_driver_handle_list_queued_owners (DBusConnection *connection,
        -:  926:				      BusTransaction *transaction,
        -:  927:				      DBusMessage    *message,
        -:  928:				      DBusError      *error)
function bus_driver_handle_list_queued_owners called 0 returned 0% blocks executed 0%
    #####:  929:{
        -:  930:  const char *text;
        -:  931:  DBusList *base_names;
        -:  932:  DBusList *link;
        -:  933:  DBusString str;
        -:  934:  BusRegistry *registry;
        -:  935:  BusService *service;
        -:  936:  DBusMessage *reply;
        -:  937:  DBusMessageIter iter, array_iter;
    #####:  938:  char *dbus_service_name = DBUS_SERVICE_DBUS;
        -:  939:  
    #####:  940:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
        -:  941:
    #####:  942:  registry = bus_connection_get_registry (connection);
call    0 never executed
        -:  943:
    #####:  944:  base_names = NULL;
    #####:  945:  text = NULL;
    #####:  946:  reply = NULL;
        -:  947:
    #####:  948:  if (! dbus_message_get_args (message, error,
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  949:			       DBUS_TYPE_STRING, &text,
        -:  950:			       DBUS_TYPE_INVALID))
    #####:  951:      goto failed;
        -:  952:
    #####:  953:  _dbus_string_init_const (&str, text);
call    0 never executed
    #####:  954:  service = bus_registry_lookup (registry, &str);
call    0 never executed
    #####:  955:  if (service == NULL &&
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
        -:  956:      _dbus_string_equal_c_str (&str, DBUS_SERVICE_DBUS))
        -:  957:    {
        -:  958:      /* ORG_FREEDESKTOP_DBUS owns itself */
    #####:  959:      if (! _dbus_list_append (&base_names, dbus_service_name))
call    0 never executed
branch  1 never executed
branch  2 never executed
    #####:  960:        goto oom;
        -:  961:    }
    #####:  962:  else if (service == NULL)
branch  0 never executed
branch  1 never executed
        -:  963:    {
    #####:  964:      dbus_set_error (error, 
call    0 never executed
        -:  965:                      DBUS_ERROR_NAME_HAS_NO_OWNER,
        -:  966:                      "Could not get owners of name '%s': no such name", text);
    #####:  967:      goto failed;
        -:  968:    }
        -:  969:  else
        -:  970:    {
    #####:  971:      if (!bus_service_list_queued_owners (service, 
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  972:                                           &base_names,
        -:  973:                                           error))
    #####:  974:        goto failed;
        -:  975:    }
        -:  976:
    #####:  977:  _dbus_assert (base_names != NULL);
call    0 never executed
        -:  978:
    #####:  979:  reply = dbus_message_new_method_return (message);
call    0 never executed
    #####:  980:  if (reply == NULL)
branch  0 never executed
branch  1 never executed
    #####:  981:    goto oom;
        -:  982:
    #####:  983:  dbus_message_iter_init_append (reply, &iter);
call    0 never executed
    #####:  984:  if (!dbus_message_iter_open_container (&iter,
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  985:                                         DBUS_TYPE_ARRAY,
        -:  986:                                         DBUS_TYPE_STRING_AS_STRING,
        -:  987:                                         &array_iter))
    #####:  988:    goto oom;
        -:  989:  
    #####:  990:  link = _dbus_list_get_first_link (&base_names);
call    0 never executed
    #####:  991:  while (link != NULL)
branch  0 never executed
branch  1 never executed
        -:  992:    {
        -:  993:      char *uname;
        -:  994:
    #####:  995:      _dbus_assert (link->data != NULL);
call    0 never executed
    #####:  996:      uname = (char *)link->data;
        -:  997:    
    #####:  998:      if (!dbus_message_iter_append_basic (&array_iter, 
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  999:                                           DBUS_TYPE_STRING,
        -: 1000:                                           &uname))
    #####: 1001:        goto oom;
        -: 1002:
    #####: 1003:      link = _dbus_list_get_next_link (&base_names, link);
branch  0 never executed
branch  1 never executed
        -: 1004:    }
        -: 1005:
    #####: 1006:  if (! dbus_message_iter_close_container (&iter, &array_iter))
call    0 never executed
branch  1 never executed
branch  2 never executed
    #####: 1007:    goto oom;
        -: 1008:                                    
        -: 1009: 
    #####: 1010:  if (! bus_transaction_send_from_driver (transaction, connection, reply))
call    0 never executed
branch  1 never executed
branch  2 never executed
    #####: 1011:    goto oom;
        -: 1012:
    #####: 1013:  dbus_message_unref (reply);
call    0 never executed
        -: 1014:
    #####: 1015:  return TRUE;
        -: 1016:
    #####: 1017: oom:
    #####: 1018:  BUS_SET_OOM (error);
call    0 never executed
        -: 1019:
    #####: 1020: failed:
    #####: 1021:  _DBUS_ASSERT_ERROR_IS_SET (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
    #####: 1022:  if (reply)
branch  0 never executed
branch  1 never executed
    #####: 1023:    dbus_message_unref (reply);
call    0 never executed
        -: 1024:
    #####: 1025:  if (base_names)
branch  0 never executed
branch  1 never executed
    #####: 1026:    _dbus_list_clear (&base_names);
call    0 never executed
        -: 1027:
    #####: 1028:  return FALSE;
        -: 1029:}
        -: 1030:
        -: 1031:static dbus_bool_t
        -: 1032:bus_driver_handle_get_connection_unix_user (DBusConnection *connection,
        -: 1033:                                            BusTransaction *transaction,
        -: 1034:                                            DBusMessage    *message,
        -: 1035:                                            DBusError      *error)
function bus_driver_handle_get_connection_unix_user called 1 returned 100% blocks executed 56%
        1: 1036:{
        -: 1037:  const char *service;
        -: 1038:  DBusString str;
        -: 1039:  BusRegistry *registry;
        -: 1040:  BusService *serv;
        -: 1041:  DBusConnection *conn;
        -: 1042:  DBusMessage *reply;
        -: 1043:  unsigned long uid;
        -: 1044:  dbus_uint32_t uid32;
        -: 1045:
        1: 1046:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
        -: 1047:
        1: 1048:  registry = bus_connection_get_registry (connection);
call    0 returned 100%
        -: 1049:
        1: 1050:  service = NULL;
        1: 1051:  reply = NULL;
        -: 1052:
        1: 1053:  if (! dbus_message_get_args (message, error,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1054:			       DBUS_TYPE_STRING, &service,
        -: 1055:			       DBUS_TYPE_INVALID))
    #####: 1056:      goto failed;
        -: 1057:
        1: 1058:  _dbus_verbose ("asked for UID of connection %s\n", service);
call    0 returned 100%
        -: 1059:
        1: 1060:  _dbus_string_init_const (&str, service);
call    0 returned 100%
        1: 1061:  serv = bus_registry_lookup (registry, &str);
call    0 returned 100%
        1: 1062:  if (serv == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1063:    {
    #####: 1064:      dbus_set_error (error, 
call    0 never executed
        -: 1065:		      DBUS_ERROR_NAME_HAS_NO_OWNER,
        -: 1066:		      "Could not get UID of name '%s': no such name", service);
    #####: 1067:      goto failed;
        -: 1068:    }
        -: 1069:
        1: 1070:  conn = bus_service_get_primary_owners_connection (serv);
call    0 returned 100%
        -: 1071:
        1: 1072:  reply = dbus_message_new_method_return (message);
call    0 returned 100%
        1: 1073:  if (reply == NULL)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
    #####: 1074:    goto oom;
        -: 1075:
        1: 1076:  if (!dbus_connection_get_unix_user (conn, &uid))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1077:    {
    #####: 1078:      dbus_set_error (error,
call    0 never executed
        -: 1079:                      DBUS_ERROR_FAILED,
        -: 1080:                      "Could not determine UID for '%s'", service);
    #####: 1081:      goto failed;
        -: 1082:    }
        -: 1083:
        1: 1084:  uid32 = uid;
        1: 1085:  if (! dbus_message_append_args (reply,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1086:                                  DBUS_TYPE_UINT32, &uid32,
        -: 1087:                                  DBUS_TYPE_INVALID))
    #####: 1088:    goto oom;
        -: 1089:
        1: 1090:  if (! bus_transaction_send_from_driver (transaction, connection, reply))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1091:    goto oom;
        -: 1092:
        1: 1093:  dbus_message_unref (reply);
call    0 returned 100%
        -: 1094:
        1: 1095:  return TRUE;
        -: 1096:
    #####: 1097: oom:
    #####: 1098:  BUS_SET_OOM (error);
call    0 never executed
        -: 1099:
    #####: 1100: failed:
    #####: 1101:  _DBUS_ASSERT_ERROR_IS_SET (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
    #####: 1102:  if (reply)
branch  0 never executed
branch  1 never executed
    #####: 1103:    dbus_message_unref (reply);
call    0 never executed
    #####: 1104:  return FALSE;
        -: 1105:}
        -: 1106:
        -: 1107:static dbus_bool_t
        -: 1108:bus_driver_handle_get_connection_unix_process_id (DBusConnection *connection,
        -: 1109:						  BusTransaction *transaction,
        -: 1110:						  DBusMessage    *message,
        -: 1111:						  DBusError      *error)
function bus_driver_handle_get_connection_unix_process_id called 1 returned 100% blocks executed 56%
        1: 1112:{
        -: 1113:  const char *service;
        -: 1114:  DBusString str;
        -: 1115:  BusRegistry *registry;
        -: 1116:  BusService *serv;
        -: 1117:  DBusConnection *conn;
        -: 1118:  DBusMessage *reply;
        -: 1119:  unsigned long pid;
        -: 1120:  dbus_uint32_t pid32;
        -: 1121:
        1: 1122:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
        -: 1123:
        1: 1124:  registry = bus_connection_get_registry (connection);
call    0 returned 100%
        -: 1125:
        1: 1126:  service = NULL;
        1: 1127:  reply = NULL;
        -: 1128:
        1: 1129:  if (! dbus_message_get_args (message, error,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1130:			       DBUS_TYPE_STRING, &service,
        -: 1131:			       DBUS_TYPE_INVALID))
    #####: 1132:      goto failed;
        -: 1133:
        1: 1134:  _dbus_verbose ("asked for PID of connection %s\n", service);
call    0 returned 100%
        -: 1135:
        1: 1136:  _dbus_string_init_const (&str, service);
call    0 returned 100%
        1: 1137:  serv = bus_registry_lookup (registry, &str);
call    0 returned 100%
        1: 1138:  if (serv == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1139:    {
    #####: 1140:      dbus_set_error (error, 
call    0 never executed
        -: 1141:		      DBUS_ERROR_NAME_HAS_NO_OWNER,
        -: 1142:		      "Could not get PID of name '%s': no such name", service);
    #####: 1143:      goto failed;
        -: 1144:    }
        -: 1145:
        1: 1146:  conn = bus_service_get_primary_owners_connection (serv);
call    0 returned 100%
        -: 1147:
        1: 1148:  reply = dbus_message_new_method_return (message);
call    0 returned 100%
        1: 1149:  if (reply == NULL)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
    #####: 1150:    goto oom;
        -: 1151:
        1: 1152:  if (!dbus_connection_get_unix_process_id (conn, &pid))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1153:    {
    #####: 1154:      dbus_set_error (error,
call    0 never executed
        -: 1155:                      DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN,
        -: 1156:                      "Could not determine PID for '%s'", service);
    #####: 1157:      goto failed;
        -: 1158:    }
        -: 1159:
        1: 1160:  pid32 = pid;
        1: 1161:  if (! dbus_message_append_args (reply,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1162:                                  DBUS_TYPE_UINT32, &pid32,
        -: 1163:                                  DBUS_TYPE_INVALID))
    #####: 1164:    goto oom;
        -: 1165:
        1: 1166:  if (! bus_transaction_send_from_driver (transaction, connection, reply))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1167:    goto oom;
        -: 1168:
        1: 1169:  dbus_message_unref (reply);
call    0 returned 100%
        -: 1170:
        1: 1171:  return TRUE;
        -: 1172:
    #####: 1173: oom:
    #####: 1174:  BUS_SET_OOM (error);
call    0 never executed
        -: 1175:
    #####: 1176: failed:
    #####: 1177:  _DBUS_ASSERT_ERROR_IS_SET (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
    #####: 1178:  if (reply)
branch  0 never executed
branch  1 never executed
    #####: 1179:    dbus_message_unref (reply);
call    0 never executed
    #####: 1180:  return FALSE;
        -: 1181:}
        -: 1182:
        -: 1183:static dbus_bool_t
        -: 1184:bus_driver_handle_get_connection_selinux_security_context (DBusConnection *connection,
        -: 1185:							   BusTransaction *transaction,
        -: 1186:							   DBusMessage    *message,
        -: 1187:							   DBusError      *error)
function bus_driver_handle_get_connection_selinux_security_context called 0 returned 0% blocks executed 0%
    #####: 1188:{
        -: 1189:  const char *service;
        -: 1190:  DBusString str;
        -: 1191:  BusRegistry *registry;
        -: 1192:  BusService *serv;
        -: 1193:  DBusConnection *conn;
        -: 1194:  DBusMessage *reply;
        -: 1195:  BusSELinuxID *context;
        -: 1196:
    #####: 1197:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
        -: 1198:
    #####: 1199:  registry = bus_connection_get_registry (connection);
call    0 never executed
        -: 1200:
    #####: 1201:  service = NULL;
    #####: 1202:  reply = NULL;
        -: 1203:
    #####: 1204:  if (! dbus_message_get_args (message, error,
call    0 never executed
branch  1 never executed
branch  2 never executed
        -: 1205:			       DBUS_TYPE_STRING, &service,
        -: 1206:			       DBUS_TYPE_INVALID))
    #####: 1207:      goto failed;
        -: 1208:
    #####: 1209:  _dbus_verbose ("asked for security context of connection %s\n", service);
call    0 never executed
        -: 1210:
    #####: 1211:  _dbus_string_init_const (&str, service);
call    0 never executed
    #####: 1212:  serv = bus_registry_lookup (registry, &str);
call    0 never executed
    #####: 1213:  if (serv == NULL)
branch  0 never executed
branch  1 never executed
        -: 1214:    {
    #####: 1215:      dbus_set_error (error, 
call    0 never executed
        -: 1216:		      DBUS_ERROR_NAME_HAS_NO_OWNER,
        -: 1217:		      "Could not get security context of name '%s': no such name", service);
    #####: 1218:      goto failed;
        -: 1219:    }
        -: 1220:
    #####: 1221:  conn = bus_service_get_primary_owners_connection (serv);
call    0 never executed
        -: 1222:
    #####: 1223:  reply = dbus_message_new_method_return (message);
call    0 never executed
    #####: 1224:  if (reply == NULL)
branch  0 never executed
branch  1 never executed
    #####: 1225:    goto oom;
        -: 1226:
    #####: 1227:  context = bus_connection_get_selinux_id (conn);
call    0 never executed
    #####: 1228:  if (!context)
branch  0 never executed
branch  1 never executed
        -: 1229:    {
    #####: 1230:      dbus_set_error (error,
call    0 never executed
        -: 1231:                      DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN,
        -: 1232:                      "Could not determine security context for '%s'", service);
    #####: 1233:      goto failed;
        -: 1234:    }
        -: 1235:
    #####: 1236:  if (! bus_selinux_append_context (reply, context, error))
call    0 never executed
branch  1 never executed
branch  2 never executed
    #####: 1237:    goto failed;
        -: 1238:
    #####: 1239:  if (! bus_transaction_send_from_driver (transaction, connection, reply))
call    0 never executed
branch  1 never executed
branch  2 never executed
    #####: 1240:    goto oom;
        -: 1241:
    #####: 1242:  dbus_message_unref (reply);
call    0 never executed
        -: 1243:
    #####: 1244:  return TRUE;
        -: 1245:
    #####: 1246: oom:
    #####: 1247:  BUS_SET_OOM (error);
call    0 never executed
        -: 1248:
    #####: 1249: failed:
    #####: 1250:  _DBUS_ASSERT_ERROR_IS_SET (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
    #####: 1251:  if (reply)
branch  0 never executed
branch  1 never executed
    #####: 1252:    dbus_message_unref (reply);
call    0 never executed
    #####: 1253:  return FALSE;
        -: 1254:}
        -: 1255:
        -: 1256:static dbus_bool_t
        -: 1257:bus_driver_handle_reload_config (DBusConnection *connection,
        -: 1258:				 BusTransaction *transaction,
        -: 1259:				 DBusMessage    *message,
        -: 1260:				 DBusError      *error)
function bus_driver_handle_reload_config called 0 returned 0% blocks executed 0%
    #####: 1261:{
        -: 1262:  BusContext *context;
        -: 1263:  DBusMessage *reply;
        -: 1264:
    #####: 1265:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
        -: 1266:
    #####: 1267:  reply = NULL;
        -: 1268:  
    #####: 1269:  context = bus_connection_get_context (connection);
call    0 never executed
    #####: 1270:  if (!bus_context_reload_config (context, error))
call    0 never executed
branch  1 never executed
branch  2 never executed
    #####: 1271:    goto failed;
        -: 1272:
    #####: 1273:  reply = dbus_message_new_method_return (message);
call    0 never executed
    #####: 1274:  if (reply == NULL)
branch  0 never executed
branch  1 never executed
    #####: 1275:    goto oom;
        -: 1276:
    #####: 1277:  if (! bus_transaction_send_from_driver (transaction, connection, reply))
call    0 never executed
branch  1 never executed
branch  2 never executed
    #####: 1278:    goto oom;
        -: 1279:
    #####: 1280:  dbus_message_unref (reply);
call    0 never executed
    #####: 1281:  return TRUE;
        -: 1282:
    #####: 1283: oom:
    #####: 1284:  BUS_SET_OOM (error);
call    0 never executed
        -: 1285:
    #####: 1286: failed:
    #####: 1287:  _DBUS_ASSERT_ERROR_IS_SET (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
    #####: 1288:  if (reply)
branch  0 never executed
branch  1 never executed
    #####: 1289:    dbus_message_unref (reply);
call    0 never executed
    #####: 1290:  return FALSE;
        -: 1291:}
        -: 1292:
        -: 1293:/* For speed it might be useful to sort this in order of
        -: 1294: * frequency of use (but doesn't matter with only a few items
        -: 1295: * anyhow)
        -: 1296: */
        -: 1297:struct
        -: 1298:{
        -: 1299:  const char *name;
        -: 1300:  const char *in_args;
        -: 1301:  const char *out_args;
        -: 1302:  dbus_bool_t (* handler) (DBusConnection *connection,
        -: 1303:                           BusTransaction *transaction,
        -: 1304:                           DBusMessage    *message,
        -: 1305:                           DBusError      *error);
        -: 1306:} message_handlers[] = {
        -: 1307:  { "RequestName",
        -: 1308:    DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_UINT32_AS_STRING,
        -: 1309:    DBUS_TYPE_UINT32_AS_STRING,
        -: 1310:    bus_driver_handle_acquire_service },
        -: 1311:  { "ReleaseName",
        -: 1312:    DBUS_TYPE_STRING_AS_STRING,
        -: 1313:    DBUS_TYPE_UINT32_AS_STRING,
        -: 1314:    bus_driver_handle_release_service },
        -: 1315:  { "StartServiceByName",
        -: 1316:    DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_UINT32_AS_STRING,
        -: 1317:    DBUS_TYPE_UINT32_AS_STRING,
        -: 1318:    bus_driver_handle_activate_service },
        -: 1319:  { "Hello",
        -: 1320:    "",
        -: 1321:    DBUS_TYPE_STRING_AS_STRING,
        -: 1322:    bus_driver_handle_hello },
        -: 1323:  { "NameHasOwner",
        -: 1324:    DBUS_TYPE_STRING_AS_STRING,
        -: 1325:    DBUS_TYPE_BOOLEAN_AS_STRING,
        -: 1326:    bus_driver_handle_service_exists },
        -: 1327:  { "ListNames",
        -: 1328:    "",
        -: 1329:    DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_STRING_AS_STRING,
        -: 1330:    bus_driver_handle_list_services },
        -: 1331:  { "AddMatch",
        -: 1332:    DBUS_TYPE_STRING_AS_STRING,
        -: 1333:    "",
        -: 1334:    bus_driver_handle_add_match },
        -: 1335:  { "RemoveMatch",
        -: 1336:    DBUS_TYPE_STRING_AS_STRING,
        -: 1337:    "",
        -: 1338:    bus_driver_handle_remove_match },
        -: 1339:  { "GetNameOwner",
        -: 1340:    DBUS_TYPE_STRING_AS_STRING,
        -: 1341:    DBUS_TYPE_STRING_AS_STRING,
        -: 1342:    bus_driver_handle_get_service_owner },
        -: 1343:  { "ListQueuedOwners",
        -: 1344:    DBUS_TYPE_STRING_AS_STRING,
        -: 1345:    DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_STRING_AS_STRING,
        -: 1346:    bus_driver_handle_list_queued_owners },
        -: 1347:  { "GetConnectionUnixUser",
        -: 1348:    DBUS_TYPE_STRING_AS_STRING,
        -: 1349:    DBUS_TYPE_UINT32_AS_STRING,
        -: 1350:    bus_driver_handle_get_connection_unix_user },
        -: 1351:  { "GetConnectionUnixProcessID",
        -: 1352:    DBUS_TYPE_STRING_AS_STRING,
        -: 1353:    DBUS_TYPE_UINT32_AS_STRING,
        -: 1354:    bus_driver_handle_get_connection_unix_process_id },
        -: 1355:  { "GetConnectionSELinuxSecurityContext",
        -: 1356:    DBUS_TYPE_STRING_AS_STRING,
        -: 1357:    DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_BYTE_AS_STRING,
        -: 1358:    bus_driver_handle_get_connection_selinux_security_context },
        -: 1359:  { "ReloadConfig",
        -: 1360:    "",
        -: 1361:    "",
        -: 1362:    bus_driver_handle_reload_config }
        -: 1363:};
        -: 1364:
        -: 1365:static dbus_bool_t
        -: 1366:write_args_for_direction (DBusString *xml,
        -: 1367:			  const char *signature,
        -: 1368:			  dbus_bool_t in)
function write_args_for_direction called 28 returned 100% blocks executed 83%
       28: 1369:{
        -: 1370:  DBusTypeReader typereader;
        -: 1371:  DBusString sigstr;
        -: 1372:  int current_type;
        -: 1373:  
       28: 1374:  _dbus_string_init_const (&sigstr, signature);
call    0 returned 100%
       28: 1375:  _dbus_type_reader_init_types_only (&typereader, &sigstr, 0);
call    0 returned 100%
        -: 1376:      
       80: 1377:  while ((current_type = _dbus_type_reader_get_current_type (&typereader)) != DBUS_TYPE_INVALID)
call    0 returned 100%
branch  1 taken 46%
branch  2 taken 54% (fallthrough)
        -: 1378:    {
        -: 1379:      const DBusString *subsig;
        -: 1380:      int start, len;
        -: 1381:
       24: 1382:      _dbus_type_reader_get_signature (&typereader, &subsig, &start, &len);
call    0 returned 100%
       24: 1383:      if (!_dbus_string_append_printf (xml, "      <arg direction=\"%s\" type=\"",
branch  0 taken 54% (fallthrough)
branch  1 taken 46%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
        -: 1384:				       in ? "in" : "out"))
    #####: 1385:	goto oom;
       24: 1386:      if (!_dbus_string_append_len (xml,
call    0 returned 100%
call    1 returned 100%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
        -: 1387:				    _dbus_string_get_const_data (subsig) + start,
        -: 1388:				    len))
    #####: 1389:	goto oom;
       24: 1390:      if (!_dbus_string_append (xml, "\"/>\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1391:	goto oom;
        -: 1392:
       24: 1393:      _dbus_type_reader_next (&typereader);
call    0 returned 100%
        -: 1394:    }
       28: 1395:  return TRUE;
    #####: 1396: oom:
    #####: 1397:  return FALSE;
        -: 1398:}
        -: 1399:
        -: 1400:static dbus_bool_t
        -: 1401:bus_driver_handle_introspect (DBusConnection *connection,
        -: 1402:                              BusTransaction *transaction,
        -: 1403:                              DBusMessage    *message,
        -: 1404:                              DBusError      *error)
function bus_driver_handle_introspect called 1 returned 100% blocks executed 63%
        1: 1405:{
        -: 1406:  DBusString xml;
        -: 1407:  DBusMessage *reply;
        -: 1408:  const char *v_STRING;
        -: 1409:  int i;
        -: 1410:
        1: 1411:  _dbus_verbose ("Introspect() on bus driver\n");
call    0 returned 100%
        -: 1412:  
        1: 1413:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
        -: 1414:
        1: 1415:  reply = NULL;
        -: 1416:
        1: 1417:  if (! dbus_message_get_args (message, error,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1418:			       DBUS_TYPE_INVALID))
        -: 1419:    {
    #####: 1420:      _DBUS_ASSERT_ERROR_IS_SET (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
    #####: 1421:      return FALSE;
        -: 1422:    }
        -: 1423:
        1: 1424:  if (!_dbus_string_init (&xml))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1425:    {
    #####: 1426:      BUS_SET_OOM (error);
call    0 never executed
    #####: 1427:      return FALSE;
        -: 1428:    }
        -: 1429:
        1: 1430:  if (!_dbus_string_append (&xml, DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE))
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
    #####: 1431:    goto oom;
        1: 1432:  if (!_dbus_string_append (&xml, "<node>\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1433:    goto oom;
        1: 1434:  if (!_dbus_string_append_printf (&xml, "  <interface name=\"%s\">\n", DBUS_INTERFACE_INTROSPECTABLE))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1435:    goto oom;
        1: 1436:  if (!_dbus_string_append (&xml, "    <method name=\"Introspect\">\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1437:    goto oom;
        1: 1438:  if (!_dbus_string_append_printf (&xml, "      <arg name=\"data\" direction=\"out\" type=\"%s\"/>\n", DBUS_TYPE_STRING_AS_STRING))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1439:    goto oom;
        1: 1440:  if (!_dbus_string_append (&xml, "    </method>\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1441:    goto oom;
        1: 1442:  if (!_dbus_string_append (&xml, "  </interface>\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1443:    goto oom;
        -: 1444:
        1: 1445:  if (!_dbus_string_append_printf (&xml, "  <interface name=\"%s\">\n",
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1446:                                   DBUS_INTERFACE_DBUS))
    #####: 1447:    goto oom;
        -: 1448:
        1: 1449:  i = 0;
       16: 1450:  while (i < _DBUS_N_ELEMENTS (message_handlers))
branch  0 taken 93%
branch  1 taken 7% (fallthrough)
        -: 1451:    {
        -: 1452:	  
       14: 1453:      if (!_dbus_string_append_printf (&xml, "    <method name=\"%s\">\n",
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1454:                                       message_handlers[i].name))
    #####: 1455:        goto oom;
        -: 1456:
       14: 1457:      if (!write_args_for_direction (&xml, message_handlers[i].in_args, TRUE))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1458:	goto oom;
        -: 1459:
       14: 1460:      if (!write_args_for_direction (&xml, message_handlers[i].out_args, FALSE))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1461:	goto oom;
        -: 1462:
       14: 1463:      if (!_dbus_string_append (&xml, "    </method>\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1464:	goto oom;
        -: 1465:      
       14: 1466:      ++i;
        -: 1467:    }
        -: 1468:
        1: 1469:  if (!_dbus_string_append_printf (&xml, "    <signal name=\"NameOwnerChanged\">\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1470:    goto oom;
        -: 1471:  
        1: 1472:  if (!_dbus_string_append_printf (&xml, "      <arg type=\"s\"/>\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1473:    goto oom;
        -: 1474:  
        1: 1475:  if (!_dbus_string_append_printf (&xml, "      <arg type=\"s\"/>\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1476:    goto oom;
        -: 1477:  
        1: 1478:  if (!_dbus_string_append_printf (&xml, "      <arg type=\"s\"/>\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1479:    goto oom;
        -: 1480:  
        1: 1481:  if (!_dbus_string_append_printf (&xml, "    </signal>\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1482:    goto oom;
        -: 1483:
        -: 1484:
        -: 1485:
        1: 1486:  if (!_dbus_string_append_printf (&xml, "    <signal name=\"NameLost\">\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1487:    goto oom;
        -: 1488:  
        1: 1489:  if (!_dbus_string_append_printf (&xml, "      <arg type=\"s\"/>\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1490:    goto oom;
        -: 1491:  
        1: 1492:  if (!_dbus_string_append_printf (&xml, "    </signal>\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1493:    goto oom;
        -: 1494:
        -: 1495:
        -: 1496:
        1: 1497:  if (!_dbus_string_append_printf (&xml, "    <signal name=\"NameAcquired\">\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1498:    goto oom;
        -: 1499:  
        1: 1500:  if (!_dbus_string_append_printf (&xml, "      <arg type=\"s\"/>\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1501:    goto oom;
        -: 1502:  
        1: 1503:  if (!_dbus_string_append_printf (&xml, "    </signal>\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1504:    goto oom;
        -: 1505:
        -: 1506:
        -: 1507:  
        1: 1508:  if (!_dbus_string_append (&xml, "  </interface>\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1509:    goto oom;
        -: 1510:  
        1: 1511:  if (!_dbus_string_append (&xml, "</node>\n"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1512:    goto oom;
        -: 1513:
        1: 1514:  reply = dbus_message_new_method_return (message);
call    0 returned 100%
        1: 1515:  if (reply == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1516:    goto oom;
        -: 1517:
        1: 1518:  v_STRING = _dbus_string_get_const_data (&xml);
call    0 returned 100%
        1: 1519:  if (! dbus_message_append_args (reply,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1520:                                  DBUS_TYPE_STRING, &v_STRING,
        -: 1521:                                  DBUS_TYPE_INVALID))
    #####: 1522:    goto oom;
        -: 1523:
        1: 1524:  if (! bus_transaction_send_from_driver (transaction, connection, reply))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1525:    goto oom;
        -: 1526:
        1: 1527:  dbus_message_unref (reply);
call    0 returned 100%
        1: 1528:  _dbus_string_free (&xml);
call    0 returned 100%
        -: 1529:
        1: 1530:  return TRUE;
        -: 1531:
    #####: 1532: oom:
    #####: 1533:  BUS_SET_OOM (error);
call    0 never executed
        -: 1534:
    #####: 1535:  if (reply)
branch  0 never executed
branch  1 never executed
    #####: 1536:    dbus_message_unref (reply);
call    0 never executed
        -: 1537:
    #####: 1538:  _dbus_string_free (&xml);
call    0 never executed
        -: 1539:  
    #####: 1540:  return FALSE;
        -: 1541:}
        -: 1542:
        -: 1543:dbus_bool_t
        -: 1544:bus_driver_handle_message (DBusConnection *connection,
        -: 1545:                           BusTransaction *transaction,
        -: 1546:			   DBusMessage    *message,
        -: 1547:                           DBusError      *error)
function bus_driver_handle_message called 15270 returned 100% blocks executed 64%
    15270: 1548:{
        -: 1549:  const char *name, *sender, *interface;
        -: 1550:  int i;
        -: 1551:
    15270: 1552:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
        -: 1553:
    15270: 1554:  if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_CALL)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1555:    {
    #####: 1556:      _dbus_verbose ("Driver got a non-method-call message, ignoring\n");
call    0 never executed
    #####: 1557:      return TRUE; /* we just ignore this */
        -: 1558:    }
        -: 1559:
    15270: 1560:  if (dbus_message_is_method_call (message,
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -: 1561:                                   DBUS_INTERFACE_INTROSPECTABLE,
        -: 1562:                                   "Introspect"))
        1: 1563:    return bus_driver_handle_introspect (connection, transaction, message, error);
call    0 returned 100%
        -: 1564:  
    15269: 1565:  interface = dbus_message_get_interface (message);
call    0 returned 100%
    15269: 1566:  if (interface == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1567:    interface = DBUS_INTERFACE_DBUS;
        -: 1568:  
    15269: 1569:  _dbus_assert (dbus_message_get_member (message) != NULL);
call    0 returned 100%
call    1 returned 100%
        -: 1570:  
    15269: 1571:  name = dbus_message_get_member (message);
call    0 returned 100%
    15269: 1572:  sender = dbus_message_get_sender (message);
call    0 returned 100%
        -: 1573:  
    15269: 1574:  if (strcmp (interface,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1575:              DBUS_INTERFACE_DBUS) != 0)
        -: 1576:    {
    #####: 1577:      _dbus_verbose ("Driver got message to unknown interface \"%s\"\n",
call    0 never executed
        -: 1578:                     interface);
    #####: 1579:      goto unknown;
        -: 1580:    }
        -: 1581:  
    15269: 1582:  _dbus_verbose ("Driver got a method call: %s\n",
call    0 returned 100%
call    1 returned 100%
        -: 1583:		 dbus_message_get_member (message));
        -: 1584:  
        -: 1585:  /* security checks should have kept this from getting here */
    15269: 1586:  _dbus_assert (sender != NULL || strcmp (name, "Hello") == 0);
branch  0 taken 41% (fallthrough)
branch  1 taken 59%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
        -: 1587:  
    15269: 1588:  i = 0;
    76690: 1589:  while (i < _DBUS_N_ELEMENTS (message_handlers))
branch  0 taken 100%
branch  1 taken 0% (fallthrough)
        -: 1590:    {
    61421: 1591:      if (strcmp (message_handlers[i].name, name) == 0)
call    0 returned 100%
branch  1 taken 25% (fallthrough)
branch  2 taken 75%
        -: 1592:        {
    15269: 1593:          _dbus_verbose ("Found driver handler for %s\n", name);
call    0 returned 100%
        -: 1594:
    15269: 1595:          if (!dbus_message_has_signature (message, message_handlers[i].in_args))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1596:            {
    #####: 1597:              _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
    #####: 1598:              _dbus_verbose ("Call to %s has wrong args (%s, expected %s)\n",
call    0 never executed
call    1 never executed
        -: 1599:                             name, dbus_message_get_signature (message),
        -: 1600:                             message_handlers[i].in_args);
        -: 1601:              
    #####: 1602:              dbus_set_error (error, DBUS_ERROR_INVALID_ARGS,
call    0 never executed
call    1 never executed
        -: 1603:                              "Call to %s has wrong args (%s, expected %s)\n",
        -: 1604:                              name, dbus_message_get_signature (message),
        -: 1605:                              message_handlers[i].in_args);
    #####: 1606:              _DBUS_ASSERT_ERROR_IS_SET (error);
branch  0 never executed
branch  1 never executed
call    2 never executed
branch  3 never executed
branch  4 never executed
call    5 never executed
    #####: 1607:              return FALSE;
        -: 1608:            }
        -: 1609:          
    15269: 1610:          if ((* message_handlers[i].handler) (connection, transaction, message, error))
call    0 returned 100%
branch  1 taken 84% (fallthrough)
branch  2 taken 16%
        -: 1611:            {
    12844: 1612:              _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
    12844: 1613:              _dbus_verbose ("Driver handler succeeded\n");
call    0 returned 100%
    12844: 1614:              return TRUE;
        -: 1615:            }
        -: 1616:          else
        -: 1617:            {
     2425: 1618:              _DBUS_ASSERT_ERROR_IS_SET (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
     2425: 1619:              _dbus_verbose ("Driver handler returned failure\n");
call    0 returned 100%
     2425: 1620:              return FALSE;
        -: 1621:            }
        -: 1622:        }
        -: 1623:      
    46152: 1624:      ++i;
        -: 1625:    }
        -: 1626:
    #####: 1627: unknown:
    #####: 1628:  _dbus_verbose ("No driver handler for message \"%s\"\n",
call    0 never executed
        -: 1629:                 name);
        -: 1630:
    #####: 1631:  dbus_set_error (error, DBUS_ERROR_UNKNOWN_METHOD,
call    0 never executed
        -: 1632:                  "%s does not understand message %s",
        -: 1633:                  DBUS_SERVICE_DBUS, name);
        -: 1634:  
    #####: 1635:  return FALSE;
        -: 1636:}
        -: 1637:
        -: 1638:void
        -: 1639:bus_driver_remove_connection (DBusConnection *connection)
function bus_driver_remove_connection called 7811 returned 100% blocks executed 100%
     7811: 1640:{
        -: 1641:  /* FIXME Does nothing for now, should unregister the connection
        -: 1642:   * with the bus driver.
        -: 1643:   */
     7811: 1644:}