2005-02-10 Havoc Pennington <hp@redhat.com>
authorHavoc Pennington <hp@redhat.com>
Fri, 11 Feb 2005 01:13:45 +0000 (01:13 +0000)
committerHavoc Pennington <hp@redhat.com>
Fri, 11 Feb 2005 01:13:45 +0000 (01:13 +0000)
* dbus/dbus-message-factory.c (generate_special): modify test to
avoid using a non-basic dict key

* dbus/dbus-marshal-validate-util.c: add test for the below

* doc/dbus-specification.xml: require that dict keys are a basic
type

* dbus/dbus-marshal-validate.c
(_dbus_validate_signature_with_reason): require that dict key is a
basic type

ChangeLog
dbus/dbus-marshal-validate-util.c
dbus/dbus-marshal-validate.c
dbus/dbus-marshal-validate.h
dbus/dbus-message-factory.c
dbus/dbus-test.c
doc/TODO
doc/dbus-specification.xml
test/glib/test-profile.c

index eff98ed..a60a7ff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2005-02-10  Havoc Pennington  <hp@redhat.com>
 
+       * dbus/dbus-message-factory.c (generate_special): modify test to
+       avoid using a non-basic dict key
+
+       * dbus/dbus-marshal-validate-util.c: add test for the below
+
+       * doc/dbus-specification.xml: require that dict keys are a basic
+       type
+
+       * dbus/dbus-marshal-validate.c
+       (_dbus_validate_signature_with_reason): require that dict key is a
+       basic type
+
+2005-02-10  Havoc Pennington  <hp@redhat.com>
+
        * dbus/dbus-object-tree.c (handle_default_introspect_and_unlock):
        change to be _and_unlock instead of _unlocked
 
index afaf526..57caa7f 100644 (file)
@@ -92,7 +92,8 @@ static const ValidityTest signature_tests[] = {
   { "()i", DBUS_INVALID_STRUCT_HAS_NO_FIELDS },
   { "(a)", DBUS_INVALID_MISSING_ARRAY_ELEMENT_TYPE },
   { "a{ia}", DBUS_INVALID_MISSING_ARRAY_ELEMENT_TYPE },
-  { "a{}", DBUS_INVALID_DICT_ENTRY_HAS_NO_FIELDS }
+  { "a{}", DBUS_INVALID_DICT_ENTRY_HAS_NO_FIELDS },
+  { "a{aii}", DBUS_INVALID_DICT_KEY_MUST_BE_BASIC_TYPE },
   /* { "a{i}", DBUS_INVALID_DICT_ENTRY_HAS_ONLY_ONE_FIELD }, */
   /* { "{is}", DBUS_INVALID_DICT_ENTRY_NOT_INSIDE_ARRAY }, */
   /* { "a{isi}", DBUS_INVALID_DICT_ENTRY_HAS_TOO_MANY_FIELDS }, */
index 1639fb8..8315bcc 100644 (file)
@@ -155,6 +155,10 @@ _dbus_validate_signature_with_reason (const DBusString *type_str,
             array_depth = 0;
         }
 
+      if (last == DBUS_DICT_ENTRY_BEGIN_CHAR &&
+          !_dbus_type_is_basic (*p))
+        return DBUS_INVALID_DICT_KEY_MUST_BE_BASIC_TYPE;
+      
       last = *p;
       ++p;
     }
index 74f4bbf..29a528b 100644 (file)
@@ -109,6 +109,7 @@ typedef enum
   DBUS_INVALID_DICT_ENTRY_HAS_ONLY_ONE_FIELD = 52,
   DBUS_INVALID_DICT_ENTRY_HAS_TOO_MANY_FIELDS = 53,
   DBUS_INVALID_DICT_ENTRY_NOT_INSIDE_ARRAY = 54,
+  DBUS_INVALID_DICT_KEY_MUST_BE_BASIC_TYPE = 55,
   DBUS_VALIDITY_LAST
 } DBusValidity;
 
index 37c3d38..39df92f 100644 (file)
@@ -623,7 +623,7 @@ generate_special (DBusMessageDataIter   *iter,
     }
   else if (item_seq == 16)
     {
-      char long_sig[DBUS_MAXIMUM_TYPE_RECURSION_DEPTH*3+6];
+      char long_sig[DBUS_MAXIMUM_TYPE_RECURSION_DEPTH*4+8];
       const char *v_STRING;
       int i;
       int n_begins;
@@ -637,19 +637,19 @@ generate_special (DBusMessageDataIter   *iter,
         _dbus_assert_not_reached ("oom");
 
       i = 0;
-      while (i <= (DBUS_MAXIMUM_TYPE_RECURSION_DEPTH*2 + 2))
+      while (i <= (DBUS_MAXIMUM_TYPE_RECURSION_DEPTH*3 + 3))
         {
           long_sig[i] = DBUS_TYPE_ARRAY;
           ++i;
           long_sig[i] = DBUS_DICT_ENTRY_BEGIN_CHAR;
           ++i;
+          long_sig[i] = DBUS_TYPE_INT32;
+          ++i;
         }
-      n_begins = i / 2;
+      n_begins = i / 3;
 
       long_sig[i] = DBUS_TYPE_INT32;
       ++i;
-      long_sig[i] = DBUS_TYPE_INT32;
-      ++i;
       
       while (n_begins > 0)
         {
index 4fdd8ce..e388310 100644 (file)
@@ -118,7 +118,7 @@ dbus_internal_do_not_use_run_tests (const char *test_data_dir)
 
   check_memleaks ();
 
-#if 1
+#if 0
   printf ("%s: running recursive marshalling tests\n", "dbus-test");
   if (!_dbus_marshal_recursive_test ())
     die ("recursive marshal");
index b64409a..642d97d 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -27,15 +27,10 @@ Important for 1.0
    yourself; is it an error, or allowed? If allowed, 
    we need to have a test for it in the test suite.
 
- - add string array support back to append_args()
-
  - validate dict entry number of fields
 
  - just before 1.0, try a HAVE_INT64=0 build and be sure it runs
 
- - the spec and implementation should probably require dict keys
-   to be basic types
-
  - in dbus-keyring.c, enforce that the keyring dir is not 
    world readable/writable
 
index ad78f0a..75ffeea 100644 (file)
       <para>
         A <literal>DICT_ENTRY</literal> works exactly like a struct, but rather
         than parentheses it uses curly braces, and it has more restrictions.
-        The restrictions are: it occurs only as an array element type; and it
-        has exactly two single complete types inside the curly
-        braces. Implementations must not accept dict entries outside of arrays,
-        and must not accept dict entries with zero, one, or more than two
-        fields. A dict entry is always a key-value pair.
+        The restrictions are: it occurs only as an array element type; it has
+        exactly two single complete types inside the curly braces; the first
+        single complete type (the "key") must be a basic type rather than a
+        container type. Implementations must not accept dict entries outside of
+        arrays, must not accept dict entries with zero, one, or more than two
+        fields, and must not accept dict entries with non-basic-typed keys. A
+        dict entry is always a key-value pair.
       </para>
       
       <para>
index 6976a11..25d4eeb 100644 (file)
@@ -48,7 +48,7 @@
  */
 #define N_CLIENT_THREADS 1
 /* It seems like at least 750000 or so iterations reduces the variability to sane levels */
-#define N_ITERATIONS 750000
+#define N_ITERATIONS 750
 #define N_PROGRESS_UPDATES 20
 /* Don't make PAYLOAD_SIZE too huge because it gets used as a static buffer size */
 #define PAYLOAD_SIZE 0