From 4fce285052c143296cd9e08a48de0175b5207853 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Tue, 18 Jan 2005 03:03:07 +0000 Subject: 2005-01-17 Havoc Pennington * dbus/dbus-types.h: remove 16-bit types since we don't use them ever * dbus/dbus-marshal-validate.c (_dbus_validate_path): disallow any "invalid name character" not only non-ASCII * doc/dbus-specification.xml: further update spec, message bus parts are still out-of-date but the marshaling etc. stuff is now accurate-ish --- dbus/dbus-marshal-validate.c | 40 ++++++++++++++++++++-------------------- dbus/dbus-types.h | 2 -- 2 files changed, 20 insertions(+), 22 deletions(-) (limited to 'dbus') diff --git a/dbus/dbus-marshal-validate.c b/dbus/dbus-marshal-validate.c index 285f1efb..ced5e1ea 100644 --- a/dbus/dbus-marshal-validate.c +++ b/dbus/dbus-marshal-validate.c @@ -481,6 +481,25 @@ _dbus_validate_body_with_reason (const DBusString *expected_signature, } } +/** + * Determine wether the given charater is valid as the first charater + * in a name. + */ +#define VALID_INITIAL_NAME_CHARACTER(c) \ + ( ((c) >= 'A' && (c) <= 'Z') || \ + ((c) >= 'a' && (c) <= 'z') || \ + ((c) == '_') ) + +/** + * Determine wether the given charater is valid as a second or later + * character in a name + */ +#define VALID_NAME_CHARACTER(c) \ + ( ((c) >= '0' && (c) <= '9') || \ + ((c) >= 'A' && (c) <= 'Z') || \ + ((c) >= 'a' && (c) <= 'z') || \ + ((c) == '_') ) + /** * Checks that the given range of the string is a valid object path * name in the D-BUS protocol. Part of the validation ensures that @@ -535,7 +554,7 @@ _dbus_validate_path (const DBusString *str, } else { - if (_DBUS_UNLIKELY (!_DBUS_ISASCII (*s))) + if (_DBUS_UNLIKELY (!VALID_NAME_CHARACTER (*s))) return FALSE; } @@ -549,25 +568,6 @@ _dbus_validate_path (const DBusString *str, return TRUE; } -/** - * Determine wether the given charater is valid as the first charater - * in a name. - */ -#define VALID_INITIAL_NAME_CHARACTER(c) \ - ( ((c) >= 'A' && (c) <= 'Z') || \ - ((c) >= 'a' && (c) <= 'z') || \ - ((c) == '_') ) - -/** - * Determine wether the given charater is valid as a second or later - * character in a name - */ -#define VALID_NAME_CHARACTER(c) \ - ( ((c) >= '0' && (c) <= '9') || \ - ((c) >= 'A' && (c) <= 'Z') || \ - ((c) >= 'a' && (c) <= 'z') || \ - ((c) == '_') ) - /** * Checks that the given range of the string is a valid interface name * in the D-BUS protocol. This includes a length restriction and an diff --git a/dbus/dbus-types.h b/dbus/dbus-types.h index 0bbc9295..55ddf434 100644 --- a/dbus/dbus-types.h +++ b/dbus/dbus-types.h @@ -29,8 +29,6 @@ #include -typedef unsigned short dbus_uint16_t; -typedef short dbus_int16_t; typedef unsigned int dbus_uint32_t; typedef int dbus_int32_t; typedef dbus_uint32_t dbus_unichar_t; -- cgit