diff options
Diffstat (limited to 'dbus/dbus-connection.c')
| -rw-r--r-- | dbus/dbus-connection.c | 56 | 
1 files changed, 51 insertions, 5 deletions
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c index 2e291eee..a960a991 100644 --- a/dbus/dbus-connection.c +++ b/dbus/dbus-connection.c @@ -1678,21 +1678,26 @@ connection_forget_shared_unlocked (DBusConnection *connection)    if (!connection->shareable)      return; +  _DBUS_LOCK (shared_connections); +          if (connection->server_guid != NULL)      {        _dbus_verbose ("dropping connection to %s out of the shared table\n",                       connection->server_guid); -      _DBUS_LOCK (shared_connections); -              if (!_dbus_hash_table_remove_string (shared_connections,                                             connection->server_guid))          _dbus_assert_not_reached ("connection was not in the shared table");        dbus_free (connection->server_guid);        connection->server_guid = NULL; -      _DBUS_UNLOCK (shared_connections);      } +  else +    { +      _dbus_list_remove (&shared_connections_no_guid, connection); +    } + +  _DBUS_UNLOCK (shared_connections);    /* remove our reference held on all shareable connections */    _dbus_connection_unref_unlocked (connection); @@ -3411,9 +3416,13 @@ _dbus_connection_read_write_dispatch (DBusConnection *connection,                                       dbus_bool_t     dispatch)  {    DBusDispatchStatus dstatus; -  dbus_bool_t no_progress_possible;    dbus_bool_t progress_possible; -   + +  /* Need to grab a ref here in case we're a private connection and +   * the user drops the last ref in a handler we call; see bug  +   * https://bugs.freedesktop.org/show_bug.cgi?id=15635 +   */ +  dbus_connection_ref (connection);    dstatus = dbus_connection_get_dispatch_status (connection);    if (dispatch && dstatus == DBUS_DISPATCH_DATA_REMAINS) @@ -3454,6 +3463,9 @@ _dbus_connection_read_write_dispatch (DBusConnection *connection,      progress_possible = _dbus_connection_get_is_connected_unlocked (connection);    CONNECTION_UNLOCK (connection); + +  dbus_connection_unref (connection); +    return progress_possible; /* TRUE if we can make more progress */  } @@ -4973,6 +4985,40 @@ dbus_connection_get_unix_process_id (DBusConnection *connection,  }  /** + * Gets the ADT audit data of the connection if any. + * Returns #TRUE if the structure pointer is returned. + * Always returns #FALSE prior to authenticating the + * connection. + * + * @param connection the connection + * @param data return location for audit data  + * @returns #TRUE if audit data is filled in with a valid ucred pointer + */ +dbus_bool_t +dbus_connection_get_adt_audit_session_data (DBusConnection *connection, +					    void          **data, +					    dbus_int32_t   *data_size) +{ +  dbus_bool_t result; + +  _dbus_return_val_if_fail (connection != NULL, FALSE); +  _dbus_return_val_if_fail (data != NULL, FALSE); +  _dbus_return_val_if_fail (data_size != NULL, FALSE); +   +  CONNECTION_LOCK (connection); + +  if (!_dbus_transport_get_is_authenticated (connection->transport)) +    result = FALSE; +  else +    result = _dbus_transport_get_adt_audit_session_data (connection->transport, +					    	         data, +			  			         data_size); +  CONNECTION_UNLOCK (connection); + +  return result; +} + +/**   * Sets a predicate function used to determine whether a given user ID   * is allowed to connect. When an incoming connection has   * authenticated with a particular user ID, this function is called;  | 
