summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-message.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2005-01-21 06:18:04 +0000
committerHavoc Pennington <hp@redhat.com>2005-01-21 06:18:04 +0000
commit606eb2106b3d7f5cd36a4f1786d281b771bb1bf7 (patch)
treed4fe3c88571d0f683f8dadbef43fd5c0dea18ffa /dbus/dbus-message.c
parentcda2389089ef180ac2f3c880cb03427e9baf884b (diff)
2005-01-21 Havoc Pennington <hp@redhat.com>
* dbus/dbus-bus.c: add more return_if_fail checks * dbus/dbus-message.c (load_message): have the "no validation" mode (have to edit the code to toggle the mode for now though) * dbus/dbus-marshal-header.c (_dbus_header_load): have a mode that skips all validation; I want to use this at least for benchmark baseline, I'm not sure if it should be a publicly-available switch.
Diffstat (limited to 'dbus/dbus-message.c')
-rw-r--r--dbus/dbus-message.c54
1 files changed, 30 insertions, 24 deletions
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
index 4ddfa37a..2ed9cf2f 100644
--- a/dbus/dbus-message.c
+++ b/dbus/dbus-message.c
@@ -3032,7 +3032,10 @@ load_message (DBusMessageLoader *loader,
DBusValidity validity;
const DBusString *type_str;
int type_pos;
+ DBusValidationMode mode;
+ mode = DBUS_VALIDATION_MODE_DATA_IS_UNTRUSTED;
+
oom = FALSE;
#if 0
@@ -3043,14 +3046,15 @@ load_message (DBusMessageLoader *loader,
_dbus_assert (_dbus_string_get_length (&message->header.data) == 0);
_dbus_assert ((header_len + body_len) <= _dbus_string_get_length (&loader->data));
- if (!_dbus_header_load_untrusted (&message->header,
- &validity,
- byte_order,
- fields_array_len,
- header_len,
- body_len,
- &loader->data, 0,
- _dbus_string_get_length (&loader->data)))
+ if (!_dbus_header_load (&message->header,
+ mode,
+ &validity,
+ byte_order,
+ fields_array_len,
+ header_len,
+ body_len,
+ &loader->data, 0,
+ _dbus_string_get_length (&loader->data)))
{
_dbus_verbose ("Failed to load header for new message code %d\n", validity);
if (validity == DBUS_VALID)
@@ -3063,23 +3067,25 @@ load_message (DBusMessageLoader *loader,
message->byte_order = byte_order;
/* 2. VALIDATE BODY */
-
- get_const_signature (&message->header, &type_str, &type_pos);
-
- /* Because the bytes_remaining arg is NULL, this validates that the
- * body is the right length
- */
- validity = _dbus_validate_body_with_reason (type_str,
- type_pos,
- byte_order,
- NULL,
- &loader->data,
- header_len,
- body_len);
- if (validity != DBUS_VALID)
+ if (mode != DBUS_VALIDATION_MODE_WE_TRUST_THIS_DATA_ABSOLUTELY)
{
- _dbus_verbose ("Failed to validate message body code %d\n", validity);
- goto failed;
+ get_const_signature (&message->header, &type_str, &type_pos);
+
+ /* Because the bytes_remaining arg is NULL, this validates that the
+ * body is the right length
+ */
+ validity = _dbus_validate_body_with_reason (type_str,
+ type_pos,
+ byte_order,
+ NULL,
+ &loader->data,
+ header_len,
+ body_len);
+ if (validity != DBUS_VALID)
+ {
+ _dbus_verbose ("Failed to validate message body code %d\n", validity);
+ goto failed;
+ }
}
/* 3. COPY OVER BODY AND QUEUE MESSAGE */