dbus/dbus dbus-auth.h, 1.8, 1.9 dbus-message.c, 1.130,
1.131 dbus-sysdeps.h, 1.39, 1.40
Havoc Pennington
hp at pdx.freedesktop.org
Fri May 28 15:30:06 PDT 2004
Update of /cvs/dbus/dbus/dbus
In directory pdx:/tmp/cvs-serv1708/dbus
Modified Files:
dbus-auth.h dbus-message.c dbus-sysdeps.h
Log Message:
2004-05-28 Havoc Pennington <hp at redhat.com>
* test/glib/test-service-glib.c (main): remove unused variable
* glib/dbus-gidl.c (base_info_ref): fix a silly compiler warning
* dbus/dbus-auth.h (enum): remove AUTHENTICATED_WITH_UNUSED_BYTES
from the enum, no longer in use.
* dbus/dbus-sysdeps.h: include config.h so DBUS_VA_COPY actually
works right.
* dbus/dbus-message.c: add various _dbus_return_val_if_fail for
whether error_name passed in is a valid error name.
Index: dbus-auth.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-auth.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- a/dbus-auth.h 2 Dec 2003 10:44:21 -0000 1.8
+++ b/dbus-auth.h 28 May 2004 22:30:04 -0000 1.9
@@ -38,7 +38,6 @@
DBUS_AUTH_STATE_WAITING_FOR_MEMORY,
DBUS_AUTH_STATE_HAVE_BYTES_TO_SEND,
DBUS_AUTH_STATE_NEED_DISCONNECT,
- DBUS_AUTH_STATE_AUTHENTICATED_WITH_UNUSED_BYTES,
DBUS_AUTH_STATE_AUTHENTICATED
} DBusAuthState;
Index: dbus-message.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-message.c,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- a/dbus-message.c 28 May 2004 19:09:00 -0000 1.130
+++ b/dbus-message.c 28 May 2004 22:30:04 -0000 1.131
@@ -171,6 +171,23 @@
message->header_padding = 0;
}
+#ifdef DBUS_DISABLE_CHECKS
+#define is_valid_error_name(x) TRUE
+#else
+static dbus_bool_t
+is_valid_error_name (const char *error_name)
+{
+ DBusString the_error_name;
+
+ if (error_name == NULL)
+ return FALSE;
+
+ _dbus_string_init_const (&the_error_name, error_name);
+ return _dbus_string_validate_error_name (&the_error_name, 0,
+ _dbus_string_get_length (&the_error_name));
+}
+#endif
+
static dbus_bool_t
append_header_padding (DBusMessage *message)
{
@@ -1022,6 +1039,7 @@
_dbus_assert ((interface && member) ||
(error_name) ||
!(interface || member || error_name));
+ _dbus_assert (error_name == NULL || is_valid_error_name (error_name));
if (!_dbus_string_append_byte (&message->header, message->byte_order))
return FALSE;
@@ -1378,6 +1396,7 @@
_dbus_return_val_if_fail (reply_to != NULL, NULL);
_dbus_return_val_if_fail (error_name != NULL, NULL);
+ _dbus_return_val_if_fail (is_valid_error_name (error_name), NULL);
sender = get_string_field (reply_to,
DBUS_HEADER_FIELD_SENDER,
@@ -1441,6 +1460,10 @@
DBusString str;
DBusMessage *message;
+ _dbus_return_val_if_fail (reply_to != NULL, NULL);
+ _dbus_return_val_if_fail (error_name != NULL, NULL);
+ _dbus_return_val_if_fail (is_valid_error_name (error_name), NULL);
+
if (!_dbus_string_init (&str))
return NULL;
@@ -1787,7 +1810,9 @@
{
_dbus_return_val_if_fail (message != NULL, FALSE);
_dbus_return_val_if_fail (!message->locked, FALSE);
-
+ _dbus_return_val_if_fail (error_name != NULL, FALSE);
+ _dbus_return_val_if_fail (is_valid_error_name (error_name), FALSE);
+
return set_string_field (message,
DBUS_HEADER_FIELD_ERROR_NAME,
DBUS_TYPE_STRING,
@@ -3819,6 +3844,9 @@
goto errorout;
break;
case DBUS_TYPE_BYTE:
+ /* FIXME if you pass an unsigned char to varargs it gets promoted to int,
+ * so probably we should read an int here.
+ */
if (!dbus_message_iter_append_byte (&iter, va_arg (var_args, unsigned char)))
goto errorout;
break;
@@ -3827,10 +3855,16 @@
goto errorout;
break;
case DBUS_TYPE_INT32:
+ /* FIXME this is probably wrong, because an int passed in probably gets
+ * converted to plain "int" not necessarily 32-bit.
+ */
if (!dbus_message_iter_append_int32 (&iter, va_arg (var_args, dbus_int32_t)))
goto errorout;
break;
case DBUS_TYPE_UINT32:
+ /* FIXME this is probably wrong, because an int passed in probably gets
+ * converted to plain "int" not necessarily 32-bit.
+ */
if (!dbus_message_iter_append_uint32 (&iter, va_arg (var_args, dbus_uint32_t)))
goto errorout;
break;
@@ -4367,13 +4401,14 @@
*/
dbus_bool_t
dbus_message_is_error (DBusMessage *message,
- const char *error_name)
+ const char *error_name)
{
const char *n;
_dbus_return_val_if_fail (message != NULL, FALSE);
_dbus_return_val_if_fail (error_name != NULL, FALSE);
-
+ _dbus_return_val_if_fail (is_valid_error_name (error_name), FALSE);
+
if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_ERROR)
return FALSE;
Index: dbus-sysdeps.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- a/dbus-sysdeps.h 12 Mar 2004 14:07:16 -0000 1.39
+++ b/dbus-sysdeps.h 28 May 2004 22:30:04 -0000 1.40
@@ -25,6 +25,8 @@
#ifndef DBUS_SYSDEPS_H
#define DBUS_SYSDEPS_H
+#include <config.h>
+
#include <dbus/dbus-errors.h>
/* this is perhaps bogus, but strcmp() etc. are faster if we use the
More information about the dbus-commit
mailing list