2003-02-16 Havoc Pennington <hp@pobox.com>

* dbus/dbus-connection.c (dbus_connection_set_change_sigpipe):
	allow people to avoid setting SIGPIPE to SIG_IGN
	(_dbus_connection_new_for_transport): disable SIGPIPE unless
	we've been asked not to
This commit is contained in:
Havoc Pennington 2003-02-16 07:20:54 +00:00
parent 30265b80ac
commit 4a8a03aeb7
14 changed files with 115 additions and 4 deletions

View file

@ -16,3 +16,7 @@ autom4te.cache
config.guess
config.h
config.h.in
*.bb
*.bbg
*.da
*.gcov

View file

@ -1,3 +1,10 @@
2003-02-16 Havoc Pennington <hp@pobox.com>
* dbus/dbus-connection.c (dbus_connection_set_change_sigpipe):
allow people to avoid setting SIGPIPE to SIG_IGN
(_dbus_connection_new_for_transport): disable SIGPIPE unless
we've been asked not to
2003-02-15 Anders Carlsson <andersca@codefactory.se>
* dbus/dbus-list.c: (_dbus_list_append_link),

View file

@ -5,3 +5,7 @@ Makefile.in
*.lo
*.la
dbus-daemon-1
*.bb
*.bbg
*.da
*.gcov

View file

@ -5,3 +5,7 @@ Makefile.in
*.lo
*.la
dbus-test
*.bb
*.bbg
*.gcov
*.da

View file

@ -1,5 +1,5 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-bus.h Convenience functions for communicating with the bus.
/* dbus-bus.c Convenience functions for communicating with the bus.
*
* Copyright (C) 2003 CodeFactory AB
*

View file

@ -64,6 +64,8 @@
/** default timeout value when waiting for a message reply */
#define DEFAULT_TIMEOUT_VALUE (15 * 1000)
static dbus_bool_t _dbus_modify_sigpipe = TRUE;
/** Opaque typedef for DBusDataSlot */
typedef struct DBusDataSlot DBusDataSlot;
/** DBusDataSlot is used to store application data on the connection */
@ -480,6 +482,9 @@ _dbus_connection_new_for_transport (DBusTransport *transport)
disconnect_link = _dbus_list_alloc_link (disconnect_message);
if (disconnect_link == NULL)
goto error;
if (_dbus_modify_sigpipe)
_dbus_disable_sigpipe ();
connection->refcount = 1;
connection->mutex = mutex;
@ -1684,7 +1689,9 @@ _dbus_allocated_slots_init_lock (void)
* Allocates an integer ID to be used for storing application-specific
* data on any DBusConnection. The allocated ID may then be used
* with dbus_connection_set_data() and dbus_connection_get_data().
* If allocation fails, -1 is returned.
* If allocation fails, -1 is returned. Again, the allocated
* slot is global, i.e. all DBusConnection objects will
* have a slot with the given integer ID reserved.
*
* @returns -1 on failure, otherwise the data slot ID
*/
@ -1865,6 +1872,18 @@ dbus_connection_get_data (DBusConnection *connection,
return res;
}
/**
* This function sets a global flag for whether dbus_connection_new()
* will set SIGPIPE behavior to SIG_IGN.
*
* @param will_modify_sigpipe #TRUE to allow sigpipe to be set to SIG_IGN
*/
void
dbus_connection_set_change_sigpipe (dbus_bool_t will_modify_sigpipe)
{
_dbus_modify_sigpipe = will_modify_sigpipe;
}
/* This must be called with the connection lock not held to avoid
* holding it over the free_data callbacks, so it can basically
* only be called at last unref

View file

@ -155,6 +155,8 @@ dbus_bool_t dbus_connection_set_data (DBusConnection *connection,
void* dbus_connection_get_data (DBusConnection *connection,
int slot);
void dbus_connection_set_change_sigpipe (dbus_bool_t will_modify_sigpipe);
void dbus_connection_set_max_message_size (DBusConnection *connection,
long size);
long dbus_connection_get_max_message_size (DBusConnection *connection);

View file

@ -1722,4 +1722,13 @@ _dbus_spawn_async (char **argv,
return FALSE;
}
/**
* signal (SIGPIPE, SIG_IGN);
*/
void
_dbus_disable_sigpipe (void)
{
signal (SIGPIPE, SIG_IGN);
}
/** @} end of sysdeps */

View file

@ -151,7 +151,9 @@ const char *_dbus_errno_to_string (int errnum);
dbus_bool_t _dbus_spawn_async (char **argv,
DBusError *error);
void _dbus_disable_sigpipe (void);
DBUS_END_DECLS;
#endif /* DBUS_SYSDEPS_H */

View file

@ -5,3 +5,7 @@ Makefile.in
*.lo
*.la
test-dbus-glib
*.bb
*.bbg
*.da
*.gcov

View file

@ -4,4 +4,7 @@ Makefile
Makefile.in
*.lo
*.la
*.bb
*.bbg
*.da
*.gcov

View file

@ -9,3 +9,9 @@ echo-server
echo-client
bus-test
unbase64
*.bb
*.bbg
*.da
*.gcov
break-loader
spawn-test

View file

@ -0,0 +1,33 @@
## this tests that after retrying too often we fail
SERVER
NO_CREDENTIALS
# 1
SEND 'AUTH EXTERNAL USERNAME_BASE64'
EXPECT_COMMAND REJECTED
EXPECT_STATE WAITING_FOR_INPUT
# 2
SEND 'AUTH EXTERNAL USERNAME_BASE64'
EXPECT_COMMAND REJECTED
EXPECT_STATE WAITING_FOR_INPUT
# 3
SEND 'AUTH EXTERNAL USERNAME_BASE64'
EXPECT_COMMAND REJECTED
EXPECT_STATE WAITING_FOR_INPUT
# 4
SEND 'AUTH EXTERNAL USERNAME_BASE64'
EXPECT_COMMAND REJECTED
EXPECT_STATE WAITING_FOR_INPUT
# 5
SEND 'AUTH EXTERNAL USERNAME_BASE64'
EXPECT_COMMAND REJECTED
EXPECT_STATE WAITING_FOR_INPUT
# 6
SEND 'AUTH EXTERNAL USERNAME_BASE64'
EXPECT_STATE NEED_DISCONNECT

View file

@ -0,0 +1,14 @@
## message with a 'name' header field and unknown 'unkn' field
## VALID_HEADER includes a LENGTH Header and LENGTH Body
VALID_HEADER
FIELD_NAME name
TYPE STRING
STRING 'org.freedesktop.Foo'
FIELD_NAME unkn
TYPE INT32
INT32 0xfeeb
ALIGN 8
END_LENGTH Header
START_LENGTH Body
END_LENGTH Body