summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-02-01 00:08:32 +0000
committerHavoc Pennington <hp@redhat.com>2003-02-01 00:08:32 +0000
commitca84a292179f520df8e2c44a02d285ded95803ff (patch)
treebbb4e81703260e950d5ede9e9949643a415bf1c7 /dbus
parent0ff552a2c5c542a1be9a1c73597c298e6ece358f (diff)
2003-01-31 Havoc Pennington <hp@pobox.com>
* doc/dbus-specification.sgml: work on the specification * dbus/dbus-message.c (_dbus_message_loader_return_buffer): check the protocol version of the message. * dbus/dbus-protocol.h: drop special _REPLY names, the spec no longer specifies that. (DBUS_SERVICE_REPLY_SERVICE_EXISTS): fix flags (1/2/4/8 not 1/2/3/4) * dbus/dbus-marshal.c (_dbus_marshal_get_arg_end_pos): add missing "break" for DBUS_TYPE_NIL, remove @todo
Diffstat (limited to 'dbus')
-rw-r--r--dbus/dbus-marshal.c5
-rw-r--r--dbus/dbus-message.c8
-rw-r--r--dbus/dbus-protocol.h8
3 files changed, 11 insertions, 10 deletions
diff --git a/dbus/dbus-marshal.c b/dbus/dbus-marshal.c
index a31e0f49..2a674987 100644
--- a/dbus/dbus-marshal.c
+++ b/dbus/dbus-marshal.c
@@ -847,8 +847,6 @@ _dbus_demarshal_string_array (const DBusString *str,
* NO VALIDATION WHATSOEVER. The message must have been previously
* validated.
*
- * @todo handle DBUS_TYPE_NIL
- *
* @param str a string
* @param byte_order the byte order to use
* @param pos the pos where the arg starts
@@ -877,6 +875,7 @@ _dbus_marshal_get_arg_end_pos (const DBusString *str,
case DBUS_TYPE_NIL:
*end_pos = pos + 1;
+ break;
case DBUS_TYPE_INT32:
*end_pos = _DBUS_ALIGN_VALUE (pos + 1, sizeof (dbus_int32_t)) + sizeof (dbus_int32_t);
@@ -1071,8 +1070,6 @@ validate_string (const DBusString *str,
* returns #TRUE if a valid arg begins at "pos"
*
* @todo security: need to audit this function.
- *
- * @todo handle DBUS_TYPE_NIL
*
* @param str a string
* @param byte_order the byte order to use
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
index 7875d90e..66c6bd59 100644
--- a/dbus/dbus-message.c
+++ b/dbus/dbus-message.c
@@ -2037,6 +2037,14 @@ _dbus_message_loader_return_buffer (DBusMessageLoader *loader,
_dbus_string_get_const_data_len (&loader->data, &header_data, 0, 16);
_dbus_assert (_DBUS_ALIGN_ADDRESS (header_data, 4) == header_data);
+
+ if (header_data[2] != DBUS_MAJOR_PROTOCOL_VERSION)
+ {
+ _dbus_verbose ("Message has protocol version %d ours is %d\n",
+ (int) header_data[2], DBUS_MAJOR_PROTOCOL_VERSION);
+ loader->corrupted = TRUE;
+ return;
+ }
byte_order = header_data[0];
diff --git a/dbus/dbus-protocol.h b/dbus/dbus-protocol.h
index 5ff6d580..f1d66ac4 100644
--- a/dbus/dbus-protocol.h
+++ b/dbus/dbus-protocol.h
@@ -72,18 +72,14 @@ extern "C" {
/* Service replies */
#define DBUS_SERVICE_REPLY_PRIMARY_OWNER 0x1
#define DBUS_SERVICE_REPLY_IN_QUEUE 0x2
-#define DBUS_SERVICE_REPLY_SERVICE_EXISTS 0x3
-#define DBUS_SERVICE_REPLY_ALREADY_OWNER 0x4
+#define DBUS_SERVICE_REPLY_SERVICE_EXISTS 0x4
+#define DBUS_SERVICE_REPLY_ALREADY_OWNER 0x8
/* Messages */
#define DBUS_MESSAGE_SERVICE_EXISTS "org.freedesktop.DBus.ServiceExists"
-#define DBUS_MESSAGE_SERVICE_EXISTS_REPLY "org.freedesktop.DBus.ServiceExists:Reply"
#define DBUS_MESSAGE_HELLO "org.freedesktop.DBus.Hello"
-#define DBUS_MESSAGE_HELLO_REPLY "org.freedesktop.DBus.Hello:Reply"
#define DBUS_MESSAGE_LIST_SERVICES "org.freedesktop.DBus.ListServices"
-#define DBUS_MESSAGE_LIST_SERVICES_REPLY "org.freedesktop.DBus.ListServices:Reply"
#define DBUS_MESSAGE_ACQUIRE_SERVICE "org.freedesktop.DBus.OwnService"
-#define DBUS_MESSAGE_ACQUIRE_SERVICE_REPLY "org.freedesktop.DBus.OwnService:Reply"
#define DBUS_MESSAGE_SERVICE_ACQUIRED "org.freedesktop.DBus.ServiceAcquired"
#define DBUS_MESSAGE_SERVICE_CREATED "org.freedesktop.DBus.ServiceCreated"
#define DBUS_MESSAGE_SERVICE_DELETED "org.freedesktop.DBus.ServiceDeleted"