From 6531968a0b62959633627f9a74a6f19f2741261d Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Fri, 29 Aug 2008 17:13:15 +0300 Subject: Bug 17352: synchronize the file before renaming Dbus is doing atomic file updates by copying them, changing the copy, and re-naming them. However, it does not synchronize the file before re-naming, which results in corruption in case of unclean reboots. The reason for this is that file-systems have write-back cache and they postpone writing data to the media. This patch adds the missed fsync() for the Unix part. I do not have windows so cannot provide a windows port fix. Signed-off-by: Artem Bityutskiy Signed-off-by: Colin Walters --- dbus/dbus-sysdeps-unix.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'dbus') diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 1e45649f..18b4967b 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -2224,6 +2224,15 @@ _dbus_string_save_to_file (const DBusString *str, total += bytes_written; } + if (fsync(fd)) + { + dbus_set_error (error, _dbus_error_from_errno (errno), + "Could not synchronize file %s: %s", + tmp_filename_c, _dbus_strerror (errno)); + + goto out; + } + if (!_dbus_close (fd, NULL)) { dbus_set_error (error, _dbus_error_from_errno (errno), -- cgit From e8ea01bd07eedb3c98bc0725e5799fe08499262a Mon Sep 17 00:00:00 2001 From: Jens Granseuer Date: Thu, 7 Aug 2008 14:45:51 -0400 Subject: Bug 13387: Fix compilation failure with AI_ADDRCONFIG Signed-off-by: Colin Walters --- dbus/dbus-sysdeps-unix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dbus') diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 18b4967b..3f963bca 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -79,8 +79,8 @@ #define O_BINARY 0 #endif -#ifndef _AI_ADDRCONFIG -#define _AI_ADDRCONFIG 0 +#ifndef AI_ADDRCONFIG +#define AI_ADDRCONFIG 0 #endif #ifndef HAVE_SOCKLEN_T -- cgit From 008bca5a4e3600d56ac7c1fe984789110b83e1b2 Mon Sep 17 00:00:00 2001 From: Joe Marcus Clarke Date: Thu, 4 Sep 2008 22:13:30 -0400 Subject: Bug 17061: Handle error return from sysconf correctly * dbus/dbus-sysdeps-unix.c: * dbus/dbus-sysdeps-util-unix.c: Cast return from sysconf temporarily so we actually see -1. Signed-off-by: Colin Walters --- dbus/dbus-sysdeps-unix.c | 6 +++++- dbus/dbus-sysdeps-util-unix.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'dbus') diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 3f963bca..24a3774f 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -1493,7 +1493,11 @@ fill_user_info (DBusUserInfo *info, /* retrieve maximum needed size for buf */ buflen = sysconf (_SC_GETPW_R_SIZE_MAX); - if (buflen <= 0) + /* sysconf actually returns a long, but everything else expects size_t, + * so just recast here. + * https://bugs.freedesktop.org/show_bug.cgi?id=17061 + */ + if ((long) buflen <= 0) buflen = 1024; result = -1; diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c index 55eb9346..0343a90c 100644 --- a/dbus/dbus-sysdeps-util-unix.c +++ b/dbus/dbus-sysdeps-util-unix.c @@ -836,7 +836,11 @@ fill_group_info (DBusGroupInfo *info, /* retrieve maximum needed size for buf */ buflen = sysconf (_SC_GETGR_R_SIZE_MAX); - if (buflen <= 0) + /* sysconf actually returns a long, but everything else expects size_t, + * so just recast here. + * https://bugs.freedesktop.org/show_bug.cgi?id=17061 + */ + if ((long) buflen <= 0) buflen = 1024; result = -1; -- cgit From f2922ce4bcf06aa8ee540accbd005c472c95d28f Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 1 Oct 2008 13:49:48 -0400 Subject: Bug 17803: Panic from dbus_signature_validate * dbus/dbus-marshal-validate.c: Ensure we validate a basic type before calling is_basic on it. * dbus-marshal-validate-util.c: Test. --- dbus/dbus-marshal-validate-util.c | 1 + dbus/dbus-marshal-validate.c | 1 + 2 files changed, 2 insertions(+) (limited to 'dbus') diff --git a/dbus/dbus-marshal-validate-util.c b/dbus/dbus-marshal-validate-util.c index f2901d74..5365d6d3 100644 --- a/dbus/dbus-marshal-validate-util.c +++ b/dbus/dbus-marshal-validate-util.c @@ -228,6 +228,7 @@ _dbus_marshal_validate_test (void) "123", ".", "(" + "a{(ii)i}" /* https://bugs.freedesktop.org/show_bug.cgi?id=17803 */ }; /* Signature with reason */ diff --git a/dbus/dbus-marshal-validate.c b/dbus/dbus-marshal-validate.c index e63a463b..b24b5bc2 100644 --- a/dbus/dbus-marshal-validate.c +++ b/dbus/dbus-marshal-validate.c @@ -247,6 +247,7 @@ _dbus_validate_signature_with_reason (const DBusString *type_str, } if (last == DBUS_DICT_ENTRY_BEGIN_CHAR && + _dbus_type_is_valid (*p) && !dbus_type_is_basic (*p)) { result = DBUS_INVALID_DICT_KEY_MUST_BE_BASIC_TYPE; -- cgit From c3fe204d31e0b58ce1a48d7e7e9365d20dfbb95a Mon Sep 17 00:00:00 2001 From: Peter McCurdy Date: Mon, 25 Aug 2008 10:10:00 -0400 Subject: Bug 17280: Add a prototype for _dbus_credentials_add_adt_audit_data() * dbus/dbus-credentials.h: Add a prototype for _dbus_credentials_add_adt_audit_data() Signed-off-by: Colin Walters --- dbus/dbus-credentials.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'dbus') diff --git a/dbus/dbus-credentials.h b/dbus/dbus-credentials.h index d4c8d160..8eed2bd2 100644 --- a/dbus/dbus-credentials.h +++ b/dbus/dbus-credentials.h @@ -47,6 +47,9 @@ dbus_bool_t _dbus_credentials_add_unix_uid (DBusCredentials dbus_uid_t uid); dbus_bool_t _dbus_credentials_add_windows_sid (DBusCredentials *credentials, const char *windows_sid); +dbus_bool_t _dbus_credentials_add_adt_audit_data (DBusCredentials *credentials, + void *audit_data, + dbus_int32_t size); dbus_bool_t _dbus_credentials_include (DBusCredentials *credentials, DBusCredentialType type); dbus_pid_t _dbus_credentials_get_unix_pid (DBusCredentials *credentials); -- cgit From 033b67aff0cdb690b697408db52161f5fd69c597 Mon Sep 17 00:00:00 2001 From: Peter McCurdy Date: Mon, 25 Aug 2008 10:00:09 -0400 Subject: 2008-08-24 Peter McCurdy * dbus/dbus-marshal-recursive.c: A stray comma between two string literals caused incorrect output and a compiler warning. Signed-off-by: Colin Walters --- dbus/dbus-marshal-recursive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dbus') diff --git a/dbus/dbus-marshal-recursive.c b/dbus/dbus-marshal-recursive.c index 6c2902e2..76ee344f 100644 --- a/dbus/dbus-marshal-recursive.c +++ b/dbus/dbus-marshal-recursive.c @@ -1654,7 +1654,7 @@ writer_recurse_init_and_check (DBusTypeWriter *writer, _dbus_type_to_string (expected), _dbus_string_get_const_data (writer->type_str), writer->type_pos); else - _dbus_warn_check_failed ("Writing an element of type %s, but no value is expected here\n", + _dbus_warn_check_failed ("Writing an element of type %s, but no value is expected here\n" "The overall signature expected here was '%s' and we are on byte %d of that signature.\n", _dbus_type_to_string (sub->container_type), _dbus_string_get_const_data (writer->type_str), writer->type_pos); -- cgit From 69ed32cbccbec9d613447cb64e9d7b1ffa11ce3c Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 10 Dec 2008 14:17:02 -0500 Subject: Add syslog of security denials and configuration file reloads We need to start logging denials so that they become more easily trackable and debuggable. --- dbus/dbus-sysdeps-unix.c | 1 - dbus/dbus-sysdeps-util-unix.c | 32 ++++++++++++++++++++++++++++++++ dbus/dbus-sysdeps.h | 4 ++++ 3 files changed, 36 insertions(+), 1 deletion(-) (limited to 'dbus') diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 24a3774f..ccb84832 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -2780,7 +2780,6 @@ _dbus_full_duplex_pipe (int *fd1, #endif } - /** * Measure the length of the given format string and arguments, * not including the terminating nul. diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c index 0343a90c..3f2a2330 100644 --- a/dbus/dbus-sysdeps-util-unix.c +++ b/dbus/dbus-sysdeps-util-unix.c @@ -451,6 +451,38 @@ _dbus_change_to_daemon_user (const char *user, return FALSE; } +void +_dbus_init_system_log (void) +{ + openlog ("dbus", LOG_PID, LOG_DAEMON); +} + +/** + * Log an informative message. Intended for use primarily by + * the system bus. + * + * @param msg a printf-style format string + * @param args arguments for the format string + */ +void +_dbus_log_info (const char *msg, va_list args) +{ + vsyslog (LOG_DAEMON|LOG_NOTICE, msg, args); +} + +/** + * Log a security-related message. Intended for use primarily by + * the system bus. + * + * @param msg a printf-style format string + * @param args arguments for the format string + */ +void +_dbus_log_security (const char *msg, va_list args) +{ + vsyslog (LOG_AUTH|LOG_NOTICE, msg, args); +} + /** Installs a UNIX signal handler * * @param sig the signal to handle diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h index 80236f05..5f4b00e1 100644 --- a/dbus/dbus-sysdeps.h +++ b/dbus/dbus-sysdeps.h @@ -420,6 +420,10 @@ void _dbus_set_signal_handler (int sig, dbus_bool_t _dbus_user_at_console (const char *username, DBusError *error); +void _dbus_init_system_log (void); +void _dbus_log_info (const char *msg, va_list args); +void _dbus_log_security (const char *msg, va_list args); + /* Define DBUS_VA_COPY() to do the right thing for copying va_list variables. * config.h may have already defined DBUS_VA_COPY as va_copy or __va_copy. */ -- cgit From 9a1657e8e1c0106bb5f1411fe9ea3c4ef6ec826f Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 17 Dec 2008 16:01:28 -0500 Subject: Add uid, pid, and command to security logs Extend the current security logs with even more relevant information than just the message content. This requires some utility code to look up and cache (as a string) the data such as the uid/pid/command when a connection is authenticated. --- dbus/dbus-sysdeps-util-unix.c | 96 +++++++++++++++++++++++++++++++++++++++++++ dbus/dbus-sysdeps.h | 5 +++ 2 files changed, 101 insertions(+) (limited to 'dbus') diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c index 3f2a2330..6ca662b2 100644 --- a/dbus/dbus-sysdeps-util-unix.c +++ b/dbus/dbus-sysdeps-util-unix.c @@ -1132,3 +1132,99 @@ _dbus_string_get_dirname (const DBusString *filename, } /** @} */ /* DBusString stuff */ +static void +string_squash_nonprintable (DBusString *str) +{ + char *buf; + int i, len; + + buf = _dbus_string_get_data (str); + len = _dbus_string_get_length (str); + + for (i = 0; i < len; i++) + if (buf[i] == '\0') + buf[i] = ' '; + else if (buf[i] < 0x20 || buf[i] > 127) + buf[i] = '?'; +} + +/** + * Get a printable string describing the command used to execute + * the process with pid. This string should only be used for + * informative purposes such as logging; it may not be trusted. + * + * The command is guaranteed to be printable ASCII and no longer + * than max_len. + * + * @param pid Process id + * @param str Append command to this string + * @param max_len Maximum length of returned command + * @param error return location for errors + * @returns #FALSE on error + */ +dbus_bool_t +_dbus_command_for_pid (unsigned long pid, + DBusString *str, + int max_len, + DBusError *error) +{ + /* This is all Linux-specific for now */ + DBusString path; + DBusString cmdline; + int fd; + + if (!_dbus_string_init (&path)) + { + _DBUS_SET_OOM (error); + return FALSE; + } + + if (!_dbus_string_init (&cmdline)) + { + _DBUS_SET_OOM (error); + _dbus_string_free (&path); + return FALSE; + } + + if (!_dbus_string_append_printf (&path, "/proc/%ld/cmdline", pid)) + goto oom; + + fd = open (_dbus_string_get_const_data (&path), O_RDONLY); + if (fd < 0) + { + dbus_set_error (error, + _dbus_error_from_errno (errno), + "Failed to open \"%s\": %s", + _dbus_string_get_const_data (&path), + _dbus_strerror (errno)); + goto fail; + } + + if (!_dbus_read (fd, &cmdline, max_len)) + { + dbus_set_error (error, + _dbus_error_from_errno (errno), + "Failed to read from \"%s\": %s", + _dbus_string_get_const_data (&path), + _dbus_strerror (errno)); + goto fail; + } + + if (!_dbus_close (fd, error)) + goto fail; + + string_squash_nonprintable (&cmdline); + + if (!_dbus_string_copy (&cmdline, 0, str, _dbus_string_get_length (str))) + goto oom; + + _dbus_string_free (&cmdline); + _dbus_string_free (&path); + return TRUE; +oom: + _DBUS_SET_OOM (error); +fail: + _dbus_string_free (&cmdline); + _dbus_string_free (&path); + return FALSE; +} \ No newline at end of file diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h index 5f4b00e1..2662b270 100644 --- a/dbus/dbus-sysdeps.h +++ b/dbus/dbus-sysdeps.h @@ -411,6 +411,11 @@ dbus_bool_t _dbus_write_pid_to_file_and_pipe (const DBusString *pidfile, dbus_pid_t pid_to_write, DBusError *error); +dbus_bool_t _dbus_command_for_pid (unsigned long pid, + DBusString *str, + int max_len, + DBusError *error); + /** A UNIX signal handler */ typedef void (* DBusSignalHandler) (int sig); -- cgit From 4e4f0de8cc8c3127641013fd833349dab34b676b Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 19 Dec 2008 18:54:59 -0500 Subject: Various compiler warning fixes --- dbus/dbus-marshal-basic.c | 2 +- dbus/dbus-spawn.c | 4 ++-- dbus/dbus-sysdeps-util-unix.c | 1 + dbus/dbus-sysdeps.c | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) (limited to 'dbus') diff --git a/dbus/dbus-marshal-basic.c b/dbus/dbus-marshal-basic.c index 0a33ff15..724d94b8 100644 --- a/dbus/dbus-marshal-basic.c +++ b/dbus/dbus-marshal-basic.c @@ -1333,7 +1333,7 @@ _dbus_verbose_bytes (const unsigned char *data, if (aligned != data) { - _dbus_verbose ("%4d\t%p: ", - (data - aligned), aligned); + _dbus_verbose ("%4ld\t%p: ", - (long)(data - aligned), aligned); while (aligned != data) { _dbus_verbose (" "); diff --git a/dbus/dbus-spawn.c b/dbus/dbus-spawn.c index 35ccba6c..f4e3b587 100644 --- a/dbus/dbus-spawn.c +++ b/dbus/dbus-spawn.c @@ -36,6 +36,8 @@ #include #endif +extern char **environ; + /** * @addtogroup DBusInternalsUtils * @{ @@ -914,8 +916,6 @@ do_exec (int child_err_report_fd, if (envp == NULL) { - extern char **environ; - _dbus_assert (environ != NULL); envp = environ; diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c index 6ca662b2..be7bc968 100644 --- a/dbus/dbus-sysdeps-util-unix.c +++ b/dbus/dbus-sysdeps-util-unix.c @@ -43,6 +43,7 @@ #include #include #include +#include #ifdef HAVE_LIBAUDIT #include #include diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c index d740f875..00a1a3de 100644 --- a/dbus/dbus-sysdeps.c +++ b/dbus/dbus-sysdeps.c @@ -51,6 +51,8 @@ _DBUS_DEFINE_GLOBAL_LOCK (win_fds); _DBUS_DEFINE_GLOBAL_LOCK (sid_atom_cache); _DBUS_DEFINE_GLOBAL_LOCK (system_users); +extern char **environ; + /** * @defgroup DBusSysdeps Internal system-dependent API * @ingroup DBusInternals @@ -191,7 +193,6 @@ _dbus_clearenv (void) if (clearenv () != 0) rc = FALSE; #else - extern char **environ; if (environ != NULL) environ[0] = NULL; @@ -210,7 +211,6 @@ char ** _dbus_get_environment (void) { int i, length; - extern char **environ; char **environment; _dbus_assert (environ != NULL); -- cgit From 6663d1dd35f94717209cd6fca86045bca853ef79 Mon Sep 17 00:00:00 2001 From: Matt McCutchen Date: Mon, 10 Nov 2008 08:55:27 -0500 Subject: Bug 18446: Keep umask for session bus Signed-off-by: Colin Walters --- dbus/dbus-sysdeps-util-unix.c | 13 +++++++++---- dbus/dbus-sysdeps-util-win.c | 4 +++- dbus/dbus-sysdeps.h | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) (limited to 'dbus') diff --git a/dbus/dbus-sysdeps-util-unix.c b/dbus/dbus-sysdeps-util-unix.c index be7bc968..03928044 100644 --- a/dbus/dbus-sysdeps-util-unix.c +++ b/dbus/dbus-sysdeps-util-unix.c @@ -70,12 +70,14 @@ * @param pidfile #NULL, or pidfile to create * @param print_pid_pipe pipe to print daemon's pid to, or -1 for none * @param error return location for errors + * @param keep_umask #TRUE to keep the original umask * @returns #FALSE on failure */ dbus_bool_t _dbus_become_daemon (const DBusString *pidfile, DBusPipe *print_pid_pipe, - DBusError *error) + DBusError *error, + dbus_bool_t keep_umask) { const char *s; pid_t child_pid; @@ -122,9 +124,12 @@ _dbus_become_daemon (const DBusString *pidfile, _dbus_verbose ("keeping stderr open due to DBUS_DEBUG_OUTPUT\n"); } - /* Get a predictable umask */ - _dbus_verbose ("setting umask\n"); - umask (022); + if (!keep_umask) + { + /* Get a predictable umask */ + _dbus_verbose ("setting umask\n"); + umask (022); + } _dbus_verbose ("calling setsid()\n"); if (setsid () == -1) diff --git a/dbus/dbus-sysdeps-util-win.c b/dbus/dbus-sysdeps-util-win.c index 8608ad0e..6358531b 100644 --- a/dbus/dbus-sysdeps-util-win.c +++ b/dbus/dbus-sysdeps-util-win.c @@ -70,12 +70,14 @@ errno_t strcpy_s(char *dest, size_t size, char *src) * @param pidfile #NULL, or pidfile to create * @param print_pid_fd file descriptor to print daemon's pid to, or -1 for none * @param error return location for errors + * @param keep_umask #TRUE to keep the original umask * @returns #FALSE on failure */ dbus_bool_t _dbus_become_daemon (const DBusString *pidfile, DBusPipe *print_pid_pipe, - DBusError *error) + DBusError *error, + dbus_bool_t keep_umask) { return TRUE; } diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h index 2662b270..b766f3f9 100644 --- a/dbus/dbus-sysdeps.h +++ b/dbus/dbus-sysdeps.h @@ -400,7 +400,8 @@ void _dbus_print_backtrace (void); dbus_bool_t _dbus_become_daemon (const DBusString *pidfile, DBusPipe *print_pid_pipe, - DBusError *error); + DBusError *error, + dbus_bool_t keep_umask); dbus_bool_t _dbus_verify_daemon_user (const char *user); dbus_bool_t _dbus_change_to_daemon_user (const char *user, -- cgit From d437d9202efd8190ec6405d04627b34cb47bcc86 Mon Sep 17 00:00:00 2001 From: Jon Gosting Date: Mon, 10 Nov 2008 23:29:05 -0500 Subject: Bug 18064 - more efficient validation for fixed-size type arrays * dbus/dbus-marshal-validate.c: If an array is fixed size, skip validation Signed-off-by: Colin Walters --- dbus/dbus-marshal-validate.c | 71 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 11 deletions(-) (limited to 'dbus') diff --git a/dbus/dbus-marshal-validate.c b/dbus/dbus-marshal-validate.c index b24b5bc2..35998cbb 100644 --- a/dbus/dbus-marshal-validate.c +++ b/dbus/dbus-marshal-validate.c @@ -370,12 +370,30 @@ validate_body_helper (DBusTypeReader *reader, /* p may now be == end */ _dbus_assert (p <= end); - + if (current_type == DBUS_TYPE_ARRAY) { int array_elem_type = _dbus_type_reader_get_element_type (reader); + + if (!_dbus_type_is_valid (array_elem_type)) + { + return DBUS_INVALID_UNKNOWN_TYPECODE; + } + alignment = _dbus_type_get_alignment (array_elem_type); - p = _DBUS_ALIGN_ADDRESS (p, alignment); + + a = _DBUS_ALIGN_ADDRESS (p, alignment); + + /* a may now be == end */ + if (a > end) + return DBUS_INVALID_NOT_ENOUGH_DATA; + + while (p != a) + { + if (*p != '\0') + return DBUS_INVALID_ALIGNMENT_PADDING_NOT_NUL; + ++p; + } } if (claimed_len > (unsigned long) (end - p)) @@ -406,6 +424,7 @@ validate_body_helper (DBusTypeReader *reader, DBusTypeReader sub; DBusValidity validity; const unsigned char *array_end; + int array_elem_type; if (claimed_len > DBUS_MAXIMUM_ARRAY_LENGTH) return DBUS_INVALID_ARRAY_LENGTH_EXCEEDS_MAXIMUM; @@ -418,16 +437,46 @@ validate_body_helper (DBusTypeReader *reader, array_end = p + claimed_len; - while (p < array_end) + array_elem_type = _dbus_type_reader_get_element_type (reader); + + /* avoid recursive call to validate_body_helper if this is an array + * of fixed-size elements + */ + if (dbus_type_is_fixed (array_elem_type)) + { + /* bools need to be handled differently, because they can + * have an invalid value + */ + if (array_elem_type == DBUS_TYPE_BOOLEAN) + { + dbus_uint32_t v; + alignment = _dbus_type_get_alignment (array_elem_type); + + while (p < array_end) + { + v = _dbus_unpack_uint32 (byte_order, p); + + if (!(v == 0 || v == 1)) + return DBUS_INVALID_BOOLEAN_NOT_ZERO_OR_ONE; + + p += alignment; + } + } + + else + { + p = array_end; + } + } + + else { - /* FIXME we are calling a function per array element! very bad - * need if (dbus_type_is_fixed(elem_type)) here to just skip - * big blocks of ints/bytes/etc. - */ - - validity = validate_body_helper (&sub, byte_order, FALSE, p, end, &p); - if (validity != DBUS_VALID) - return validity; + while (p < array_end) + { + validity = validate_body_helper (&sub, byte_order, FALSE, p, end, &p); + if (validity != DBUS_VALID) + return validity; + } } if (p != array_end) -- cgit From 5a3907f28f963e05682bb29019774bf5843ab1ee Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Mon, 14 Apr 2008 15:46:33 +0300 Subject: Fix typo in docs. --- dbus/dbus-message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dbus') diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index cd447985..e2c4771e 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -1726,7 +1726,7 @@ _dbus_message_iter_init_common (DBusMessage *message, * * The easiest way to iterate is like this: * @code - * dbus_message_iter_init (&iter); + * dbus_message_iter_init (message, &iter); * while ((current_type = dbus_message_iter_get_arg_type (&iter)) != DBUS_TYPE_INVALID) * dbus_message_iter_next (&iter); * @endcode -- cgit