mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-04 21:08:14 +02:00
2003-04-06 Havoc Pennington <hp@pobox.com>
* bus/bus.c (bus_context_new): print the address in here, rather than in main(), because we need to do it before forking the daemon * bus/dispatch.c (send_service_nonexistent_error): set the sender on the service nonexistent error * bus/driver.c (bus_driver_handle_acquire_service): set the sender on the AcquireService reply * test/data/valid-config-files/debug-allow-all.conf.in: Make test server also listen on a UNIX socket so services can connect to it.
This commit is contained in:
parent
bc8b061eec
commit
c8991b0f95
8 changed files with 75 additions and 34 deletions
14
ChangeLog
14
ChangeLog
|
|
@ -1,3 +1,17 @@
|
|||
2003-04-06 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* bus/bus.c (bus_context_new): print the address in here, rather
|
||||
than in main(), because we need to do it before forking the daemon
|
||||
|
||||
* bus/dispatch.c (send_service_nonexistent_error): set the sender
|
||||
on the service nonexistent error
|
||||
|
||||
* bus/driver.c (bus_driver_handle_acquire_service): set the
|
||||
sender on the AcquireService reply
|
||||
|
||||
* test/data/valid-config-files/debug-allow-all.conf.in: Make test
|
||||
server also listen on a UNIX socket so services can connect to it.
|
||||
|
||||
2003-04-06 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* dbus/dbus-threads.c: Redo how the fake debug mutexes are done
|
||||
|
|
|
|||
43
bus/bus.c
43
bus/bus.c
|
|
@ -298,6 +298,7 @@ setup_server (BusContext *context,
|
|||
|
||||
BusContext*
|
||||
bus_context_new (const DBusString *config_file,
|
||||
int print_addr_fd,
|
||||
DBusError *error)
|
||||
{
|
||||
BusContext *context;
|
||||
|
|
@ -498,6 +499,48 @@ bus_context_new (const DBusString *config_file,
|
|||
goto failed;
|
||||
}
|
||||
|
||||
/* Note that we don't know whether the print_addr_fd is
|
||||
* one of the sockets we're using to listen on, or some
|
||||
* other random thing. But I think the answer is "don't do
|
||||
* that then"
|
||||
*/
|
||||
if (print_addr_fd >= 0)
|
||||
{
|
||||
DBusString addr;
|
||||
const char *a = bus_context_get_address (context);
|
||||
int bytes;
|
||||
|
||||
_dbus_assert (a != NULL);
|
||||
if (!_dbus_string_init (&addr))
|
||||
{
|
||||
BUS_SET_OOM (error);
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if (!_dbus_string_append (&addr, a) ||
|
||||
!_dbus_string_append (&addr, "\n"))
|
||||
{
|
||||
_dbus_string_free (&addr);
|
||||
BUS_SET_OOM (error);
|
||||
goto failed;
|
||||
}
|
||||
|
||||
bytes = _dbus_string_get_length (&addr);
|
||||
if (_dbus_write (print_addr_fd, &addr, 0, bytes) != bytes)
|
||||
{
|
||||
dbus_set_error (error, DBUS_ERROR_FAILED,
|
||||
"Printing message bus address: %s\n",
|
||||
_dbus_strerror (errno));
|
||||
_dbus_string_free (&addr);
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if (print_addr_fd > 2)
|
||||
_dbus_close (print_addr_fd, NULL);
|
||||
|
||||
_dbus_string_free (&addr);
|
||||
}
|
||||
|
||||
/* Create activation subsystem */
|
||||
|
||||
context->activation = bus_activation_new (context, &full_address,
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ typedef struct BusService BusService;
|
|||
typedef struct BusTransaction BusTransaction;
|
||||
|
||||
BusContext* bus_context_new (const DBusString *config_file,
|
||||
int print_addr_fd,
|
||||
DBusError *error);
|
||||
void bus_context_shutdown (BusContext *context);
|
||||
void bus_context_ref (BusContext *context);
|
||||
|
|
|
|||
|
|
@ -137,7 +137,14 @@ send_service_nonexistent_error (BusTransaction *transaction,
|
|||
BUS_SET_OOM (error);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (!dbus_message_set_sender (error_reply, DBUS_SERVICE_DBUS))
|
||||
{
|
||||
dbus_message_unref (error_reply);
|
||||
BUS_SET_OOM (error);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!bus_transaction_send_message (transaction, connection, error_reply))
|
||||
{
|
||||
dbus_message_unref (error_reply);
|
||||
|
|
|
|||
|
|
@ -478,6 +478,12 @@ bus_driver_handle_acquire_service (DBusConnection *connection,
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (!dbus_message_set_sender (reply, DBUS_SERVICE_DBUS))
|
||||
{
|
||||
BUS_SET_OOM (error);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (service == NULL)
|
||||
{
|
||||
service = bus_registry_ensure (registry,
|
||||
|
|
|
|||
33
bus/main.c
33
bus/main.c
|
|
@ -216,7 +216,7 @@ main (int argc, char **argv)
|
|||
}
|
||||
|
||||
dbus_error_init (&error);
|
||||
context = bus_context_new (&config_file, &error);
|
||||
context = bus_context_new (&config_file, print_addr_fd, &error);
|
||||
_dbus_string_free (&config_file);
|
||||
if (context == NULL)
|
||||
{
|
||||
|
|
@ -225,37 +225,6 @@ main (int argc, char **argv)
|
|||
dbus_error_free (&error);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* Note that we don't know whether the print_addr_fd is
|
||||
* one of the sockets we're using to listen on, or some
|
||||
* other random thing. But I think the answer is "don't do
|
||||
* that then"
|
||||
*/
|
||||
if (print_addr_fd >= 0)
|
||||
{
|
||||
DBusString addr;
|
||||
const char *a = bus_context_get_address (context);
|
||||
int bytes;
|
||||
|
||||
_dbus_assert (a != NULL);
|
||||
if (!_dbus_string_init (&addr) ||
|
||||
!_dbus_string_append (&addr, a) ||
|
||||
!_dbus_string_append (&addr, "\n"))
|
||||
exit (1);
|
||||
|
||||
bytes = _dbus_string_get_length (&addr);
|
||||
if (_dbus_write (print_addr_fd, &addr, 0, bytes) != bytes)
|
||||
{
|
||||
_dbus_warn ("Failed to print message bus address: %s\n",
|
||||
_dbus_strerror (errno));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (print_addr_fd > 2)
|
||||
_dbus_close (print_addr_fd, NULL);
|
||||
|
||||
_dbus_string_free (&addr);
|
||||
}
|
||||
|
||||
/* FIXME we have to handle this properly below _dbus_set_signal_handler (SIGHUP, signal_handler); */
|
||||
_dbus_set_signal_handler (SIGTERM, signal_handler);
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ bus_context_new_test (const DBusString *test_data_dir,
|
|||
}
|
||||
|
||||
dbus_error_init (&error);
|
||||
context = bus_context_new (&config_file, &error);
|
||||
context = bus_context_new (&config_file, -1, &error);
|
||||
if (context == NULL)
|
||||
{
|
||||
_DBUS_ASSERT_ERROR_IS_SET (&error);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
<listen>debug-pipe:name=test-server</listen>
|
||||
<listen>unix:tmpdir=@TEST_SOCKET_DIR@</listen>
|
||||
<servicedir>@TEST_SERVICE_DIR@</servicedir>
|
||||
<policy context="default">
|
||||
<allow send="*"/>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue