]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
2005-01-20 Havoc Pennington <hp@redhat.com>
authorHavoc Pennington <hp@redhat.com>
Fri, 21 Jan 2005 03:44:10 +0000 (03:44 +0000)
committerHavoc Pennington <hp@redhat.com>
Fri, 21 Jan 2005 03:44:10 +0000 (03:44 +0000)
* doc/dbus-tutorial.xml: replace > with &gt;

* bus/services.c (bus_registry_acquire_service): validate the name
and return a better error if it's no good.

* doc/dbus-specification.xml: note NO_AUTO_START change

* dbus/dbus-protocol.h (DBUS_HEADER_FLAG_NO_AUTO_START): change
from AUTO_START, we're toggling the default

* bus/dispatch.c: adapt the tests to change of auto-start default

ChangeLog
bus/dispatch.c
bus/services.c
dbus/dbus-message.c
dbus/dbus-protocol.h
doc/dbus-specification.xml
doc/dbus-tutorial.xml

index 1a9bcfcf4bb5b9e757399682d93a5253255ad42a..2d0dd6aedc7f049682a5df617e542ce7ffa8d022 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2005-01-20  Havoc Pennington  <hp@redhat.com>
+
+       * doc/dbus-tutorial.xml: replace > with &gt;
+
+       * bus/services.c (bus_registry_acquire_service): validate the name
+       and return a better error if it's no good.
+
+       * doc/dbus-specification.xml: note NO_AUTO_START change
+
+       * dbus/dbus-protocol.h (DBUS_HEADER_FLAG_NO_AUTO_START): change
+       from AUTO_START, we're toggling the default
+
+       * bus/dispatch.c: adapt the tests to change of auto-start default
+
 2005-01-18  Havoc Pennington  <hp@redhat.com>
 
        * rename dbus-daemon-1 to dbus-daemon throughout
index 120c90378c7e7fdbdf88e2f2209b50304fbff6f9..96115b1cb66b83328f7769d0213cd2c57c8b253f 100644 (file)
@@ -983,7 +983,7 @@ check_double_hello_message (BusContext     *context,
 
   if (message == NULL)
     return TRUE;
-
+  
   if (!dbus_connection_send (connection, message, &serial))
     {
       dbus_message_unref (message);
@@ -1524,8 +1524,8 @@ check_hello_connection (BusContext *context)
  * but the correct thing may include OOM errors.
  */
 static dbus_bool_t
-check_nonexistent_service_activation (BusContext     *context,
-                                      DBusConnection *connection)
+check_nonexistent_service_no_auto_start (BusContext     *context,
+                                         DBusConnection *connection)
 {
   DBusMessage *message;
   dbus_uint32_t serial;
@@ -1541,6 +1541,8 @@ check_nonexistent_service_activation (BusContext     *context,
   if (message == NULL)
     return TRUE;
 
+  dbus_message_set_auto_start (message, FALSE);
+  
   flags = 0;
   if (!dbus_message_append_args (message,
                                  DBUS_TYPE_STRING, &nonexistent,
@@ -1628,8 +1630,8 @@ check_nonexistent_service_activation (BusContext     *context,
  * but the correct thing may include OOM errors.
  */
 static dbus_bool_t
-check_nonexistent_service_auto_activation (BusContext     *context,
-                                          DBusConnection *connection)
+check_nonexistent_service_auto_start (BusContext     *context,
+                                      DBusConnection *connection)
 {
   DBusMessage *message;
   dbus_uint32_t serial;
@@ -1642,8 +1644,6 @@ check_nonexistent_service_auto_activation (BusContext     *context,
   
   if (message == NULL)
     return TRUE;
-
-  dbus_message_set_auto_start (message, TRUE);
  
   if (!dbus_connection_send (connection, message, &serial))
     {
@@ -2387,8 +2387,8 @@ check_got_service_info (DBusMessage *message)
  * but the correct thing may include OOM errors.
  */
 static dbus_bool_t
-check_existent_service_activation (BusContext     *context,
-                                   DBusConnection *connection)
+check_existent_service_no_auto_start (BusContext     *context,
+                                      DBusConnection *connection)
 {
   DBusMessage *message;
   DBusMessage *base_service_message;
@@ -2408,6 +2408,8 @@ check_existent_service_activation (BusContext     *context,
   if (message == NULL)
     return TRUE;
 
+  dbus_message_set_auto_start (message, FALSE);
+  
   flags = 0;
   if (!dbus_message_append_args (message,
                                  DBUS_TYPE_STRING, &existent,
@@ -2611,8 +2613,8 @@ check_existent_service_activation (BusContext     *context,
  * but the correct thing may include OOM errors.
  */
 static dbus_bool_t
-check_segfault_service_activation (BusContext     *context,
-                                   DBusConnection *connection)
+check_segfault_service_no_auto_start (BusContext     *context,
+                                      DBusConnection *connection)
 {
   DBusMessage *message;
   dbus_uint32_t serial;
@@ -2628,6 +2630,8 @@ check_segfault_service_activation (BusContext     *context,
   if (message == NULL)
     return TRUE;
 
+  dbus_message_set_auto_start (message, FALSE);
+  
   segv_service = "org.freedesktop.DBus.TestSuiteSegfaultService";
   flags = 0;
   if (!dbus_message_append_args (message,
@@ -2717,8 +2721,8 @@ check_segfault_service_activation (BusContext     *context,
  * but the correct thing may include OOM errors.
  */
 static dbus_bool_t
-check_segfault_service_auto_activation (BusContext     *context,
-                                       DBusConnection *connection)
+check_segfault_service_auto_start (BusContext     *context,
+                                   DBusConnection *connection)
 {
   DBusMessage *message;
   dbus_uint32_t serial;
@@ -2731,8 +2735,6 @@ check_segfault_service_auto_activation (BusContext     *context,
   
   if (message == NULL)
     return TRUE;
-
-  dbus_message_set_auto_start (message, TRUE);
   
   if (!dbus_connection_send (connection, message, &serial))
     {
@@ -2813,8 +2815,8 @@ check_segfault_service_auto_activation (BusContext     *context,
  * but the correct thing may include OOM errors.
  */
 static dbus_bool_t
-check_existent_service_auto_activation (BusContext     *context,
-                                       DBusConnection *connection)
+check_existent_service_auto_start (BusContext     *context,
+                                   DBusConnection *connection)
 {
   DBusMessage *message;
   DBusMessage *base_service_message;
@@ -2833,8 +2835,6 @@ check_existent_service_auto_activation (BusContext     *context,
   if (message == NULL)
     return TRUE;
 
-  dbus_message_set_auto_start (message, TRUE);
-
   text = TEST_ECHO_MESSAGE;
   if (!dbus_message_append_args (message,
                                  DBUS_TYPE_STRING, &text,
@@ -3164,32 +3164,32 @@ bus_dispatch_test (const DBusString *test_data_dir)
   check1_try_iterations (context, "create_and_hello",
                          check_hello_connection);
   
-  check2_try_iterations (context, foo, "nonexistent_service_activation",
-                         check_nonexistent_service_activation);
+  check2_try_iterations (context, foo, "nonexistent_service_no_auto_start",
+                         check_nonexistent_service_no_auto_start);
 
-  check2_try_iterations (context, foo, "segfault_service_activation",
-                         check_segfault_service_activation);
+  check2_try_iterations (context, foo, "segfault_service_no_auto_start",
+                         check_segfault_service_no_auto_start);
   
-  check2_try_iterations (context, foo, "existent_service_activation",
-                         check_existent_service_activation);
+  check2_try_iterations (context, foo, "existent_service_no_auto_start",
+                         check_existent_service_no_auto_start);
   
-  check2_try_iterations (context, foo, "nonexistent_service_auto_activation",
-                        check_nonexistent_service_auto_activation);
+  check2_try_iterations (context, foo, "nonexistent_service_auto_start",
+                        check_nonexistent_service_auto_start);
   
-  check2_try_iterations (context, foo, "segfault_service_auto_activation",
-                        check_segfault_service_auto_activation);
+  check2_try_iterations (context, foo, "segfault_service_auto_start",
+                        check_segfault_service_auto_start);
 
 #if 0
   /* Note: need to resolve some issues with the testing code in order to run
    * this in oom (handle that we sometimes don't get replies back from the bus
    * when oom happens, without blocking the test).
    */
-  check2_try_iterations (context, foo, "existent_service_auto_activation",
-                        check_existent_service_auto_activation);
+  check2_try_iterations (context, foo, "existent_service_auto_auto_start",
+                        check_existent_service_auto_start);
 #endif
   
-  if (!check_existent_service_auto_activation (context, foo))
-    _dbus_assert_not_reached ("existent service auto activation failed");
+  if (!check_existent_service_auto_start (context, foo))
+    _dbus_assert_not_reached ("existent service auto start failed");
 
   _dbus_verbose ("Disconnecting foo, bar, and baz\n");
 
index 90c8d1d8b9c83ee82149b96d7cbb155adc93a815..4392daa2bec61b7feefdc7af6ee8d74c7fb9de23 100644 (file)
@@ -24,6 +24,7 @@
 #include <dbus/dbus-hash.h>
 #include <dbus/dbus-list.h>
 #include <dbus/dbus-mempool.h>
+#include <dbus/dbus-marshal-validate.h>
 
 #include "driver.h"
 #include "services.h"
@@ -283,12 +284,14 @@ bus_registry_acquire_service (BusRegistry      *registry,
   
   retval = FALSE;
 
-  if (_dbus_string_get_length (service_name) == 0)
+  if (!_dbus_validate_bus_name (service_name, 0,
+                                _dbus_string_get_length (service_name)))
     {
-      dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
-                      "Zero-length service name is not allowed");
+      dbus_set_error (error, DBUS_ERROR_INVALID_ARGS,
+                      "Requested bus name \"%s\" is not valid",
+                      _dbus_string_get_const_data (service_name));
       
-      _dbus_verbose ("Attempt to acquire zero-length service name\n");
+      _dbus_verbose ("Attempt to acquire invalid service name\n");
       
       goto out;
     }
@@ -296,7 +299,7 @@ bus_registry_acquire_service (BusRegistry      *registry,
   if (_dbus_string_get_byte (service_name, 0) == ':')
     {
       /* Not allowed; only base services can start with ':' */
-      dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
+      dbus_set_error (error, DBUS_ERROR_INVALID_ARGS,
                       "Cannot acquire a service starting with ':' such as \"%s\"",
                       _dbus_string_get_const_data (service_name));
       
index e4c761c2847f62da48414488a3a9cc95ca523cbd..4ddfa37a3b9d1876f642379cdaf7fbfe24a0a254 100644 (file)
@@ -2207,8 +2207,8 @@ dbus_message_set_auto_start (DBusMessage *message,
   _dbus_return_if_fail (!message->locked);
 
   _dbus_header_toggle_flag (&message->header,
-                            DBUS_HEADER_FLAG_AUTO_START,
-                            auto_start);
+                            DBUS_HEADER_FLAG_NO_AUTO_START,
+                            !auto_start);
 }
 
 /**
@@ -2223,8 +2223,8 @@ dbus_message_get_auto_start (DBusMessage *message)
 {
   _dbus_return_val_if_fail (message != NULL, FALSE);
 
-  return _dbus_header_get_flag (&message->header,
-                                DBUS_HEADER_FLAG_AUTO_START);
+  return !_dbus_header_get_flag (&message->header,
+                                 DBUS_HEADER_FLAG_NO_AUTO_START);
 }
 
 
index fec94d8cb21c0e14bcc36426014ce37a693ce843..385c5ebc53d8cbb1c2a8ddb149143929603fec9c 100644 (file)
@@ -142,7 +142,7 @@ extern "C" {
 
 /* Header flags */
 #define DBUS_HEADER_FLAG_NO_REPLY_EXPECTED 0x1
-#define DBUS_HEADER_FLAG_AUTO_START        0x2
+#define DBUS_HEADER_FLAG_NO_AUTO_START     0x2
 
 /* Header fields */
 #define DBUS_HEADER_FIELD_INVALID        0
index 821c6011cd841676d704baec13cbfec863b6f9b8..c0be80fbd8c8dbe0eba426920adf24a5f8ae42f2 100644 (file)
                 to return the reply despite this flag.</entry>
               </row>
               <row>
-                <entry><literal>AUTO_START</literal></entry>
+                <entry><literal>NO_AUTO_START</literal></entry>
                 <entry>0x2</entry>
-                <entry>This message automatically launches an owner
-                  for the destination name before the message is delivered.
+                <entry>This message should not automatically launch an owner
+                  for the destination name.
                 </entry>
               </row>
             </tbody>
           flag and reply anyway.
         </para>
         <para>
-          If a message has the flag <literal>AUTO_START</literal> and the
-          destination name does not exist, then a program to own the destination
+          Unless a message has the flag <literal>NO_AUTO_START</literal>, if the
+          destination name does not exist then a program to own the destination
           name will be started before the message is delivered.  The message
           will be held until the new program is successfully started or has
           failed to start; in case of failure, an error will be returned. This
index 44f2f7cadb70d2c3768f90ccf5512981bdabd1c0..ccb12d4cde9a2ab6a18b028eb585f7a3a5cf992c 100644 (file)
         method call on a particular object instance, a number of 
         nested components have to be named:
         <programlisting>
-          Address -> [Bus Name] -> Path -> Interface -> Method
+          Address -&gt; [Bus Name] -&gt; Path -&gt; Interface -&gt; Method
         </programlisting>
         The bus name is in brackets to indicate that it's optional -- you only
         provide a name to route the method call to the right application
@@ -467,7 +467,7 @@ main (int argc, char **argv)
   if (connection == NULL)
     {
       g_printerr ("Failed to open connection to bus: %s\n",
-                  error->message);
+                  error-&gt;message);
       g_error_free (error);
       exit (1);
     }
@@ -490,7 +490,7 @@ main (int argc, char **argv)
                               DBUS_TYPE_INVALID))
     {
       g_printerr ("Failed to complete ListNames call: %s\n",
-                  error->message);
+                  error-&gt;message);
       g_error_free (error);
       exit (1);
     }