summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2011-03-10 19:07:15 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2011-03-10 19:07:15 +0000
commit8299a41aa6808f020907b17bf3a66d9f360305be (patch)
treebc33b3450045829078cf172656e0ad175c98f964
parent9759973233122ecf121a1d9522f95414f0fa7493 (diff)
parentd1d395774435d7759ef2b2af337222da79bc7264 (diff)
Merge branch 'dbus-1.4'
-rw-r--r--dbus/dbus-marshal-basic.c2
-rw-r--r--dbus/dbus-marshal-validate.c2
-rw-r--r--dbus/dbus-marshal-validate.h4
-rw-r--r--dbus/dbus-message.c50
-rw-r--r--dbus/dbus-signature.c17
-rw-r--r--doc/.gitignore1
-rw-r--r--doc/Makefile.am8
7 files changed, 71 insertions, 13 deletions
diff --git a/dbus/dbus-marshal-basic.c b/dbus/dbus-marshal-basic.c
index ea18dbf3..3cbc7216 100644
--- a/dbus/dbus-marshal-basic.c
+++ b/dbus/dbus-marshal-basic.c
@@ -1065,8 +1065,6 @@ _dbus_marshal_write_fixed_multi (DBusString *str,
case DBUS_TYPE_INT16:
case DBUS_TYPE_UINT16:
return marshal_fixed_multi (str, insert_at, vp, n_elements, byte_order, 2, pos_after);
- /* FIXME: we canonicalize to 0 or 1 for the single boolean case
- * should we here too ? */
case DBUS_TYPE_BOOLEAN:
case DBUS_TYPE_INT32:
case DBUS_TYPE_UINT32:
diff --git a/dbus/dbus-marshal-validate.c b/dbus/dbus-marshal-validate.c
index b4579978..4304467d 100644
--- a/dbus/dbus-marshal-validate.c
+++ b/dbus/dbus-marshal-validate.c
@@ -1221,6 +1221,8 @@ DEFINE_DBUS_NAME_CHECK(error_name)
DEFINE_DBUS_NAME_CHECK(bus_name)
/** define _dbus_check_is_valid_signature() */
DEFINE_DBUS_NAME_CHECK(signature)
+/** define _dbus_check_is_valid_utf8() */
+DEFINE_DBUS_NAME_CHECK(utf8)
/** @} */
diff --git a/dbus/dbus-marshal-validate.h b/dbus/dbus-marshal-validate.h
index 8947a2af..1d2e26b8 100644
--- a/dbus/dbus-marshal-validate.h
+++ b/dbus/dbus-marshal-validate.h
@@ -147,6 +147,8 @@ dbus_bool_t _dbus_validate_bus_name (const DBusString *str,
dbus_bool_t _dbus_validate_signature (const DBusString *str,
int start,
int len);
+/* just to have a name consistent with the above: */
+#define _dbus_validate_utf8(s,b,e) _dbus_string_validate_utf8 (s, b, e)
#ifdef DBUS_DISABLE_CHECKS
@@ -193,6 +195,8 @@ DECLARE_DBUS_NAME_CHECK(error_name);
DECLARE_DBUS_NAME_CHECK(bus_name);
/** defines _dbus_check_is_valid_signature() */
DECLARE_DBUS_NAME_CHECK(signature);
+/** defines _dbus_check_is_valid_utf8() */
+DECLARE_DBUS_NAME_CHECK(utf8);
/** @} */
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
index 442ec2ae..24ef5ac7 100644
--- a/dbus/dbus-message.c
+++ b/dbus/dbus-message.c
@@ -2515,6 +2515,39 @@ dbus_message_iter_append_basic (DBusMessageIter *iter,
_dbus_return_val_if_fail (dbus_type_is_basic (type), FALSE);
_dbus_return_val_if_fail (value != NULL, FALSE);
+#ifndef DBUS_DISABLE_CHECKS
+ switch (type)
+ {
+ const char * const *string_p;
+ const dbus_bool_t *bool_p;
+
+ case DBUS_TYPE_STRING:
+ string_p = value;
+ _dbus_return_val_if_fail (_dbus_check_is_valid_utf8 (*string_p), FALSE);
+ break;
+
+ case DBUS_TYPE_OBJECT_PATH:
+ string_p = value;
+ _dbus_return_val_if_fail (_dbus_check_is_valid_path (*string_p), FALSE);
+ break;
+
+ case DBUS_TYPE_SIGNATURE:
+ string_p = value;
+ _dbus_return_val_if_fail (_dbus_check_is_valid_signature (*string_p), FALSE);
+ break;
+
+ case DBUS_TYPE_BOOLEAN:
+ bool_p = value;
+ _dbus_return_val_if_fail (*bool_p == 0 || *bool_p == 1, FALSE);
+ break;
+
+ default:
+ {
+ /* nothing to check, all possible values are allowed */
+ }
+ }
+#endif
+
if (!_dbus_message_iter_open_signature (real))
return FALSE;
@@ -2598,10 +2631,6 @@ dbus_message_iter_append_basic (DBusMessageIter *iter,
* @todo If this fails due to lack of memory, the message is hosed and
* you have to start over building the whole message.
*
- * For Unix file descriptors this function will internally duplicate
- * the descriptor you passed in. Hence you may close the descriptor
- * immediately after this call.
- *
* @param iter the append iterator
* @param element_type the type of the array elements
* @param value the address of the array
@@ -2627,6 +2656,19 @@ dbus_message_iter_append_fixed_array (DBusMessageIter *iter,
DBUS_MAXIMUM_ARRAY_LENGTH / _dbus_type_get_alignment (element_type),
FALSE);
+#ifndef DBUS_DISABLE_CHECKS
+ if (element_type == DBUS_TYPE_BOOLEAN)
+ {
+ const dbus_bool_t * const *bools = value;
+ int i;
+
+ for (i = 0; i < n_elements; i++)
+ {
+ _dbus_return_val_if_fail ((*bools)[i] == 0 || (*bools)[i] == 1, FALSE);
+ }
+ }
+#endif
+
ret = _dbus_type_writer_write_fixed_multi (&real->u.writer, element_type, value, n_elements);
return ret;
diff --git a/dbus/dbus-signature.c b/dbus/dbus-signature.c
index ddc0bcc3..9c13ff43 100644
--- a/dbus/dbus-signature.c
+++ b/dbus/dbus-signature.c
@@ -283,9 +283,10 @@ dbus_signature_validate_single (const char *signature,
* A "container type" can contain basic types, or nested
* container types. #DBUS_TYPE_INVALID is not a container type.
*
- * This function will crash if passed a typecode that isn't
- * in dbus-protocol.h
+ * It is an error to pass an invalid type-code, other than DBUS_TYPE_INVALID,
+ * to this function. The valid type-codes are defined by dbus-protocol.h.
*
+ * @param typecode either a valid type-code or DBUS_TYPE_INVALID
* @returns #TRUE if type is a container
*/
dbus_bool_t
@@ -305,9 +306,10 @@ dbus_type_is_container (int typecode)
* variants are not basic types. #DBUS_TYPE_INVALID is not a basic
* type.
*
- * This function will crash if passed a typecode that isn't
- * in dbus-protocol.h
+ * It is an error to pass an invalid type-code, other than DBUS_TYPE_INVALID,
+ * to this function. The valid type-codes are defined by dbus-protocol.h.
*
+ * @param typecode either a valid type-code or DBUS_TYPE_INVALID
* @returns #TRUE if type is basic
*/
dbus_bool_t
@@ -334,9 +336,10 @@ dbus_type_is_basic (int typecode)
* but struct is not considered a fixed type for purposes of this
* function.
*
- * This function will crash if passed a typecode that isn't
- * in dbus-protocol.h
- *
+ * It is an error to pass an invalid type-code, other than DBUS_TYPE_INVALID,
+ * to this function. The valid type-codes are defined by dbus-protocol.h.
+ *
+ * @param typecode either a valid type-code or DBUS_TYPE_INVALID
* @returns #FALSE if the type can occupy different lengths
*/
dbus_bool_t
diff --git a/doc/.gitignore b/doc/.gitignore
index c26fd2d0..1afe0141 100644
--- a/doc/.gitignore
+++ b/doc/.gitignore
@@ -15,3 +15,4 @@ dbus-faq.html
dbus-daemon.1
dbus-docs
dbus-docs.tar.gz
+doxygen.stamp
diff --git a/doc/Makefile.am b/doc/Makefile.am
index adac743c..e8156c6b 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -90,6 +90,13 @@ endif
install-data-local:: doxygen.stamp
$(MKDIR_P) $(DESTDIR)$(apidir)
$(INSTALL_DATA) api/html/* $(DESTDIR)$(apidir)
+
+uninstall-local::
+ rm -f $(DESTDIR)$(apidir)/*.html
+ rm -f $(DESTDIR)$(apidir)/*.png
+ rm -f $(DESTDIR)$(apidir)/*.css
+ rmdir --ignore-fail-on-non-empty $(DESTDIR)$(apidir) || \
+ rmdir $(DESTDIR)$(apidir)
endif
if DBUS_HAVE_MAN2HTML
@@ -143,6 +150,7 @@ clean-local:
rm -rf api
rm -rf dbus-docs
rm -f *.1.html
+ rm -f doxygen.stamp
maintainer-clean-local:
rm -f $(HTML_FILES)