summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-02-16 07:20:54 +0000
committerHavoc Pennington <hp@redhat.com>2003-02-16 07:20:54 +0000
commit4a8a03aeb7430a570618ffec08616c4c87c4ee73 (patch)
treea3ae8240f121e1bfe5bf5df08890ae933f5489d7
parent30265b80acc505602e38d19c7d3036c19ee39340 (diff)
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
-rw-r--r--.cvsignore4
-rw-r--r--ChangeLog7
-rw-r--r--bus/.cvsignore4
-rw-r--r--dbus/.cvsignore4
-rw-r--r--dbus/dbus-bus.c2
-rw-r--r--dbus/dbus-connection.c21
-rw-r--r--dbus/dbus-connection.h2
-rw-r--r--dbus/dbus-sysdeps.c9
-rw-r--r--dbus/dbus-sysdeps.h4
-rw-r--r--glib/.cvsignore4
-rw-r--r--qt/.cvsignore5
-rw-r--r--test/.cvsignore6
-rw-r--r--test/data/auth/fail-after-n-attempts.auth-script33
-rw-r--r--test/data/valid-messages/unknown-header-field.message14
14 files changed, 115 insertions, 4 deletions
diff --git a/.cvsignore b/.cvsignore
index d90d2b75..f36c2ddf 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -16,3 +16,7 @@ autom4te.cache
config.guess
config.h
config.h.in
+*.bb
+*.bbg
+*.da
+*.gcov
diff --git a/ChangeLog b/ChangeLog
index ff9212b1..94768963 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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),
diff --git a/bus/.cvsignore b/bus/.cvsignore
index 8b966130..2c217808 100644
--- a/bus/.cvsignore
+++ b/bus/.cvsignore
@@ -5,3 +5,7 @@ Makefile.in
*.lo
*.la
dbus-daemon-1
+*.bb
+*.bbg
+*.da
+*.gcov
diff --git a/dbus/.cvsignore b/dbus/.cvsignore
index 4ebd42b8..d5539b20 100644
--- a/dbus/.cvsignore
+++ b/dbus/.cvsignore
@@ -5,3 +5,7 @@ Makefile.in
*.lo
*.la
dbus-test
+*.bb
+*.bbg
+*.gcov
+*.da
diff --git a/dbus/dbus-bus.c b/dbus/dbus-bus.c
index 776c78ae..99ef5ade 100644
--- a/dbus/dbus-bus.c
+++ b/dbus/dbus-bus.c
@@ -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
*
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index 73b9f18e..f97a5e13 100644
--- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -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
diff --git a/dbus/dbus-connection.h b/dbus/dbus-connection.h
index 774374e0..5a91ce82 100644
--- a/dbus/dbus-connection.h
+++ b/dbus/dbus-connection.h
@@ -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);
diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c
index e1ae16c3..67677707 100644
--- a/dbus/dbus-sysdeps.c
+++ b/dbus/dbus-sysdeps.c
@@ -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 */
diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h
index dca12ed3..7805f0fd 100644
--- a/dbus/dbus-sysdeps.h
+++ b/dbus/dbus-sysdeps.h
@@ -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 */
diff --git a/glib/.cvsignore b/glib/.cvsignore
index 0d7278ef..2ab9efa8 100644
--- a/glib/.cvsignore
+++ b/glib/.cvsignore
@@ -5,3 +5,7 @@ Makefile.in
*.lo
*.la
test-dbus-glib
+*.bb
+*.bbg
+*.da
+*.gcov
diff --git a/qt/.cvsignore b/qt/.cvsignore
index 9626b600..b9485851 100644
--- a/qt/.cvsignore
+++ b/qt/.cvsignore
@@ -4,4 +4,7 @@ Makefile
Makefile.in
*.lo
*.la
-
+*.bb
+*.bbg
+*.da
+*.gcov
diff --git a/test/.cvsignore b/test/.cvsignore
index 3a3c50d9..c3d07582 100644
--- a/test/.cvsignore
+++ b/test/.cvsignore
@@ -9,3 +9,9 @@ echo-server
echo-client
bus-test
unbase64
+*.bb
+*.bbg
+*.da
+*.gcov
+break-loader
+spawn-test
diff --git a/test/data/auth/fail-after-n-attempts.auth-script b/test/data/auth/fail-after-n-attempts.auth-script
new file mode 100644
index 00000000..75bd3801
--- /dev/null
+++ b/test/data/auth/fail-after-n-attempts.auth-script
@@ -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
diff --git a/test/data/valid-messages/unknown-header-field.message b/test/data/valid-messages/unknown-header-field.message
new file mode 100644
index 00000000..18ab379c
--- /dev/null
+++ b/test/data/valid-messages/unknown-header-field.message
@@ -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