Merge branch 'master' of ssh://git.freedesktop.org/git/dbus/dbus
authorRalf Habacker <ralf.habacker@freenet.de>
Tue, 13 Apr 2010 13:40:06 +0000 (15:40 +0200)
committerRalf Habacker <ralf.habacker@freenet.de>
Tue, 13 Apr 2010 13:40:06 +0000 (15:40 +0200)
194 files changed:
HACKING
INSTALL
README
bus/Makefile.am
bus/activation.c
bus/activation.h
bus/bus.c
bus/bus.h
bus/config-loader-expat.c
bus/config-loader-libxml.c
bus/config-parser-common.c
bus/config-parser-common.h
bus/config-parser-trivial.c
bus/config-parser-trivial.h
bus/config-parser.c
bus/config-parser.h
bus/connection.c
bus/desktop-file.c
bus/dir-watch-default.c
bus/dir-watch-inotify.c
bus/dir-watch-kqueue.c
bus/dir-watch.h
bus/dispatch.c
bus/driver.c
bus/expirelist.c
bus/main.c
bus/messagebus.in
bus/policy.c
bus/selinux.c
bus/services.c
bus/signals.c
bus/signals.h
bus/test-launch-helper.c
bus/test-main.c
bus/test-system.c
bus/test.h
cmake/CMakeLists.txt
cmake/ConfigureChecks.cmake
cmake/Doxyfile.cmake
cmake/bus/CMakeLists.txt
cmake/bus/dbus-daemon.xml [new file with mode: 0644]
cmake/config.h.cmake
cmake/dbus/CMakeLists.txt
cmake/dbus/dbus-internal.def.cmake [new file with mode: 0644]
cmake/doc/CMakeLists.txt
cmake/doc/index.html.cmake [new file with mode: 0644]
cmake/modules/FindGNUWIN32.cmake [deleted file]
cmake/modules/FindKDEWIN.cmake [deleted file]
cmake/modules/FindKDEWIN_Packager.cmake [deleted file]
cmake/modules/FindQt4.cmake [deleted file]
cmake/test/CMakeLists.txt
cmake/test/name-test/CMakeLists.txt
cmake/tools/CMakeLists.txt
cmake/tools/dbus-launch.xml [new file with mode: 0644]
cmake/tools/dbus-monitor.xml [new file with mode: 0644]
cmake/tools/dbus-send.xml [new file with mode: 0644]
configure.in
dbus-win.patch [deleted file]
dbus/Makefile.am
dbus/dbus-1-symbols.def.in [moved from dbus/dbus-1.def with 58% similarity]
dbus/dbus-1-testsymbols.def.in [new file with mode: 0644]
dbus/dbus-1-verbosesymbols.def.in [new file with mode: 0644]
dbus/dbus-1.def.pre [new file with mode: 0644]
dbus/dbus-address.h
dbus/dbus-auth-script.h
dbus/dbus-auth-util.c
dbus/dbus-auth.c
dbus/dbus-bus.h
dbus/dbus-connection.c
dbus/dbus-connection.h
dbus/dbus-convenience.def.pre [new file with mode: 0644]
dbus/dbus-credentials-util.c
dbus/dbus-credentials.c
dbus/dbus-credentials.h
dbus/dbus-dataslot.c
dbus/dbus-errors.c
dbus/dbus-errors.h
dbus/dbus-file-unix.c [new file with mode: 0644]
dbus/dbus-file-win.c [new file with mode: 0644]
dbus/dbus-file.c [new file with mode: 0644]
dbus/dbus-file.h [new file with mode: 0644]
dbus/dbus-hash.c
dbus/dbus-internal-symbols.def.in [new file with mode: 0644]
dbus/dbus-internal-testsymbols.def.in [new file with mode: 0644]
dbus/dbus-internals.c
dbus/dbus-internals.h
dbus/dbus-keyring.c
dbus/dbus-list.c
dbus/dbus-macros.h
dbus/dbus-mainloop.c
dbus/dbus-marshal-basic.c
dbus/dbus-marshal-basic.h
dbus/dbus-marshal-byteswap.c
dbus/dbus-marshal-byteswap.h
dbus/dbus-marshal-header.c
dbus/dbus-marshal-header.h
dbus/dbus-marshal-recursive-util.c
dbus/dbus-marshal-recursive.c
dbus/dbus-marshal-recursive.h
dbus/dbus-marshal-validate.c
dbus/dbus-marshal-validate.h
dbus/dbus-md5.c
dbus/dbus-memory.c
dbus/dbus-memory.h
dbus/dbus-mempool.c
dbus/dbus-message-private.h
dbus/dbus-message-util.c
dbus/dbus-message.c
dbus/dbus-message.h
dbus/dbus-misc.h
dbus/dbus-nonce.c
dbus/dbus-object-tree.c
dbus/dbus-pending-call.c
dbus/dbus-pending-call.h
dbus/dbus-pipe-unix.c
dbus/dbus-pipe-win.c
dbus/dbus-pipe.c
dbus/dbus-pipe.h
dbus/dbus-protocol.h
dbus/dbus-resources.c
dbus/dbus-server-debug-pipe.c
dbus/dbus-server-protected.h
dbus/dbus-server-socket.c
dbus/dbus-server-unix.c
dbus/dbus-server-win.c
dbus/dbus-server.c
dbus/dbus-server.h
dbus/dbus-sha.c
dbus/dbus-shell.c
dbus/dbus-signature.c
dbus/dbus-signature.h
dbus/dbus-spawn-win.c
dbus/dbus-spawn.c
dbus/dbus-string-private.h
dbus/dbus-string-util.c
dbus/dbus-string.c
dbus/dbus-string.h
dbus/dbus-sysdeps-pthread.c
dbus/dbus-sysdeps-thread-win.c
dbus/dbus-sysdeps-unix.c
dbus/dbus-sysdeps-unix.h
dbus/dbus-sysdeps-util-unix.c
dbus/dbus-sysdeps-util-win.c
dbus/dbus-sysdeps-util.c
dbus/dbus-sysdeps-win.c
dbus/dbus-sysdeps-win.h
dbus/dbus-sysdeps.c
dbus/dbus-sysdeps.h
dbus/dbus-test-main.c
dbus/dbus-threads.c
dbus/dbus-threads.h
dbus/dbus-timeout.c
dbus/dbus-transport-protected.h
dbus/dbus-transport-socket.c
dbus/dbus-transport-unix.c
dbus/dbus-transport-win.c
dbus/dbus-transport.c
dbus/dbus-userdb-util.c
dbus/dbus-userdb.c
dbus/dbus-uuidgen.c
dbus/dbus-watch.c
doc/Makefile.am
doc/dbus-specification.xml
test/Makefile.am
test/break-loader.c
test/data/valid-config-files-system/debug-allow-all-fail.conf.cmake [new file with mode: 0644]
test/data/valid-config-files-system/debug-allow-all-pass.conf.cmake [new file with mode: 0644]
test/decode-gcov.c
test/name-test/Makefile.am
test/name-test/run-test.sh
test/name-test/test-ids.c
test/name-test/test-names.c [deleted file]
test/name-test/test-pending-call-dispatch.c
test/name-test/test-pending-call-timeout.c
test/name-test/test-privserver-client.c
test/name-test/test-privserver.c
test/name-test/test-shutdown.c
test/name-test/test-threads-init.c
test/shell-test.c
test/spawn-test.c
test/test-exit.c
test/test-names.c
test/test-segfault.c
test/test-service.c
test/test-shell-service.c
test/test-utils.c
test/test-utils.h
tools/Makefile.am
tools/dbus-launch-win.c
tools/dbus-launch-x11.c
tools/dbus-launch.c
tools/dbus-launch.h
tools/dbus-monitor.c
tools/dbus-print-message.c

diff --git a/HACKING b/HACKING
index 5dfb1d7..873e025 100644 (file)
--- a/HACKING
+++ b/HACKING
@@ -321,8 +321,22 @@ rules are:
    No reviewer should approve a patch without these attributes, and
    failure on these points is grounds for reverting the patch.
 
-The reviewer group that can approve patches: Havoc Pennington, Michael
-Meeks, Alex Larsson, Zack Rusin, Joe Shaw, Mikael Hallendal, Richard
-Hult, Owen Fraser-Green, Olivier Andrieu, Colin Walters, Thiago
-Macieira, John Palmieri, Scott James Remnant.
+The reviewer group that can approve patches:
+
+Havoc Pennington <hp@pobox.net>
+Michael Meeks <michael.meeks@novell.com>
+Alexander Larsson  <alexl@redhat.com>
+Zack Rusin <zack@kde.org>
+Joe Shaw <joe@assbarn.com>
+Mikael Hallendal <micke@imendio.com>
+Richard Hult <richard@imendio.com>
+Owen Fraser-Green <owen@discobabe.net>
+Olivier Andrieu <oliv__a@users.sourceforge.net>
+Colin Walters <walters@verbum.org>
+Thiago Macieira <thiago@kde.org>
+John Palmieri <johnp@redhat.com>
+Scott James Remnant <scott@netsplit.com>
+Will Thompson <will.thompson@collabora.co.uk>
+Simon McVittie <simon.mcvittie@collabora.co.uk>
+
 
diff --git a/INSTALL b/INSTALL
index 744851d..e182f98 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -4,8 +4,10 @@
 Quick start
 ===========
 
-DBus uses GNU AutoTools for its build system, thus the basic install
-procedure can be summarized as:
+DBus could be build with GNU AutoTools or with cmake for its build system,
+thus the basic install procedure can be summarized as:
+
+with autotools:
 
     ./configure --prefix=/usr
     make
@@ -13,13 +15,29 @@ procedure can be summarized as:
 
 The configure script will automatically determine whether to try and
 build bindings for GLib, Qt, Qt3, Python and Mono based on what tools
-are installed on the host system. The default build behaviour can be 
+are installed on the host system. The default build behaviour can be
 overridden using the --enable-XXX/--disable-XXX arguments to configure.
 A typical scenario in which it is desirable to override automatic
-detection, is during packaging of binary builds, where a predictable 
-dependancy chain is required. For more details on GNU AutoTools 
+detection, is during packaging of binary builds, where a predictable
+dependancy chain is required. For more details on GNU AutoTools
 installation, consult the generic instructions later in this document
 
+with cmake:
+    mkdir dbus-build-dir
+    cd dbus-build-dir
+    cmake -G <makefile-generator-name> [-D<option>] <dbus-src-root>/cmake
+    make
+    make install
+
+cmake will automatically determine whether to build some features
+based on what tools and/or libraries are installed on the host system. 
+The default build behaviour can be overridden using the 
+-DENABLE_<XXX> arguments to cmake.
+A typical scenario in which it is desirable to override automatic
+detection, is during packaging of binary builds, where a predictable
+dependancy chain is required. For more details on cmake installation, 
+consult http://www.cmake.org/cmake/help/help.html. 
+
 External software dependancies
 ==============================
 
@@ -40,10 +58,10 @@ Core library
 
  Optional:
 
-  - libselinux  (for SELinux integration)
-  - dnotify     (for automatic service file reload)
-  - doxygen     (for API documentation)
-  - xmlto       (for Spec & other XML documentation)
+  - libselinux           (for SELinux integration)
+  - dnotify              (for automatic service file reload)
+  - doxygen              (for API documentation)
+  - xmlto or meinproc4   (for Spec & other XML documentation)
 
 ====================================================================
 
diff --git a/README b/README
index ec63a98..89bfaf7 100644 (file)
--- a/README
+++ b/README
@@ -60,24 +60,34 @@ Development snapshots make no ABI stability guarantees for new ABI
 introduced since the last stable release. Development snapshots are
 likely to have more bugs than stable releases, obviously.
 
+Configuration 
+===
+
+dbus could be build by using autotools or cmake. 
+
+When using autotools the configure step is initiated by running ./configure 
+with our without additional configuration flags. 
+
+When using cmake the configure step is initiated by running the cmake 
+program with our without additional configuration flags. 
+
 Configuration flags
 ===
 
-These are the dbus-specific configuration flags that can be given to
-the ./configure program.
-
-  --enable-tests          enable unit test code
-  --enable-verbose-mode   support verbose debug mode
-  --enable-asserts        include assertion checks
-  --enable-checks         include sanity checks on public API
-  --enable-xml-docs       build XML documentation (requires xmlto)
-  --enable-doxygen-docs   build DOXYGEN documentation (requires Doxygen)
-  --enable-gcov           compile with coverage profiling instrumentation (gcc only)
-  --enable-abstract-sockets
-                          use abstract socket namespace (linux only)
-  --enable-selinux        build with SELinux support
-  --enable-dnotify        build with dnotify support (linux only)
-  --enable-kqueue         build with kqueue support (*BSD only)
+When using autools the dbus-specific configuration flags that can be given to
+the ./configure program are these 
+
+  --enable-tests             enable unit test code
+  --enable-verbose-mode      support verbose debug mode
+  --enable-asserts           include assertion checks
+  --enable-checks            include sanity checks on public API
+  --enable-xml-docs          build XML documentation (requires xmlto)
+  --enable-doxygen-docs      build DOXYGEN documentation (requires Doxygen)
+  --enable-gcov              compile with coverage profiling instrumentation (gcc only)
+  --enable-abstract-sockets  use abstract socket namespace (linux only)
+  --enable-selinux           build with SELinux support
+  --enable-dnotify           build with dnotify support (linux only)
+  --enable-kqueue            build with kqueue support (*BSD only)
   --with-xml=libxml/expat           XML library to use
   --with-init-scripts=redhat        Style of init scripts to install
   --with-session-socket-dir=dirname Where to put sockets for the per-login-session message bus
@@ -90,7 +100,29 @@ the ./configure program.
   --with-tags[=TAGS]                include additional configurations [automatic]
   --with-x                          use the X Window System
 
-
+When using the cmake build system the dbus-specific configuration flags that can be given 
+to the cmake program are these (use -D<key>=<value> on command line)
+
+    CMAKE_BUILD_TYPE                   set dbus build mode - one of Debug|Release|RelWithDebInfo|MinSizeRel
+    DBUS_BUILD_TESTS                   enable unit test code  default=ON
+    DBUS_BUILD_X11                     Build X11-dependent code default=ON
+    HAVE_CONSOLE_OWNER_FILE            enable console owner file (solaris only) ) default=ON
+    DBUS_DISABLE_ASSERTS               Disable assertion checking default=OFF
+    DBUS_DISABLE_CHECKS                Disable public API sanity checking default=OFF
+    DBUS_ENABLE_ABSTRACT_SOCKETS       enable support for abstract sockets (linux only) default=ON
+    DBUS_ENABLE_ANSI                   enable -ansi -pedantic gcc flags default=OFF
+    DBUS_ENABLE_DNOTIFY                build with dnotify support (linux only) default=ON
+    DBUS_ENABLE_VERBOSE_MODE           support verbose debug mode default=ON
+    DBUS_ENABLE_DOXYGEN_DOCS           build DOXYGEN documentation (requires Doxygen) default=ON
+    DBUS_GCOV_ENABLED                  compile with coverage profiling instrumentation (gcc only) default=OFF
+    DBUS_INSTALL_SYSTEM_LIBS           install required system libraries default (windows only) =OFF
+    DBUS_USE_EXPAT                     Use expat (== ON) or libxml2 (==OFF) default=ON [1]
+    DBUS_USE_NONCE_TCP_DEFAULT_ADDRESS Use nonce tcp default address default=OFF
+    DBUS_USE_OUTPUT_DEBUG_STRING       enable win32 debug port for message output default=OFF
+    
+    [1] requires installed development package of the related dependency 
+
+    
 API/ABI Policy
 ===
 
index b1ee36c..31db351 100644 (file)
@@ -3,7 +3,7 @@ configdir=$(sysconfdir)/dbus-1
 
 INCLUDES=-I$(top_srcdir) $(DBUS_BUS_CFLAGS) @PIE_CFLAGS@               \
        -DDBUS_SYSTEM_CONFIG_FILE=\""$(configdir)/system.conf"\"        \
-       -DDAEMON_NAME=\"dbus-daemon\"  -DDBUS_COMPILATION
+       -DDBUS_COMPILATION
 
 EFENCE=
 
@@ -76,8 +76,9 @@ dbus_daemon_SOURCES=                          \
        $(BUS_SOURCES)                          \
        main.c                                  
 
+dbus_daemon_CPPFLAGS = -DDBUS_STATIC_BUILD
 dbus_daemon_LDADD=                                     \
-       $(top_builddir)/dbus/libdbus-convenience.la     \
+       $(top_builddir)/dbus/libdbus-internal.la        \
        $(EFENCE)                                       \
        $(DBUS_BUS_LIBS)
 
@@ -102,9 +103,10 @@ dbus_daemon_launch_helper_SOURCES=         \
        activation-helper-bin.c                 \
        $(LAUNCH_HELPER_SOURCES)
 
+dbus_daemon_launch_helper_CPPFLAGS = -DDBUS_STATIC_BUILD
 dbus_daemon_launch_helper_LDADD=               \
-       $(DBUS_LAUNCHER_LIBS)                   \
-       $(top_builddir)/dbus/libdbus-convenience.la
+       $(top_builddir)/dbus/libdbus-internal.la \
+       $(DBUS_LAUNCHER_LIBS)
 
 dbus_daemon_launch_helper_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@
 
@@ -115,11 +117,11 @@ dbus_daemon_launch_helper_test_SOURCES=           \
        $(LAUNCH_HELPER_SOURCES)
 
 dbus_daemon_launch_helper_test_LDADD=          \
-       $(DBUS_LAUNCHER_LIBS)                   \
-       $(top_builddir)/dbus/libdbus-convenience.la
+       $(top_builddir)/dbus/libdbus-internal.la \
+       $(DBUS_LAUNCHER_LIBS)
 
 dbus_daemon_launch_helper_test_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@
-dbus_daemon_launch_helper_test_CPPFLAGS=       \
+dbus_daemon_launch_helper_test_CPPFLAGS= -DDBUS_STATIC_BUILD   \
        -DACTIVATION_LAUNCHER_TEST
 
 ## we build yet another binary so we can do the OOM tests
@@ -129,11 +131,11 @@ bus_test_launch_helper_SOURCES=           \
        $(LAUNCH_HELPER_SOURCES)
 
 bus_test_launch_helper_LDADD=          \
-       $(DBUS_LAUNCHER_LIBS)                   \
-       $(top_builddir)/dbus/libdbus-convenience.la
+       $(top_builddir)/dbus/libdbus-internal.la \
+       $(DBUS_LAUNCHER_LIBS)
 
 bus_test_launch_helper_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@
-bus_test_launch_helper_CPPFLAGS=       \
+bus_test_launch_helper_CPPFLAGS= -DDBUS_STATIC_BUILD   \
        -DACTIVATION_LAUNCHER_TEST      \
        -DACTIVATION_LAUNCHER_DO_OOM
 
@@ -173,14 +175,16 @@ bus_test_system_SOURCES=                  \
        utils.h                                 \
        test-system.c
 
-bus_test_system_LDADD=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_BUS_LIBS)
+bus_test_system_CPPFLAGS = -DDBUS_STATIC_BUILD
+bus_test_system_LDADD=$(top_builddir)/dbus/libdbus-internal.la $(DBUS_BUS_LIBS)
 bus_test_system_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
 bus_test_SOURCES=                              \
        $(BUS_SOURCES)                          \
        test-main.c
 
-bus_test_LDADD=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_BUS_LIBS)
+bus_test_CPPFLAGS = -DDBUS_STATIC_BUILD
+bus_test_LDADD=$(top_builddir)/dbus/libdbus-internal.la $(DBUS_BUS_LIBS)
 bus_test_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
 ## mop up the gcov files
index 00caac2..54296c1 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "activation.h"
 #include "activation-exit-codes.h"
 #include "desktop-file.h"
+#include "dispatch.h"
 #include "services.h"
 #include "test.h"
 #include "utils.h"
@@ -735,74 +738,56 @@ out:
   return retval;
 }
 
-BusActivation*
-bus_activation_new (BusContext        *context,
-                    const DBusString  *address,
-                    DBusList         **directories,
-                    DBusError         *error)
+dbus_bool_t
+bus_activation_reload (BusActivation     *activation,
+                       const DBusString  *address,
+                       DBusList         **directories,
+                       DBusError         *error)
 {
-  BusActivation *activation;
   DBusList      *link;
   char          *dir;
-  
-  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
-  
-  activation = dbus_new0 (BusActivation, 1);
-  if (activation == NULL)
-    {
-      BUS_SET_OOM (error);
-      return NULL;
-    }
-  
-  activation->refcount = 1;
-  activation->context = context;
-  activation->n_pending_activations = 0;
-  
+
+  if (activation->server_address != NULL)
+    dbus_free (activation->server_address);
   if (!_dbus_string_copy_data (address, &activation->server_address))
     {
       BUS_SET_OOM (error);
       goto failed;
     }
-  
+
+  if (activation->entries != NULL)
+    _dbus_hash_table_unref (activation->entries);
   activation->entries = _dbus_hash_table_new (DBUS_HASH_STRING, NULL,
                                              (DBusFreeFunction)bus_activation_entry_unref);
   if (activation->entries == NULL)
-    {      
-      BUS_SET_OOM (error);
-      goto failed;
-    }
-
-  activation->pending_activations = _dbus_hash_table_new (DBUS_HASH_STRING, NULL,
-                                                          (DBusFreeFunction)bus_pending_activation_unref);
-
-  if (activation->pending_activations == NULL)
     {
       BUS_SET_OOM (error);
       goto failed;
     }
 
+  if (activation->directories != NULL)
+    _dbus_hash_table_unref (activation->directories);
   activation->directories = _dbus_hash_table_new (DBUS_HASH_STRING, NULL,
                                                   (DBusFreeFunction)bus_service_directory_unref);
-  
-  if (activation->directories == NULL) 
+
+  if (activation->directories == NULL)
     {
       BUS_SET_OOM (error);
       goto failed;
     }
-  /* Load service files */
+
   link = _dbus_list_get_first_link (directories);
   while (link != NULL)
     {
       BusServiceDirectory *s_dir;
-      
+
       dir = _dbus_strdup ((const char *) link->data);
       if (!dir)
         {
           BUS_SET_OOM (error);
           goto failed;
         }
-      
+
       s_dir = dbus_new0 (BusServiceDirectory, 1);
       if (!s_dir)
         {
@@ -813,7 +798,7 @@ bus_activation_new (BusContext        *context,
 
       s_dir->refcount = 1;
       s_dir->dir_c = dir;
-      
+
       s_dir->entries = _dbus_hash_table_new (DBUS_HASH_STRING, NULL,
                                              (DBusFreeFunction)bus_activation_entry_unref);
 
@@ -833,8 +818,8 @@ bus_activation_new (BusContext        *context,
 
       /* only fail on OOM, it is ok if we can't read the directory */
       if (!update_directory (activation, s_dir, error))
-        { 
-          if (dbus_error_has_name (error, DBUS_ERROR_NO_MEMORY)) 
+        {
+          if (dbus_error_has_name (error, DBUS_ERROR_NO_MEMORY))
             goto failed;
           else
             dbus_error_free (error);
@@ -843,10 +828,52 @@ bus_activation_new (BusContext        *context,
       link = _dbus_list_get_next_link (directories, link);
     }
 
+  return TRUE;
+ failed:
+  return FALSE;
+}
+
+BusActivation*
+bus_activation_new (BusContext        *context,
+                    const DBusString  *address,
+                    DBusList         **directories,
+                    DBusError         *error)
+{
+  BusActivation *activation;
+  DBusList      *link;
+  char          *dir;
+
+  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+  activation = dbus_new0 (BusActivation, 1);
+  if (activation == NULL)
+    {
+      BUS_SET_OOM (error);
+      return NULL;
+    }
+
+  activation->refcount = 1;
+  activation->context = context;
+  activation->n_pending_activations = 0;
+
+  if (!bus_activation_reload (activation, address, directories, error))
+    goto failed;
+
+   /* Initialize this hash table once, we don't want to lose pending
+   * activations on reload. */
+  activation->pending_activations = _dbus_hash_table_new (DBUS_HASH_STRING, NULL,
+                                                          (DBusFreeFunction)bus_pending_activation_unref);
+
+  if (activation->pending_activations == NULL)
+    {
+      BUS_SET_OOM (error);
+      goto failed;
+    }
+
   activation->environment = _dbus_hash_table_new (DBUS_HASH_STRING,
                                                   (DBusFreeFunction) dbus_free,
                                                   (DBusFreeFunction) dbus_free);
-  
+
   if (activation->environment == NULL) 
     {
       BUS_SET_OOM (error);
@@ -1108,21 +1135,12 @@ bus_activation_send_pending_auto_activation_messages (BusActivation  *activation
           
           addressed_recipient = bus_service_get_primary_owners_connection (service);
 
-          /* Check the security policy, which has the side-effect of adding an
-           * expected pending reply.
-           */
-          if (!bus_context_check_security_policy (activation->context, transaction,
-                                                  entry->connection,
-                                                  addressed_recipient,
-                                                  addressed_recipient,
-                                                  entry->activation_message, error))
+          /* Resume dispatching where we left off in bus_dispatch() */
+          if (!bus_dispatch_matches (transaction,
+                                     entry->connection,
+                                     addressed_recipient,
+                                     entry->activation_message, error))
             goto error;
-
-          if (!bus_transaction_send (transaction, addressed_recipient, entry->activation_message))
-            {
-              BUS_SET_OOM (error);
-              goto error;
-            }
         }
 
       link = next;
index 2dff812..03bfed2 100644 (file)
@@ -32,6 +32,10 @@ BusActivation* bus_activation_new              (BusContext        *context,
                                                const DBusString  *address,
                                                DBusList         **directories,
                                                DBusError         *error);
+dbus_bool_t bus_activation_reload           (BusActivation     *activation,
+                                               const DBusString  *address,
+                                               DBusList         **directories,
+                                               DBusError         *error);
 BusActivation* bus_activation_ref              (BusActivation     *activation);
 void           bus_activation_unref            (BusActivation     *activation);
 
index f6ff180..2e9a505 100644 (file)
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "bus.h"
 #include "activation.h"
 #include "connection.h"
@@ -33,6 +34,7 @@
 #include "dir-watch.h"
 #include <dbus/dbus-list.h>
 #include <dbus/dbus-hash.h>
+#include <dbus/dbus-credentials.h>
 #include <dbus/dbus-internals.h>
 
 struct BusContext
@@ -45,6 +47,7 @@ struct BusContext
   char *address;
   char *pidfile;
   char *user;
+  char *log_prefix;
   DBusLoop *loop;
   DBusList *servers;
   BusConnections *connections;
@@ -274,6 +277,7 @@ process_config_first_time_only (BusContext      *context,
                                BusConfigParser *parser,
                                DBusError       *error)
 {
+  DBusString log_prefix;
   DBusList *link;
   DBusList **addresses;
   const char *user, *pidfile;
@@ -299,21 +303,61 @@ process_config_first_time_only (BusContext      *context,
       DBusStat stbuf;
       
       _dbus_string_init_const (&u, pidfile);
-      
+
       if (_dbus_stat (&u, &stbuf, NULL))
-       {
-         dbus_set_error (error, DBUS_ERROR_FAILED,
-                         "The pid file \"%s\" exists, if the message bus is not running, remove this file",
-                         pidfile);
-         goto failed;
-       }
+        {
+          dbus_set_error (error, DBUS_ERROR_FAILED,
+                                 "The pid file \"%s\" exists, if the message bus is not running, remove this file",
+                          pidfile);
+             goto failed;
+        }
     }
-  
+
   /* keep around the pid filename so we can delete it later */
   context->pidfile = _dbus_strdup (pidfile);
 
+  /* note that type may be NULL */
+  context->type = _dbus_strdup (bus_config_parser_get_type (parser));
+  if (bus_config_parser_get_type (parser) != NULL && context->type == NULL)
+    goto oom;
+
+  user = bus_config_parser_get_user (parser);
+  if (user != NULL)
+    {
+      context->user = _dbus_strdup (user);
+      if (context->user == NULL)
+        goto oom;
+    }
+
+  /* Set up the prefix for syslog messages */
+  if (!_dbus_string_init (&log_prefix))
+    goto oom;
+  if (context->type && !strcmp (context->type, "system"))
+    {
+      if (!_dbus_string_append (&log_prefix, "[system] "))
+        goto oom;
+    }
+  else if (context->type && !strcmp (context->type, "session"))
+    {
+      DBusCredentials *credentials;
+
+      credentials = _dbus_credentials_new_from_current_process ();
+      if (!credentials)
+        goto oom;
+      if (!_dbus_string_append (&log_prefix, "[session "))
+        goto oom;
+      if (!_dbus_credentials_to_string_append (credentials, &log_prefix))
+        goto oom;
+      if (!_dbus_string_append (&log_prefix, "] "))
+        goto oom;
+      _dbus_credentials_unref (credentials);
+    }
+  if (!_dbus_string_steal_data (&log_prefix, &context->log_prefix))
+    goto oom;
+  _dbus_string_free (&log_prefix);
+
   /* Build an array of auth mechanisms */
-  
+
   auth_mechanisms_list = bus_config_parser_get_mechanisms (parser);
   len = _dbus_list_get_length (auth_mechanisms_list);
 
@@ -323,21 +367,15 @@ process_config_first_time_only (BusContext      *context,
 
       auth_mechanisms = dbus_new0 (char*, len + 1);
       if (auth_mechanisms == NULL)
-       {
-         BUS_SET_OOM (error);
-         goto failed;
-       }
-      
+        goto oom;
+
       i = 0;
       link = _dbus_list_get_first_link (auth_mechanisms_list);
       while (link != NULL)
         {
           auth_mechanisms[i] = _dbus_strdup (link->data);
           if (auth_mechanisms[i] == NULL)
-           {
-             BUS_SET_OOM (error);
-             goto failed;
-           }
+            goto oom;
           link = _dbus_list_get_next_link (auth_mechanisms_list, link);
         }
     }
@@ -368,44 +406,27 @@ process_config_first_time_only (BusContext      *context,
        }
 
       if (!_dbus_list_append (&context->servers, server))
-        {
-          BUS_SET_OOM (error);
-          goto failed;
-        }          
-      
-      link = _dbus_list_get_next_link (addresses, link);
-    }
-
-  /* note that type may be NULL */
-  context->type = _dbus_strdup (bus_config_parser_get_type (parser));
-  if (bus_config_parser_get_type (parser) != NULL && context->type == NULL)
-    {
-      BUS_SET_OOM (error);
-      goto failed;
-    }
+        goto oom;
 
-  user = bus_config_parser_get_user (parser);
-  if (user != NULL)
-    {
-      context->user = _dbus_strdup (user);
-      if (context->user == NULL)
-       {
-         BUS_SET_OOM (error);
-         goto failed;
-       }
+      link = _dbus_list_get_next_link (addresses, link);
     }
 
   context->fork = bus_config_parser_get_fork (parser);
   context->syslog = bus_config_parser_get_syslog (parser);
   context->keep_umask = bus_config_parser_get_keep_umask (parser);
   context->allow_anonymous = bus_config_parser_get_allow_anonymous (parser);
-  
+
   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   retval = TRUE;
 
  failed:
   dbus_free_string_array (auth_mechanisms);
   return retval;
+
+ oom:
+  BUS_SET_OOM (error);
+  dbus_free_string_array (auth_mechanisms);
+  return FALSE;
 }
 
 /* This code gets executed every time the config files
@@ -444,6 +465,8 @@ process_config_every_time (BusContext      *context,
   /* get our limits and timeout lengths */
   bus_config_parser_get_limits (parser, &context->limits);
 
+  if (context->policy)
+    bus_policy_unref (context->policy);
   context->policy = bus_config_parser_steal_policy (parser);
   _dbus_assert (context->policy != NULL);
 
@@ -507,26 +530,24 @@ process_config_every_time (BusContext      *context,
       dbus_free(context->servicehelper);
       context->servicehelper = s;
     }
-  
+
   /* Create activation subsystem */
-  new_activation = bus_activation_new (context, &full_address,
-                                       dirs, error);
-  if (new_activation == NULL)
+  if (context->activation)
+    {
+      if (!bus_activation_reload (context->activation, &full_address, dirs, error))
+        goto failed;
+    }
+  else
+    {
+      context->activation = bus_activation_new (context, &full_address, dirs, error);
+    }
+
+  if (context->activation == NULL)
     {
       _DBUS_ASSERT_ERROR_IS_SET (error);
       goto failed;
     }
 
-  if (is_reload)
-    bus_activation_unref (context->activation);
-
-  context->activation = new_activation;
-
-  /* Drop existing conf-dir watches (if applicable) */
-
-  if (is_reload)
-    bus_drop_all_directory_watches ();
-
   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   retval = TRUE;
 
@@ -540,11 +561,39 @@ process_config_every_time (BusContext      *context,
 }
 
 static dbus_bool_t
+list_concat_new (DBusList **a,
+                 DBusList **b,
+                 DBusList **result)
+{
+  DBusList *link;
+
+  *result = NULL;
+
+  link = _dbus_list_get_first_link (a);
+  for (link = _dbus_list_get_first_link (a); link; link = _dbus_list_get_next_link (a, link))
+    {
+      if (!_dbus_list_append (result, link->data))
+        goto oom;
+    }
+  for (link = _dbus_list_get_first_link (b); link; link = _dbus_list_get_next_link (b, link))
+    {
+      if (!_dbus_list_append (result, link->data))
+        goto oom;
+    }
+
+  return TRUE;
+oom:
+  _dbus_list_clear (result);
+  return FALSE;
+}
+
+static dbus_bool_t
 process_config_postinit (BusContext      *context,
                         BusConfigParser *parser,
                         DBusError       *error)
 {
   DBusHashTable *service_context_table;
+  DBusList *watched_dirs = NULL;
 
   service_context_table = bus_config_parser_steal_service_context_table (parser);
   if (!bus_registry_set_service_context_table (context->registry,
@@ -556,10 +605,20 @@ process_config_postinit (BusContext      *context,
 
   _dbus_hash_table_unref (service_context_table);
 
-  /* Watch all conf directories */
-  _dbus_list_foreach (bus_config_parser_get_conf_dirs (parser),
-                     (DBusForeachFunction) bus_watch_directory,
-                     context);
+  /* We need to monitor both the configuration directories and directories
+   * containing .service files.
+   */
+  if (!list_concat_new (bus_config_parser_get_conf_dirs (parser),
+                        bus_config_parser_get_service_dirs (parser),
+                        &watched_dirs))
+    {
+      BUS_SET_OOM (error);
+      return FALSE;
+    }
+
+  bus_set_watched_dirs (context, &watched_dirs);
+
+  _dbus_list_clear (&watched_dirs);
 
   return TRUE;
 }
@@ -571,6 +630,7 @@ bus_context_new (const DBusString *config_file,
                  DBusPipe         *print_pid_pipe,
                  DBusError        *error)
 {
+  DBusString log_prefix;
   BusContext *context;
   BusConfigParser *parser;
 
@@ -594,7 +654,7 @@ bus_context_new (const DBusString *config_file,
   context->refcount = 1;
 
   _dbus_generate_uuid (&context->uuid);
-  
+
   if (!_dbus_string_copy_data (config_file, &context->config_file))
     {
       BUS_SET_OOM (error);
@@ -755,9 +815,9 @@ bus_context_new (const DBusString *config_file,
 
   if (!bus_selinux_full_init ())
     {
-      _dbus_warn ("SELinux initialization failed\n");
+      bus_context_log (context, DBUS_SYSTEM_LOG_FATAL, "SELinux enabled but AVC initialization failed; check system log\n");
     }
-  
+
   if (!process_config_postinit (context, parser, error))
     {
       _DBUS_ASSERT_ERROR_IS_SET (error);
@@ -842,10 +902,10 @@ bus_context_reload_config (BusContext *context,
     }
   ret = TRUE;
 
-  bus_context_log_info (context, "Reloaded configuration");
- failed:  
+  bus_context_log (context, DBUS_SYSTEM_LOG_INFO, "Reloaded configuration");
+ failed:
   if (!ret)
-    bus_context_log_info (context, "Unable to reload configuration: %s", error->message);
+    bus_context_log (context, DBUS_SYSTEM_LOG_INFO, "Unable to reload configuration: %s", error->message);
   if (parser != NULL)
     bus_config_parser_unref (parser);
   return ret;
@@ -955,8 +1015,9 @@ bus_context_unref (BusContext *context)
           bus_matchmaker_unref (context->matchmaker);
           context->matchmaker = NULL;
         }
-      
+
       dbus_free (context->config_file);
+      dbus_free (context->log_prefix);
       dbus_free (context->type);
       dbus_free (context->address);
       dbus_free (context->user);
@@ -1127,28 +1188,37 @@ bus_context_get_reply_timeout (BusContext *context)
 }
 
 void
-bus_context_log_info (BusContext *context, const char *msg, ...)
-{
-  va_list args;
-
-  va_start (args, msg);
-  
-  if (context->syslog)
-    _dbus_log_info (msg, args);
-
-  va_end (args);
-}
+bus_context_log (BusContext *context, DBusSystemLogSeverity severity, const char *msg, ...) _DBUS_GNUC_PRINTF (3, 4);
 
 void
-bus_context_log_security (BusContext *context, const char *msg, ...)
+bus_context_log (BusContext *context, DBusSystemLogSeverity severity, const char *msg, ...)
 {
   va_list args;
 
+  if (!context->syslog)
+    return;
+
   va_start (args, msg);
-  
-  if (context->syslog)
-    _dbus_log_security (msg, args);
 
+  if (context->log_prefix)
+    {
+      DBusString full_msg;
+
+      if (!_dbus_string_init (&full_msg))
+        goto out;
+      if (!_dbus_string_append (&full_msg, context->log_prefix))
+        goto oom_out;
+      if (!_dbus_string_append_printf_valist (&full_msg, msg, args))
+        goto oom_out;
+
+      _dbus_system_log (severity, "%s", _dbus_string_get_const_data (&full_msg));
+    oom_out:
+      _dbus_string_free (&full_msg);
+    }
+  else
+    _dbus_system_logv (severity, msg, args);
+
+out:
   va_end (args);
 }
 
@@ -1391,8 +1461,8 @@ bus_context_check_security_policy (BusContext     *context,
                       dest ? dest : DBUS_SERVICE_DBUS,
                       proposed_recipient_loginfo);
       /* Needs to be duplicated to avoid calling malloc and having to handle OOM */
-      if (addressed_recipient == proposed_recipient)      
-        bus_context_log_security (context, msg,
+      if (addressed_recipient == proposed_recipient)
+        bus_context_log (context, DBUS_SYSTEM_LOG_SECURITY, msg,
                                   toggles,
                                   dbus_message_type_to_string (dbus_message_get_type (message)),
                                   sender_name ? sender_name : "(unset)",
@@ -1411,7 +1481,7 @@ bus_context_check_security_policy (BusContext     *context,
     }
 
   if (log)
-    bus_context_log_security (context, 
+    bus_context_log (context, DBUS_SYSTEM_LOG_SECURITY,
                               "Would reject message, %d matched rules; "
                               "type=\"%s\", sender=\"%s\" (%s) interface=\"%s\" member=\"%s\" error name=\"%s\" requested_reply=%d destination=\"%s\" (%s))",
                               toggles,
@@ -1455,8 +1525,8 @@ bus_context_check_security_policy (BusContext     *context,
                       dest ? dest : DBUS_SERVICE_DBUS,
                       proposed_recipient_loginfo);
       /* Needs to be duplicated to avoid calling malloc and having to handle OOM */
-      if (addressed_recipient == proposed_recipient)      
-        bus_context_log_security (context, msg,
+      if (addressed_recipient == proposed_recipient)
+        bus_context_log (context, DBUS_SYSTEM_LOG_SECURITY, msg,
                                   toggles,
                                   dbus_message_type_to_string (dbus_message_get_type (message)),
                                   sender_name ? sender_name : "(unset)",
index aade920..7eb5fd8 100644 (file)
--- a/bus/bus.h
+++ b/bus/bus.h
 #ifndef BUS_BUS_H
 #define BUS_BUS_H
 
-#include <config.h>
-
 #include <dbus/dbus.h>
 #include <dbus/dbus-string.h>
 #include <dbus/dbus-mainloop.h>
 #include <dbus/dbus-pipe.h>
+#include <dbus/dbus-sysdeps.h>
 
 typedef struct BusActivation    BusActivation;
 typedef struct BusConnections   BusConnections;
@@ -111,11 +110,9 @@ int               bus_context_get_max_services_per_connection    (BusContext
 int               bus_context_get_max_match_rules_per_connection (BusContext       *context);
 int               bus_context_get_max_replies_per_connection     (BusContext       *context);
 int               bus_context_get_reply_timeout                  (BusContext       *context);
-void              bus_context_log_info                           (BusContext       *context, 
-                                                                  const char       *msg, 
-                                                                  ...);
-void              bus_context_log_security                       (BusContext       *context,
-                                                                  const char       *msg, 
+void              bus_context_log                                (BusContext       *context,
+                                                                  DBusSystemLogSeverity severity,
+                                                                  const char       *msg,
                                                                   ...);
 dbus_bool_t       bus_context_check_security_policy              (BusContext       *context,
                                                                   BusTransaction   *transaction,
index c0620ae..b571fda 100644 (file)
  *
  */
 
+#include <config.h>
 #include "config-parser.h"
 #include <dbus/dbus-internals.h>
 #include <expat.h>
 
-static XML_Memory_Handling_Suite memsuite =
-{
-  dbus_malloc,
-  dbus_realloc,
-  dbus_free
-};
+static XML_Memory_Handling_Suite memsuite;
 
 typedef struct
 {
@@ -195,7 +191,11 @@ bus_config_load (const DBusString      *file,
       _dbus_string_free (&context.content);
       return NULL;
     }
-  
+
+  memsuite.malloc_fcn = dbus_malloc;
+  memsuite.realloc_fcn = dbus_realloc;
+  memsuite.free_fcn = dbus_free;
+
   expat = XML_ParserCreate_MM ("UTF-8", &memsuite, NULL);
   if (expat == NULL)
     {
index 3d82a63..c73a181 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "config-parser.h"
 #include <dbus/dbus-internals.h>
 #include <libxml/xmlreader.h>
index ebcb717..f8d75be 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
  
+#include <config.h>
 #include <dbus/dbus-internals.h>
 #include <string.h>
 
index dc0e0ed..da74560 100644 (file)
@@ -24,8 +24,6 @@
 #ifndef BUS_CONFIG_PARSER_COMMON_H
 #define BUS_CONFIG_PARSER_COMMON_H
 
-#include <config.h>
-
 typedef enum
 {
   ELEMENT_NONE,
index fd016a8..a35226a 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
  
+#include <config.h>
 #include "config-parser-common.h"
 #include "config-parser-trivial.h"
 #include "utils.h"
index ce542bf..70e5d5b 100644 (file)
@@ -24,8 +24,6 @@
 #ifndef BUS_CONFIG_PARSER_TRIVIAL_H
 #define BUS_CONFIG_PARSER_TRIVIAL_H
 
-#include <config.h>
-
 #include <dbus/dbus.h>
 #include <dbus/dbus-string.h>
 #include <dbus/dbus-list.h>
index d8ae459..2d19f2b 100644 (file)
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "config-parser-common.h"
 #include "config-parser.h"
 #include "test.h"
index 3aac1ed..ba5bf74 100644 (file)
@@ -24,8 +24,6 @@
 #ifndef BUS_CONFIG_PARSER_H
 #define BUS_CONFIG_PARSER_H
 
-#include <config.h>
-
 #include <dbus/dbus.h>
 #include <dbus/dbus-string.h>
 #include <dbus/dbus-list.h>
index 50807f1..8ccae76 100644 (file)
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "connection.h"
 #include "dispatch.h"
 #include "policy.h"
@@ -837,7 +839,7 @@ expire_incomplete_timeout (void *data)
 {
   BusConnections *connections = data;
 
-  _dbus_verbose ("Running %s\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("Running\n");
   
   /* note that this may remove the timeout */
   bus_connections_expire_incomplete (connections);
@@ -1630,7 +1632,7 @@ cancel_pending_reply (void *data)
 {
   CancelPendingReplyData *d = data;
 
-  _dbus_verbose ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d);
+  _dbus_verbose ("d = %p\n", d);
   
   if (!bus_expire_list_remove (d->connections->pending_replies,
                                &d->pending->expire_item))
@@ -1644,7 +1646,7 @@ cancel_pending_reply_data_free (void *data)
 {
   CancelPendingReplyData *d = data;
 
-  _dbus_verbose ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d);
+  _dbus_verbose ("d = %p\n", d);
   
   /* d->pending should be either freed or still
    * in the list of pending replies (owned by someone
@@ -1781,7 +1783,7 @@ cancel_check_pending_reply (void *data)
 {
   CheckPendingReplyData *d = data;
 
-  _dbus_verbose ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d);
+  _dbus_verbose ("d = %p\n",d);
 
   bus_expire_list_add_link (d->connections->pending_replies,
                             d->link);
@@ -1793,7 +1795,7 @@ check_pending_reply_data_free (void *data)
 {
   CheckPendingReplyData *d = data;
 
-  _dbus_verbose ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d);
+  _dbus_verbose ("d = %p\n",d);
   
   if (d->link != NULL)
     {
index 9f88d6e..ae441c5 100644 (file)
@@ -21,6 +21,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include <dbus/dbus-sysdeps.h>
 #include <dbus/dbus-internals.h>
 #include "desktop-file.h"
index 6f8f1e9..8e457eb 100644 (file)
 
 /* NoOp */
 
-void 
-bus_drop_all_directory_watches (void)
+void
+bus_watch_directory (const char *dir, BusContext *context)
 {
 }
 
 void
-bus_watch_directory (const char *dir, BusContext *context)
+bus_set_watched_dirs (BusContext *context, DBusList **directories)
 {
 }
index ee580d7..39eff97 100644 (file)
@@ -33,6 +33,7 @@
 #include <errno.h>
 
 #include <dbus/dbus-internals.h>
+#include <dbus/dbus-list.h>
 #include <dbus/dbus-watch.h>
 #include "dir-watch.h"
 
@@ -42,6 +43,7 @@
 
 /* use a static array to avoid handling OOM */
 static int wds[MAX_DIRS_TO_WATCH];
+static char *dirs[MAX_DIRS_TO_WATCH];
 static int num_wds = 0;
 static int inotify_fd = -1;
 static DBusWatch *watch = NULL;
@@ -89,81 +91,188 @@ _handle_inotify_watch (DBusWatch *passed_watch, unsigned int flags, void *data)
   return TRUE;
 }
 
-void
-bus_watch_directory (const char *dir, BusContext *context)
+#include <stdio.h>
+
+static void
+_set_watched_dirs_internal (DBusList **directories)
 {
-  int wd;
+  int new_wds[MAX_DIRS_TO_WATCH];
+  char *new_dirs[MAX_DIRS_TO_WATCH];
+  DBusList *link;
+  int i, j, wd;
 
-  _dbus_assert (dir != NULL);
+  for (i = 0; i < MAX_DIRS_TO_WATCH; i++)
+    {
+      new_wds[i] = -1;
+      new_dirs[i] = NULL;
+    }
 
-  if (inotify_fd == -1) {
-#ifdef HAVE_INOTIFY_INIT1
-     inotify_fd = inotify_init1 (IN_CLOEXEC);
-#else
-     inotify_fd = inotify_init ();
-#endif
-     if (inotify_fd <= 0) {
-      _dbus_warn ("Cannot initialize inotify\n");
-      goto out;
-     } 
-     loop = bus_context_get_loop (context);
-
-     watch = _dbus_watch_new (inotify_fd, DBUS_WATCH_READABLE, TRUE,
-                              _handle_inotify_watch, NULL, NULL);
-
-       if (watch == NULL)
-          {
-            _dbus_warn ("Unable to create inotify watch\n");
-           goto out;
-         }
-
-       if (!_dbus_loop_add_watch (loop, watch, _inotify_watch_callback,
-                                   NULL, NULL))
-          {
-            _dbus_warn ("Unable to add reload watch to main loop");
-           _dbus_watch_unref (watch);
-           watch = NULL;
-            goto out;
-         }
-  }
-
-  if (num_wds >= MAX_DIRS_TO_WATCH )
+  i = 0;
+  link = _dbus_list_get_first_link (directories);
+  while (link != NULL)
     {
-      _dbus_warn ("Cannot watch config directory '%s'. Already watching %d directories\n", dir, MAX_DIRS_TO_WATCH);
-      goto out;
+      new_dirs[i++] = (char *)link->data;
+      link = _dbus_list_get_next_link (directories, link);
     }
 
-  wd = inotify_add_watch (inotify_fd, dir, IN_CLOSE_WRITE | IN_DELETE | IN_MOVED_TO | IN_MOVED_FROM);
-  if (wd < 0)
+  /* Look for directories in both the old and new sets, if
+   * we find one, move its data into the new set.
+   */
+  for (i = 0; new_dirs[i]; i++)
     {
-      _dbus_warn ("Cannot setup inotify for '%s'; error '%s'\n", dir, _dbus_strerror (errno));
-      goto out;
+      for (j = 0; j < num_wds; j++)
+        {
+          if (dirs[j] && strcmp (new_dirs[i], dirs[j]) == 0)
+            {
+              new_wds[i] = wds[j];
+              new_dirs[i] = dirs[j];
+              wds[j] = -1;
+              dirs[j] = NULL;
+              break;
+            }
+        }
     }
 
-  wds[num_wds++] = wd;
-  _dbus_verbose ("Added watch on config directory '%s'\n", dir);
+  /* Any directories we find in "wds" with a nonzero fd must
+   * not be in the new set, so perform cleanup now.
+   */
+  for (j = 0; j < num_wds; j++)
+    {
+      if (wds[j] != -1)
+        {
+          inotify_rm_watch (inotify_fd, wds[j]);
+          dbus_free (dirs[j]);
+          wds[j] = -1;
+          dirs[j] = NULL;
+        }
+    }
 
- out:
-  ;
+  for (i = 0; new_dirs[i]; i++)
+    {
+      if (new_wds[i] == -1)
+        {
+          /* FIXME - less lame error handling for failing to add a watch; we may need to sleep. */
+          wd = inotify_add_watch (inotify_fd, new_dirs[i], IN_CLOSE_WRITE | IN_DELETE | IN_MOVED_TO | IN_MOVED_FROM);
+          if (wd < 0)
+            {
+              /* Not all service directories need to exist. */
+              if (errno != ENOENT)
+                {
+                  _dbus_warn ("Cannot setup inotify for '%s'; error '%s'\n", new_dirs[i], _dbus_strerror (errno));
+                  goto out;
+                }
+              else
+                {
+                  new_wds[i] = -1;
+                  new_dirs[i] = NULL;
+                  continue;
+                }
+            }
+          new_wds[i] = wd;
+          new_dirs[i] = _dbus_strdup (new_dirs[i]);
+          if (!new_dirs[i])
+            {
+              /* FIXME have less lame handling for OOM, we just silently fail to
+               * watch.  (In reality though, the whole OOM handling in dbus is stupid
+               * but we won't go into that in this comment =) )
+               */
+              inotify_rm_watch (inotify_fd, wd);
+              new_wds[i] = -1;
+            }
+        }
+    }
+
+  num_wds = i;
+
+  for (i = 0; i < MAX_DIRS_TO_WATCH; i++)
+    {
+      wds[i] = new_wds[i];
+      dirs[i] = new_dirs[i];
+    }
+
+ out:;
 }
 
-void 
-bus_drop_all_directory_watches (void)
+#include <stdio.h>
+static void
+_shutdown_inotify (void *data)
 {
-  int ret;
+  DBusList *empty = NULL;
+
+  if (inotify_fd == -1)
+    return;
 
+  _set_watched_dirs_internal (&empty);
+
+  close (inotify_fd);
+  inotify_fd = -1;
   if (watch != NULL)
     {
       _dbus_loop_remove_watch (loop, watch, _inotify_watch_callback, NULL);
       _dbus_watch_unref (watch);
-      watch = NULL;
+      _dbus_loop_unref (loop);
     }
+  watch = NULL;
+  loop = NULL;
+}
 
-  _dbus_verbose ("Dropping all watches on config directories\n");
-  ret = close (inotify_fd);
-  if (ret)
-    _dbus_verbose ("Error dropping watches: '%s'\n",  _dbus_strerror(errno));
+static int
+_init_inotify (BusContext *context)
+{
+  int ret = 0;
 
-  num_wds = 0;
-  inotify_fd = -1;
+  if (inotify_fd == -1)
+    {
+#ifdef HAVE_INOTIFY_INIT1
+      inotify_fd = inotify_init1 (IN_CLOEXEC);
+      /* This ensures we still run on older Linux kernels.
+       * https://bugs.freedesktop.org/show_bug.cgi?id=23957
+       */
+      if (inotify_fd < 0)
+        inotify_fd = inotify_init ();
+#else
+      inotify_fd = inotify_init ();
+#endif
+      if (inotify_fd <= 0)
+        {
+          _dbus_warn ("Cannot initialize inotify\n");
+          goto out;
+        }
+      loop = bus_context_get_loop (context);
+      _dbus_loop_ref (loop);
+
+      watch = _dbus_watch_new (inotify_fd, DBUS_WATCH_READABLE, TRUE,
+                               _handle_inotify_watch, NULL, NULL);
+
+      if (watch == NULL)
+        {
+          _dbus_warn ("Unable to create inotify watch\n");
+          goto out;
+        }
+
+      if (!_dbus_loop_add_watch (loop, watch, _inotify_watch_callback,
+                                 NULL, NULL))
+        {
+          _dbus_warn ("Unable to add reload watch to main loop");
+          _dbus_watch_unref (watch);
+          watch = NULL;
+          goto out;
+        }
+
+      _dbus_register_shutdown_func (_shutdown_inotify, NULL);
+    }
+
+  ret = 1;
+
+out:
+  return ret;
+}
+
+void
+bus_set_watched_dirs (BusContext *context, DBusList **directories)
+{
+  if (!_init_inotify (context))
+    return;
+
+  _set_watched_dirs_internal (directories);
 }
index 16741dd..4a01b74 100644 (file)
 #include <dbus/dbus-watch.h>
 
 #include <dbus/dbus-internals.h>
+#include <dbus/dbus-list.h>
 #include "dir-watch.h"
 
 #define MAX_DIRS_TO_WATCH 128
 
 static int kq = -1;
 static int fds[MAX_DIRS_TO_WATCH];
+static char *dirs[MAX_DIRS_TO_WATCH];
 static int num_fds = 0;
 static DBusWatch *watch = NULL;
 static DBusLoop *loop = NULL;
@@ -90,13 +92,10 @@ _handle_kqueue_watch (DBusWatch *watch, unsigned int flags, void *data)
   return TRUE;
 }
 
-void
-bus_watch_directory (const char *dir, BusContext *context)
+static int
+_init_kqueue (BusContext *context)
 {
-  int fd;
-  struct kevent ev;
-
-  _dbus_assert (dir != NULL);
+  int ret = 0;
 
   if (kq < 0)
     {
@@ -133,49 +132,124 @@ bus_watch_directory (const char *dir, BusContext *context)
          }
     }
 
-  if (num_fds >= MAX_DIRS_TO_WATCH )
+  ret = 1;
+
+out:
+  return ret;
+}
+
+void
+bus_set_watched_dirs (BusContext *context, DBusList **directories)
+{
+  int new_fds[MAX_DIRS_TO_WATCH];
+  char *new_dirs[MAX_DIRS_TO_WATCH];
+  DBusList *link;
+  int i, j, f, fd;
+  struct kevent ev;
+
+  if (!_init_kqueue (context))
+    goto out;
+
+  for (i = 0; i < MAX_DIRS_TO_WATCH; i++)
     {
-      _dbus_warn ("Cannot watch config directory '%s'. Already watching %d directories\n", dir, MAX_DIRS_TO_WATCH);
-      goto out;
+      new_fds[i] = -1;
+      new_dirs[i] = NULL;
     }
 
-  fd = open (dir, O_RDONLY);
-  if (fd < 0)
+  i = 0;
+  link = _dbus_list_get_first_link (directories);
+  while (link != NULL)
     {
-      _dbus_warn ("Cannot open directory '%s'; error '%s'\n", dir, _dbus_strerror (errno));
-      goto out;
+      new_dirs[i++] = (char *)link->data;
+      link = _dbus_list_get_next_link (directories, link);
     }
 
-  EV_SET (&ev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR,
-          NOTE_DELETE | NOTE_EXTEND | NOTE_WRITE | NOTE_RENAME, 0, 0);
-  if (kevent (kq, &ev, 1, NULL, 0, NULL) == -1)
+  /* Look for directories in both the old and new sets, if
+   * we find one, move its data into the new set.
+   */
+  for (i = 0; new_dirs[i]; i++)
     {
-      _dbus_warn ("Cannot setup a kevent for '%s'; error '%s'\n", dir, _dbus_strerror (errno));
-      close (fd);
-      goto out;
+      for (j = 0; i < num_fds; j++)
+        {
+          if (dirs[j] && strcmp (new_dirs[i], dirs[j]) == 0)
+            {
+              new_fds[i] = fds[j];
+             new_dirs[i] = dirs[j];
+             fds[j] = -1;
+             dirs[j] = NULL;
+             break;
+           }
+       }
     }
 
-  fds[num_fds++] = fd;
-  _dbus_verbose ("Added kqueue watch on config directory '%s'\n", dir);
-
- out:
-  ;
-}
-
-void
-bus_drop_all_directory_watches (void)
-{
-  int i;
-
-  _dbus_verbose ("Dropping all watches on config directories\n");
+  /* Any directory we find in "fds" with a nonzero fd must
+   * not be in the new set, so perform cleanup now.
+   */
+  for (j = 0; j < num_fds; j++)
+    {
+      if (fds[j] != -1)
+        {
+          close (fds[j]);
+         dbus_free (dirs[j]);
+         fds[j] = -1;
+         dirs[j] = NULL;
+       }
+    }
 
-  for (i = 0; i < num_fds; i++)
+  for (i = 0; new_dirs[i]; i++)
     {
-      if (close (fds[i]) != 0)
+      if (new_fds[i] == -1)
         {
-          _dbus_verbose ("Error closing fd %d for config directory watch\n", fds[i]);
+          /* FIXME - less lame error handling for failing to add a watch;
+          * we may need to sleep.
+          */
+          fd = open (new_dirs[i], O_RDONLY);
+          if (fd < 0)
+            {
+              if (errno != ENOENT)
+                {
+                  _dbus_warn ("Cannot open directory '%s'; error '%s'\n", new_dirs[i], _dbus_strerror (errno));
+                  goto out;
+                }
+              else
+                {
+                  new_fds[i] = -1;
+                  new_dirs[i] = NULL;
+                  continue;
+                }
+            }
+
+          EV_SET (&ev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR,
+                  NOTE_DELETE | NOTE_EXTEND | NOTE_WRITE | NOTE_RENAME, 0, 0);
+          if (kevent (kq, &ev, 1, NULL, 0, NULL) == -1)
+            {
+              _dbus_warn ("Cannot setup a kevent for '%s'; error '%s'\n", new_dirs[i], _dbus_strerror (errno));
+              close (fd);
+              goto out;
+            }
+
+         new_fds[i] = fd;
+         new_dirs[i] = _dbus_strdup (new_dirs[i]);
+         if (!new_dirs[i])
+            {
+              /* FIXME have less lame handling for OOM, we just silently fail to
+              * watch.  (In reality though, the whole OOM handling in dbus is
+              * stupid but we won't go into that in this comment =) )
+              */
+              close (fd);
+             new_fds[i] = -1;
+           }
        }
     }
 
-  num_fds = 0;
+  num_fds = i;
+
+  for (i = 0; i < MAX_DIRS_TO_WATCH; i++)
+    {
+      fds[i] = new_fds[i];
+      dirs[i] = new_dirs[i];
+    }
+
+ out:
+  ;
 }
index 8e322a6..b44529e 100644 (file)
 #ifndef DIR_WATCH_H
 #define DIR_WATCH_H
 
-/* setup a watch on a directory (OS dependent, may be a NOP) */
-void bus_watch_directory (const char *directory, BusContext *context);
-
-/* drop all the watches previously set up by bus_config_watch_directory (OS dependent, may be a NOP) */
-void bus_drop_all_directory_watches (void);
+/**
+ * Update the set of directories to monitor for changes.  The
+ * operating-system-specific implementation of this function should
+ * avoid creating a window where a directory in both the
+ * old and new set isn't monitored.
+ *
+ * @param context The bus context
+ * @param dirs List of strings which are directory paths
+ */
+void bus_set_watched_dirs (BusContext *context, DBusList **dirs);
 
 #endif /* DIR_WATCH_H */
index f769a44..d42a9e3 100644 (file)
@@ -23,6 +23,7 @@
  *
  */
 
+#include <config.h>
 #include "dispatch.h"
 #include "connection.h"
 #include "driver.h"
 #include <unistd.h>
 #endif
 
+#ifndef TEST_CONNECTION
+/*
+ TODO autotools:
+  move to build system as already done for cmake
+*/
 #ifdef DBUS_UNIX
 #define TEST_CONNECTION "debug-pipe:name=test-server"
 #else
 #define TEST_CONNECTION "tcp:host=localhost,port=1234"
 #endif
+#endif
 
 static dbus_bool_t
 send_one_message (DBusConnection *connection,
@@ -101,10 +108,39 @@ bus_dispatch_matches (BusTransaction *transaction,
   _dbus_assert (sender == NULL || bus_connection_is_active (sender));
   _dbus_assert (dbus_message_get_sender (message) != NULL);
 
+  context = bus_transaction_get_context (transaction);
+
+  /* First, send the message to the addressed_recipient, if there is one. */
+  if (addressed_recipient != NULL)
+    {
+      if (!bus_context_check_security_policy (context, transaction,
+                                              sender, addressed_recipient,
+                                              addressed_recipient,
+                                              message, error))
+        return FALSE;
+
+      if (dbus_message_contains_unix_fds (message) &&
+          !dbus_connection_can_send_type (addressed_recipient,
+                                          DBUS_TYPE_UNIX_FD))
+        {
+          dbus_set_error (error,
+                          DBUS_ERROR_NOT_SUPPORTED,
+                          "Tried to send message with Unix file descriptors"
+                          "to a client that doesn't support that.");
+          return FALSE;
+      }
+
+      /* Dispatch the message */
+      if (!bus_transaction_send (transaction, addressed_recipient, message))
+        {
+          BUS_SET_OOM (error);
+          return FALSE;
+        }
+    }
+
+  /* Now dispatch to others who look interested in this message */
   connections = bus_transaction_get_connections (transaction);
-  
   dbus_error_init (&tmp_error);
-  context = bus_transaction_get_context (transaction);
   matchmaker = bus_context_get_matchmaker (context);
 
   recipients = NULL;
@@ -304,34 +340,12 @@ bus_dispatch (DBusConnection *connection,
         {
           addressed_recipient = bus_service_get_primary_owners_connection (service);
           _dbus_assert (addressed_recipient != NULL);
-          
-          if (!bus_context_check_security_policy (context, transaction,
-                                                  connection, addressed_recipient,
-                                                  addressed_recipient,
-                                                  message, &error))
-            goto out;
-
-          if (dbus_message_contains_unix_fds(message) &&
-              !dbus_connection_can_send_type(addressed_recipient, DBUS_TYPE_UNIX_FD))
-            {
-              dbus_set_error(&error,
-                             DBUS_ERROR_NOT_SUPPORTED,
-                             "Tried to send message with Unix file descriptors"
-                             "to a client that doesn't support that.");
-              goto out;
-          }
-          
-          /* Dispatch the message */
-          if (!bus_transaction_send (transaction, addressed_recipient, message))
-            {
-              BUS_SET_OOM (&error);
-              goto out;
-            }
         }
     }
 
-  /* Now match the messages against any match rules, which will send
-   * out signals and such. addressed_recipient may == NULL.
+  /* Now send the message to its destination (or not, if
+   * addressed_recipient == NULL), and match it against other connections'
+   * match rules.
    */
   if (!bus_dispatch_matches (transaction, connection, addressed_recipient, message, &error))
     goto out;
@@ -744,8 +758,7 @@ check_no_leftovers (BusContext *context)
   
   if (nmd.failed)
     {
-      _dbus_verbose ("%s: leftover message found\n",
-                     _DBUS_FUNCTION_NAME);
+      _dbus_verbose ("leftover message found\n");
       return FALSE;
     }
   else
@@ -969,7 +982,7 @@ check_hello_message (BusContext     *context,
   retval = TRUE;
   
  out:
-  _dbus_verbose ("ending %s retval = %d\n", _DBUS_FUNCTION_NAME, retval);
+  _dbus_verbose ("ending - retval = %d\n", retval);
   
   dbus_error_free (&error);
   
@@ -1025,7 +1038,7 @@ check_double_hello_message (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_verbose ("connection was disconnected\n");
       
       dbus_connection_unref (connection);
       
@@ -1127,7 +1140,7 @@ check_get_connection_unix_user (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_verbose ("connection was disconnected\n");
       
       dbus_connection_unref (connection);
       
@@ -1264,7 +1277,7 @@ check_get_connection_unix_process_id (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_verbose ("connection was disconnected\n");
       
       dbus_connection_unref (connection);
       
@@ -1427,7 +1440,7 @@ check_add_match_all (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_verbose ("connection was disconnected\n");
       
       dbus_connection_unref (connection);
       
@@ -1438,7 +1451,7 @@ check_add_match_all (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_verbose ("connection was disconnected\n");
       
       dbus_connection_unref (connection);
       
@@ -1607,7 +1620,7 @@ check_nonexistent_service_no_auto_start (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_verbose ("connection was disconnected\n");
       return TRUE;
     }
   
@@ -1699,7 +1712,7 @@ check_nonexistent_service_auto_start (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_verbose ("connection was disconnected\n");
       return TRUE;
     }
   
@@ -2479,7 +2492,7 @@ check_existent_service_no_auto_start (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_verbose ("connection was disconnected\n");
       return TRUE;
     }
   
@@ -2701,7 +2714,7 @@ check_segfault_service_no_auto_start (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_verbose ("connection was disconnected\n");
       return TRUE;
     }
   
@@ -2802,7 +2815,7 @@ check_segfault_service_auto_start (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_verbose ("connection was disconnected\n");
       return TRUE;
     }
   
@@ -3121,7 +3134,7 @@ check_existent_service_auto_start (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_verbose ("connection was disconnected\n");
       return TRUE;
     }
 
@@ -3306,7 +3319,7 @@ check_launch_service_file_missing (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_verbose ("connection was disconnected\n");
       return TRUE;
     }
   
@@ -3402,7 +3415,7 @@ check_launch_service_user_missing (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_warn ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_warn ("connection was disconnected\n");
       return TRUE;
     }
   
@@ -3498,7 +3511,7 @@ check_launch_service_exec_missing (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_warn ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_warn ("connection was disconnected\n");
       return TRUE;
     }
   
@@ -3602,7 +3615,7 @@ check_launch_service_service_missing (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_warn ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_warn ("connection was disconnected\n");
       return TRUE;
     }
   
@@ -3705,7 +3718,7 @@ check_shell_fail_service_auto_start (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_verbose ("connection was disconnected\n");
       return TRUE;
     }
   
@@ -3809,7 +3822,7 @@ check_shell_service_success_auto_start (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_verbose ("connection was disconnected\n");
       return TRUE;
     }
 
@@ -4089,7 +4102,7 @@ check_get_services (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_verbose ("connection was disconnected\n");
 
       dbus_connection_unref (connection);
 
@@ -4251,7 +4264,7 @@ check_list_services (BusContext     *context,
 
   if (!dbus_connection_get_is_connected (connection))
     {
-      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+      _dbus_verbose ("connection was disconnected\n");
       return TRUE;
     }
 
@@ -4536,11 +4549,16 @@ bus_dispatch_test_conf (const DBusString *test_data_dir,
   if (!check_add_match_all (context, baz))
     _dbus_assert_not_reached ("AddMatch message failed");
 
+#ifdef DBUS_WIN_FIXME
+  _dbus_warn("TODO: testing of GetConnectionUnixUser message skipped for now\n");
+  _dbus_warn("TODO: testing of GetConnectionUnixProcessID message skipped for now\n");
+#else
   if (!check_get_connection_unix_user (context, baz))
     _dbus_assert_not_reached ("GetConnectionUnixUser message failed");
 
   if (!check_get_connection_unix_process_id (context, baz))
     _dbus_assert_not_reached ("GetConnectionUnixProcessID message failed");
+#endif
 
   if (!check_list_services (context, baz))
     _dbus_assert_not_reached ("ListActivatableNames message failed");
index 4a6a324..0dcfdaa 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#include <config.h>
 #include "activation.h"
 #include "connection.h"
 #include "driver.h"
@@ -32,6 +33,7 @@
 #include "utils.h"
 #include <dbus/dbus-string.h>
 #include <dbus/dbus-internals.h>
+#include <dbus/dbus-message.h>
 #include <dbus/dbus-marshal-recursive.h>
 #include <string.h>
 
@@ -791,6 +793,9 @@ send_ack_reply (DBusConnection *connection,
 {
   DBusMessage *reply;
 
+  if (dbus_message_get_no_reply (message))
+    return TRUE;
+
   reply = dbus_message_new_method_return (message);
   if (reply == NULL)
     {
index 58e1f6d..946a615 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "expirelist.h"
 #include "test.h"
 #include <dbus/dbus-internals.h>
@@ -217,7 +218,7 @@ expire_timeout_handler (void *data)
 {
   BusExpireList *list = data;
 
-  _dbus_verbose ("Running %s\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("Running\n");
 
   /* note that this may remove the timeout */
   bus_expirelist_expire (list);
index 45e08f0..24bc905 100644 (file)
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "bus.h"
 #include "driver.h"
 #include <dbus/dbus-internals.h>
@@ -27,7 +29,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef HAVE_SIGNAL_H
 #include <signal.h>
+#endif
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
@@ -65,16 +69,18 @@ signal_handler (int sig)
       }
       break;
 #endif
+#ifdef SIGTERM
     case SIGTERM:
       _dbus_loop_quit (bus_context_get_loop (context));
       break;
+#endif
     }
 }
 
 static void
 usage (void)
 {
-  fprintf (stderr, DAEMON_NAME " [--version] [--session] [--system] [--config-file=FILE] [--print-address[=DESCRIPTOR]] [--print-pid[=DESCRIPTOR]] [--fork] [--nofork] [--introspect]\n");
+  fprintf (stderr, DBUS_DAEMON_NAME " [--version] [--session] [--system] [--config-file=FILE] [--print-address[=DESCRIPTOR]] [--print-pid[=DESCRIPTOR]] [--fork] [--nofork] [--introspect]\n");
   exit (1);
 }
 
@@ -156,7 +162,10 @@ handle_reload_watch (DBusWatch    *watch,
 {
   DBusError error;
   DBusString str;
-  _dbus_string_init (&str);
+
+  while (!_dbus_string_init (&str))
+    _dbus_wait_for_memory ();
+
   if ((reload_pipe[RELOAD_READ_END] > 0) &&
       _dbus_read_socket (reload_pipe[RELOAD_READ_END], &str, 1) != 1)
     {
@@ -298,7 +307,6 @@ main (int argc, char **argv)
         }
       else if (strcmp (arg, "--session") == 0)
         {
-          is_session_bus = TRUE;
           check_two_config_files (&config_file, "session");
 
           if (!_dbus_append_session_config_file (&config_file))
@@ -455,6 +463,9 @@ main (int argc, char **argv)
       exit (1);
     }
 
+  is_session_bus = bus_context_get_type(context) != NULL
+      && strcmp(bus_context_get_type(context),"session") == 0;
+
   if (is_session_bus)
     _dbus_daemon_publish_session_bus_address (bus_context_get_address (context));
 
@@ -467,7 +478,9 @@ main (int argc, char **argv)
 #ifdef SIGHUP
   _dbus_set_signal_handler (SIGHUP, signal_handler);
 #endif
+#ifdef SIGTERM
   _dbus_set_signal_handler (SIGTERM, signal_handler);
+#endif
 #ifdef DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX 
   _dbus_set_signal_handler (SIGIO, signal_handler);
 #endif /* DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX */
index b55d6e6..1f1004b 100755 (executable)
@@ -2,7 +2,7 @@
 #
 # messagebus:   The D-BUS systemwide message bus
 #
-# chkconfig: 345 97 03
+# chkconfig: 345 22 85
 # description:  This is a daemon which broadcasts notifications of system events \
 #               and other messages. See http://www.freedesktop.org/software/dbus/
 #
index bc1d2d9..27c89ac 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "policy.h"
 #include "services.h"
 #include "test.h"
index df9a00b..fe04063 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include <dbus/dbus-internals.h>
 #include <dbus/dbus-string.h>
+#ifndef DBUS_WIN
+#include <dbus/dbus-userdb.h>
+#endif
 #include "selinux.h"
 #include "services.h"
 #include "policy.h"
 #include "utils.h"
 #include "config-parser.h"
 
-#ifdef HAVE_SELINUX
-#include <sys/types.h>
-#include <unistd.h>
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
+#ifdef HAVE_SELINUX
+#include <sys/types.h>
+#include <unistd.h>
 #include <limits.h>
 #include <pthread.h>
 #include <syslog.h>
 #include <signal.h>
 #include <stdarg.h>
 #include <stdio.h>
+#include <grp.h>
+#endif /* HAVE_SELINUX */
 #ifdef HAVE_LIBAUDIT
+#include <cap-ng.h>
 #include <libaudit.h>
 #endif /* HAVE_LIBAUDIT */
-#endif /* HAVE_SELINUX */
 
 #define BUS_SID_FROM_SELINUX(sid)  ((BusSELinuxID*) (sid))
 #define SELINUX_SID_FROM_BUS(sid)  ((security_id_t) (sid))
@@ -143,13 +150,17 @@ log_callback (const char *fmt, ...)
 #ifdef HAVE_LIBAUDIT
   if (audit_fd >= 0)
   {
-    char buf[PATH_MAX*2];
+    capng_get_caps_process();
+    if (capng_have_capability(CAPNG_EFFECTIVE, CAP_AUDIT_WRITE))
+    {
+      char buf[PATH_MAX*2];
     
-    /* FIXME: need to change this to show real user */
-    vsnprintf(buf, sizeof(buf), fmt, ap);
-    audit_log_user_avc_message(audit_fd, AUDIT_USER_AVC, buf, NULL, NULL,
+      /* FIXME: need to change this to show real user */
+      vsnprintf(buf, sizeof(buf), fmt, ap);
+      audit_log_user_avc_message(audit_fd, AUDIT_USER_AVC, buf, NULL, NULL,
                                NULL, getuid());
-    return;
+      return;
+    }
   }
 #endif /* HAVE_LIBAUDIT */
   
@@ -1010,3 +1021,74 @@ bus_selinux_shutdown (void)
 #endif /* HAVE_SELINUX */
 }
 
+/* The !HAVE_LIBAUDIT case lives in dbus-sysdeps-util-unix.c */
+#ifdef HAVE_LIBAUDIT
+/**
+ * Changes the user and group the bus is running as.
+ *
+ * @param user the user to become
+ * @param error return location for errors
+ * @returns #FALSE on failure
+ */
+dbus_bool_t
+_dbus_change_to_daemon_user  (const char    *user,
+                              DBusError     *error)
+{
+  dbus_uid_t uid;
+  dbus_gid_t gid;
+  DBusString u;
+
+  _dbus_string_init_const (&u, user);
+
+  if (!_dbus_get_user_id_and_primary_group (&u, &uid, &gid))
+    {
+      dbus_set_error (error, DBUS_ERROR_FAILED,
+                      "User '%s' does not appear to exist?",
+                      user);
+      return FALSE;
+    }
+
+  /* If we were root */
+  if (_dbus_geteuid () == 0)
+    {
+      int rc;
+
+      capng_clear (CAPNG_SELECT_BOTH);
+      capng_update (CAPNG_ADD, CAPNG_EFFECTIVE | CAPNG_PERMITTED,
+                    CAP_AUDIT_WRITE);
+      rc = capng_change_id (uid, gid, 0);
+      if (rc)
+        {
+          switch (rc) {
+            default:
+              dbus_set_error (error, DBUS_ERROR_FAILED,
+                              "Failed to drop capabilities: %s\n",
+                              _dbus_strerror (errno));
+              break;
+            case -4:
+              dbus_set_error (error, _dbus_error_from_errno (errno),
+                              "Failed to set GID to %lu: %s", gid,
+                              _dbus_strerror (errno));
+              break;
+            case -5:
+              _dbus_warn ("Failed to drop supplementary groups: %s\n",
+                          _dbus_strerror (errno));
+              break;
+            case -6:
+              dbus_set_error (error, _dbus_error_from_errno (errno),
+                              "Failed to set UID to %lu: %s", uid,
+                              _dbus_strerror (errno));
+              break;
+            case -7:
+              dbus_set_error (error, _dbus_error_from_errno (errno),
+                              "Failed to unset keep-capabilities: %s\n",
+                              _dbus_strerror (errno));
+              break;
+          }
+          return FALSE;
+        }
+    }
+
+ return TRUE;
+}
+#endif
index b260c63..0a04925 100644 (file)
@@ -21,6 +21,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include <dbus/dbus-hash.h>
 #include <dbus/dbus-list.h>
 #include <dbus/dbus-mempool.h>
index b020a76..6f97b2b 100644 (file)
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "signals.h"
 #include "services.h"
 #include "utils.h"
@@ -1018,25 +1020,173 @@ bus_match_rule_parse (DBusConnection   *matches_go_to,
   return rule;
 }
 
+typedef struct RulePool RulePool;
+struct RulePool
+{
+  /* Maps non-NULL interface names to non-NULL (DBusList **)s */
+  DBusHashTable *rules_by_iface;
+
+  /* List of BusMatchRules which don't specify an interface */
+  DBusList *rules_without_iface;
+};
+
 struct BusMatchmaker
 {
   int refcount;
 
-  DBusList *all_rules;
+  /* Pools of rules, grouped by the type of message they match. 0
+   * (DBUS_MESSAGE_TYPE_INVALID) represents rules that do not specify a message
+   * type.
+   */
+  RulePool rules_by_type[DBUS_NUM_MESSAGE_TYPES];
 };
 
+static void
+rule_list_free (DBusList **rules)
+{
+  while (*rules != NULL)
+    {
+      BusMatchRule *rule;
+
+      rule = (*rules)->data;
+      bus_match_rule_unref (rule);
+      _dbus_list_remove_link (rules, *rules);
+    }
+}
+
+static void
+rule_list_ptr_free (DBusList **list)
+{
+  /* We have to cope with NULL because the hash table frees the "existing"
+   * value (which is NULL) when creating a new table entry...
+   */
+  if (list != NULL)
+    {
+      rule_list_free (list);
+      dbus_free (list);
+    }
+}
+
 BusMatchmaker*
 bus_matchmaker_new (void)
 {
   BusMatchmaker *matchmaker;
+  int i;
 
   matchmaker = dbus_new0 (BusMatchmaker, 1);
   if (matchmaker == NULL)
     return NULL;
 
   matchmaker->refcount = 1;
-  
+
+  for (i = DBUS_MESSAGE_TYPE_INVALID; i < DBUS_NUM_MESSAGE_TYPES; i++)
+    {
+      RulePool *p = matchmaker->rules_by_type + i;
+
+      p->rules_by_iface = _dbus_hash_table_new (DBUS_HASH_STRING,
+          dbus_free, (DBusFreeFunction) rule_list_ptr_free);
+
+      if (p->rules_by_iface == NULL)
+        goto nomem;
+    }
+
   return matchmaker;
+
+ nomem:
+  for (i = DBUS_MESSAGE_TYPE_INVALID; i < DBUS_NUM_MESSAGE_TYPES; i++)
+    {
+      RulePool *p = matchmaker->rules_by_type + i;
+
+      if (p->rules_by_iface == NULL)
+        break;
+      else
+        _dbus_hash_table_unref (p->rules_by_iface);
+    }
+
+  return NULL;
+}
+
+static DBusList **
+bus_matchmaker_get_rules (BusMatchmaker *matchmaker,
+                          int            message_type,
+                          const char    *interface,
+                          dbus_bool_t    create)
+{
+  RulePool *p;
+
+  _dbus_assert (message_type >= 0);
+  _dbus_assert (message_type < DBUS_NUM_MESSAGE_TYPES);
+
+  _dbus_verbose ("Looking up rules for message_type %d, interface %s\n",
+                 message_type,
+                 interface != NULL ? interface : "<null>");
+
+  p = matchmaker->rules_by_type + message_type;
+
+  if (interface == NULL)
+    {
+      return &p->rules_without_iface;
+    }
+  else
+    {
+      DBusList **list;
+
+      list = _dbus_hash_table_lookup_string (p->rules_by_iface, interface);
+
+      if (list == NULL && create)
+        {
+          char *dupped_interface;
+
+          list = dbus_new0 (DBusList *, 1);
+          if (list == NULL)
+            return NULL;
+
+          dupped_interface = _dbus_strdup (interface);
+          if (dupped_interface == NULL)
+            {
+              dbus_free (list);
+              return NULL;
+            }
+
+          _dbus_verbose ("Adding list for type %d, iface %s\n", message_type,
+                         interface);
+
+          if (!_dbus_hash_table_insert_string (p->rules_by_iface,
+                                               dupped_interface, list))
+            {
+              dbus_free (list);
+              dbus_free (dupped_interface);
+              return NULL;
+            }
+        }
+
+      return list;
+    }
+}
+
+static void
+bus_matchmaker_gc_rules (BusMatchmaker *matchmaker,
+                         int            message_type,
+                         const char    *interface,
+                         DBusList     **rules)
+{
+  RulePool *p;
+
+  if (interface == NULL)
+    return;
+
+  if (*rules != NULL)
+    return;
+
+  _dbus_verbose ("GCing HT entry for message_type %u, interface %s\n",
+                 message_type, interface);
+
+  p = matchmaker->rules_by_type + message_type;
+
+  _dbus_assert (_dbus_hash_table_lookup_string (p->rules_by_iface, interface)
+      == rules);
+
+  _dbus_hash_table_remove_string (p->rules_by_iface, interface);
 }
 
 BusMatchmaker *
@@ -1057,14 +1207,14 @@ bus_matchmaker_unref (BusMatchmaker *matchmaker)
   matchmaker->refcount -= 1;
   if (matchmaker->refcount == 0)
     {
-      while (matchmaker->all_rules != NULL)
+      int i;
+
+      for (i = DBUS_MESSAGE_TYPE_INVALID; i < DBUS_NUM_MESSAGE_TYPES; i++)
         {
-          BusMatchRule *rule;
+          RulePool *p = matchmaker->rules_by_type + i;
 
-          rule = matchmaker->all_rules->data;
-          bus_match_rule_unref (rule);
-          _dbus_list_remove_link (&matchmaker->all_rules,
-                                  matchmaker->all_rules);
+          _dbus_hash_table_unref (p->rules_by_iface);
+          rule_list_free (&p->rules_without_iface);
         }
 
       dbus_free (matchmaker);
@@ -1076,17 +1226,31 @@ dbus_bool_t
 bus_matchmaker_add_rule (BusMatchmaker   *matchmaker,
                          BusMatchRule    *rule)
 {
+  DBusList **rules;
+
   _dbus_assert (bus_connection_is_active (rule->matches_go_to));
 
-  if (!_dbus_list_append (&matchmaker->all_rules, rule))
+  _dbus_verbose ("Adding rule with message_type %d, interface %s\n",
+                 rule->message_type,
+                 rule->interface != NULL ? rule->interface : "<null>");
+
+  rules = bus_matchmaker_get_rules (matchmaker, rule->message_type,
+                                    rule->interface, TRUE);
+
+  if (rules == NULL)
+    return FALSE;
+
+  if (!_dbus_list_append (rules, rule))
     return FALSE;
 
   if (!bus_connection_add_match_rule (rule->matches_go_to, rule))
     {
-      _dbus_list_remove_last (&matchmaker->all_rules, rule);
+      _dbus_list_remove_last (rules, rule);
+      bus_matchmaker_gc_rules (matchmaker, rule->message_type,
+                               rule->interface, rules);
       return FALSE;
     }
-  
+
   bus_match_rule_ref (rule);
 
 #ifdef DBUS_ENABLE_VERBOSE_MODE
@@ -1171,13 +1335,13 @@ match_rule_equal (BusMatchRule *a,
 }
 
 static void
-bus_matchmaker_remove_rule_link (BusMatchmaker   *matchmaker,
+bus_matchmaker_remove_rule_link (DBusList       **rules,
                                  DBusList        *link)
 {
   BusMatchRule *rule = link->data;
   
   bus_connection_remove_match_rule (rule->matches_go_to, rule);
-  _dbus_list_remove_link (&matchmaker->all_rules, link);
+  _dbus_list_remove_link (rules, link);
 
 #ifdef DBUS_ENABLE_VERBOSE_MODE
   {
@@ -1196,8 +1360,25 @@ void
 bus_matchmaker_remove_rule (BusMatchmaker   *matchmaker,
                             BusMatchRule    *rule)
 {
+  DBusList **rules;
+
+  _dbus_verbose ("Removing rule with message_type %d, interface %s\n",
+                 rule->message_type,
+                 rule->interface != NULL ? rule->interface : "<null>");
+
   bus_connection_remove_match_rule (rule->matches_go_to, rule);
-  _dbus_list_remove (&matchmaker->all_rules, rule);
+
+  rules = bus_matchmaker_get_rules (matchmaker, rule->message_type,
+                                    rule->interface, FALSE);
+
+  /* We should only be asked to remove a rule by identity right after it was
+   * added, so there should be a list for it.
+   */
+  _dbus_assert (rules != NULL);
+
+  _dbus_list_remove (rules, rule);
+  bus_matchmaker_gc_rules (matchmaker, rule->message_type, rule->interface,
+      rules);
 
 #ifdef DBUS_ENABLE_VERBOSE_MODE
   {
@@ -1218,29 +1399,38 @@ bus_matchmaker_remove_rule_by_value (BusMatchmaker   *matchmaker,
                                      BusMatchRule    *value,
                                      DBusError       *error)
 {
-  /* FIXME this is an unoptimized linear scan */
+  DBusList **rules;
+  DBusList *link = NULL;
 
-  DBusList *link;
+  _dbus_verbose ("Removing rule by value with message_type %d, interface %s\n",
+                 value->message_type,
+                 value->interface != NULL ? value->interface : "<null>");
 
-  /* we traverse backward because bus_connection_remove_match_rule()
-   * removes the most-recently-added rule
-   */
-  link = _dbus_list_get_last_link (&matchmaker->all_rules);
-  while (link != NULL)
+  rules = bus_matchmaker_get_rules (matchmaker, value->message_type,
+      value->interface, FALSE);
+
+  if (rules != NULL)
     {
-      BusMatchRule *rule;
-      DBusList *prev;
+      /* we traverse backward because bus_connection_remove_match_rule()
+       * removes the most-recently-added rule
+       */
+      link = _dbus_list_get_last_link (rules);
+      while (link != NULL)
+        {
+          BusMatchRule *rule;
+          DBusList *prev;
 
-      rule = link->data;
-      prev = _dbus_list_get_prev_link (&matchmaker->all_rules, link);
+          rule = link->data;
+          prev = _dbus_list_get_prev_link (rules, link);
 
-      if (match_rule_equal (rule, value))
-        {
-          bus_matchmaker_remove_rule_link (matchmaker, link);
-          break;
-        }
+          if (match_rule_equal (rule, value))
+            {
+              bus_matchmaker_remove_rule_link (rules, link);
+              break;
+            }
 
-      link = prev;
+          link = prev;
+        }
     }
 
   if (link == NULL)
@@ -1250,38 +1440,30 @@ bus_matchmaker_remove_rule_by_value (BusMatchmaker   *matchmaker,
       return FALSE;
     }
 
+  bus_matchmaker_gc_rules (matchmaker, value->message_type, value->interface,
+      rules);
+
   return TRUE;
 }
 
-void
-bus_matchmaker_disconnected (BusMatchmaker   *matchmaker,
-                             DBusConnection  *disconnected)
+static void
+rule_list_remove_by_connection (DBusList       **rules,
+                                DBusConnection  *connection)
 {
   DBusList *link;
 
-  /* FIXME
-   *
-   * This scans all match rules on the bus. We could avoid that
-   * for the rules belonging to the connection, since we keep
-   * a list of those; but for the rules that just refer to
-   * the connection we'd need to do something more elaborate.
-   * 
-   */
-  
-  _dbus_assert (bus_connection_is_active (disconnected));
-
-  link = _dbus_list_get_first_link (&matchmaker->all_rules);
+  link = _dbus_list_get_first_link (rules);
   while (link != NULL)
     {
       BusMatchRule *rule;
       DBusList *next;
 
       rule = link->data;
-      next = _dbus_list_get_next_link (&matchmaker->all_rules, link);
+      next = _dbus_list_get_next_link (rules, link);
 
-      if (rule->matches_go_to == disconnected)
+      if (rule->matches_go_to == connection)
         {
-          bus_matchmaker_remove_rule_link (matchmaker, link);
+          bus_matchmaker_remove_rule_link (rules, link);
         }
       else if (((rule->flags & BUS_MATCH_SENDER) && *rule->sender == ':') ||
                ((rule->flags & BUS_MATCH_DESTINATION) && *rule->destination == ':'))
@@ -1292,7 +1474,7 @@ bus_matchmaker_disconnected (BusMatchmaker   *matchmaker,
            */
           const char *name;
 
-          name = bus_connection_get_name (disconnected);
+          name = bus_connection_get_name (connection);
           _dbus_assert (name != NULL); /* because we're an active connection */
 
           if (((rule->flags & BUS_MATCH_SENDER) &&
@@ -1300,7 +1482,7 @@ bus_matchmaker_disconnected (BusMatchmaker   *matchmaker,
               ((rule->flags & BUS_MATCH_DESTINATION) &&
                strcmp (rule->destination, name) == 0))
             {
-              bus_matchmaker_remove_rule_link (matchmaker, link);
+              bus_matchmaker_remove_rule_link (rules, link);
             }
         }
 
@@ -1308,6 +1490,44 @@ bus_matchmaker_disconnected (BusMatchmaker   *matchmaker,
     }
 }
 
+void
+bus_matchmaker_disconnected (BusMatchmaker   *matchmaker,
+                             DBusConnection  *connection)
+{
+  int i;
+
+  /* FIXME
+   *
+   * This scans all match rules on the bus. We could avoid that
+   * for the rules belonging to the connection, since we keep
+   * a list of those; but for the rules that just refer to
+   * the connection we'd need to do something more elaborate.
+   */
+
+  _dbus_assert (bus_connection_is_active (connection));
+
+  _dbus_verbose ("Removing all rules for connection %p\n", connection);
+
+  for (i = DBUS_MESSAGE_TYPE_INVALID; i < DBUS_NUM_MESSAGE_TYPES; i++)
+    {
+      RulePool *p = matchmaker->rules_by_type + i;
+      DBusHashIter iter;
+
+      rule_list_remove_by_connection (&p->rules_without_iface, connection);
+
+      _dbus_hash_iter_init (p->rules_by_iface, &iter);
+      while (_dbus_hash_iter_next (&iter))
+        {
+          DBusList **items = _dbus_hash_iter_get_value (&iter);
+
+          rule_list_remove_by_connection (items, connection);
+
+          if (*items == NULL)
+            _dbus_hash_iter_remove_entry (&iter);
+        }
+    }
+}
+
 static dbus_bool_t
 connection_is_primary_owner (DBusConnection *connection,
                              const char     *service_name)
@@ -1333,8 +1553,11 @@ static dbus_bool_t
 match_rule_matches (BusMatchRule    *rule,
                     DBusConnection  *sender,
                     DBusConnection  *addressed_recipient,
-                    DBusMessage     *message)
+                    DBusMessage     *message,
+                    BusMatchFlags    already_matched)
 {
+  int flags;
+
   /* All features of the match rule are AND'd together,
    * so FALSE if any of them don't match.
    */
@@ -1343,8 +1566,11 @@ match_rule_matches (BusMatchRule    *rule,
    * or for addressed_recipient may mean a message with no
    * specific recipient (i.e. a signal)
    */
-  
-  if (rule->flags & BUS_MATCH_MESSAGE_TYPE)
+
+  /* Don't bother re-matching features we've already checked implicitly. */
+  flags = rule->flags & (~already_matched);
+
+  if (flags & BUS_MATCH_MESSAGE_TYPE)
     {
       _dbus_assert (rule->message_type != DBUS_MESSAGE_TYPE_INVALID);
 
@@ -1352,7 +1578,7 @@ match_rule_matches (BusMatchRule    *rule,
         return FALSE;
     }
 
-  if (rule->flags & BUS_MATCH_INTERFACE)
+  if (flags & BUS_MATCH_INTERFACE)
     {
       const char *iface;
 
@@ -1366,7 +1592,7 @@ match_rule_matches (BusMatchRule    *rule,
         return FALSE;
     }
 
-  if (rule->flags & BUS_MATCH_MEMBER)
+  if (flags & BUS_MATCH_MEMBER)
     {
       const char *member;
 
@@ -1380,7 +1606,7 @@ match_rule_matches (BusMatchRule    *rule,
         return FALSE;
     }
 
-  if (rule->flags & BUS_MATCH_SENDER)
+  if (flags & BUS_MATCH_SENDER)
     {
       _dbus_assert (rule->sender != NULL);
 
@@ -1397,7 +1623,7 @@ match_rule_matches (BusMatchRule    *rule,
         }
     }
 
-  if (rule->flags & BUS_MATCH_DESTINATION)
+  if (flags & BUS_MATCH_DESTINATION)
     {
       const char *destination;
 
@@ -1420,7 +1646,7 @@ match_rule_matches (BusMatchRule    *rule,
         }
     }
 
-  if (rule->flags & BUS_MATCH_PATH)
+  if (flags & BUS_MATCH_PATH)
     {
       const char *path;
 
@@ -1434,7 +1660,7 @@ match_rule_matches (BusMatchRule    *rule,
         return FALSE;
     }
 
-  if (rule->flags & BUS_MATCH_ARGS)
+  if (flags & BUS_MATCH_ARGS)
     {
       int i;
       DBusMessageIter iter;
@@ -1504,38 +1730,19 @@ match_rule_matches (BusMatchRule    *rule,
   return TRUE;
 }
 
-dbus_bool_t
-bus_matchmaker_get_recipients (BusMatchmaker   *matchmaker,
-                               BusConnections  *connections,
-                               DBusConnection  *sender,
-                               DBusConnection  *addressed_recipient,
-                               DBusMessage     *message,
-                               DBusList       **recipients_p)
+static dbus_bool_t
+get_recipients_from_list (DBusList       **rules,
+                          DBusConnection  *sender,
+                          DBusConnection  *addressed_recipient,
+                          DBusMessage     *message,
+                          DBusList       **recipients_p)
 {
-  /* FIXME for now this is a wholly unoptimized linear search */
-  /* Guessing the important optimization is to skip the signal-related
-   * match lists when processing method call and exception messages.
-   * So separate match rule lists for signals?
-   */
-  
   DBusList *link;
 
-  _dbus_assert (*recipients_p == NULL);
+  if (rules == NULL)
+    return TRUE;
 
-  /* This avoids sending same message to the same connection twice.
-   * Purpose of the stamp instead of a bool is to avoid iterating over
-   * all connections resetting the bool each time.
-   */
-  bus_connections_increment_stamp (connections);
-
-  /* addressed_recipient is already receiving the message, don't add to list.
-   * NULL addressed_recipient means either bus driver, or this is a signal
-   * and thus lacks a specific addressed_recipient.
-   */
-  if (addressed_recipient != NULL)
-    bus_connection_mark_stamp (addressed_recipient);
-
-  link = _dbus_list_get_first_link (&matchmaker->all_rules);
+  link = _dbus_list_get_first_link (rules);
   while (link != NULL)
     {
       BusMatchRule *rule;
@@ -1545,23 +1752,24 @@ bus_matchmaker_get_recipients (BusMatchmaker   *matchmaker,
 #ifdef DBUS_ENABLE_VERBOSE_MODE
       {
         char *s = match_rule_to_string (rule);
-        
+
         _dbus_verbose ("Checking whether message matches rule %s for connection %p\n",
                        s, rule->matches_go_to);
         dbus_free (s);
       }
 #endif
-      
+
       if (match_rule_matches (rule,
-                              sender, addressed_recipient, message))
+                              sender, addressed_recipient, message,
+                              BUS_MATCH_MESSAGE_TYPE | BUS_MATCH_INTERFACE))
         {
           _dbus_verbose ("Rule matched\n");
-          
+
           /* Append to the list if we haven't already */
           if (bus_connection_mark_stamp (rule->matches_go_to))
             {
               if (!_dbus_list_append (recipients_p, rule->matches_go_to))
-                goto nomem;
+                return FALSE;
             }
 #ifdef DBUS_ENABLE_VERBOSE_MODE
           else
@@ -1571,14 +1779,72 @@ bus_matchmaker_get_recipients (BusMatchmaker   *matchmaker,
 #endif /* DBUS_ENABLE_VERBOSE_MODE */
         }
 
-      link = _dbus_list_get_next_link (&matchmaker->all_rules, link);
+      link = _dbus_list_get_next_link (rules, link);
     }
 
   return TRUE;
+}
 
- nomem:
-  _dbus_list_clear (recipients_p);
-  return FALSE;
+dbus_bool_t
+bus_matchmaker_get_recipients (BusMatchmaker   *matchmaker,
+                               BusConnections  *connections,
+                               DBusConnection  *sender,
+                               DBusConnection  *addressed_recipient,
+                               DBusMessage     *message,
+                               DBusList       **recipients_p)
+{
+  int type;
+  const char *interface;
+  DBusList **neither, **just_type, **just_iface, **both;
+
+  _dbus_assert (*recipients_p == NULL);
+
+  /* This avoids sending same message to the same connection twice.
+   * Purpose of the stamp instead of a bool is to avoid iterating over
+   * all connections resetting the bool each time.
+   */
+  bus_connections_increment_stamp (connections);
+
+  /* addressed_recipient is already receiving the message, don't add to list.
+   * NULL addressed_recipient means either bus driver, or this is a signal
+   * and thus lacks a specific addressed_recipient.
+   */
+  if (addressed_recipient != NULL)
+    bus_connection_mark_stamp (addressed_recipient);
+
+  type = dbus_message_get_type (message);
+  interface = dbus_message_get_interface (message);
+
+  neither = bus_matchmaker_get_rules (matchmaker, DBUS_MESSAGE_TYPE_INVALID,
+      NULL, FALSE);
+  just_type = just_iface = both = NULL;
+
+  if (interface != NULL)
+    just_iface = bus_matchmaker_get_rules (matchmaker,
+        DBUS_MESSAGE_TYPE_INVALID, interface, FALSE);
+
+  if (type > DBUS_MESSAGE_TYPE_INVALID && type < DBUS_NUM_MESSAGE_TYPES)
+    {
+      just_type = bus_matchmaker_get_rules (matchmaker, type, NULL, FALSE);
+
+      if (interface != NULL)
+        both = bus_matchmaker_get_rules (matchmaker, type, interface, FALSE);
+    }
+
+  if (!(get_recipients_from_list (neither, sender, addressed_recipient,
+                                  message, recipients_p) &&
+        get_recipients_from_list (just_iface, sender, addressed_recipient,
+                                  message, recipients_p) &&
+        get_recipients_from_list (just_type, sender, addressed_recipient,
+                                  message, recipients_p) &&
+        get_recipients_from_list (both, sender, addressed_recipient,
+                                  message, recipients_p)))
+    {
+      _dbus_list_clear (recipients_p);
+      return FALSE;
+    }
+
+  return TRUE;
 }
 
 #ifdef DBUS_BUILD_TESTS
@@ -1943,7 +2209,7 @@ check_matches (dbus_bool_t  expected_to_match,
   _dbus_assert (rule != NULL);
 
   /* We can't test sender/destination rules since we pass NULL here */
-  matched = match_rule_matches (rule, NULL, NULL, message);
+  matched = match_rule_matches (rule, NULL, NULL, message, 0);
 
   if (matched != expected_to_match)
     {
index 4ea1075..eeb1d2d 100644 (file)
@@ -77,7 +77,7 @@ dbus_bool_t bus_matchmaker_remove_rule_by_value (BusMatchmaker   *matchmaker,
 void        bus_matchmaker_remove_rule          (BusMatchmaker   *matchmaker,
                                                  BusMatchRule    *rule);
 void        bus_matchmaker_disconnected         (BusMatchmaker   *matchmaker,
-                                                 DBusConnection  *disconnected);
+                                                 DBusConnection  *connection);
 dbus_bool_t bus_matchmaker_get_recipients       (BusMatchmaker   *matchmaker,
                                                  BusConnections  *connections,
                                                  DBusConnection  *sender,
index d78ca51..ab36b6e 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "test.h"
 #include "activation-helper.h"
 
index 000bdd5..cb0ed00 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "test.h"
 #include <stdio.h>
 #include <stdlib.h>
index 6224ab5..56a7d4e 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "test.h"
 #include <stdio.h>
 #include <stdlib.h>
index 090768c..45024e6 100644 (file)
@@ -24,8 +24,6 @@
 #ifndef BUS_TEST_H
 #define BUS_TEST_H
 
-#include <config.h>
-
 #ifdef DBUS_BUILD_TESTS
 
 #include <dbus/dbus.h>
index d0a290c..1bae290 100644 (file)
@@ -35,8 +35,6 @@ endif (CYGWIN)
 if (WIN32)
     # include local header first to avoid using old installed header
     set (CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/..)
-    find_package(KDEWIN)
-    find_package(KDEWIN_Packager)
        find_package(LibIconv)
     include(Win32Macros)
     addExplorerWrapper(${CMAKE_PROJECT_NAME})
@@ -45,16 +43,12 @@ find_package(LibXml2)
 find_package(LibExpat)
 find_package(X11)
 
+if(NOT WIN32)
+       OPTION(DBUS_ENABLE_ABSTRACT_SOCKETS "enable support for abstract sockets" ON)
+endif(NOT WIN32)
 
-OPTION(DBUS_ENABLE_ABSTRACT_SOCKETS "enable support for abstract sockets" ON)
-
-if (MINGW)
-    set (DBUS_VA_COPY_AS_ARRAY 1)
-endif (MINGW)
-if (MSVC)
-    set (DBUS_HAVE_VA_COPY 1)
-    set (DBUS_VA_COPY_AS_ARRAY 0)
-endif (MSVC)
+#AC_ARG_ENABLE(asserts, AS_HELP_STRING([--enable-asserts],[include assertion checks]),enable_asserts=$enableval,enable_asserts=$USE_MAINTAINER_MODE)
+OPTION(DBUS_DISABLE_ASSERTS "Disable assertion checking" OFF)
 
 # do config checks
 INCLUDE(ConfigureChecks.cmake)
@@ -70,50 +64,53 @@ if(VCS)
        set(DBUS_VERBOSE_C_S 1)
 endif(VCS)
 
-if(MSVC)
-       # controll folders in msvc projects
-       include(ProjectSourceGroup)
-       if(NOT GROUP_CODE)
-               #set(GROUP_CODE split) #cmake default
-               set(GROUP_CODE flat)
-       endif(NOT GROUP_CODE)
-       ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
-
-
-       # Use the highest warning level
-       if (WALL)
-               set(WALL 1 CACHE TYPE STRING FORCE)
-               set(CMAKE_CXX_WARNING_LEVEL 4 CACHE TYPE STRING FORCE)
-
-               if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
-                       STRING(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
-               else(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
-                       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
-               endif(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
-
-               if(CMAKE_C_FLAGS MATCHES "/W[0-4]")
-                       STRING(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
-               else(CMAKE_C_FLAGS MATCHES "/W[0-4]")
-                       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
-               endif(CMAKE_C_FLAGS MATCHES "/W[0-4]")
-       else (WALL)
-               set(CMAKE_CXX_WARNING_LEVEL 3 CACHE TYPE STRING FORCE)
-       endif (WALL)
-
-       SET(MSVC_W_ERROR   " /we4028 /we4013 /we4133 /we4047 /we4031 /we4002 /we4003 /we4114")
-       SET(MSVC_W_DISABLE " /wd4127 /wd4090 /wd4101 /wd4244")
-
-       SET(CMAKE_C_FLAGS_DEBUG   "${CMAKE_C_FLAGS_DEBUG}   /FIconfig.h ${MSVC_W_ERROR} ${MSVC_W_DISABLE}")
-       SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /FIconfig.h ${MSVC_W_ERROR} ${MSVC_W_DISABLE}")
-
-   # used by executables, CMAKE_DEBUG_POSTFIX does not handle this case
-   #set (CMAKE_EXE_POSTFIX "d")
-
-endif(MSVC)
 if(WIN32)
-  set (CMAKE_DEBUG_POSTFIX "d")
+       set(CMAKE_DEBUG_POSTFIX "d")
+       if(MSVC)
+               # controll folders in msvc projects
+               include(ProjectSourceGroup)
+               if(NOT GROUP_CODE)
+                       #set(GROUP_CODE split) #cmake default
+                       set(GROUP_CODE flat)
+               endif(NOT GROUP_CODE)
+               ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
+
+
+               # Use the highest warning level
+               if (WALL)
+                       set(WALL 1 CACHE TYPE STRING FORCE)
+                       set(CMAKE_CXX_WARNING_LEVEL 4 CACHE TYPE STRING FORCE)
+
+                       if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
+                               STRING(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+                       else(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
+                               SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
+                       endif(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
+
+                       if(CMAKE_C_FLAGS MATCHES "/W[0-4]")
+                               STRING(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+                       else(CMAKE_C_FLAGS MATCHES "/W[0-4]")
+                               SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
+                       endif(CMAKE_C_FLAGS MATCHES "/W[0-4]")
+               else (WALL)
+                       set(CMAKE_CXX_WARNING_LEVEL 3 CACHE TYPE STRING FORCE)
+               endif (WALL)
+
+               SET(MSVC_W_ERROR   " /we4028 /we4013 /we4133 /we4047 /we4031 /we4002 /we4003 /we4114")
+               SET(MSVC_W_DISABLE " /wd4127 /wd4090 /wd4101 /wd4244")
+
+               SET(CMAKE_C_FLAGS_DEBUG   "${CMAKE_C_FLAGS_DEBUG}   /FIconfig.h ${MSVC_W_ERROR} ${MSVC_W_DISABLE}")
+               SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /FIconfig.h ${MSVC_W_ERROR} ${MSVC_W_DISABLE}")
+       endif(MSVC)
 endif(WIN32)
 
+if (UNIX AND NOT DBUS_DISABLE_ASSERTS)
+       # required for backtrace
+       SET(CMAKE_C_FLAGS_DEBUG   "${CMAKE_C_FLAGS_DEBUG}   -Wl,--export-dynamic")
+       SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wl,--export-dynamic")
+       add_definitions(-DDBUS_BUILT_R_DYNAMIC)
+endif (UNIX AND NOT DBUS_DISABLE_ASSERTS)
+
 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}  -D_DEBUG")
 
 #########################################################################
@@ -200,39 +197,28 @@ ENABLE_TESTING()
 ########### basic vars ###############
 
 if (DBUSDIR)
-       set(DBUS_INSTALL_DIR "${DBUSDIR}" CACHE TYPE STRING)
-else (DBUSDIR)
-       set(DBUS_INSTALL_DIR "$ENV{DBUSDIR}" CACHE TYPE STRING)
+       set(DBUS_INSTALL_DIR "${DBUSDIR}")
 endif (DBUSDIR)
-
-if (NOT DBUS_INSTALL_DIR)
-       set(DBUS_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE TYPE STRING)
-endif (NOT DBUS_INSTALL_DIR)
-
-# TODO: setting EXPANDED_... has nothing to do with DBUS_INSTALL_SYSTEM_LIBS
-if (DBUS_INSTALL_SYSTEM_LIBS)
-       set(prefix                   ${DBUS_INSTALL_DIR})
-       set(exec_prefix              ${prefix})
-       set(EXPANDED_LIBDIR          ${DBUS_INSTALL_DIR}/lib)
-       set(EXPANDED_INCLUDEDIR      ${DBUS_INSTALL_DIR}/include)
-       set(EXPANDED_BINDIR          ${DBUS_INSTALL_DIR}/bin)
-       set(EXPANDED_SYSCONFDIR      ${DBUS_INSTALL_DIR}/etc)
-       set(EXPANDED_DATADIR         ${DBUS_INSTALL_DIR}/data)
-       set(DBUS_BINDIR              ${EXPANDED_BINDIR})
-       set(DBUS_MACHINE_UUID_FILE   ${DBUS_INSTALL_DIR}/lib/dbus/machine-id)
-else (DBUS_INSTALL_SYSTEM_LIBS)
-       set(EXPANDED_INCLUDEDIR      ${CMAKE_SOURCE_DIR}/include)
-       set(EXPANDED_DATADIR         ${CMAKE_BINARY_DIR}/test/data)
-       if (MSVC_IDE)
-               set(EXPANDED_BINDIR      ${CMAKE_BINARY_DIR}/bin/debug)
-       else (MSVC_IDE)
-               set(EXPANDED_BINDIR      ${CMAKE_BINARY_DIR}/bin)
-       endif (MSVC_IDE)
-       set(DBUS_BINDIR              ${EXPANDED_BINDIR})
-       set(DBUS_MACHINE_UUID_FILE   ${CMAKE_BINARY_DIR}/lib/dbus/machine-id)
-endif (DBUS_INSTALL_SYSTEM_LIBS)
-
-set (DBUS_DAEMONDIR ${EXPANDED_BINDIR})
+if ($ENV{DBUSDIR})
+       set(DBUS_INSTALL_DIR "$ENV{DBUSDIR}")
+endif ($ENV{DBUSDIR})
+
+if (DBUS_INSTALL_DIR)
+       set(CMAKE_INSTALL_PREFIX "${DBUS_INSTALL_DIR}" CACHE TYPE PATH FORCE)
+else (DBUS_INSTALL_DIR)
+       set(DBUS_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}")
+endif (DBUS_INSTALL_DIR)
+
+set(prefix                   ${DBUS_INSTALL_DIR})
+set(exec_prefix              ${prefix})
+set(EXPANDED_LIBDIR          ${DBUS_INSTALL_DIR}/lib)
+set(EXPANDED_INCLUDEDIR      ${DBUS_INSTALL_DIR}/include)
+set(EXPANDED_BINDIR          ${DBUS_INSTALL_DIR}/bin)
+set(EXPANDED_SYSCONFDIR      ${DBUS_INSTALL_DIR}/etc)
+set(EXPANDED_DATADIR         ${DBUS_INSTALL_DIR}/data)
+set(DBUS_MACHINE_UUID_FILE   ${DBUS_INSTALL_DIR}/lib/dbus/machine-id)
+set(DBUS_BINDIR              ${EXPANDED_BINDIR})
+set(DBUS_DAEMONDIR                      ${EXPANDED_BINDIR})
 
 ########### command line options ###############
 # TODO: take check from configure.in
@@ -249,8 +235,10 @@ if(DBUS_USE_OUTPUT_DEBUG_STRING)
     add_definitions(-DDBUS_USE_OUTPUT_DEBUG_STRING)
 endif(DBUS_USE_OUTPUT_DEBUG_STRING)
 
-# win32 dbus service support - this support is not complete
-OPTION(DBUS_SERVICE "enable dbus service installer" OFF)
+if(WIN32)
+       # win32 dbus service support - this support is not complete
+       OPTION(DBUS_SERVICE "enable dbus service installer" OFF)
+endif(WIN32)
 
 #AC_ARG_ENABLE(ansi, AS_HELP_STRING([--enable-ansi],[enable -ansi -pedantic gcc flags]),enable_ansi=$enableval,enable_ansi=no)
 OPTION(DBUS_ENABLE_ANSI "enable -ansi -pedantic gcc flags" OFF)
@@ -265,25 +253,22 @@ endif(DBUS_ENABLE_ANSI)
 #AC_ARG_ENABLE(verbose-mode, AS_HELP_STRING([--enable-verbose-mode],[support verbose debug mode]),enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
 OPTION(DBUS_ENABLE_VERBOSE_MODE "support verbose debug mode" ON)
 
-#AC_ARG_ENABLE(asserts, AS_HELP_STRING([--enable-asserts],[include assertion checks]),enable_asserts=$enableval,enable_asserts=$USE_MAINTAINER_MODE)
-OPTION(DBUS_DISABLE_ASSERTS "Disable assertion checking" OFF)
-
 #AC_ARG_ENABLE(checks, AS_HELP_STRING([--enable-checks],[include sanity checks on public API]),enable_checks=$enableval,enable_checks=yes)
 OPTION(DBUS_DISABLE_CHECKS "Disable public API sanity checking" OFF)
 
-#AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov],[compile with coverage profiling instrumentation (gcc only)]),enable_gcov=$enableval,enable_gcov=no)
-OPTION(DBUS_GCOV_ENABLED "compile with coverage profiling instrumentation (gcc only)" OFF)
-if(DBUS_GCOV_ENABLED)
-   if(NOT MSVC)
-        add_definitions(-fprofile-arcs -ftest-coverage)
-        # FIXME!!!!
-        ## remove optimization
-#        CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
-   endif(NOT MSVC)
-endif(DBUS_GCOV_ENABLED)
+if(NOT MSVC)
+    #AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov],[compile with coverage profiling instrumentation (gcc only)]),enable_gcov=$enableval,enable_gcov=no)
+    OPTION(DBUS_GCOV_ENABLED "compile with coverage profiling instrumentation (gcc only)" OFF)
+    if(DBUS_GCOV_ENABLED)
+            add_definitions(-fprofile-arcs -ftest-coverage)
+            # FIXME!!!!
+            ## remove optimization
+    #        CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
+    endif(DBUS_GCOV_ENABLED)
+endif(NOT MSVC)
 
 #AC_ARG_ENABLE(abstract-sockets, AS_HELP_STRING([--enable-abstract-sockets],[use abstract socket namespace (linux only)]),enable_abstract_sockets=$enableval,enable_abstract_sockets=auto)
-#abstract sockets missing
+# -> moved before include(ConfigureChecks.cmake)
 
 #AC_ARG_ENABLE(selinux, AS_HELP_STRING([--enable-selinux],[build with SELinux support]),enable_selinux=$enableval,enable_selinux=auto)
 #selinux missing
@@ -479,7 +464,7 @@ else (WIN32)
   set (DBUS_DATADIR ${EXPANDED_DATADIR})
 endif (WIN32)
 
-set (DAEMON_NAME dbus-daemon)
+set(DBUS_DAEMON_NAME dbus-daemon CACHE STRING "The name of the dbus daemon executable")
 
 ########### create config.h ###############
 
@@ -490,41 +475,41 @@ if (MINGW)
        set (HAVE_GNUC_VARARGS 1)
 endif(MINGW)
 
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dbus-env.bat.cmake ${CMAKE_BINARY_DIR}/bin/dbus-env.bat )
-install_files(/bin FILES ${CMAKE_BINARY_DIR}/bin/dbus-env.bat)
-
 # compiler definitions
 add_definitions(-DHAVE_CONFIG_H=1)
 add_definitions(${DBUS_BUS_CFLAGS} -DDBUS_API_SUBJECT_TO_CHANGE)
 
 
-option(splitlib "split library into dbus-lib-client, dbus-lib-generic, and dbus-lib-util, no installing possible" OFF)
-if(splitlib AND MSVC)
-       # does not work with GCC/ld
-       set(DBUS_1 dbus-lib-client dbus-lib-generic dbus-lib-util)
-       message(STATUS "")
-       message(STATUS "dbus library is splitted into dbus-lib-client, dbus-lib-generic, and dbus-lib-util")
-       message(STATUS "installing is not possible")
-       message(STATUS "disable splitting: -Dsplitlib=0")
-       message(STATUS "")
-else(splitlib AND MSVC)
-       message(STATUS "")
-       message(STATUS "for better code reading the dbus library could be splitted into three libraries:")
-       message(STATUS "dbus-lib-client, dbus-lib-generic, and dbus-lib-util (installing is then not possible)")
-       message(STATUS "enable splitting: -Dsplitlib=1")
-       message(STATUS "")
-       set(DBUS_1 dbus-1)
-endif(splitlib AND MSVC)
-
 if (DBUS_BUILD_TESTS)
     # set variables used for the .in files (substituted by configure_file) in test/data:
     set(TEST_VALID_SERVICE_DIR ${CMAKE_BINARY_DIR}/test/data/valid-service-files)
     set(TEST_VALID_SERVICE_SYSTEM_DIR ${CMAKE_BINARY_DIR}/test/data/valid-service-files-system)
     set(TEST_SOCKET_DIR ${DBUS_SESSION_SOCKET_DIR} )
     set(TEST_LAUNCH_HELPER_BINARY ${EXECUTABLE_OUTPUT_PATH}/dbus-daemon-launch-helper-test)
+    if (UNIX)
+        set (TEST_LISTEN "debug-pipe:name=test-server")
+        set (TEST_CONNECTION "${TEST_LISTEN}")
+    endif (UNIX)
+    if (WIN32)
+        set (TEST_LISTEN "tcp:host=localhost,port=12436")
+        set (TEST_CONNECTION "${TEST_LISTEN}")
+    endif (WIN32)
 endif  (DBUS_BUILD_TESTS)
 
+set(DBUS_LIBRARIES dbus-1)
+set(DBUS_INTERNAL_LIBRARIES dbus-internal)
+
+# settings for building and using static internal lib
+# important note: DBUS_INTERNAL_xxxxx_DEFINITIONS must *not* be set when building dbus-1 library
+set (DBUS_INTERNAL_ADD_LIBRARY_OPTIONS STATIC)
+set (DBUS_INTERNAL_LIBRARY_DEFINITIONS "-DDBUS_STATIC_BUILD")
+set (DBUS_INTERNAL_CLIENT_DEFINITIONS "-DDBUS_STATIC_BUILD")
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dbus-env.bat.cmake ${CMAKE_BINARY_DIR}/bin/dbus-env.bat )
+install_files(/bin FILES ${CMAKE_BINARY_DIR}/bin/dbus-env.bat)
+
+
 ########### subdirs ###############
 
 add_subdirectory( dbus )
@@ -548,14 +533,15 @@ GET_FILENAME_COMPONENT(CXX_COMPILER ${CMAKE_CXX_COMPILER} NAME)
 message("                  D-BUS ${DBUS_VERSION}                               ")
 message("                  ===========                                         ")
 message("                                                                      ")
-message("        prefix:                   ${prefix}                           ")
-message("        exec_prefix:              ${exec_prefix}                      ")
-message("        libdir:                   ${EXPANDED_LIBDIR}                  ")
-message("        bindir:                   ${EXPANDED_BINDIR}                  ")
-message("        sysconfdir:               ${EXPANDED_SYSCONFDIR}              ")
-message("        localstatedir:            ${EXPANDED_LOCALSTATEDIR}           ")
-message("        datadir:                  ${EXPANDED_DATADIR}                 ")
+message("        install prefix:           ${prefix}                           ")
+message("        install exec_prefix:      ${exec_prefix}                      ")
+message("        install libdir:           ${EXPANDED_LIBDIR}                  ")
+message("        install bindir:           ${EXPANDED_BINDIR}                  ")
+message("        install sysconfdir:       ${EXPANDED_SYSCONFDIR}              ")
+#message("        install localstatedir:    ${EXPANDED_LOCALSTATEDIR}           ")
+message("        install datadir:          ${EXPANDED_DATADIR}                 ")
 message("        source code location:     ${DBUS_SOURCE_DIR}                  ")
+message("        build dir:                ${CMAKE_BINARY_DIR}                 ")
 message("        c compiler:               ${C_COMPILER}                       ")
 message("        cflags:                   ${CMAKE_C_FLAGS}                    ")
 message("        cflags debug:             ${CMAKE_C_FLAGS_DEBUG}              ")
@@ -568,7 +554,7 @@ message("        64-bit int:               ${DBUS_INT64_TYPE}                  "
 message("        32-bit int:               ${DBUS_INT32_TYPE}                  ")
 message("        16-bit int:               ${DBUS_INT16_TYPE}                  ")
 message("        Doxygen:                  ${DOXYGEN}                          ")
-message("        xmlto:                    ${XMLTO}                            ")
+message("        Docbook Generator:        ${DOCBOOK_GENERATOR_NAME}           ")
 
 
 #message("        Maintainer mode:          ${USE_MAINTAINER_MODE}              ")
@@ -581,9 +567,10 @@ message("        installing system libs:   ${DBUS_INSTALL_SYSTEM_LIBS}         "
 #message("        Building SELinux support: ${have_selinux}                     ")
 #message("        Building dnotify support: ${have_dnotify}                     ")
 message("        Building Doxygen docs:    ${DBUS_ENABLE_DOXYGEN_DOCS}         ")
-#message("        Building XML docs:        ${enable_xml_docs}                  ")
+message("        Building XML docs:        ${DBUS_ENABLE_XML_DOCS}             ")
 #message("        Gettext libs (empty OK):  ${INTLLIBS}                         ")
 message("        Using XML parser:         ${XML_LIB}                          ")
+message("        Daemon executable name:   ${DBUS_DAEMON_NAME}")
 if (WIN32)
 message("        System bus address:       ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS}  ")
 message("        Session bus address:      ${DBUS_SESSION_BUS_DEFAULT_ADDRESS} ")
@@ -598,6 +585,7 @@ message("        Console auth dir:         ${DBUS_CONSOLE_AUTH_DIR}            "
 message("        System bus user:          ${DBUS_USER}                        ")
 message("        'make check' socket dir:  ${TEST_SOCKET_DIR}                  ")
 endif (WIN32)
+message("        Test listen address:      ${TEST_LISTEN}                      ")
 if (MSVC)
 message("        build timestamp:          ${DBUS_BUILD_TIMESTAMP}             ")
 endif (MSVC)
@@ -629,7 +617,3 @@ endif(DBUS_DISABLE_CHECKS)
 MESSAGE(" ")
 
 INCLUDE(modules/CPackInstallConfig.cmake)
-
-if (KDEWIN_PACKAGER_FOUND)
-    KDEWIN_PACKAGER(${CMAKE_PROJECT_NAME} ${DBUS_VERSION} "ipc library" "")
-endif (KDEWIN_PACKAGER_FOUND)
index 1e83d80..c4e3359 100644 (file)
@@ -15,6 +15,8 @@ check_include_file(unistd.h     HAVE_UNISTD_H)  # dbus-sysdeps-util-win.c
 check_include_file(stdio.h      HAVE_STDIO_H)   # dbus-sysdeps.h
 check_include_file(sys/syslimits.h    HAVE_SYS_SYSLIMITS_H)   # dbus-sysdeps-unix.c
 check_include_file(errno.h     HAVE_ERRNO_H)    # dbus-sysdeps.c
+check_include_file(signal.h     HAVE_SIGNAL_H)
+check_include_file(locale.h     HAVE_LOCALE_H)
 
 check_symbol_exists(backtrace    "execinfo.h"       HAVE_BACKTRACE)          #  dbus-sysdeps.c, dbus-sysdeps-win.c
 check_symbol_exists(getgrouplist "grp.h"            HAVE_GETGROUPLIST)       #  dbus-sysdeps.c
@@ -90,7 +92,8 @@ if(MSVC)
    SET(DBUS_VA_COPY_FUNC "_DBUS_VA_COPY_ASSIGN";)
 else(MSVC)
 write_file("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/cmake_try_compile.c" "#include <stdarg.h>
-       void f (int i, ...) {
+       #include <stdlib.h>
+        static void f (int i, ...) {
        va_list args1, args2;
        va_start (args1, i);
        va_copy (args2, args1);
@@ -111,7 +114,8 @@ if(DBUS_HAVE_VA_COPY)
   SET(DBUS_VA_COPY_FUNC va_copy CACHE STRING "va_copy function")
 else(DBUS_HAVE_VA_COPY)
   write_file("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/cmake_try_compile.c" "#include <stdarg.h>
-         void f (int i, ...) {
+          #include <stdlib.h>
+         static void f (int i, ...) {
          va_list args1, args2;
          va_start (args1, i);
          __va_copy (args2, args1);
index 9bdfde8..e00984e 100644 (file)
@@ -148,7 +148,8 @@ PREDEFINED             = "DBUS_BEGIN_DECLS="                        \
                         "DOXYGEN_SHOULD_SKIP_THIS"             \
                          "DBUS_GNUC_DEPRECATED="                \
                         "_DBUS_DEFINE_GLOBAL_LOCK(name)="      \
-                        "_DBUS_GNUC_PRINTF(from,to)="
+                        "_DBUS_GNUC_PRINTF(from,to)=" \
+                        "DBUS_EXPORT="
 SKIP_FUNCTION_MACROS   = YES
 #---------------------------------------------------------------------------
 # Configuration::addtions related to external references   
index 059b841..1cfd147 100644 (file)
@@ -76,19 +76,11 @@ set (BUS_SOURCES
 )
 
 include_directories(${XML_INCLUDE_DIR})
-SET (LIBS ${XML_LIBRARY})
-
-if(splitlib AND MSVC)
-       add_library(bus-lib STATIC ${BUS_SOURCES})
-       add_executable(dbus-daemon ${BUS_DIR}/main.c)
-       target_link_libraries(dbus-daemon ${DBUS_1} ${LIBS} bus-lib)
-else(splitlib AND MSVC)
-       add_executable(dbus-daemon ${BUS_SOURCES} ${BUS_DIR}/main.c)
-       target_link_libraries(dbus-daemon ${DBUS_1} ${LIBS})
-endif(splitlib AND MSVC)
-if(WIN32)
-    set_target_properties(dbus-daemon PROPERTIES DEBUG_POSTFIX d)
-endif(WIN32)
+
+add_executable(dbus-daemon ${BUS_SOURCES} ${BUS_DIR}/main.c)
+target_link_libraries(dbus-daemon ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY})
+set_target_properties(dbus-daemon PROPERTIES OUTPUT_NAME ${DBUS_DAEMON_NAME})
+set_target_properties(dbus-daemon PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
 
 install_targets(/bin dbus-daemon)
 install_files(/etc FILES ${config_DATA})
@@ -102,36 +94,15 @@ if (DBUS_SERVICE)
        )
 
        add_executable(dbus-service ${dbus_service_SOURCES} )
-       target_link_libraries(dbus-service ${DBUS_1} ${LIBS})
+       target_link_libraries(dbus-service ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY})
+       set_target_properties(dbus-service PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
        install_targets(/bin dbus-service )
-       if(WIN32)
-          set_target_properties(dbus-service PROPERTIES DEBUG_POSTFIX d)
-    endif(WIN32)
 endif (DBUS_SERVICE)
 
-## note that TESTS has special meaning (stuff to use in make check)
-## so if adding tests not to be run in make check, don't add them to 
-## TESTS
-#if DBUS_BUILD_TESTS
-#TESTS_ENVIRONMENT=DBUS_TEST_DATA=$(top_builddir)/test/data DBUS_TEST_HOMEDIR=$(top_builddir)/dbus
-#TESTS=bus-test 
-#else
-#TESTS=
-#endif
-
-## we use noinst_PROGRAMS not check_PROGRAMS so that we build 
-## even when not doing "make check"
-#noinst_PROGRAMS=$(TESTS) 
-
 if (DBUS_BUILD_TESTS)  
-       if(splitlib AND MSVC)
-               add_executable(bus-test ${BUS_DIR}/test-main.c)
-               target_link_libraries(bus-test ${DBUS_1} ${LIBS} bus-lib)
-       else(splitlib AND MSVC)
-               add_executable(bus-test ${BUS_SOURCES} ${BUS_DIR}/test-main.c)
-               target_link_libraries(bus-test ${DBUS_1} ${LIBS})
-       endif(splitlib AND MSVC)
-       #install_targets(/bin bus-test)
+       add_executable(bus-test ${BUS_SOURCES} ${BUS_DIR}/test-main.c)
+       target_link_libraries(bus-test ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY})
+       set_target_properties(bus-test PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
        add_test(bus-test ${EXECUTABLE_OUTPUT_PATH}/bus-test ${CMAKE_BINARY_DIR}/test/data)
 endif (DBUS_BUILD_TESTS)
 
@@ -163,15 +134,15 @@ set(LAUNCH_HELPER_SOURCES ${XML_SOURCES}
 if(NOT WIN32)
 # TODO PENDING(kdab) fix build on windows (activation-helper.c)
    add_executable(dbus-daemon-launch-helper ${LAUNCH_HELPER_SOURCES} ${BUS_DIR}/activation-helper-bin.c )
-   target_link_libraries(dbus-daemon-launch-helper ${DBUS_1} ${LIBS} )
+   target_link_libraries(dbus-daemon-launch-helper ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY} )
    
    add_executable(dbus-daemon-launch-helper-test ${LAUNCH_HELPER_SOURCES}     ${BUS_DIR}/activation-helper-bin.c)
    set_target_properties(dbus-daemon-launch-helper-test PROPERTIES COMPILE_FLAGS "-DACTIVATION_LAUNCHER_TEST")
-   target_link_libraries(dbus-daemon-launch-helper-test ${DBUS_1} ${LIBS} )
+   target_link_libraries(dbus-daemon-launch-helper-test ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY} )
    
    add_executable(bus-test-launch-helper ${LAUNCH_HELPER_SOURCES}  ${BUS_DIR}/test-launch-helper.c)
    set_target_properties(bus-test-launch-helper PROPERTIES COMPILE_FLAGS "-DACTIVATION_LAUNCHER_TEST -DACTIVATION_LAUNCHER_DO_OOM")
-   target_link_libraries(bus-test-launch-helper ${DBUS_1} ${LIBS} )
+   target_link_libraries(bus-test-launch-helper ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY} )
    add_test(bus-test-launch-helper ${EXECUTABLE_OUTPUT_PATH}/bus-test-launch-helper )
 
 endif(NOT WIN32)
diff --git a/cmake/bus/dbus-daemon.xml b/cmake/bus/dbus-daemon.xml
new file mode 100644 (file)
index 0000000..c6f4db0
--- /dev/null
@@ -0,0 +1,744 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<!-- lifted from troff+man by doclifter -->
+<refentry id='dbus-daemon'>
+<!--   -->
+<!--  dbus\-daemon manual page. -->
+<!--  Copyright (C) 2003 Red Hat, Inc. -->
+
+<refmeta>
+<refentrytitle>dbus-daemon</refentrytitle>
+<manvolnum>1</manvolnum>
+</refmeta>
+<refnamediv id='name'>
+<refname>dbus-daemon</refname>
+<refpurpose>Message bus daemon</refpurpose>
+</refnamediv>
+<!-- body begins here -->
+<refsynopsisdiv id='synopsis'>
+<cmdsynopsis>
+  <command>dbus-daemon</command></cmdsynopsis>
+<cmdsynopsis>
+  <command>dbus-daemon</command>    <arg choice='opt'>--version </arg>
+    <arg choice='opt'>--session </arg>
+    <arg choice='opt'>--system </arg>
+    <arg choice='opt'>--config-file=<replaceable>FILE</replaceable></arg>
+    <arg choice='opt'><arg choice='plain'>--print-address </arg><arg choice='opt'><replaceable>=DESCRIPTOR</replaceable></arg></arg>
+    <arg choice='opt'><arg choice='plain'>--print-pid </arg><arg choice='opt'><replaceable>=DESCRIPTOR</replaceable></arg></arg>
+    <arg choice='opt'>--fork </arg>
+    <sbr/>
+</cmdsynopsis>
+</refsynopsisdiv>
+
+
+<refsect1 id='description'><title>DESCRIPTION</title>
+<para><command>dbus-daemon</command> is the D-Bus message bus daemon. See
+<ulink url='http://www.freedesktop.org/software/dbus/'>http://www.freedesktop.org/software/dbus/</ulink> for more information about
+the big picture. D-Bus is first a library that provides one-to-one
+communication between any two applications; <command>dbus-daemon</command> is an
+application that uses this library to implement a message bus
+daemon. Multiple programs connect to the message bus daemon and can
+exchange messages with one another.</para>
+
+
+<para>There are two standard message bus instances: the systemwide message bus 
+(installed on many systems as the "messagebus" init service) and the 
+per-user-login-session message bus (started each time a user logs in).
+<command>dbus-daemon</command> is used for both of these instances, but with 
+a different configuration file.</para>
+
+
+<para>The --session option is equivalent to
+"--config-file=/etc/dbus-1/session.conf" and the --system
+option is equivalent to
+"--config-file=/etc/dbus-1/system.conf". By creating 
+additional configuration files and using the --config-file option,
+additional special-purpose message bus daemons could be created.</para>
+
+
+<para>The systemwide daemon is normally launched by an init script, 
+standardly called simply "messagebus".</para> 
+
+
+<para>The systemwide daemon is largely used for broadcasting system events, 
+such as changes to the printer queue, or adding/removing devices.</para>
+
+
+<para>The per-session daemon is used for various interprocess communication 
+among desktop applications (however, it is not tied to X or the GUI 
+in any way).</para>
+
+
+<para>SIGHUP will cause the D-Bus daemon to PARTIALLY reload its
+configuration file and to flush its user/group information caches. Some
+configuration changes would require kicking all apps off the bus; so they will
+only take effect if you restart the daemon. Policy changes should take effect
+with SIGHUP.</para>
+
+</refsect1>
+
+<refsect1 id='options'><title>OPTIONS</title>
+<para>The following options are supported:</para>
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><option>--config-file=FILE</option></term>
+  <listitem>
+<para>Use the given configuration file.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--fork</option></term>
+  <listitem>
+<para>Force the message bus to fork and become a daemon, even if 
+the configuration file does not specify that it should.
+In most contexts the configuration file already gets this
+right, though.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--print-address[=DESCRIPTOR]</option></term>
+  <listitem>
+<para>Print the address of the message bus to standard output, or 
+to the given file descriptor. This is used by programs that 
+launch the message bus.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--print-pid[=DESCRIPTOR]</option></term>
+  <listitem>
+<para>Print the process ID of the message bus to standard output, or 
+to the given file descriptor. This is used by programs that 
+launch the message bus.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--session</option></term>
+  <listitem>
+<para>Use the standard configuration file for the per-login-session message
+bus.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--system</option></term>
+  <listitem>
+<para>Use the standard configuration file for the systemwide message bus.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--version</option></term>
+  <listitem>
+<para>Print the version of the daemon.</para>
+
+  </listitem>
+  </varlistentry>
+</variablelist>
+</refsect1>
+
+<refsect1 id='configuration_file'><title>CONFIGURATION FILE</title>
+<para>A message bus daemon has a configuration file that specializes it
+for a particular application. For example, one configuration 
+file might set up the message bus to be a systemwide message bus, 
+while another might set it up to be a per-user-login-session bus.</para>
+
+
+<para>The configuration file also establishes resource limits, security
+parameters, and so forth.</para>
+
+
+<para>The configuration file is not part of any interoperability
+specification and its backward compatibility is not guaranteed; this
+document is documentation, not specification.</para>
+
+
+<para>The standard systemwide and per-session message bus setups are
+configured in the files "/etc/dbus-1/system.conf" and
+"/etc/dbus-1/session.conf".  These files normally
+&lt;include&gt; a system-local.conf or session-local.conf; you can put local
+overrides in those files to avoid modifying the primary configuration
+files.</para>
+
+
+<para>The configuration file is an XML document. It must have the following
+doctype declaration:</para>
+<literallayout remap='.nf'>
+
+   &lt;!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
+    "<ulink url='http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd'>http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd</ulink>"&gt;
+
+</literallayout> <!-- .fi -->
+
+
+<para>The following elements may be present in the configuration file.</para>
+
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='I'>&lt;busconfig&gt;</emphasis></term>
+  <listitem>
+<para></para> 
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>Root element.</para>
+
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='I'>&lt;type&gt;</emphasis></term>
+  <listitem>
+
+<para></para> <!-- FIXME: blank list item -->
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>The well-known type of the message bus. Currently known values are
+"system" and "session"; if other values are set, they should be
+either added to the D-Bus specification, or namespaced.  The last
+&lt;type&gt; element "wins" (previous values are ignored).</para>
+
+
+<para>Example: &lt;type&gt;session&lt;/type&gt;</para>
+
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='I'>&lt;include&gt;</emphasis></term>
+  <listitem>
+<para></para> 
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>Include a file &lt;include&gt;filename.conf&lt;/include&gt; at this point.  If the
+filename is relative, it is located relative to the configuration file
+doing the including.</para>
+
+
+<para>&lt;include&gt; has an optional attribute "ignore_missing=(yes|no)"
+which defaults to "no" if not provided. This attribute 
+controls whether it's a fatal error for the included file 
+to be absent.</para>
+
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='I'>&lt;includedir&gt;</emphasis></term>
+  <listitem>
+
+<para></para> <!-- FIXME: blank list item -->
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>Include all files in &lt;includedir&gt;foo.d&lt;/includedir&gt; at this
+point. Files in the directory are included in undefined order.
+Only files ending in ".conf" are included.</para>
+
+
+<para>This is intended to allow extension of the system bus by particular
+packages. For example, if CUPS wants to be able to send out
+notification of printer queue changes, it could install a file to
+/etc/dbus-1/system.d that allowed all apps to receive
+this message and allowed the printer daemon user to send it.</para>
+
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='I'>&lt;user&gt;</emphasis></term>
+  <listitem>
+
+<para></para> <!-- FIXME: blank list item -->
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>The user account the daemon should run as, as either a username or a
+UID. If the daemon cannot change to this UID on startup, it will exit.
+If this element is not present, the daemon will not change or care
+about its UID.</para>
+
+
+<para>The last &lt;user&gt; entry in the file "wins", the others are ignored.</para>
+
+
+<para>The user is changed after the bus has completed initialization.  So
+sockets etc. will be created before changing user, but no data will be
+read from clients before changing user. This means that sockets 
+and PID files can be created in a location that requires root 
+privileges for writing.</para>
+
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='I'>&lt;fork&gt;</emphasis></term>
+  <listitem>
+<para></para>    
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>If present, the bus daemon becomes a real daemon (forks 
+into the background, etc.). This is generally used 
+rather than the --fork command line option.</para>
+
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='I'>&lt;listen&gt;</emphasis></term>
+  <listitem>
+
+<para></para> <!-- FIXME: blank list item -->
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>Add an address that the bus should listen on. The 
+address is in the standard D-Bus format that contains 
+a transport name plus possible parameters/options.</para>
+
+
+<para>Example: &lt;listen&gt;unix:path=/tmp/foo&lt;/listen&gt;</para>
+
+
+<para>If there are multiple &lt;listen&gt; elements, then the bus listens 
+on multiple addresses. The bus will pass its address to 
+started services or other interested parties with 
+the last address given in &lt;listen&gt; first. That is, 
+apps will try to connect to the last &lt;listen&gt; address first.</para>
+
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='I'>&lt;auth&gt;</emphasis></term>
+  <listitem>
+
+<para></para> <!-- FIXME: blank list item -->
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>Lists permitted authorization mechanisms. If this element doesn't
+exist, then all known mechanisms are allowed.  If there are multiple
+&lt;auth&gt; elements, all the listed mechanisms are allowed.  The order in
+which mechanisms are listed is not meaningful.</para>
+    
+
+<para>Example: &lt;auth&gt;EXTERNAL&lt;/auth&gt;</para>
+
+
+<para>Example: &lt;auth&gt;DBUS_COOKIE_SHA1&lt;/auth&gt;</para>
+
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='I'>&lt;servicedir&gt;</emphasis></term>
+  <listitem>
+
+<para></para> <!-- FIXME: blank list item -->
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>Adds a directory to scan for .service files. Directories are
+scanned starting with the last to appear in the config file 
+(the first .service file found that provides a particular 
+service will be used).</para>
+
+
+<para>Service files tell the bus how to automatically start a program.
+They are primarily used with the per-user-session bus, 
+not the systemwide bus.</para>
+
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='I'>&lt;standard_session_servicedirs/&gt;</emphasis></term>
+  <listitem>
+
+<para></para> <!-- FIXME: blank list item -->
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>&lt;standard_session_servicedirs/&gt; is equivalent to specifying a series
+of &lt;servicedir/&gt; elements for each of the data directories in the "XDG
+Base Directory Specification" with the subdirectory "dbus-1/services",
+so for example "/usr/share/dbus-1/services" would be among the
+directories searched.</para>
+
+
+<para>The "XDG Base Directory Specification" can be found at
+<ulink url='http://freedesktop.org/wiki/Standards/basedir-spec'>http://freedesktop.org/wiki/Standards/basedir-spec</ulink> if it hasn't moved,
+otherwise try your favorite search engine.</para>
+
+
+<para>The &lt;standard_session_servicedirs/&gt; option is only relevant to the
+per-user-session bus daemon defined in
+/etc/dbus-1/session.conf. Putting it in any other
+configuration file would probably be nonsense.</para>
+
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='I'>&lt;limit&gt;</emphasis></term>
+  <listitem>
+
+<para></para> <!-- FIXME: blank list item -->
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>&lt;limit&gt; establishes a resource limit. For example:</para>
+<literallayout remap='.nf'>
+  &lt;limit name="max_message_size"&gt;64&lt;/limit&gt;
+  &lt;limit name="max_completed_connections"&gt;512&lt;/limit&gt;
+</literallayout> <!-- .fi -->
+
+
+<para>The name attribute is mandatory.
+Available limit names are:</para>
+<literallayout remap='.nf'>
+      "max_incoming_bytes"         : total size in bytes of messages
+                                     incoming from a single connection
+      "max_outgoing_bytes"         : total size in bytes of messages
+                                     queued up for a single connection
+      "max_message_size"           : max size of a single message in
+                                     bytes
+      "service_start_timeout"      : milliseconds (thousandths) until 
+                                     a started service has to connect
+      "auth_timeout"               : milliseconds (thousandths) a
+                                     connection is given to
+                                     authenticate
+      "max_completed_connections"  : max number of authenticated connections  
+      "max_incomplete_connections" : max number of unauthenticated
+                                     connections
+      "max_connections_per_user"   : max number of completed connections from
+                                     the same user
+      "max_pending_service_starts" : max number of service launches in
+                                     progress at the same time
+      "max_names_per_connection"   : max number of names a single 
+                                     connection can own
+      "max_match_rules_per_connection": max number of match rules for a single 
+                                        connection
+      "max_replies_per_connection" : max number of pending method 
+                                     replies per connection
+                                     (number of calls-in-progress)
+      "reply_timeout"              : milliseconds (thousandths) 
+                                     until a method call times out   
+</literallayout> <!-- .fi -->
+
+
+<para>The max incoming/outgoing queue sizes allow a new message to be queued
+if one byte remains below the max. So you can in fact exceed the max
+by max_message_size.</para>
+
+
+<para>max_completed_connections divided by max_connections_per_user is the
+number of users that can work together to denial-of-service all other users by using
+up all connections on the systemwide bus.</para>
+
+
+<para>Limits are normally only of interest on the systemwide bus, not the user session 
+buses.</para>
+
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='I'>&lt;policy&gt;</emphasis></term>
+  <listitem>
+
+<para></para> <!-- FIXME: blank list item -->
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>The &lt;policy&gt; element defines a security policy to be applied to a particular
+set of connections to the bus. A policy is made up of
+&lt;allow&gt; and &lt;deny&gt; elements. Policies are normally used with the systemwide bus;
+they are analogous to a firewall in that they allow expected traffic 
+and prevent unexpected traffic.</para>
+
+
+<para>The &lt;policy&gt; element has one of three attributes:</para>
+<literallayout remap='.nf'>
+  context="(default|mandatory)"
+  user="username or userid"
+  group="group name or gid"
+</literallayout> <!-- .fi -->
+
+
+<para> 
+Policies are applied to a connection as follows:</para>
+<literallayout remap='.nf'>
+   - all context="default" policies are applied
+   - all group="connection's user's group" policies are applied
+     in undefined order
+   - all user="connection's auth user" policies are applied
+     in undefined order
+   - all context="mandatory" policies are applied
+</literallayout> <!-- .fi -->
+
+
+<para>Policies applied later will override those applied earlier, 
+when the policies overlap. Multiple policies with the same 
+user/group/context are applied in the order they appear 
+in the config file.</para>
+
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='I'>&lt;deny&gt;</emphasis></term>
+  <listitem>
+<para><emphasis remap='I'>&lt;allow&gt;</emphasis></para>
+
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>A &lt;deny&gt; element appears below a &lt;policy&gt; element and prohibits some
+action. The &lt;allow&gt; element makes an exception to previous &lt;deny&gt;
+statements, and works just like &lt;deny&gt; but with the inverse meaning.</para>
+
+
+<para>The possible attributes of these elements are:</para>
+<literallayout remap='.nf'>
+   send_interface="interface_name"
+   send_member="method_or_signal_name" 
+   send_error="error_name" 
+   send_destination="name" 
+   send_type="method_call" | "method_return" | "signal" | "error" 
+   send_path="/path/name"
+
+   receive_interface="interface_name"
+   receive_member="method_or_signal_name" 
+   receive_error="error_name" 
+   receive_sender="name" 
+   receive_type="method_call" | "method_return" | "signal" | "error"
+   receive_path="/path/name"
+
+   send_requested_reply="true" | "false"
+   receive_requested_reply="true" | "false"
+
+   eavesdrop="true" | "false"
+
+   own="name"
+   user="username"
+   group="groupname"
+</literallayout> <!-- .fi -->
+
+
+<para>Examples:</para>
+<literallayout remap='.nf'>
+   &lt;deny send_interface="org.freedesktop.System" send_member="Reboot"/&gt; 
+   &lt;deny receive_interface="org.freedesktop.System" receive_member="Reboot"/&gt;
+   &lt;deny own="org.freedesktop.System"/&gt;
+   &lt;deny send_destination="org.freedesktop.System"/&gt;
+   &lt;deny receive_sender="org.freedesktop.System"/&gt;
+   &lt;deny user="john"/&gt;
+   &lt;deny group="enemies"/&gt;
+</literallayout> <!-- .fi -->
+
+
+<para>The &lt;deny&gt; element's attributes determine whether the deny "matches" a
+particular action. If it matches, the action is denied (unless later
+rules in the config file allow it).</para>
+
+
+<para>send_destination and receive_sender rules mean that messages may not be
+sent to or received from the *owner* of the given name, not that
+they may not be sent *to that name*. That is, if a connection
+owns services A, B, C, and sending to A is denied, sending to B or C
+will not work either.</para>
+
+
+<para>The other send_* and receive_* attributes are purely textual/by-value
+matches against the given field in the message header.</para>
+
+
+<para>"Eavesdropping" occurs when an application receives a message that
+was explicitly addressed to a name the application does not own.
+Eavesdropping thus only applies to messages that are addressed to
+services (i.e. it does not apply to signals).</para>
+
+
+<para>For &lt;allow&gt;, eavesdrop="true" indicates that the rule matches even 
+when eavesdropping. eavesdrop="false" is the default and means that 
+the rule only allows messages to go to their specified recipient.
+For &lt;deny&gt;, eavesdrop="true" indicates that the rule matches 
+only when eavesdropping. eavesdrop="false" is the default for &lt;deny&gt;
+also, but here it means that the rule applies always, even when 
+not eavesdropping. The eavesdrop attribute can only be combined with
+receive rules (with receive_* attributes).</para>
+
+
+
+<para>The [send|receive]_requested_reply attribute works similarly to the eavesdrop
+attribute. It controls whether the &lt;deny&gt; or &lt;allow&gt; matches a reply
+that is expected (corresponds to a previous method call message).
+This attribute only makes sense for reply messages (errors and method
+returns), and is ignored for other message types.</para>
+
+
+<para>For &lt;allow&gt;, [send|receive]_requested_reply="true" is the default and indicates that
+only requested replies are allowed by the
+rule. [send|receive]_requested_reply="false" means that the rule allows any reply
+even if unexpected.</para>
+
+
+<para>For &lt;deny&gt;, [send|receive]_requested_reply="false" is the default but indicates that
+the rule matches only when the reply was not
+requested. [send|receive]_requested_reply="true" indicates that the rule applies
+always, regardless of pending reply state.</para>
+
+
+<para>user and group denials mean that the given user or group may 
+not connect to the message bus.</para>
+
+
+<para>For "name", "username", "groupname", etc.
+the character "*" can be substituted, meaning "any." Complex globs
+like "foo.bar.*" aren't allowed for now because they'd be work to
+implement and maybe encourage sloppy security anyway.</para>
+
+
+<para>It does not make sense to deny a user or group inside a &lt;policy&gt;
+for a user or group; user/group denials can only be inside
+context="default" or context="mandatory" policies.</para>
+
+
+<para>A single &lt;deny&gt; rule may specify combinations of attributes such as
+send_destination and send_interface and send_type. In this case, the
+denial applies only if both attributes match the message being denied.
+e.g. &lt;deny send_interface="foo.bar" send_destination="foo.blah"/&gt; would
+deny messages with the given interface AND the given bus name.
+To get an OR effect you specify multiple &lt;deny&gt; rules.</para>
+
+
+<para>You can't include both send_ and receive_ attributes on the same
+rule, since "whether the message can be sent" and "whether it can be
+received" are evaluated separately.</para>
+
+
+<para>Be careful with send_interface/receive_interface, because the 
+interface field in messages is optional.</para>
+
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='I'>&lt;selinux&gt;</emphasis></term>
+  <listitem>
+
+<para></para> <!-- FIXME: blank list item -->
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>The &lt;selinux&gt; element contains settings related to Security Enhanced Linux.
+More details below.</para>
+
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='I'>&lt;associate&gt;</emphasis></term>
+  <listitem>
+
+<para></para> <!-- FIXME: blank list item -->
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>An &lt;associate&gt; element appears below an &lt;selinux&gt; element and
+creates a mapping. Right now only one kind of association is possible:</para>
+<literallayout remap='.nf'>
+   &lt;associate own="org.freedesktop.Foobar" context="foo_t"/&gt; 
+</literallayout> <!-- .fi -->
+
+
+<para>This means that if a connection asks to own the name
+"org.freedesktop.Foobar" then the source context will be the context
+of the connection and the target context will be "foo_t" - see the 
+short discussion of SELinux below.</para>
+
+
+<para>Note, the context here is the target context when requesting a name,
+NOT the context of the connection owning the name.</para>
+
+
+<para>There's currently no way to set a default for owning any name, if
+we add this syntax it will look like:</para>
+<literallayout remap='.nf'>
+   &lt;associate own="*" context="foo_t"/&gt; 
+</literallayout> <!-- .fi -->
+<para>If you find a reason this is useful, let the developers know.
+Right now the default will be the security context of the bus itself.</para>
+
+
+<para>If two &lt;associate&gt; elements specify the same name, the element
+appearing later in the configuration file will be used.</para>
+
+</refsect1>
+
+<refsect1 id='selinux'><title>SELinux</title>
+<para>See <ulink url='http://www.nsa.gov/selinux/'>http://www.nsa.gov/selinux/</ulink> for full details on SELinux. Some useful excerpts:</para>
+
+
+<para>Every subject (process) and object (e.g. file, socket, IPC object,
+etc) in the system is assigned a collection of security attributes,
+known as a security context. A security context contains all of the
+security attributes associated with a particular subject or object
+that are relevant to the security policy.</para>
+
+
+<para>In order to better encapsulate security contexts and to provide
+greater efficiency, the policy enforcement code of SELinux typically
+handles security identifiers (SIDs) rather than security contexts. A
+SID is an integer that is mapped by the security server to a security
+context at runtime.</para>
+
+
+<para>When a security decision is required, the policy enforcement code
+passes a pair of SIDs (typically the SID of a subject and the SID of
+an object, but sometimes a pair of subject SIDs or a pair of object
+SIDs), and an object security class to the security server. The object
+security class indicates the kind of object, e.g. a process, a regular
+file, a directory, a TCP socket, etc.</para>
+
+
+<para>Access decisions specify whether or not a permission is granted for a
+given pair of SIDs and class. Each object class has a set of
+associated permissions defined to control operations on objects with
+that class.</para>
+
+
+<para>D-Bus performs SELinux security checks in two places.</para>
+
+
+<para>First, any time a message is routed from one connection to another
+connection, the bus daemon will check permissions with the security context of
+the first connection as source, security context of the second connection
+as target, object class "dbus" and requested permission "send_msg".</para>
+
+
+<para>If a security context is not available for a connection 
+(impossible when using UNIX domain sockets), then the target 
+context used is the context of the bus daemon itself.
+There is currently no way to change this default, because we're 
+assuming that only UNIX domain sockets will be used to 
+connect to the systemwide bus. If this changes, we'll 
+probably add a way to set the default connection context.</para>
+
+
+<para>Second, any time a connection asks to own a name, 
+the bus daemon will check permissions with the security 
+context of the connection as source, the security context specified
+for the name in the config file as target, object 
+class "dbus" and requested permission "acquire_svc".</para>
+
+
+<para>The security context for a bus name is specified with the 
+&lt;associate&gt; element described earlier in this document.
+If a name has no security context associated in the 
+configuration file, the security context of the bus daemon 
+itself will be used.</para>
+
+</refsect1>
+
+<refsect1 id='author'><title>AUTHOR</title>
+<para>See <ulink url='http://www.freedesktop.org/software/dbus/doc/AUTHORS'>http://www.freedesktop.org/software/dbus/doc/AUTHORS</ulink></para>
+
+</refsect1>
+
+<refsect1 id='bugs'><title>BUGS</title>
+<para>Please send bug reports to the D-Bus mailing list or bug tracker,
+see <ulink url='http://www.freedesktop.org/software/dbus/'>http://www.freedesktop.org/software/dbus/</ulink></para>
+</refsect1>
+</refentry>
+
index db38371..a4aae42 100644 (file)
@@ -11,7 +11,7 @@
 #cmakedefine DBUS_BINDIR   "@DBUS_BINDIR@"
 #cmakedefine DBUS_SYSTEM_CONFIG_FILE  "@DBUS_SYSTEM_CONFIG_FILE@"
 #cmakedefine DBUS_SESSION_CONFIG_FILE "@DBUS_SESSION_CONFIG_FILE@"
-#cmakedefine DAEMON_NAME "@DAEMON_NAME@"
+#cmakedefine DBUS_DAEMON_NAME "@DBUS_DAEMON_NAME@"
 #cmakedefine DBUS_SYSTEM_BUS_DEFAULT_ADDRESS  "@DBUS_SYSTEM_BUS_DEFAULT_ADDRESS@"
 #cmakedefine DBUS_MACHINE_UUID_FILE "@DBUS_MACHINE_UUID_FILE@"
 //#cmakedefine DBUS_SESSION_BUS_DEFAULT_ADDRESS "@DBUS_SESSION_BUS_DEFAULT_ADDRESS@"
 #cmakedefine DBUS_VERSION ((@DBUS_MAJOR_VERSION@ << 16) | (@DBUS_MINOR_VERSION@ << 8) | (@DBUS_MICRO_VERSION@))
 #cmakedefine DBUS_VERSION_STRING "@DBUS_VERSION_STRING@"
 
+#define VERSION DBUS_VERSION_STRING
+
+#define TEST_LISTEN       "@TEST_LISTEN@"
+#define TEST_CONNECTION   "@TEST_CONNECTION@"
+
 // test binaries
 /* Full path to test file test/test-exit in builddir */
 #define TEST_BUS_BINARY          "@TEST_BUS_BINARY@"
 /* Define to 1 if you have unistd.h */
 #cmakedefine   HAVE_UNISTD_H 1
 
-/* Define to 1 if you have errno.h */
-#cmakedefine   HAVE_ERRNO_H 1
-
 /* Define to 1 if you have stdio.h */
 #cmakedefine   HAVE_STDIO_H 1
 
 /* Define to 1 if you have sys/syslimits.h */
 #cmakedefine   HAVE_SYS_SYSLIMITS_H 1
 
+/* Define to 1 if you have errno.h */
+#cmakedefine   HAVE_ERRNO_H 1
+
+/* Define to 1 if you have signal.h */
+#cmakedefine   HAVE_SIGNAL_H 1
+
+/* Define to 1 if you have locale.h */
+#cmakedefine   HAVE_LOCALE_H 1
+
 // symbols
 /* Define to 1 if you have backtrace */
 #cmakedefine   HAVE_BACKTRACE 1
index ed2fb1f..57c499f 100644 (file)
@@ -1,7 +1,5 @@
 project(dbus-lib)
 
-#INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) -DDBUS_COMPILATION
-
 SET(DBUS_DIR ${CMAKE_SOURCE_DIR}/../dbus)
 
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dbus-arch-deps.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/dbus-arch-deps.h )
@@ -23,7 +21,6 @@ set (dbusinclude_HEADERS
        ${DBUS_DIR}/dbus-server.h
        ${DBUS_DIR}/dbus-shared.h
        ${DBUS_DIR}/dbus-signature.h
-       ${DBUS_DIR}/dbus-spawn.h
        ${DBUS_DIR}/dbus-threads.h
        ${DBUS_DIR}/dbus-types.h
        dbus-arch-deps.h
@@ -125,6 +122,7 @@ endif(UNIX)
 ### be underscore-prefixed)
 set (DBUS_SHARED_SOURCES
        ${DBUS_DIR}/dbus-dataslot.c
+       ${DBUS_DIR}/dbus-file.c
        ${DBUS_DIR}/dbus-hash.c
        ${DBUS_DIR}/dbus-internals.c
        ${DBUS_DIR}/dbus-list.c
@@ -138,6 +136,7 @@ set (DBUS_SHARED_SOURCES
 
 set (DBUS_SHARED_HEADERS
        ${DBUS_DIR}/dbus-dataslot.h
+       ${DBUS_DIR}/dbus-file.h
        ${DBUS_DIR}/dbus-hash.h
        ${DBUS_DIR}/dbus-internals.h
        ${DBUS_DIR}/dbus-list.h
@@ -165,7 +164,7 @@ set (DBUS_UTIL_SOURCES
        ${DBUS_DIR}/dbus-message-util.c
        ${DBUS_DIR}/dbus-shell.c
        ${DBUS_DIR}/dbus-string-util.c
-        ${DBUS_DIR}/dbus-sysdeps-util.c
+       ${DBUS_DIR}/dbus-sysdeps-util.c
 )
 
 if (DBUS_BUILD_TESTS)
@@ -186,25 +185,25 @@ set (DBUS_UTIL_HEADERS
 ### platform specific settings
 if (WIN32)
        set (DBUS_SHARED_SOURCES ${DBUS_SHARED_SOURCES} 
+               ${DBUS_DIR}/dbus-file-win.c
                ${DBUS_DIR}/dbus-sysdeps-win.c
                ${DBUS_DIR}/dbus-pipe-win.c
                ${DBUS_DIR}/dbus-sysdeps-thread-win.c
-               ${DBUS_DIR}/dbus-spawn-win.c
        )
        set (DBUS_SHARED_HEADERS ${DBUS_SHARED_HEADERS} 
                ${DBUS_DIR}/dbus-sockets-win.h
                ${DBUS_DIR}/dbus-sysdeps-win.h
        )
        set (DBUS_UTIL_SOURCES ${DBUS_UTIL_SOURCES}
+               ${DBUS_DIR}/dbus-spawn-win.c
                ${DBUS_DIR}/dbus-sysdeps-util-win.c
        )
-       set (LIBS ${LIBS} ws2_32 advapi32 netapi32)
 else (WIN32)
        set (DBUS_SHARED_SOURCES ${DBUS_SHARED_SOURCES} 
+               ${DBUS_DIR}/dbus-file-unix.c
                ${DBUS_DIR}/dbus-pipe-unix.c
                ${DBUS_DIR}/dbus-sysdeps-unix.c
                ${DBUS_DIR}/dbus-sysdeps-pthread.c
-               ${DBUS_DIR}/dbus-spawn.c
                ${DBUS_DIR}/dbus-userdb.c
        )
        set (DBUS_SHARED_HEADERS ${DBUS_SHARED_HEADERS} 
@@ -214,6 +213,7 @@ else (WIN32)
                ${DBUS_DIR}/dbus-userdb.h
        )
        set (DBUS_UTIL_SOURCES ${DBUS_UTIL_SOURCES}
+               ${DBUS_DIR}/dbus-spawn.c
                ${DBUS_DIR}/dbus-userdb-util.c
                ${DBUS_DIR}/dbus-sysdeps-util-unix.c
        )
@@ -242,74 +242,48 @@ if (MSVC)
     set_source_files_properties(versioninfo.rc COMPILE_FLAGS "-D__LINE__=1")
 endif (MSVC)
 
-if(MSVC AND splitlib)
-       set(DBUS_LIB_TYPE STATIC)
-elseif(MSVC AND splitlib)
-       set(DBUS_LIB_TYPE SHARED)
-endif(MSVC AND splitlib)
+if(MSVC_IDE)
+       project_source_group(${GROUP_CODE} DBUS_LIB_SOURCES DBUS_LIB_HEADERS)
+       project_source_group(${GROUP_CODE} DBUS_SHARED_SOURCES DBUS_SHARED_HEADERS)
+       project_source_group(${GROUP_CODE} DBUS_UTIL_SOURCES DBUS_UTIL_SOURCES)
+endif(MSVC_IDE)
 
+### Client library
 
-if(splitlib AND MSVC)
-       # code for the client library and daemon/tests
-       add_library(dbus-lib-generic ${DBUS_LIB_TYPE} ${DBUS_SHARED_SOURCES} ${DBUS_SHARED_HEADERS})
-       
-       # code only for daemon/tests
-       add_library(dbus-lib-util ${DBUS_LIB_TYPE} ${DBUS_UTIL_SOURCES} ${DBUS_UTIL_HEADERS})
-       
-       # code for the client library
-       add_library(dbus-lib-client ${DBUS_LIB_TYPE} ${DBUS_LIB_SOURCES} ${DBUS_LIB_HEADERS})
-       
-       target_link_libraries(dbus-lib-generic ${LIBS})
-       target_link_libraries(dbus-lib-util ${LIBS})
-       target_link_libraries(dbus-lib-client ${LIBS})
-       
-       if(MSVC_IDE)
-               project_source_group(${GROUP_CODE} DBUS_LIB_SOURCES DBUS_LIB_HEADERS)
-               project_source_group(${GROUP_CODE} DBUS_SHARED_SOURCES DBUS_SHARED_HEADERS)
-               project_source_group(${GROUP_CODE} DBUS_UTIL_SOURCES DBUS_UTIL_SOURCES)
-       endif(MSVC_IDE)
-else(splitlib AND MSVC)
-       # all code into one library
-       add_library(dbus-1 ${DBUS_LIB_TYPE} ${libdbus_SOURCES} ${libdbus_HEADERS} )
-       target_link_libraries(dbus-1 ${LIBS})
-       
-       if(MSVC)
-               set_target_properties(dbus-1  PROPERTIES LINK_FLAGS_RELWITHDEBINFO /def:"${DBUS_DIR}/dbus-1.def")
-               set_target_properties(dbus-1  PROPERTIES LINK_FLAGS_RELEASE /def:"${DBUS_DIR}/dbus-1.def")
-               set_target_properties(dbus-1  PROPERTIES LINK_FLAGS_MINSIZEREL /def:"${DBUS_DIR}/dbus-1.def")
-               set_target_properties(dbus-1  PROPERTIES LINK_FLAGS_DEBUG /def:"${DBUS_DIR}/dbus-1.def")
-       endif(MSVC)
-       if(MSVC_IDE)    
-               project_source_group(${GROUP_CODE} libdbus_SOURCES libdbus_HEADERS)
-       endif(MSVC_IDE)
-endif(splitlib AND MSVC)
+add_library(dbus-1 SHARED
+                       ${DBUS_LIB_SOURCES}
+                       ${DBUS_SHARED_SOURCES}
+                       ${DBUS_LIB_HEADERS}
+                       ${DBUS_SHARED_HEADERS})
+if(WIN32)
+       target_link_libraries(dbus-1 ws2_32 advapi32 netapi32)
+endif(WIN32)
 
+install_targets(/lib dbus-1 )
+install_files(/include/dbus FILES ${dbusinclude_HEADERS})
 
-if(NOT splitlib)
-       install_targets(/lib dbus-1 )
-       install_files(/include/dbus FILES ${dbusinclude_HEADERS})
-endif(NOT splitlib)
+### Internal library, used for the daemon, tools and tests, compiled statically.
 
-#ADD_EXECUTABLE(dbus-example dbus-example.c)
-#target_link_libraries(${CMAKE_SOURCE_DIR}/../dbus/dbus-example dbus-1)
-#install_targets(/bin dbus-example )
-
-## note that TESTS has special meaning (stuff to use in make check)
-## so if adding tests not to be run in make check, don't add them to 
-## TESTS
-#if DBUS_BUILD_TESTS
-#TESTS_ENVIRONMENT=DBUS_TEST_DATA=$(top_builddir)/test/data DBUS_TEST_HOMEDIR=$(top_builddir)/dbus
-#TESTS=dbus-test
-#else
-#TESTS=
-#endif
+add_library(dbus-internal ${DBUS_INTERNAL_ADD_LIBRARY_OPTIONS}
+                       ${DBUS_LIB_SOURCES}
+                       ${DBUS_LIB_HEADERS}
+                       ${DBUS_SHARED_SOURCES}
+                       ${DBUS_SHARED_HEADERS}
+                       ${DBUS_UTIL_SOURCES}
+                       ${DBUS_UTIL_HEADERS}
+)
+target_link_libraries(dbus-internal)
+set_target_properties(dbus-internal PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_LIBRARY_DEFINITIONS})
+if(WIN32)
+       target_link_libraries(dbus-internal ws2_32 advapi32 netapi32)
+endif(WIN32)
 
 if (DBUS_BUILD_TESTS)
        set (TESTS_ENVIRONMENT "DBUS_TEST_DATA=${CMAKE_SOURCE_DIR}/test/data DBUS_TEST_HOMEDIR=${CMAKE_BUILD_DIR}/dbus")
        ADD_EXECUTABLE(dbus-test ${CMAKE_SOURCE_DIR}/../dbus/dbus-test-main.c)
-       target_link_libraries(dbus-test ${DBUS_1} ${LIBS})
+       target_link_libraries(dbus-test ${DBUS_INTERNAL_LIBRARIES})
        add_test(dbus-test ${EXECUTABLE_OUTPUT_PATH}/dbus-test ${CMAKE_SOURCE_DIR}/../test/data)
-       #install_targets(/bin dbus-test)
+       set_target_properties(dbus-test PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
 ENDIF (DBUS_BUILD_TESTS)
 
 if (UNIX)
diff --git a/cmake/dbus/dbus-internal.def.cmake b/cmake/dbus/dbus-internal.def.cmake
new file mode 100644 (file)
index 0000000..da4ed89
--- /dev/null
@@ -0,0 +1,3 @@
+EXPORTS
+@DBUS_INTERNAL_EXPORTS@
+@DBUS_INTERNAL_TEST_EXPORTS@
index dd46708..9bd9a84 100644 (file)
@@ -12,45 +12,63 @@ if (DBUS_ENABLE_DOXYGEN_DOCS)
     )
 endif (DBUS_ENABLE_DOXYGEN_DOCS)
 
-#AC_ARG_ENABLE(xml-docs, AS_HELP_STRING([--enable-xml-docs],[build XML documentation (requires xmlto)]),enable_xml_docs=$enableval,enable_xml_docs=auto)
-#xmldocs missing
+#
+# find docbook generator
+# 
+find_program(MEINPROC4_EXECUTABLE meinproc4)
 
-# depends on xmlto
-set(DBUS_XML_DOCS_ENABLED 0)
+find_program(XMLTO_EXECUTABLE xmlto)
 
-set (EXTRA_DIST        
-       busconfig.dtd                   
-       introspect.dtd                  
-       dbus-faq.xml                    
-       dbus-specification.xml  
-       dbus-test-plan.xml              
-       dbus-tutorial.xml               
-       dcop-howto.txt                  
-       file-boilerplate.c              
-       introspect.xsl
-)
+if (MEINPROC4_EXECUTABLE OR XMLTO_EXECUTABLE)
+  OPTION(DBUS_ENABLE_XML_DOCS "build XML  documentation (requires xmlto or meinproc4)" ON)
+endif (MEINPROC4_EXECUTABLE OR XMLTO_EXECUTABLE)
 
-set (HTML_FILES
-       dbus-faq.html                   
-       dbus-specification.html 
-       dbus-test-plan.html             
-       dbus-tutorial.html
-)
+if (MEINPROC4_EXECUTABLE)
+       set(DOCBOOK_GENERATOR_NAME "meinproc4" PARENT_SCOPE)
+       set(DBUS_XML_DOCS_ENABLED 1)
+       if(WIN32)
+               get_filename_component(_a ${MEINPROC_EXECUTABLE} PATH)
+               get_filename_component(_meinproc_install_path ${_a} PATH)
+       else(WIN32)
+               set(_meinproc_install_path ${CMAKE_INSTALL_PREFIX})
+       endif(WIN32)
+       set(STYLESHEET "${_meinproc_install_path}/share/apps/ksgmltools2/docbook/xsl/html/docbook.xsl")
+endif (MEINPROC4_EXECUTABLE)
+  
+if (XMLTO_EXECUTABLE)
+       set (DOCBOOK_GENERATOR_NAME "xmlto" PARENT_SCOPE)
+       set(DBUS_XML_DOCS_ENABLED 1)
+       MESSAGE(STATUS "xmlto docbook generator found")
+endif (XMLTO_EXECUTABLE)
 
-if (DBUS_XML_DOCS_ENABLED)
+if (DBUS_ENABLE_XML_DOCS)
 
 macro (DOCBOOK _sources _options)
-  get_filename_component(_tmp_FILE ${_sources} ABSOLUTE)
-  get_filename_component(_basename ${_tmp_FILE} NAME_WE)
-  set(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.html)
-  MESSAGE (${_header} ${_sources} ${_options} ${_basename})
-
-  ADD_CUSTOM_TARGET(${_basename}.html ALL
-    xmlto.bat ${_sources} 
-#    xmlto.bat ${_options} ${_sources} 
-    DEPENDS ${_sources} 
-    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-  )
+  get_filename_component(_infile ${_sources} ABSOLUTE)
+  get_filename_component(_basename ${_infile} NAME_WE)
+  set(_outfile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.html)
+
+  if (EXISTS ${_sources})
+         if (MEINPROC4_EXECUTABLE)
+                 ADD_CUSTOM_TARGET(${_basename}.html ALL
+                       ${MEINPROC4_EXECUTABLE} --stylesheet ${STYLESHEET} -o ${_outfile} ${_infile} 
+                       DEPENDS ${_infile} 
+                       WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+               )
+         endif ()
+         if (XMLTO_EXECUTABLE)
+                 ADD_CUSTOM_TARGET(${_basename}.html ALL
+                       ${XMLTO_EXECUTABLE} -vv ${_options} ${_infile} 
+                       DEPENDS ${_infile} 
+                       WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+               )
+         endif ()
+         install(FILES ${_outfile} DESTINATION share/doc/dbus)
+  else ()
+         MESSAGE(STATUS "skipping xml doc generating for ${_infile}, file not found")
+  endif ()
+         
 endmacro (DOCBOOK)
 
 ### copy tests to builddir so that generated tests and static tests 
@@ -80,5 +98,23 @@ DOCBOOK(${CMAKE_SOURCE_DIR}/../doc/dbus-test-plan.xml html-nochunks)
 DOCBOOK(${CMAKE_SOURCE_DIR}/../doc/dbus-tutorial.xml html-nochunks)
 DOCBOOK(${CMAKE_SOURCE_DIR}/../doc/dbus-specification.xml html-nochunks)
 DOCBOOK(${CMAKE_SOURCE_DIR}/../doc/dbus-faq.xml html-nochunks)
+DOCBOOK(${CMAKE_SOURCE_DIR}/bus/dbus-daemon.xml html-nochunks)
+DOCBOOK(${CMAKE_SOURCE_DIR}/tools/dbus-monitor.xml html-nochunks)
+DOCBOOK(${CMAKE_SOURCE_DIR}/tools/dbus-send.xml html-nochunks)
+DOCBOOK(${CMAKE_SOURCE_DIR}/tools/dbus-launch.xml html-nochunks)
+
+#
+# handle html index file
+#
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/index.html.cmake ${CMAKE_CURRENT_BINARY_DIR}/index.html )
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/index.html DESTINATION share/doc/dbus)
+
+set (EXTRA_DIST        
+       ${CMAKE_SOURCE_DIR}/../doc/busconfig.dtd                        
+       ${CMAKE_SOURCE_DIR}/../doc/introspect.dtd                       
+       ${CMAKE_SOURCE_DIR}/../doc/introspect.xsl
+)
+
+install(FILES ${EXTRA_DIST} DESTINATION share/doc/dbus)
 
-endif(DBUS_XML_DOCS_ENABLED)
+endif(DBUS_ENABLE_XML_DOCS)
diff --git a/cmake/doc/index.html.cmake b/cmake/doc/index.html.cmake
new file mode 100644 (file)
index 0000000..77dd661
--- /dev/null
@@ -0,0 +1,55 @@
+<html>
+<head>
+<title>D-Bus Documentation Index</title>
+</head>
+<body>
+<h1>D-Bus Documentation Index</h1>
+<p>Version @DBUS_VERSION_STRING@</p>
+
+<table>
+ <tr>
+  <th width=10%>
+  </th>
+  <th width=30% align=left>
+   generic documentation
+  </th>
+  <th width=30% align=left>
+application manuals
+  </th>
+ </tr>
+ <tr>
+  <td valign=top>
+  </td>
+  <td valign=top>
+<a href="http://dbus.freedesktop.org">D-Bus Website</a>
+  <br>
+  <br>
+<a href="dbus-tutorial.html">D-Bus Tutorial</a>
+  <br>
+  <br>
+<a href="dbus-specification.html">D-Bus Specification</a>
+   <br>
+   <br>
+<a href="dbus-faq.html">D-Bus FAQ</a>
+   <br>
+   <br>
+<a href="dbus-test-plan.html">D-Bus Test Plan</a>
+   <br>
+   <br>
+  </td>
+  <td  valign=top>
+<a href="dbus-daemon.html">D-Bus Daemon manual</a>
+   <br>
+   <br>
+<a href="dbus-launch.html">D-Bus launch manual</a>
+   <br>
+   <br>
+<a href="dbus-send.html">D-Bus send tool manual</a>
+   <br>
+   <br>
+<a href="dbus-monitor.html">D-Bus monitor manual</a>
+  </td>
+ </tr>
+</table>
+</body>
+</html>
diff --git a/cmake/modules/FindGNUWIN32.cmake b/cmake/modules/FindGNUWIN32.cmake
deleted file mode 100644 (file)
index 4a2c6ad..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-if (WIN32)
-
-# check if GNUWIN32_DIR is already set 
-# (e.g. by command line argument or the calling script)
-if(NOT GNUWIN32_DIR)
-       # check for enviroment variable
-       file(TO_CMAKE_PATH "$ENV{GNUWIN32_DIR}" GNUWIN32_DIR)
-       if(NOT GNUWIN32_DIR)
-               # search in the default program install folder
-               file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _progFiles)
-               find_file(GNUWIN32_DIR_tmp gnuwin32 win32libs 
-                       PATHS
-                       "${_progFiles}"
-                       "C:/" "D:/" "E:/" "F:/" "G:/"
-               )
-               set(GNUWIN32_DIR ${GNUWIN32_DIR_tmp})
-       endif(NOT GNUWIN32_DIR)
-endif(NOT GNUWIN32_DIR)
-
-if (GNUWIN32_DIR)
-   set(GNUWIN32_INCLUDE_DIR ${GNUWIN32_DIR}/include)
-   set(GNUWIN32_LIBRARY_DIR ${GNUWIN32_DIR}/lib)
-   set(GNUWIN32_BINARY_DIR  ${GNUWIN32_DIR}/bin)
-   set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${GNUWIN32_INCLUDE_DIR})
-   set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${GNUWIN32_LIBRARY_DIR})
-   set(GNUWIN32_FOUND TRUE)
-else (GNUWIN32_DIR)
-   set(GNUWIN32_FOUND)
-endif (GNUWIN32_DIR)
-
-if (GNUWIN32_FOUND)
-  if (NOT GNUWIN32_FIND_QUIETLY)
-    message(STATUS "Found GNUWIN32: ${GNUWIN32_DIR}")
-  endif (NOT GNUWIN32_FIND_QUIETLY)
-else (GNUWIN32_FOUND)
-  if (GNUWIN32_FIND_REQUIRED)
-    message(SEND_ERROR "Could NOT find GNUWIN32")
-  endif (GNUWIN32_FIND_REQUIRED)
-endif (GNUWIN32_FOUND)
-
-endif (WIN32)
-
diff --git a/cmake/modules/FindKDEWIN.cmake b/cmake/modules/FindKDEWIN.cmake
deleted file mode 100644 (file)
index ba0e367..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-# - Try to find the install path of the required win32 supplementary libraries 
-# 
-# used environment vars 
-#  KDEWIN_DIR  - kdewin root dir 
-#
-# this will define
-#  KDEWIN_FOUND - system has KDEWIN
-#  KDEWIN_DIR - the KDEWIN root installation dir
-#
-# Copyright (c) 2007, Ralf Habacker, <ralf.habacker@freenet.de>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-if (WIN32)
-  IF (NOT KDEWIN_DIR)
-    # check for enviroment variable
-    file(TO_CMAKE_PATH "$ENV{KDEWIN_DIR}" KDEWIN_DIR)
-    if(NOT KDEWIN_DIR)
-      file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _progFiles)
-      if (MINGW)
-        set (DIR "kdewin-mingw")
-      else (MINGW)
-        set (DIR "kdewin-msvc")
-      endif (MINGW)
-      
-      # search in the default program install folder
-      find_file(KDEWIN_DIR_tmp ${DIR} kdewin kdewin32 gnuwin32 win32libs
-      PATHS
-        "${_progFiles}"
-      )
-      set (KDEWIN_DIR ${KDEWIN_DIR_tmp})
-    endif (NOT KDEWIN_DIR)
-    if (KDEWIN_DIR)
-      message(STATUS "Found windows supplementary package location: ${KDEWIN_DIR}")
-    endif (KDEWIN_DIR)
-  endif (NOT KDEWIN_DIR)
-
-  # this must be set every time 
-  if (KDEWIN_DIR)
-    # add include path and library to all targets, this is required because 
-    # cmake's 2.4.6 FindZLib.cmake does not use CMAKE_REQUIRED... vars
-    set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${KDEWIN_DIR}/include)
-    set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${KDEWIN_DIR}/lib)
-     
-    set (KDEWIN_FOUND 1)
-  else(KDEWIN_DIR)
-    message(STATUS "Could not find the location of the windows supplementary packages which is \n"
-                    "\t\tenvironment variable KDEWIN_DIR\n"
-                    "\t\t<ProgramFiles>/${DIR}\n"
-                    "\t\t<ProgramFiles>/kdewin\n" 
-                    "\t\t<ProgramFiles>/kdewin32\n" 
-                    "\t\t<ProgramFiles>/gnuwin32\n")
-   endif(KDEWIN_DIR)
-  
-endif (WIN32)
diff --git a/cmake/modules/FindKDEWIN_Packager.cmake b/cmake/modules/FindKDEWIN_Packager.cmake
deleted file mode 100644 (file)
index d4b6328..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-#
-# KDEWIN packager support http://download.cegit.de/kde-windows/installer
-# 
-# The kdewin packager is searched in the following pathes and order 
-# 
-#    path specified by the environment dir KDEWIN_PACKAGER_DIR
-#    <ProgramFiles>/kdewin-packager 
-#    <ProgramFiles>/kdewin-installer
-#
-# The macro KDEWIN_PACKAGER provides package building support and should be 
-# added to the top level CMakeLists.txt as shown below
-# 
-# if (KDEWIN_PACKAGER_FOUND)
-#    KDEWIN_PACKAGER(
-#       "projectname"
-#       "version"
-#       "description" 
-#       "additional options"
-#   )
-# endif (KDEWIN_PACKAGER_FOUND)
-
-# The macro KDEWIN_PACKAGER adds three additional makefile targets, which could be 
-# called using the regular make tool 
-#   
-#    kdewin_package 
-#           - build kdewin package with currently used compiler and build type 
-#    kdewin_package_debug_and_release 
-#           - build kdewin debug and release package with currently used compiler
-#    kdewin_package_debug_and_release_mingw_and_msvc
-#           - build kdewin debug and release package with mingw and msvc compiler
-#
-#
-#
-# Copyright (c) 2006-2007, Ralf Habacker
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-#
-
-if (WIN32)
-    if(NOT KDEWIN_PACKAGER_DIR)
-        # check for enviroment variable
-       file(TO_CMAKE_PATH "$ENV{KDEWIN_PACKAGER_DIR}" KDEWIN_PACKAGER_DIR)
-       if(NOT KDEWIN_PACKAGER_DIR)
-               # search in the default program install folder
-               file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _progFiles)
-               find_file(KDEWIN_PACKAGER_DIR_tmp kdewin-packager kdewin-installer
-                               PATHS
-                               "${_progFiles}"
-               )
-               set(KDEWIN_PACKAGER_DIR ${KDEWIN_PACKAGER_DIR_tmp})
-       endif(NOT KDEWIN_PACKAGER_DIR)
-    endif(NOT KDEWIN_PACKAGER_DIR)
-        
-    if (KDEWIN_PACKAGER_DIR)
-    
-        find_program(KDEWIN_PACKAGER_EXECUTABLE kdewin-packager
-            PATHS
-                ${KDEWIN_PACKAGER_DIR}/bin
-        )
-        
-       set(KDEWIN_PACKAGER_FOUND TRUE)
-    else (KDEWIN_PACKAGER_DIR)
-       set(KDEWIN_PACKAGER_FOUND)
-    endif (KDEWIN_PACKAGER_DIR)
-    
-    if (KDEWIN_PACKAGER_FOUND)
-      if (NOT KDEWIN_PACKAGER_FIND_QUIETLY)
-        message(STATUS "Found KDEWIN Packager: ${KDEWIN_PACKAGER_DIR}")
-      endif (NOT KDEWIN_PACKAGER_FIND_QUIETLY)
-    else (KDEWIN_PACKAGER_FOUND)
-      if (KDEWIN_PACKAGER_FIND_REQUIRED)
-        message(FATAL_ERROR "Could NOT find KDEWIN PAckager")
-      endif (KDEWIN_PACKAGER_FIND_REQUIRED)
-    endif (KDEWIN_PACKAGER_FOUND)
-
-endif (WIN32)
-
-MACRO (KDEWIN_PACKAGER _name _version _notes _options)
-    if (KDEWIN_PACKAGER_FOUND)
-        if (MSVC)
-            set (type "msvc")
-        else (MSVC)
-            set (type "mingw")
-        endif (MSVC)
-    
-        add_custom_target(kdewin_package
-            COMMAND ${CMAKE_COMMAND} 
-                -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P ${CMAKE_BINARY_DIR}/cmake_install.cmake 
-            COMMAND ${KDEWIN_PACKAGER_EXECUTABLE} 
-                -name ${_name}
-                -root ${CMAKE_BINARY_DIR}/temp
-                -srcroot ${CMAKE_SOURCE_DIR}
-                -version ${_version} 
-                -notes "${_notes}"
-                -type ${type}
-                ${_options}               
-            # FIXME: cleanup does not work 
-            #COMMAND rmdir /Q /S ${CMAKE_BINARY_DIR}\temp
-        )
-        add_custom_target(kdewin_package_debug_and_release
-            COMMAND ${CMAKE_COMMAND} 
-                -H$(CMAKE_SOURCE_DIR) 
-                -B$(CMAKE_BINARY_DIR)
-                -DCMAKE_BUILD_TYPE=Release
-            COMMAND ${CMAKE_MAKE_PROGRAM} 
-                clean
-            COMMAND ${CMAKE_MAKE_PROGRAM} 
-                install/local
-            COMMAND ${CMAKE_COMMAND} 
-                -H$(CMAKE_SOURCE_DIR) 
-                -B$(CMAKE_BINARY_DIR)
-                -DCMAKE_BUILD_TYPE=Debug
-            COMMAND ${CMAKE_MAKE_PROGRAM} 
-                clean
-            COMMAND ${CMAKE_MAKE_PROGRAM} 
-                install/local
-            COMMAND ${KDEWIN_PACKAGER_EXECUTABLE} 
-                -name ${_name}
-                -root ${CMAKE_BINARY_DIR}/temp
-                -srcroot ${CMAKE_SOURCE_DIR}
-                -version ${_version} 
-                -notes "${_notes}"
-                -type ${type}
-                ${_options}               
-            # FIXME: cleanup does not work 
-            #COMMAND rmdir /Q /S ${CMAKE_BINARY_DIR}\temp
-        )
-set (CONTENT "
-if \"%1\" == \"package_only\" goto package_only
-
-del CMakeCache.txt
-rmdir /Q /S ${CMAKE_BINARY_DIR}/temp 
-${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -G \"MinGW Makefiles\" -DCMAKE_BUILD_TYPE=Release
-mingw32-make
-${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P cmake_install.cmake
-${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -G \"MinGW Makefiles\" -DCMAKE_BUILD_TYPE=Debug
-mingw32-make
-${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P cmake_install.cmake
-del CMakeCache.txt
-${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release
-nmake
-${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P cmake_install.cmake
-${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Debug
-nmake
-${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P cmake_install.cmake
-:package_only
-${KDEWIN_PACKAGER_EXECUTABLE} -name ${_name} -root ${CMAKE_BINARY_DIR}/temp -srcroot ${CMAKE_SOURCE_DIR} -version ${_version}  -notes \"${_notes}\" ${_options} 
-"
-)
-        write_file(${CMAKE_BINARY_DIR}/kdewin_package_debug_and_release_mingw_and_msvc.bat "${CONTENT}")
-        add_custom_target(kdewin_package_debug_and_release_mingw_and_msvc
-            COMMAND ${CMAKE_BINARY_DIR}/kdewin_package_debug_and_release_mingw_and_msvc.bat
-        )
-    endif (KDEWIN_PACKAGER_FOUND)
-ENDMACRO (KDEWIN_PACKAGER)
-
diff --git a/cmake/modules/FindQt4.cmake b/cmake/modules/FindQt4.cmake
deleted file mode 100644 (file)
index 17d19a0..0000000
+++ /dev/null
@@ -1,1036 +0,0 @@
-# - Find QT 4
-# This module can be used to find Qt4.
-# The most important issue is that the Qt4 qmake is available via the system path.
-# This qmake is then used to detect basically everything else.
-# This module defines a number of key variables and macros. First is 
-# QT_USE_FILE which is the path to a CMake file that can be included to compile
-# Qt 4 applications and libraries.  By default, the QtCore and QtGui 
-# libraries are loaded. This behavior can be changed by setting one or more 
-# of the following variables to true:
-#                    QT_DONT_USE_QTCORE
-#                    QT_DONT_USE_QTGUI
-#                    QT_USE_QT3SUPPORT
-#                    QT_USE_QTASSISTANT
-#                    QT_USE_QTDESIGNER
-#                    QT_USE_QTMOTIF
-#                    QT_USE_QTMAIN
-#                    QT_USE_QTNETWORK
-#                    QT_USE_QTNSPLUGIN
-#                    QT_USE_QTOPENGL
-#                    QT_USE_QTSQL
-#                    QT_USE_QTXML
-# All the libraries required are stored in a variable called QT_LIBRARIES.  
-# Add this variable to your TARGET_LINK_LIBRARIES.
-#  
-#  macro QT4_WRAP_CPP(outfiles inputfile ... )
-#  macro QT4_WRAP_UI(outfiles inputfile ... )
-#  macro QT4_ADD_RESOURCE(outfiles inputfile ... )
-#  macro QT4_AUTOMOC(inputfile ... )
-#  macro QT4_GENERATE_MOC(inputfile outputfile )
-#
-#  macro QT4_ADD_DBUS_INTERFACE(outfiles interface basename)
-#        create a the interface header and implementation files with the 
-#        given basename from the given interface xml file and add it to 
-#        the list of sources
-#
-#  macro QT4_ADD_DBUS_INTERFACES(outfiles inputfile ... )
-#        create the interface header and implementation files 
-#        for all listed interface xml files
-#        the name will be automatically determined from the name of the xml file
-#
-#  macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname [basename] )
-#        create a dbus adaptor (header and implementation file) from the xml file
-#        describing the interface, and add it to the list of sources. The adaptor
-#        forwards the calls to a parent class, defined in parentheader and named
-#        parentclassname. The name of the generated files will be
-#        <basename>adaptor.{cpp,h} where basename is the basename of the xml file.
-#
-#  macro QT4_GENERATE_DBUS_INTERFACE( header)
-#        generate the xml interface file from the given header
-#
-#  QT_FOUND         If false, don't try to use Qt.
-#  QT4_FOUND        If false, don't try to use Qt 4.
-#
-#  QT_QTCORE_FOUND        True if QtCore was found.
-#  QT_QTGUI_FOUND         True if QtGui was found.
-#  QT_QT3SUPPORT_FOUND    True if Qt3Support was found.
-#  QT_QTASSISTANT_FOUND   True if QtAssistant was found.
-#  QT_QTDBUS_FOUND        True if QtDBus was found.
-#  QT_QTDESIGNER_FOUND    True if QtDesigner was found.
-#  QT_QTMOTIF_FOUND       True if QtMotif was found.
-#  QT_QTNETWORK_FOUND     True if QtNetwork was found.
-#  QT_QTNSPLUGIN_FOUND    True if QtNsPlugin was found.
-#  QT_QTOPENGL_FOUND      True if QtOpenGL was found.
-#  QT_QTSQL_FOUND         True if QtSql was found.
-#  QT_QTXML_FOUND         True if QtXml was found.
-#  QT_QTSVG_FOUND         True if QtSvg was found.
-#  QT_QTTEST_FOUND        True if QtTest was found.
-#                      
-#  QT_DEFINITIONS   Definitions to use when compiling code that uses Qt.
-#                  
-#  QT_INCLUDES      List of paths to all include directories of 
-#                   Qt4 QT_INCLUDE_DIR and QT_QTCORE_INCLUDE_DIR are
-#                   always in this variable even if NOTFOUND,
-#                   all other INCLUDE_DIRS are
-#                   only added if they are found.
-#   
-#  QT_INCLUDE_DIR              Path to "include" of Qt4
-#  QT_QT_INCLUDE_DIR           Path to "include/Qt" 
-#  QT_QT3SUPPORT_INCLUDE_DIR   Path to "include/Qt3Support" 
-#  QT_QTASSISTANT_INCLUDE_DIR  Path to "include/QtAssistant" 
-#  QT_QTCORE_INCLUDE_DIR       Path to "include/QtCore"         
-#  QT_QTDESIGNER_INCLUDE_DIR   Path to "include/QtDesigner" 
-#  QT_QTDBUS_INCLUDE_DIR       Path to "include/QtDBus" 
-#  QT_QTGUI_INCLUDE_DIR        Path to "include/QtGui" 
-#  QT_QTMOTIF_INCLUDE_DIR      Path to "include/QtMotif" 
-#  QT_QTNETWORK_INCLUDE_DIR    Path to "include/QtNetwork" 
-#  QT_QTNSPLUGIN_INCLUDE_DIR   Path to "include/QtNsPlugin" 
-#  QT_QTOPENGL_INCLUDE_DIR     Path to "include/QtOpenGL" 
-#  QT_QTSQL_INCLUDE_DIR        Path to "include/QtSql" 
-#  QT_QTXML_INCLUDE_DIR        Path to "include/QtXml" 
-#  QT_QTSVG_INCLUDE_DIR        Path to "include/QtSvg"
-#  QT_QTTEST_INCLUDE_DIR       Path to "include/QtTest"
-#                            
-#  QT_LIBRARY_DIR              Path to "lib" of Qt4
-#                            
-# For every library of Qt there are three variables:
-#  QT_QTFOO_LIBRARY_RELEASE, which contains the full path to the release version
-#  QT_QTFOO_LIBRARY_DEBUG, which contains the full path to the debug version
-#  QT_QTFOO_LIBRARY, the full path to the release version if available, otherwise to the debug version
-#
-# So there are the following variables:
-# The Qt3Support library:     QT_QT3SUPPORT_LIBRARY
-#                             QT_QT3SUPPORT_LIBRARY_RELEASE
-#                             QT_QT3SUPPORT_DEBUG
-#
-# The QtAssistant library:    QT_QTASSISTANT_LIBRARY
-#                             QT_QTASSISTANT_LIBRARY_RELEASE
-#                             QT_QTASSISTANT_LIBRARY_DEBUG
-#
-# The QtCore library:         QT_QTCORE_LIBRARY
-#                             QT_QTCORE_LIBRARY_RELEASE
-#                             QT_QTCORE_LIBRARY_DEBUG
-#
-# The QtDBus library:         QT_QTDBUS_LIBRARY
-#                             QT_QTDBUS_LIBRARY_RELEASE
-#                             QT_QTDBUS_LIBRARY_DEBUG
-#
-# The QtDesigner library:     QT_QTDESIGNER_LIBRARY
-#                             QT_QTDESIGNER_LIBRARY_RELEASE
-#                             QT_QTDESIGNER_LIBRARY_DEBUG
-#
-# The QtGui library:          QT_QTGUI_LIBRARY
-#                             QT_QTGUI_LIBRARY_RELEASE
-#                             QT_QTGUI_LIBRARY_DEBUG
-#
-# The QtMotif library:        QT_QTMOTIF_LIBRARY
-#                             QT_QTMOTIF_LIBRARY_RELEASE
-#                             QT_QTMOTIF_LIBRARY_DEBUG
-#
-# The QtNetwork library:      QT_QTNETWORK_LIBRARY
-#                             QT_QTNETWORK_LIBRARY_RELEASE
-#                             QT_QTNETWORK_LIBRARY_DEBUG
-#
-# The QtNsPLugin library:     QT_QTNSPLUGIN_LIBRARY
-#                             QT_QTNSPLUGIN_LIBRARY_RELEASE
-#                             QT_QTNSPLUGIN_LIBRARY_DEBUG
-#
-# The QtOpenGL library:       QT_QTOPENGL_LIBRARY
-#                             QT_QTOPENGL_LIBRARY_RELEASE
-#                             QT_QTOPENGL_LIBRARY_DEBUG
-#
-# The QtSql library:          QT_QTSQL_LIBRARY
-#                             QT_QTSQL_LIBRARY_RELEASE
-#                             QT_QTSQL_LIBRARY_DEBUG
-#
-# The QtXml library:          QT_QTXML_LIBRARY
-#                             QT_QTXML_LIBRARY_RELEASE
-#                             QT_QTXML_LIBRARY_DEBUG
-#
-# The QtSvg library:          QT_QTSVG_LIBRARY
-#                             QT_QTSVG_LIBRARY_RELEASE
-#                             QT_QTSVG_LIBRARY_DEBUG
-#
-# The QtTest library:         QT_QTTEST_LIBRARY
-#                             QT_QTTEST_LIBRARY_RELEASE
-#                             QT_QTTEST_LIBRARY_DEBUG
-#
-# The qtmain library for Windows QT_QTMAIN_LIBRARY
-#                             QT_QTMAIN_LIBRARY_RELEASE
-#                             QT_QTMAIN_LIBRARY_DEBUG
-#
-#The QtUiTools library:       QT_QTUITOOLS_LIBRARY
-#                             QT_QTUITOOLS_LIBRARY_RELEASE
-#                             QT_QTUITOOLS_LIBRARY_DEBUG
-#  
-# also defined, but NOT for general use are
-#  QT_MOC_EXECUTABLE          Where to find the moc tool.
-#  QT_UIC_EXECUTABLE          Where to find the uic tool.
-#  QT_UIC3_EXECUTABLE         Where to find the uic3 tool.
-#  QT_RCC_EXECUTABLE          Where to find the rcc tool
-#  QT_DBUSCPP2XML_EXECUTABLE  Where to find the dbuscpp2xml tool.
-#  QT_DBUSXML2CPP_EXECUTABLE  Where to find the dbusxml2cpp tool.
-#  
-#  QT_DOC_DIR                 Path to "doc" of Qt4
-#  QT_MKSPECS_DIR             Path to "mkspecs" of Qt4
-#
-#
-# These are around for backwards compatibility 
-# they will be set
-#  QT_WRAP_CPP  Set true if QT_MOC_EXECUTABLE is found
-#  QT_WRAP_UI   Set true if QT_UIC_EXECUTABLE is found
-#  
-# These variables do _NOT_ have any effect anymore (compared to FindQt.cmake)
-#  QT_MT_REQUIRED         Qt4 is now always multithreaded
-#  
-# These variables are set to "" Because Qt structure changed 
-# (They make no sense in Qt4)
-#  QT_QT_LIBRARY        Qt-Library is now split
-
-INCLUDE(CheckSymbolExists)
-INCLUDE(MacroAddFileDependencies)
-
-SET(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake)
-
-SET( QT_DEFINITIONS "")
-
-IF (WIN32)
-  SET(QT_DEFINITIONS -DQT_DLL)
-ENDIF(WIN32)
-
-# check for qmake
-FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake-qt4 PATHS
-  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
-  "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
-  $ENV{QTDIR}/bin
-)
-
-SET(QT4_INSTALLED_VERSION_TOO_OLD FALSE)
-
-
-IF (QT_QMAKE_EXECUTABLE)
-
-   SET(QT4_QMAKE_FOUND FALSE)
-   
-   EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION)
-
-   # check that we found the Qt4 qmake, Qt3 qmake output won't match here
-   STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" qt_version_tmp "${QTVERSION}")
-   IF (qt_version_tmp)
-
-      # we need at least version 4.0.0
-      IF (NOT QT_MIN_VERSION)
-         SET(QT_MIN_VERSION "4.0.0")
-      ENDIF (NOT QT_MIN_VERSION)
-   
-      #now parse the parts of the user given version string into variables
-      STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" req_qt_major_vers "${QT_MIN_VERSION}")
-      IF (NOT req_qt_major_vers)
-         MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", expected e.g. \"4.0.1\"")
-      ENDIF (NOT req_qt_major_vers)
-   
-      # now parse the parts of the user given version string into variables
-      STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_qt_major_vers "${QT_MIN_VERSION}")
-      STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" req_qt_minor_vers "${QT_MIN_VERSION}")
-      STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_qt_patch_vers "${QT_MIN_VERSION}")
-   
-      IF (NOT req_qt_major_vers EQUAL 4)
-         MESSAGE( FATAL_ERROR "Invalid Qt version string given: \"${QT_MIN_VERSION}\", major version 4 is required, e.g. \"4.0.1\"")
-      ENDIF (NOT req_qt_major_vers EQUAL 4)
-   
-      # and now the version string given by qmake
-      STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" found_qt_major_vers "${QTVERSION}")
-      STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" found_qt_minor_vers "${QTVERSION}")
-      STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" found_qt_patch_vers "${QTVERSION}")
-   
-      # compute an overall version number which can be compared at once
-      MATH(EXPR req_vers "${req_qt_major_vers}*10000 + ${req_qt_minor_vers}*100 + ${req_qt_patch_vers}")
-      MATH(EXPR found_vers "${found_qt_major_vers}*10000 + ${found_qt_minor_vers}*100 + ${found_qt_patch_vers}")
-   
-      IF (found_vers LESS req_vers)
-         SET(QT4_QMAKE_FOUND FALSE)
-         SET(QT4_INSTALLED_VERSION_TOO_OLD TRUE)
-      ELSE (found_vers LESS req_vers)
-    SET(QT4_QMAKE_FOUND TRUE)
-      ENDIF (found_vers LESS req_vers)
-
-   ENDIF (qt_version_tmp)
-
-ENDIF (QT_QMAKE_EXECUTABLE)
-
-IF (QT4_QMAKE_FOUND)
-
-  # ask qmake for the library dir
-  # Set QT_LIBRARY_DIR
-  IF (NOT QT_LIBRARY_DIR)
-    EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
-      ARGS "-query QT_INSTALL_LIBS"
-      OUTPUT_VARIABLE QT_LIBRARY_DIR_TMP )
-    IF(EXISTS "${QT_LIBRARY_DIR_TMP}")
-      SET(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE PATH "Qt library dir")
-    ELSE(EXISTS "${QT_LIBRARY_DIR_TMP}")
-      MESSAGE("Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_LIBS as ${QT_LIBRARY_DIR_TMP}")
-       MESSAGE("Warning: ${QT_LIBRARY_DIR_TMP} does NOT exist, Qt must NOT be installed correctly.")
-    ENDIF(EXISTS "${QT_LIBRARY_DIR_TMP}")
-  ENDIF(NOT QT_LIBRARY_DIR)
-  
-  IF (APPLE)
-    IF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
-      SET(QT_USE_FRAMEWORKS ON
-        CACHE BOOL "Set to ON if Qt build uses frameworks.")
-    ELSE (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
-      SET(QT_USE_FRAMEWORKS OFF
-        CACHE BOOL "Set to ON if Qt build uses frameworks.")
-    ENDIF (EXISTS ${QT_LIBRARY_DIR}/QtCore.framework)
-    
-    MARK_AS_ADVANCED(QT_USE_FRAMEWORKS)
-  ENDIF (APPLE)
-  
-  # ask qmake for the binary dir
-  IF (NOT QT_BINARY_DIR)
-     EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE}
-        ARGS "-query QT_INSTALL_BINS"
-        OUTPUT_VARIABLE qt_bins )
-     SET(QT_BINARY_DIR ${qt_bins} CACHE INTERNAL "")
-  ENDIF (NOT QT_BINARY_DIR)
-
-  # ask qmake for the include dir
-  IF (NOT QT_HEADERS_DIR)
-      EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
-        ARGS "-query QT_INSTALL_HEADERS" 
-        OUTPUT_VARIABLE qt_headers )
-      SET(QT_HEADERS_DIR ${qt_headers} CACHE INTERNAL "")
-  ENDIF(NOT QT_HEADERS_DIR)
-
-
-  # ask qmake for the documentation directory
-  IF (NOT QT_DOC_DIR)
-    EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
-      ARGS "-query QT_INSTALL_DOCS"
-      OUTPUT_VARIABLE qt_doc_dir )
-    SET(QT_DOC_DIR ${qt_doc_dir} CACHE PATH "The location of the Qt docs")
-  ENDIF (NOT QT_DOC_DIR)
-
-  # ask qmake for the mkspecs directory
-  IF (NOT QT_MKSPECS_DIR)
-    EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
-      ARGS "-query QMAKE_MKSPECS"
-      OUTPUT_VARIABLE qt_mkspecs_dir )
-    SET(QT_MKSPECS_DIR ${qt_mkspecs_dir} CACHE PATH "The location of the Qt mkspecs")
-  ENDIF (NOT QT_MKSPECS_DIR)
-
-  ########################################
-  #
-  #       Setting the INCLUDE-Variables
-  #
-  ########################################
-
-  FIND_PATH(QT_QTCORE_INCLUDE_DIR QtGlobal
-    "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/include/QtCore"
-    ${QT_HEADERS_DIR}/QtCore
-    ${QT_LIBRARY_DIR}/QtCore.framework/Headers
-    $ENV{QTDIR}/include/QtCore
-    "$ENV{ProgramFiles}/qt/include/Qt"
-   )
-
-  # Set QT_INCLUDE_DIR by removine "/QtCore" in the string ${QT_QTCORE_INCLUDE_DIR}
-  IF( QT_QTCORE_INCLUDE_DIR AND NOT QT_INCLUDE_DIR)
-    IF (QT_USE_FRAMEWORKS)
-      SET(QT_INCLUDE_DIR ${QT_HEADERS_DIR})
-    ELSE (QT_USE_FRAMEWORKS)
-      STRING( REGEX REPLACE "/QtCore$" "" qt4_include_dir ${QT_QTCORE_INCLUDE_DIR})
-      SET( QT_INCLUDE_DIR ${qt4_include_dir} CACHE PATH "")
-    ENDIF (QT_USE_FRAMEWORKS)
-  ENDIF( QT_QTCORE_INCLUDE_DIR AND NOT QT_INCLUDE_DIR)
-
-  IF( NOT QT_INCLUDE_DIR)
-    IF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED)
-      MESSAGE( FATAL_ERROR "Could NOT find QtGlobal header")
-    ENDIF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED)
-  ENDIF( NOT QT_INCLUDE_DIR)
-
-  #############################################
-  #
-  # Find out what window system we're using
-  #
-  #############################################
-  # Save required includes variable
-  SET(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
-  # Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
-  SET(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR}")
-  # Check for Window system symbols (note: only one should end up being set)
-  CHECK_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11)
-  CHECK_SYMBOL_EXISTS(Q_WS_MAC "QtCore/qglobal.h" Q_WS_MAC)
-  CHECK_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN)
-
-  IF (QT_QTCOPY_REQUIRED)
-     CHECK_SYMBOL_EXISTS(QT_IS_QTCOPY "QtCore/qglobal.h" QT_KDE_QT_COPY)
-     IF (NOT QT_IS_QTCOPY)
-        MESSAGE(FATAL_ERROR "qt-copy is required, but hasn't been found")
-     ENDIF (NOT QT_IS_QTCOPY)
-  ENDIF (QT_QTCOPY_REQUIRED)
-
-  # Restore CMAKE_REQUIRED_INCLUDES variable
-  SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
-  #
-  #############################################
-
-  IF (QT_USE_FRAMEWORKS)
-    SET(QT_DEFINITIONS ${QT_DEFINITIONS} -F${QT_LIBRARY_DIR} -L${QT_LIBRARY_DIR} )
-  ENDIF (QT_USE_FRAMEWORKS)
-
-  # Set QT_QT3SUPPORT_INCLUDE_DIR
-  FIND_PATH(QT_QT3SUPPORT_INCLUDE_DIR Qt3Support
-    PATHS
-    ${QT_INCLUDE_DIR}/Qt3Support
-    ${QT_LIBRARY_DIR}/Qt3Support.framework/Headers
-    NO_DEFAULT_PATH
-    )
-
-  # Set QT_QT_INCLUDE_DIR
-  FIND_PATH(QT_QT_INCLUDE_DIR qglobal.h
-    PATHS
-    ${QT_INCLUDE_DIR}/Qt
-    ${QT_LIBRARY_DIR}/QtCore.framework/Headers
-    NO_DEFAULT_PATH
-    )
-
-  # Set QT_QTGUI_INCLUDE_DIR
-  FIND_PATH(QT_QTGUI_INCLUDE_DIR QtGui
-    PATHS
-    ${QT_INCLUDE_DIR}/QtGui
-    ${QT_LIBRARY_DIR}/QtGui.framework/Headers
-    NO_DEFAULT_PATH
-    )
-
-  # Set QT_QTSVG_INCLUDE_DIR
-  FIND_PATH(QT_QTSVG_INCLUDE_DIR QtSvg
-    PATHS
-    ${QT_INCLUDE_DIR}/QtSvg
-    ${QT_LIBRARY_DIR}/QtSvg.framework/Headers
-    NO_DEFAULT_PATH
-    )
-
-  # Set QT_QTTEST_INCLUDE_DIR
-  FIND_PATH(QT_QTTEST_INCLUDE_DIR QtTest
-    PATHS
-    ${QT_INCLUDE_DIR}/QtTest
-    ${QT_LIBRARY_DIR}/QtTest.framework/Headers
-    NO_DEFAULT_PATH
-    )
-
-  # Set QT_QTUITOOLS_INCLUDE_DIR
-  FIND_PATH(QT_QTUITOOLS_INCLUDE_DIR QtUiTools
-    PATHS
-    ${QT_INCLUDE_DIR}/QtUiTools
-    ${QT_LIBRARY_DIR}/QtUiTools.framework/Headers
-    NO_DEFAULT_PATH
-    )
-
-
-
-  # Set QT_QTMOTIF_INCLUDE_DIR
-  IF(Q_WS_X11)
-    FIND_PATH(QT_QTMOTIF_INCLUDE_DIR QtMotif PATHS ${QT_INCLUDE_DIR}/QtMotif NO_DEFAULT_PATH )
-  ENDIF(Q_WS_X11)
-
-  # Set QT_QTNETWORK_INCLUDE_DIR
-  FIND_PATH(QT_QTNETWORK_INCLUDE_DIR QtNetwork
-    PATHS
-    ${QT_INCLUDE_DIR}/QtNetwork
-    ${QT_LIBRARY_DIR}/QtNetwork.framework/Headers
-    NO_DEFAULT_PATH
-    )
-
-  # Set QT_QTNSPLUGIN_INCLUDE_DIR
-  FIND_PATH(QT_QTNSPLUGIN_INCLUDE_DIR QtNsPlugin
-    PATHS
-    ${QT_INCLUDE_DIR}/QtNsPlugin
-    ${QT_LIBRARY_DIR}/QtNsPlugin.framework/Headers
-    NO_DEFAULT_PATH
-    )
-
-  # Set QT_QTOPENGL_INCLUDE_DIR
-  FIND_PATH(QT_QTOPENGL_INCLUDE_DIR QtOpenGL
-    PATHS
-    ${QT_INCLUDE_DIR}/QtOpenGL
-    ${QT_LIBRARY_DIR}/QtOpenGL.framework/Headers
-    NO_DEFAULT_PATH
-    )
-
-  # Set QT_QTSQL_INCLUDE_DIR
-  FIND_PATH(QT_QTSQL_INCLUDE_DIR QtSql
-    PATHS
-    ${QT_INCLUDE_DIR}/QtSql
-    ${QT_LIBRARY_DIR}/QtSql.framework/Headers
-    NO_DEFAULT_PATH
-    )
-
-  # Set QT_QTXML_INCLUDE_DIR
-  FIND_PATH(QT_QTXML_INCLUDE_DIR QtXml
-    PATHS
-    ${QT_INCLUDE_DIR}/QtXml
-    ${QT_LIBRARY_DIR}/QtXml.framework/Headers
-    NO_DEFAULT_PATH
-    )
-
-  # Set QT_QTASSISTANT_INCLUDE_DIR
-  FIND_PATH(QT_QTASSISTANT_INCLUDE_DIR QtAssistant
-    PATHS
-    ${QT_INCLUDE_DIR}/QtAssistant
-    ${QT_HEADERS_DIR}/QtAssistant
-    NO_DEFAULT_PATH
-    )
-
-  # Set QT_QTDESIGNER_INCLUDE_DIR
-  FIND_PATH(QT_QTDESIGNER_INCLUDE_DIR QDesignerComponents
-    PATHS
-    ${QT_INCLUDE_DIR}/QtDesigner
-    ${QT_HEADERS_DIR}/QtDesigner
-    NO_DEFAULT_PATH
-    )
-
-  # Set QT_QTDBUS_INCLUDE_DIR
-  FIND_PATH(QT_QTDBUS_INCLUDE_DIR QtDBus
-    PATHS
-    ${QT_INCLUDE_DIR}/QtDBus
-    ${QT_HEADERS_DIR}/QtDBus
-    NO_DEFAULT_PATH
-    )
-
-  # Make variables changeble to the advanced user
-  MARK_AS_ADVANCED( QT_LIBRARY_DIR QT_INCLUDE_DIR QT_QT_INCLUDE_DIR QT_DOC_DIR)
-
-  # Set QT_INCLUDES
-  SET( QT_INCLUDES ${QT_INCLUDE_DIR} ${QT_QT_INCLUDE_DIR} ${QT_MKSPECS_DIR}/default )
-
-
-  ########################################
-  #
-  #       Setting the LIBRARY-Variables
-  #
-  ########################################
-
-  IF (QT_USE_FRAMEWORKS)
-    # If FIND_LIBRARY found libraries in Apple frameworks, we would NOT have
-    # to jump through these hoops.
-    SET(QT_QTCORE_LIBRARY_RELEASE "-F${QT_LIBRARY_DIR} -framework QtCore" CACHE STRING "The QtCore library.")
-    SET(QT_QTCORE_LIBRARY_DEBUG   "-F${QT_LIBRARY_DIR} -framework QtCore" CACHE STRING "The QtCore library.")
-    SET(QT_QT3SUPPORT_LIBRARY_RELEASE "-framework Qt3Support" CACHE STRING "The Qt3Support library.")
-    SET(QT_QT3SUPPORT_LIBRARY_DEBUG   "-framework Qt3Support" CACHE STRING "The Qt3Support library.")
-    SET(QT_QTGUI_LIBRARY_RELEASE      "-framework QtGui"      CACHE STRING "The QtGui library.")
-    SET(QT_QTGUI_LIBRARY_DEBUG        "-framework QtGui"      CACHE STRING "The QtGui library.")
-    SET(QT_QTNETWORK_LIBRARY_RELEASE  "-framework QtNetwork"  CACHE STRING "The QtNetwork library.")
-    SET(QT_QTNETWORK_LIBRARY_DEBUG    "-framework QtNetwork"  CACHE STRING "The QtNetwork library.")
-    SET(QT_QTOPENGL_LIBRARY_RELEASE   "-framework QtOpenGL"   CACHE STRING "The QtOpenGL library.")
-    SET(QT_QTOPENGL_LIBRARY_DEBUG     "-framework QtOpenGL"   CACHE STRING "The QtOpenGL library.")
-    SET(QT_QTSQL_LIBRARY_RELEASE      "-framework QtSql"      CACHE STRING "The QtSql library.")
-    SET(QT_QTSQL_LIBRARY_DEBUG        "-framework QtSql"      CACHE STRING "The QtSql library.")
-    SET(QT_QTXML_LIBRARY_RELEASE      "-framework QtXml"      CACHE STRING "The QtXml library.")
-    SET(QT_QTXML_LIBRARY_DEBUG        "-framework QtXml"      CACHE STRING "The QtXml library.")
-    SET(QT_QTSVG_LIBRARY_RELEASE      "-framework QtSvg"      CACHE STRING "The QtSvg library.")
-    SET(QT_QTSVG_LIBRARY_DEBUG        "-framework QtSvg"      CACHE STRING "The QtSvg library.")
-    SET(QT_QTDBUS_LIBRARY_RELEASE     "-framework QtDBus"     CACHE STRING "The QtDBus library.")
-    SET(QT_QTDBUS_LIBRARY_DEBUG       "-framework QtDBus"     CACHE STRING "The QtDBus library.")
-
-
-    # WTF?  why don't we have frameworks?  :P
-    SET(QT_QTUITOOLS_LIBRARY_RELEASE      "-L${QT_LIBRARY_DIR} -lQtUiTools"      CACHE STRING "The QtUiTools library.")
-    SET(QT_QTUITOOLS_LIBRARY_DEBUG      "-L${QT_LIBRARY_DIR} -lQtUiTools"      CACHE STRING "The QtUiTools library.")
-    SET(QT_QTTEST_LIBRARY_RELEASE "-L${QT_LIBRARY_DIR} -lQtTest" CACHE STRING "The QtTest library.")
-    SET(QT_QTTEST_LIBRARY_DEBUG   "-L${QT_LIBRARY_DIR} -lQtTest_debug" CACHE STRING "The QtTest library.")
-    MARK_AS_ADVANCED(QT_QT3SUPPORT_LIBRARY QT_QTGUI_LIBRARY )
-
-  ELSE (QT_USE_FRAMEWORKS)
-    
-    # Set QT_QTCORE_LIBRARY by searching for a lib with "QtCore."  as part of the filename
-    FIND_LIBRARY(QT_QTCORE_LIBRARY_RELEASE NAMES QtCore QtCore4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH )
-    FIND_LIBRARY(QT_QTCORE_LIBRARY_DEBUG NAMES QtCore_debug QtCored4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
-
-    # Set QT_QT3SUPPORT_LIBRARY
-    FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_RELEASE NAMES Qt3Support Qt3Support4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
-    FIND_LIBRARY(QT_QT3SUPPORT_LIBRARY_DEBUG   NAMES Qt3Support_debug Qt3Supportd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
-
-    # Set QT_QTGUI_LIBRARY
-    FIND_LIBRARY(QT_QTGUI_LIBRARY_RELEASE NAMES QtGui QtGui4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
-    FIND_LIBRARY(QT_QTGUI_LIBRARY_DEBUG   NAMES QtGui_debug QtGuid4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
-
-    # Set QT_QTMOTIF_LIBRARY
-    IF(Q_WS_X11)
-      FIND_LIBRARY(QT_QTMOTIF_LIBRARY_RELEASE NAMES QtMotif PATHS ${QT_LIBRARY_DIR}       NO_DEFAULT_PATH)
-      FIND_LIBRARY(QT_QTMOTIF_LIBRARY_DEBUG   NAMES QtMotif_debug PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
-    ENDIF(Q_WS_X11)
-
-    # Set QT_QTNETWORK_LIBRARY
-    FIND_LIBRARY(QT_QTNETWORK_LIBRARY_RELEASE NAMES QtNetwork QtNetwork4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
-    FIND_LIBRARY(QT_QTNETWORK_LIBRARY_DEBUG   NAMES QtNetwork_debug QtNetworkd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
-
-    # Set QT_QTNSPLUGIN_LIBRARY
-    FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY_RELEASE NAMES QtNsPlugin PATHS ${QT_LIBRARY_DIR}       NO_DEFAULT_PATH)
-    FIND_LIBRARY(QT_QTNSPLUGIN_LIBRARY_DEBUG   NAMES QtNsPlugin_debug PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
-
-    # Set QT_QTOPENGL_LIBRARY
-    FIND_LIBRARY(QT_QTOPENGL_LIBRARY_RELEASE NAMES QtOpenGL QtOpenGL4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
-    FIND_LIBRARY(QT_QTOPENGL_LIBRARY_DEBUG   NAMES QtOpenGL_debug QtOpenGLd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
-
-    # Set QT_QTSQL_LIBRARY
-    FIND_LIBRARY(QT_QTSQL_LIBRARY_RELEASE NAMES QtSql QtSql4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
-    FIND_LIBRARY(QT_QTSQL_LIBRARY_DEBUG   NAMES QtSql_debug QtSqld4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
-
-    # Set QT_QTXML_LIBRARY
-    FIND_LIBRARY(QT_QTXML_LIBRARY_RELEASE NAMES QtXml QtXml4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
-    FIND_LIBRARY(QT_QTXML_LIBRARY_DEBUG   NAMES QtXml_debug QtXmld4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
-
-    # Set QT_QTSVG_LIBRARY
-    FIND_LIBRARY(QT_QTSVG_LIBRARY_RELEASE NAMES QtSvg QtSvg4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
-    FIND_LIBRARY(QT_QTSVG_LIBRARY_DEBUG   NAMES QtSvg_debug QtSvgd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
-
-    # Set QT_QTUITOOLS_LIBRARY
-    FIND_LIBRARY(QT_QTUITOOLS_LIBRARY_RELEASE NAMES QtUiTools QtUiTools4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
-    FIND_LIBRARY(QT_QTUITOOLS_LIBRARY_DEBUG   NAMES QtUiTools_debug QtUiToolsd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
-
-    # Set QT_QTTEST_LIBRARY
-    FIND_LIBRARY(QT_QTTEST_LIBRARY_RELEASE NAMES QtTest QtTest4 PATHS ${QT_LIBRARY_DIR}                      NO_DEFAULT_PATH)
-    FIND_LIBRARY(QT_QTTEST_LIBRARY_DEBUG   NAMES QtTest_debug QtTest_debug4 QtTestd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
-
-    FIND_LIBRARY(QT_QTDBUS_LIBRARY_RELEASE NAMES QtDBus QtDBus4 PATHS ${QT_LIBRARY_DIR}                      NO_DEFAULT_PATH)
-    FIND_LIBRARY(QT_QTDBUS_LIBRARY_DEBUG   NAMES QtDBus_debug QtDBus_debug4 QtDBusd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
-
-    MARK_AS_ADVANCED(QT_QT3SUPPORT_LIBRARY QT_QTGUI_LIBRARY )
-
-  ENDIF (QT_USE_FRAMEWORKS)
-
-  IF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE )
-    IF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED)
-      MESSAGE( FATAL_ERROR "Could NOT find QtCore. Check CMakeFiles/CMakeError.log for more details.")
-    ENDIF( NOT Qt4_FIND_QUIETLY AND Qt4_FIND_REQUIRED)
-  ENDIF( NOT QT_QTCORE_LIBRARY_DEBUG AND NOT QT_QTCORE_LIBRARY_RELEASE )
-
-  # Set QT_QTASSISTANT_LIBRARY
-  FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient QtAssistant QtAssistant4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
-  FIND_LIBRARY(QT_QTASSISTANT_LIBRARY_DEBUG   NAMES QtAssistantClientd QtAssistantClient_debug QtAssistant_debug QtAssistantd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
-
-  # Set QT_QTDESIGNER_LIBRARY
-  FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_RELEASE NAMES QtDesigner QtDesigner4 PATHS ${QT_LIBRARY_DIR}        NO_DEFAULT_PATH)
-  FIND_LIBRARY(QT_QTDESIGNER_LIBRARY_DEBUG   NAMES QtDesigner_debug QtDesignerd4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH)
-
-  ############################################
-  #
-  # Check the existence of the libraries.
-  #
-  ############################################
-
-  MACRO (_QT4_ADJUST_LIB_VARS basename)
-    IF (QT_${basename}_INCLUDE_DIR)
-
-      # if only the release version was found, set the debug variable also to the release version
-      IF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG)
-        SET(QT_${basename}_LIBRARY_DEBUG ${QT_${basename}_LIBRARY_RELEASE})
-        SET(QT_${basename}_LIBRARY       ${QT_${basename}_LIBRARY_RELEASE})
-        SET(QT_${basename}_LIBRARIES     ${QT_${basename}_LIBRARY_RELEASE})
-      ENDIF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG)
-
-      # if only the debug version was found, set the release variable also to the debug version
-      IF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE)
-        SET(QT_${basename}_LIBRARY_RELEASE ${QT_${basename}_LIBRARY_DEBUG})
-        SET(QT_${basename}_LIBRARY         ${QT_${basename}_LIBRARY_DEBUG})
-        SET(QT_${basename}_LIBRARIES       ${QT_${basename}_LIBRARY_DEBUG})
-      ENDIF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE)
-
-      IF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE)
-        IF(NOT MSVC)
-        SET(QT_${basename}_LIBRARY         ${QT_${basename}_LIBRARY_RELEASE})
-        ELSE(NOT MSVC)
-          SET(QT_${basename}_LIBRARY       optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
-        ENDIF(NOT MSVC)
-        SET(QT_${basename}_LIBRARIES       optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
-      ENDIF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE)
-
-      SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE FILEPATH "The Qt ${basename} library")
-
-      IF (QT_${basename}_LIBRARY)
-        SET(QT_${basename}_FOUND 1)
-      ENDIF (QT_${basename}_LIBRARY)
-
-      #add the include directory to QT_INCLUDES
-      SET(QT_INCLUDES ${QT_INCLUDES} "${QT_${basename}_INCLUDE_DIR}")
-    ENDIF (QT_${basename}_INCLUDE_DIR )
-
-    # Make variables changeble to the advanced user
-    MARK_AS_ADVANCED(QT_${basename}_LIBRARY QT_${basename}_LIBRARY_RELEASE QT_${basename}_LIBRARY_DEBUG QT_${basename}_INCLUDE_DIR)
-  ENDMACRO (_QT4_ADJUST_LIB_VARS)
-
-  IF(WIN32)
-     _QT4_ADJUST_LIB_VARS(QTMAIN)
-  ENDIF(WIN32)
-
-
-  _QT4_ADJUST_LIB_VARS(QTCORE)
-  _QT4_ADJUST_LIB_VARS(QTGUI)
-  _QT4_ADJUST_LIB_VARS(QT3SUPPORT)
-  _QT4_ADJUST_LIB_VARS(QTASSISTANT)
-  _QT4_ADJUST_LIB_VARS(QTDESIGNER)
-  IF(Q_WS_X11)
-    _QT4_ADJUST_LIB_VARS(QTMOTIF)
-  ENDIF(Q_WS_X11)
-  _QT4_ADJUST_LIB_VARS(QTNETWORK)
-  _QT4_ADJUST_LIB_VARS(QTNSPLUGIN)
-  _QT4_ADJUST_LIB_VARS(QTOPENGL)
-  _QT4_ADJUST_LIB_VARS(QTSQL)
-  _QT4_ADJUST_LIB_VARS(QTXML)
-  _QT4_ADJUST_LIB_VARS(QTSVG)
-  _QT4_ADJUST_LIB_VARS(QTUITOOLS)
-  _QT4_ADJUST_LIB_VARS(QTTEST)
-  _QT4_ADJUST_LIB_VARS(QTDBUS)
-
-  #######################################
-  #
-  #       Check the executables of Qt 
-  #          ( moc, uic, rcc )
-  #
-  #######################################
-
-
-   # find moc and uic using qmake
-   FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmpQmake/tmp.pro
-    "message(MOC<$$QMAKE_MOC>)
-      message(UIC<$$QMAKE_UIC>)
-   ")
-
-   EXECUTE_PROCESS(COMMAND ${QT_QMAKE_EXECUTABLE}
-      WORKING_DIRECTORY  ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmpQmake
-      OUTPUT_VARIABLE _moc_OUTPUT
-      ERROR_VARIABLE _moc_OUTPUT )
-   FILE(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmpQmake")
-
-   STRING(REGEX REPLACE ".*MOC<([^>]+).*" "\\1" QT_MOC_EXECUTABLE_INTERNAL "${_moc_OUTPUT}" )
-   STRING(REGEX REPLACE ".*UIC<([^>]+).*" "\\1" QT_UIC_EXECUTABLE_INTERNAL "${_moc_OUTPUT}" )
-
-   FILE(TO_CMAKE_PATH "${QT_MOC_EXECUTABLE_INTERNAL}" QT_MOC_EXECUTABLE_INTERNAL)
-   FILE(TO_CMAKE_PATH "${QT_UIC_EXECUTABLE_INTERNAL}" QT_UIC_EXECUTABLE_INTERNAL)
-
-   SET(QT_MOC_EXECUTABLE ${QT_MOC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The moc executable")
-   SET(QT_UIC_EXECUTABLE ${QT_UIC_EXECUTABLE_INTERNAL} CACHE FILEPATH "The uic executable")
-
-  FIND_PROGRAM(QT_UIC3_EXECUTABLE
-    NAMES uic3
-    PATHS ${QT_BINARY_DIR}
-    NO_DEFAULT_PATH
-    )
-
-  FIND_PROGRAM(QT_RCC_EXECUTABLE 
-    NAMES rcc
-    PATHS ${QT_BINARY_DIR}
-    NO_DEFAULT_PATH
-    )
-
-  FIND_PROGRAM(QT_DBUSCPP2XML_EXECUTABLE 
-    NAMES dbuscpp2xml
-    PATHS ${QT_BINARY_DIR}
-    NO_DEFAULT_PATH
-    )
-
-  FIND_PROGRAM(QT_DBUSXML2CPP_EXECUTABLE 
-    NAMES dbusxml2cpp
-    PATHS ${QT_BINARY_DIR}
-    NO_DEFAULT_PATH
-    )
-
-  IF (QT_MOC_EXECUTABLE)
-     SET(QT_WRAP_CPP "YES")
-  ENDIF (QT_MOC_EXECUTABLE)
-
-  IF (QT_UIC_EXECUTABLE)
-     SET(QT_WRAP_UI "YES")
-  ENDIF (QT_UIC_EXECUTABLE)
-
-
-
-  MARK_AS_ADVANCED( QT_UIC_EXECUTABLE QT_UIC3_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE )
-
-  ######################################
-  #
-  #       Macros for building Qt files
-  #
-  ######################################
-
-  MACRO (QT4_GET_MOC_INC_DIRS _moc_INC_DIRS)
-     SET(${_moc_INC_DIRS})
-     GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES)
-
-     FOREACH(_current ${_inc_DIRS})
-        SET(${_moc_INC_DIRS} ${${_moc_INC_DIRS}} "-I" ${_current})
-     ENDFOREACH(_current ${_inc_DIRS})
-  ENDMACRO(QT4_GET_MOC_INC_DIRS)
-
-
-  MACRO (QT4_GENERATE_MOC infile outfile )
-  # get include dirs
-     QT4_GET_MOC_INC_DIRS(moc_includes)
-
-     GET_FILENAME_COMPONENT(abs_infile ${infile} ABSOLUTE)
-
-     ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
-        COMMAND ${QT_MOC_EXECUTABLE}
-        ARGS ${moc_includes} -o ${outfile} ${abs_infile}
-        DEPENDS ${abs_infile})
-
-     MACRO_ADD_FILE_DEPENDENCIES(${abs_infile} ${outfile})
-  ENDMACRO (QT4_GENERATE_MOC)
-
-
-  # QT4_WRAP_CPP(outfiles inputfile ... )
-  # TODO  perhaps add support for -D, -U and other minor options
-
-  MACRO (QT4_WRAP_CPP outfiles )
-    # get include dirs
-    QT4_GET_MOC_INC_DIRS(moc_includes)
-
-    FOREACH (it ${ARGN})
-      GET_FILENAME_COMPONENT(it ${it} ABSOLUTE)
-      GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
-
-      SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/moc_${outfile}.cxx)
-      ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
-        COMMAND ${QT_MOC_EXECUTABLE}
-        ARGS ${moc_includes} -o ${outfile} ${it}
-        DEPENDS ${it})
-      SET(${outfiles} ${${outfiles}} ${outfile})
-    ENDFOREACH(it)
-
-  ENDMACRO (QT4_WRAP_CPP)
-
-
-  # QT4_WRAP_UI(outfiles inputfile ... )
-
-  MACRO (QT4_WRAP_UI outfiles )
-
-    FOREACH (it ${ARGN})
-      GET_FILENAME_COMPONENT(outfile ${it} NAME_WE)
-      GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
-      SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h)
-      ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
-        COMMAND ${QT_UIC_EXECUTABLE}
-        ARGS -o ${outfile} ${infile}
-        MAIN_DEPENDENCY ${infile})
-      SET(${outfiles} ${${outfiles}} ${outfile})
-    ENDFOREACH (it)
-
-  ENDMACRO (QT4_WRAP_UI)
-
-
-  # QT4_ADD_RESOURCE(outfiles inputfile ... )
-  # TODO  perhaps consider adding support for compression and root options to rcc
-
-  MACRO (QT4_ADD_RESOURCES outfiles )
-
-    FOREACH (it ${ARGN})
-      GET_FILENAME_COMPONENT(outfilename ${it} NAME_WE)
-      GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
-      SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cxx)
-      ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
-        COMMAND ${QT_RCC_EXECUTABLE}
-        ARGS -name ${outfilename} -o ${outfile} ${infile}
-        MAIN_DEPENDENCY ${infile} )
-      SET(${outfiles} ${${outfiles}} ${outfile})
-    ENDFOREACH (it)
-
-  ENDMACRO (QT4_ADD_RESOURCES)
-
-
-  MACRO(QT4_ADD_DBUS_INTERFACE _sources _interface _basename)
-    GET_FILENAME_COMPONENT(_infile ${_interface} ABSOLUTE)
-    SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
-    SET(_impl   ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
-    SET(_moc    ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc)
-  
-    ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header}
-        COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -p ${_basename} ${_infile}
-        DEPENDS ${_infile})
-  
-    SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE)
-    
-    QT4_GENERATE_MOC(${_header} ${_moc})
-  
-    SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc})
-    MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc})
-  
-  ENDMACRO(QT4_ADD_DBUS_INTERFACE)
-  
-  
-  MACRO(QT4_ADD_DBUS_INTERFACES _sources)
-     FOREACH (_current_FILE ${ARGN})
-        GET_FILENAME_COMPONENT(_infile ${_current_FILE} ABSOLUTE)
-  
-  # get the part before the ".xml" suffix
-        STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2" _basename ${_current_FILE})
-        STRING(TOLOWER ${_basename} _basename)
-  
-        QT4_ADD_DBUS_INTERFACE(${_sources} ${_infile} ${_basename}interface)
-     ENDFOREACH (_current_FILE)
-  ENDMACRO(QT4_ADD_DBUS_INTERFACES)
-  
-  
-  MACRO(QT4_GENERATE_DBUS_INTERFACE _header)
-    GET_FILENAME_COMPONENT(_in_file ${_header} ABSOLUTE)
-    GET_FILENAME_COMPONENT(_basename ${_header} NAME_WE)
-    SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.xml)
-  
-    ADD_CUSTOM_COMMAND(OUTPUT ${_target}
-        COMMAND ${QT_DBUSCPP2XML_EXECUTABLE} ${_in_file} > ${_target}
-        DEPENDS ${_in_file}
-    )
-  ENDMACRO(QT4_GENERATE_DBUS_INTERFACE)
-  
-  
-  MACRO(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass)
-    GET_FILENAME_COMPONENT(_infile ${_xml_file} ABSOLUTE)
-    
-    SET(_optionalBasename "${ARGV4}")
-    IF (_optionalBasename)
-       SET(_basename ${_optionalBasename} )
-    ELSE (_optionalBasename)
-       STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2adaptor" _basename ${_infile})
-       STRING(TOLOWER ${_basename} _basename)
-    ENDIF (_optionalBasename)
-
-    SET(_optionalClassName "${ARGV5}")
-       SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
-    SET(_impl   ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
-    SET(_moc    ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc)
-       
-       IF(_optionalClassName)
-       ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header}
-          COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -c ${_optionalClassName} -i ${_include} -l ${_parentClass} ${_infile}
-          DEPENDS ${_infile}
-        )                      
-       ELSE(_optionalClassName)
-       ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header}
-          COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -i ${_include} -l ${_parentClass} ${_infile}
-          DEPENDS ${_infile}
-        )
-       ENDIF(_optionalClassName)
-
-    QT4_GENERATE_MOC(${_header} ${_moc})
-    SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE)
-    MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc})
-
-    SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc})
-  ENDMACRO(QT4_ADD_DBUS_ADAPTOR)
-
-  MACRO(QT4_ADD_DBUS_ADAPTORS _sources)
-    message(FATAL_ERROR "There is a call to QT4_ADD_DBUS_ADAPTORS() in the CMakeLists.txt for '${ARGV0}', but this macro has been removed, please use QT4_ADD_DBUS_ADAPTOR and specify the include file and classname for the parent object implementing the code")
-  ENDMACRO(QT4_ADD_DBUS_ADAPTORS _sources)
-
-   MACRO(QT4_AUTOMOC)
-      QT4_GET_MOC_INC_DIRS(_moc_INCS)
-
-      SET(_matching_FILES )
-      FOREACH (_current_FILE ${ARGN})
-
-         GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE)
-         # if "SKIP_AUTOMOC" is set to true, we will not handle this file here.
-         # here. this is required to make bouic work correctly:
-         # we need to add generated .cpp files to the sources (to compile them),
-         # but we cannot let automoc handle them, as the .cpp files don't exist yet when
-         # cmake is run for the very first time on them -> however the .cpp files might
-         # exist at a later run. at that time we need to skip them, so that we don't add two
-         # different rules for the same moc file
-         GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC)
-
-         IF ( NOT _skip AND EXISTS ${_abs_FILE} )
-
-            FILE(READ ${_abs_FILE} _contents)
-
-            GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH)
-
-            STRING(REGEX MATCHALL "#include +[^ ]+\\.moc[\">]" _match "${_contents}")
-            IF(_match)
-               FOREACH (_current_MOC_INC ${_match})
-                  STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}")
-
-                  GET_filename_component(_basename ${_current_MOC} NAME_WE)
-   #               SET(_header ${CMAKE_CURRENT_SOURCE_DIR}/${_basename}.h)
-                  SET(_header ${_abs_PATH}/${_basename}.h)
-                  SET(_moc    ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})
-                  ADD_CUSTOM_COMMAND(OUTPUT ${_moc}
-                     COMMAND ${QT_MOC_EXECUTABLE}
-                     ARGS ${_moc_INCS} ${_header} -o ${_moc}
-                     DEPENDS ${_header}
-                  )
-
-                  MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc})
-               ENDFOREACH (_current_MOC_INC)
-            ENDIF(_match)
-         ENDIF ( NOT _skip AND EXISTS ${_abs_FILE} )
-      ENDFOREACH (_current_FILE)
-   ENDMACRO(QT4_AUTOMOC)
-
-
-
-  ######################################
-  #
-  #       decide if Qt got found
-  #
-  ######################################
-
-  # if the includes,libraries,moc,uic and rcc are found then we have it
-  IF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE)
-    SET( QT4_FOUND "YES" )
-    IF( NOT Qt4_FIND_QUIETLY)
-      MESSAGE(STATUS "Found Qt-Version ${QTVERSION}")
-    ENDIF( NOT Qt4_FIND_QUIETLY)
-  ELSE( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND QT_RCC_EXECUTABLE)
-    SET( QT4_FOUND "NO")
-    SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE)
-    IF( Qt4_FIND_REQUIRED)
-      MESSAGE( FATAL_ERROR "Qt libraries, includes, moc, uic or/and rcc NOT found!")
-    ENDIF( Qt4_FIND_REQUIRED)
-  ENDIF( QT_LIBRARY_DIR AND QT_INCLUDE_DIR AND QT_MOC_EXECUTABLE AND QT_UIC_EXECUTABLE AND  QT_RCC_EXECUTABLE)
-  SET(QT_FOUND ${QT4_FOUND})
-
-
-  #######################################
-  #
-  #       System dependent settings  
-  #
-  #######################################
-  # for unix add X11 stuff
-  IF(UNIX)
-    # on OS X X11 may not be required
-    IF (Q_WS_X11)
-    FIND_PACKAGE(X11)
-    ENDIF (Q_WS_X11)
-    FIND_PACKAGE(Threads)
-    SET(QT_QTCORE_LIBRARY ${QT_QTCORE_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
-  ENDIF(UNIX)
-
-
-  #######################################
-  #
-  #       compatibility settings 
-  #
-  #######################################
-  # Backwards compatibility for CMake1.4 and 1.2
-  SET (QT_MOC_EXE ${QT_MOC_EXECUTABLE} )
-  SET (QT_UIC_EXE ${QT_UIC_EXECUTABLE} )
-
-  SET( QT_QT_LIBRARY "")
-
-ELSE(QT4_QMAKE_FOUND)
-   
-   SET(QT_QMAKE_EXECUTABLE "${QT_QMAKE_EXECUTABLE}-NOTFOUND" CACHE FILEPATH "Invalid qmake found" FORCE)
-   IF(Qt4_FIND_REQUIRED)
-      IF(QT4_INSTALLED_VERSION_TOO_OLD)
-         MESSAGE(FATAL_ERROR "The installed Qt version ${QTVERSION} is too old, at least version ${QT_MIN_VERSION} is required")
-      ELSE(QT4_INSTALLED_VERSION_TOO_OLD)
-         MESSAGE( FATAL_ERROR "Qt qmake not found!")
-      ENDIF(QT4_INSTALLED_VERSION_TOO_OLD)
-   ELSE(Qt4_FIND_REQUIRED)
-      IF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY)
-         MESSAGE(STATUS "The installed Qt version ${QTVERSION} is too old, at least version ${QT_MIN_VERSION} is required")
-      ENDIF(QT4_INSTALLED_VERSION_TOO_OLD AND NOT Qt4_FIND_QUIETLY)
-   ENDIF(Qt4_FIND_REQUIRED)
-ENDIF (QT4_QMAKE_FOUND)
-
index a84bfd1..3ab1f40 100644 (file)
@@ -1,59 +1,29 @@
 project(test)
 
-#if HAVE_GLIB
-#    GLIB_SUBDIR=glib
-#endif
-#if HAVE_PYTHON
-#    PYTHON_SUBDIR=python
-#endif
-#if HAVE_QTESTLIB
-#    QT_SUBDIR=qt
-#endif
+add_definitions(${DBUS_INTERNAL_CLIENT_DEFINITIONS})
 
 add_subdirectory( name-test )
 
-#SUBDIRS=name-test $(GLIB_SUBDIR) $(PYTHON_SUBDIR) $(QT_SUBDIR)
-#DIST_SUBDIRS=glib python qt name-test
-
-#INCLUDES=-I$(top_srcdir) $(DBUS_test-CFLAGS) 
-
-#if (DBUS_BUILD_TESTS)
-## break-loader removed for now
-#test-BINARIES=test-service test-names test-shell-service shell-test spawn-test test-segfault test-exit test-sleep-forever
-
-#enable stand alone make check test
-#TESTS=shell-test
-#else
-#test-BINARIES=
-#TESTS=
-#endif
-
-#if DBUS_GCOV_ENABLED
-#GCOV_BINARIES=decode-gcov
-#else
-#GCOV_BINARIES=
-#endif
-
 set (test-service_SOURCES
-       ${CMAKE_SOURCE_DIR}/../test/test-service.c                              
-       ${CMAKE_SOURCE_DIR}/../test/test-utils.c                                
-       ${CMAKE_SOURCE_DIR}/../test/test-utils.h
+    ${CMAKE_SOURCE_DIR}/../test/test-service.c
+    ${CMAKE_SOURCE_DIR}/../test/test-utils.c
+    ${CMAKE_SOURCE_DIR}/../test/test-utils.h
 )
 
 set (test-names_SOURCES
-       ${CMAKE_SOURCE_DIR}/../test/test-names.c                                
-       ${CMAKE_SOURCE_DIR}/../test/test-utils.c                                
-       ${CMAKE_SOURCE_DIR}/../test/test-utils.h
+    ${CMAKE_SOURCE_DIR}/../test/test-names.c
+    ${CMAKE_SOURCE_DIR}/../test/test-utils.c
+    ${CMAKE_SOURCE_DIR}/../test/test-utils.h
 )
 
 set (break_loader_SOURCES
-       ${CMAKE_SOURCE_DIR}/../test/break-loader.c
+    ${CMAKE_SOURCE_DIR}/../test/break-loader.c
 )
 
 set (test-shell-service_SOURCES
-       ${CMAKE_SOURCE_DIR}/../test/test-shell-service.c                        
-       ${CMAKE_SOURCE_DIR}/../test/test-utils.c                                
-       ${CMAKE_SOURCE_DIR}/../test/test-utils.h
+    ${CMAKE_SOURCE_DIR}/../test/test-shell-service.c
+    ${CMAKE_SOURCE_DIR}/../test/test-utils.c
+    ${CMAKE_SOURCE_DIR}/../test/test-utils.h
 )
 
 set (shell-test_SOURCES
@@ -61,100 +31,99 @@ set (shell-test_SOURCES
 )
 
 set (spawn-test_SOURCES
-       ${CMAKE_SOURCE_DIR}/../test/spawn-test.c
+    ${CMAKE_SOURCE_DIR}/../test/spawn-test.c
 )
 
 set (test-exit_SOURCES
-       ${CMAKE_SOURCE_DIR}/../test/test-exit.c
+    ${CMAKE_SOURCE_DIR}/../test/test-exit.c
 )
 
 set (test-segfault_SOURCES
-       ${CMAKE_SOURCE_DIR}/../test/test-segfault.c
+    ${CMAKE_SOURCE_DIR}/../test/test-segfault.c
 )
 
 set (test-sleep-forever_SOURCES
-       ${CMAKE_SOURCE_DIR}/../test/test-sleep-forever.c
+    ${CMAKE_SOURCE_DIR}/../test/test-sleep-forever.c
 )
 
 set (decode_gcov_SOURCES
-       ${CMAKE_SOURCE_DIR}/../test/decode-gcov.c
+    ${CMAKE_SOURCE_DIR}/../test/decode-gcov.c
 )
 
 add_executable(test-service ${test-service_SOURCES})
-target_link_libraries(test-service ${DBUS_1})
+target_link_libraries(test-service ${DBUS_INTERNAL_LIBRARIES})
 
 add_executable(test-names ${test-names_SOURCES})
-target_link_libraries(test-names ${DBUS_1})
+target_link_libraries(test-names ${DBUS_INTERNAL_LIBRARIES})
 
 add_executable(shell-test ${shell-test_SOURCES})
-target_link_libraries(shell-test ${DBUS_1})
+target_link_libraries(shell-test ${DBUS_INTERNAL_LIBRARIES})
 ADD_TEST(shell-test ${EXECUTABLE_OUTPUT_PATH}/shell-test${EXT})
 
 add_executable(test-shell-service ${test-shell-service_SOURCES})
-target_link_libraries(test-shell-service ${DBUS_1})
+target_link_libraries(test-shell-service ${DBUS_INTERNAL_LIBRARIES})
 
 add_executable(spawn-test ${spawn-test_SOURCES})
-target_link_libraries(spawn-test ${DBUS_1})
+target_link_libraries(spawn-test ${DBUS_INTERNAL_LIBRARIES})
 
 add_executable(test-exit ${test-exit_SOURCES})
-target_link_libraries(test-exit ${DBUS_1})
+target_link_libraries(test-exit ${DBUS_INTERNAL_LIBRARIES})
 
 add_executable(test-segfault ${test-segfault_SOURCES})
-target_link_libraries(test-segfault ${DBUS_1})
+target_link_libraries(test-segfault ${DBUS_INTERNAL_LIBRARIES})
 
 add_executable(test-sleep-forever ${test-sleep-forever_SOURCES})
-target_link_libraries(test-sleep-forever ${DBUS_1})
+target_link_libraries(test-sleep-forever ${DBUS_INTERNAL_LIBRARIES})
 
 #add_executable(decode-gcov ${decode_gcov_SOURCES})
-#target_link_libraries(decode-gcov ${DBUS_1})
+#target_link_libraries(decode-gcov ${DBUS_INTERNAL_LIBRARIES})
 
-#EXTRA_DIST=
-#
 ### keep these in creation order, i.e. uppermost dirs first 
 set (TESTDIRS
-       test/data                                       
-       test/data/auth
-       test/data/equiv-config-files
-       test/data/equiv-config-files/basic
-       test/data/equiv-config-files/basic/basic.d
-       test/data/equiv-config-files/entities
-       test/data/equiv-config-files/entities/basic.d
-       test/data/incomplete-messages
-       test/data/invalid-config-files
-       test/data/invalid-config-files-system
-       test/data/invalid-messages
-       test/data/invalid-service-files-system
-       test/data/sha-1
-       test/data/valid-config-files
-       test/data/valid-config-files/basic.d            
-       test/data/valid-config-files/system.d
-       test/data/valid-config-files-system
-       test/data/valid-introspection-files
-       test/data/valid-messages
-       test/data/valid-service-files
-       test/data/valid-service-files-system
+    test/data
+    test/data/auth
+    test/data/equiv-config-files
+    test/data/equiv-config-files/basic
+    test/data/equiv-config-files/basic/basic.d
+    test/data/equiv-config-files/entities
+    test/data/equiv-config-files/entities/basic.d
+    test/data/incomplete-messages
+    test/data/invalid-config-files
+    test/data/invalid-config-files-system
+    test/data/invalid-messages
+    test/data/invalid-service-files-system
+    test/data/sha-1
+    test/data/valid-config-files
+    test/data/valid-config-files/basic.d
+    test/data/valid-config-files/system.d
+    test/data/valid-config-files-system
+    test/data/valid-introspection-files
+    test/data/valid-messages
+    test/data/valid-service-files
+    test/data/valid-service-files-system
 )
 set (CONFIG_VERBOSE 0)
 
 ### copy tests to builddir so that generated tests and static tests 
 ### are all in one place.
+MESSAGE(STATUS "Copying test files to test directory")
 FOREACH(FILE_TYPE *.message *.message-raw *.auth-script *.sha1 *.txt *.conf *.service)
-       FOREACH(DIR ${TESTDIRS})
-               FILE(GLOB FILES "${CMAKE_SOURCE_DIR}/../${DIR}/${FILE_TYPE}" )
-               FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DIR})
-               FOREACH(FILE ${FILES})
-                       GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME)
-                       SET (TARGET ${CMAKE_BINARY_DIR}/${DIR}/${FILENAME})
-                       configure_file(${FILE} ${TARGET} COPYONLY)
-                       IF (CONFIG_VERBOSE)
-                               MESSAGE("FROM: ${FILE}\nTO: ${TARGET}\n")
-                       ENDIF (CONFIG_VERBOSE)
-               ENDFOREACH(FILE)
-       ENDFOREACH(DIR)
+    FOREACH(DIR ${TESTDIRS})
+        FILE(GLOB FILES "${CMAKE_SOURCE_DIR}/../${DIR}/${FILE_TYPE}" )
+        FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DIR})
+        FOREACH(FILE ${FILES})
+            GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME)
+            SET (TARGET ${CMAKE_BINARY_DIR}/${DIR}/${FILENAME})
+            configure_file(${FILE} ${TARGET} COPYONLY)
+            IF (CONFIG_VERBOSE)
+                MESSAGE("${FILE}")
+            ENDIF (CONFIG_VERBOSE)
+        ENDFOREACH(FILE)
+    ENDFOREACH(DIR)
 ENDFOREACH(FILE_TYPE)
 
-
 ### generate test files
+MESSAGE(STATUS "Generating test files from templates into test directory")
 
 FOREACH(FILE_TYPE *.conf.in *.service.in)
   FOREACH(DIR ${TESTDIRS})
@@ -164,78 +133,32 @@ FOREACH(FILE_TYPE *.conf.in *.service.in)
       GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME)
       STRING(REGEX REPLACE "\\.in$" "" FILENAME ${FILENAME})
       SET (TARGET ${CMAKE_BINARY_DIR}/${DIR}/${FILENAME})
+      STRING(REGEX REPLACE "\\.in$" ".cmake" _file ${FILE})
+      IF (EXISTS ${_file})
+        SET (FILE ${_file})
+      ENDIF (EXISTS ${_file})
       configure_file(${FILE} ${TARGET} @ONLY IMMEDIATE)
       IF (CONFIG_VERBOSE)
-        MESSAGE("FROM: ${FILE}\nTO: ${TARGET}\n")
+        MESSAGE("${FILE}")
       ENDIF (CONFIG_VERBOSE)
     ENDFOREACH(FILE)
   ENDFOREACH(DIR)
 ENDFOREACH(FILE_TYPE)
 
-#
-# the following config files are required on windows because the related 
-# *.in files are not customized sufficiently. 
-# TODO merge test/data/valid-config-files/debug-allow-all*.conf.in and ....cmake
-#
-SET (CONFIG_FILES test/data/valid-config-files)
-set (TEST_LISTEN "tcp:host=localhost,port=1234")
-configure_file(${CMAKE_SOURCE_DIR}/../${CONFIG_FILES}/debug-allow-all-sha1.conf.cmake ${CMAKE_BINARY_DIR}/${CONFIG_FILES}/debug-allow-all-sha1.conf )
-configure_file(${CMAKE_SOURCE_DIR}/../${CONFIG_FILES}/debug-allow-all.conf.cmake ${CMAKE_BINARY_DIR}/${CONFIG_FILES}/debug-allow-all.conf )  
+MESSAGE(STATUS "Copying generated bus config files to test directory")
+set (OUTDIR ${CMAKE_BINARY_DIR}/test/data/valid-config-files)
 
-# todo: for installation the TEST_..._BINARY variables must reflect the 
-#       installation dir or has to be defined relative
-#
-SET (SERVICE_FILES test/data/valid-service-files)
-FILE(GLOB FILES "${CMAKE_SOURCE_DIR}/../${SERVICE_FILES}/*.service.in" )
-FOREACH(FILE ${FILES}) 
-       GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME_WE)
-       SET (TARGET ${CMAKE_BINARY_DIR}/${SERVICE_FILES}/${FILENAME}.service)
-       IF (CONFIG_VERBOSE)
-               MESSAGE("FROM: ${FILE}\nTO: ${TARGET}\n")
-       ENDIF (CONFIG_VERBOSE)
-       configure_file(${FILE} ${TARGET} )
-       #install_files(/data/dbus-1/services FILES ${TARGET})
+FILE(GLOB FILES "${CMAKE_BINARY_DIR}/bus/*.conf" )
+FILE(MAKE_DIRECTORY ${OUTDIR})
+FOREACH(FILE ${FILES})
+    GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME)
+    SET (TARGET ${OUTDIR}/${FILENAME})
+    configure_file(${FILE} ${TARGET} COPYONLY)
+    IF (CONFIG_VERBOSE)
+        MESSAGE("FROM: ${FILE}\nTO: ${TARGET}\n")
+    ENDIF (CONFIG_VERBOSE)
 ENDFOREACH(FILE)
 
+# todo: for installation the TEST_..._BINARY variables must reflect the 
+#       installation dir or has to be defined relative
 #
-#FIND_TESTS=find -name "*.message" -o -name "*.message-raw" -o -name "*.auth-script" -o -name "*.sha1" -o -name "*.txt" -o -name "*.conf" -o -name "*.service"
-#
-### copy tests to builddir so that generated tests and static tests 
-### are all in one place.
-#all-local:
-#      for D in $(TESTDIRS); do                                                                
-#              test -d $(top_builddir)/test/$$D || mkdir $(top_builddir)/test/$$D || exit 1 ;  
-#      done ;                                                                                  
-#      if ! (test $(srcdir) = . || test $(srcdir) -ef .) ; then                                                                
-#              FILES=`(cd $(srcdir) && $(FIND_TESTS))` ;                                       
-#              for F in $$FILES; do                                                            
-#                      SRC=$(srcdir)/$$F ;                                                     
-#                      DEST=$(top_builddir)/test/$$F ;                                         
-#                      echo '-- Copying test file '$$F ;                                       
-#                      cp $$SRC $$DEST || exit 1 ;                                             
-#                      chmod u+w $$DEST || exit 1 ;                                            
-#              done ;                                                                          
-#      else                                                                                    
-#              echo '-- No need to copy test data as srcdir = builddir' ;                      
-#      fi ;                                                                                    
-#      echo '-- Copying' $(top_builddir)/bus/*.conf 'to test directory' ;                      
-#      cp $(top_builddir)/bus/*.conf $(top_builddir)/test/data/valid-config-files || exit 1 ;  
-#      chmod u+w $(top_builddir)/test/data/valid-config-files/*.conf || exit 1
-#
-### this doesn't clean generated test data files when srcdir=builddir
-#clean-local:
-#      if test $(srcdir) != . ; then                                   
-#              FILES=`(cd $(top_builddir)/test && $(FIND_TESTS))` ;    
-#              for F in $$FILES; do                                    
-#                      DEST=$(top_builddir)/test/$$F ;                 
-#                      echo '-- Deleting test file '$$F ;              
-#                      rm $$DEST || exit 1 ;                           
-#              done ;                                                  
-#              REVERSEDIRS= ;                                          
-#              for D in $(TESTDIRS); do                                
-#                      REVERSEDIRS="$$D $$REVERSEDIRS" ;               
-#              done ;                                                  
-#              for D in $$REVERSEDIRS; do                              
-#                      rmdir $(top_builddir)/test/$$D || exit 1 ;      
-#              done ;                                                  
-#      fi
index 45683a7..aad1ad4 100644 (file)
@@ -4,19 +4,12 @@ set (NAMEtest-DIR ../../../test/name-test)
 
 add_definitions(-DDBUS_COMPILATION)
 
-# there is also a test-names executable, don't know if this is the same
-add_executable(test-names2 ${NAMEtest-DIR}/test-names.c)
-target_link_libraries(test-names2 ${DBUS_1})
-ADD_TEST(test-names2 ${EXECUTABLE_OUTPUT_PATH}/test-names2)
-
 add_executable(test-pending-call-dispatch ${NAMEtest-DIR}/test-pending-call-dispatch.c)
-target_link_libraries(test-pending-call-dispatch ${DBUS_1})
-#install_targets(/bin test-pending-call-dispatch)
+target_link_libraries(test-pending-call-dispatch ${DBUS_INTERNAL_LIBRARIES})
 ADD_TEST(test-pending-call-dispatch ${EXECUTABLE_OUTPUT_PATH}/test-pending-call-dispatch)
 
 add_executable(test-thread-init ${NAMEtest-DIR}/test-threads-init.c)
-target_link_libraries(test-thread-init ${DBUS_1})
-#install_targets(/bin test-thread-init)
+target_link_libraries(test-thread-init ${DBUS_INTERNAL_LIBRARIES})
 ADD_TEST(test-thread-init ${EXECUTABLE_OUTPUT_PATH}/test-thread-init)
 
 endif (DBUS_BUILD_TESTS)
index 4f8c50a..e91a509 100644 (file)
@@ -42,7 +42,7 @@ set (dbus_viewer_SOURCES
 )
 
 add_executable(dbus-send ${dbus_send_SOURCES})
-target_link_libraries(dbus-send ${DBUS_1})
+target_link_libraries(dbus-send ${DBUS_LIBRARIES})
 install_targets(/bin dbus-send )
 
 add_executable(dbus-launch ${dbus_launch_SOURCES})
@@ -53,9 +53,5 @@ endif (DBUS_BUILD_X11)
 install_targets(/bin dbus-launch )
 
 add_executable(dbus-monitor ${dbus_monitor_SOURCES})
-target_link_libraries(dbus-monitor ${DBUS_1})
+target_link_libraries(dbus-monitor ${DBUS_LIBRARIES})
 install_targets(/bin dbus-monitor )
-
-if(WIN32)
-  set_target_properties(dbus-send dbus-launch dbus-monitor PROPERTIES DEBUG_POSTFIX d)
-endif(WIN32)
\ No newline at end of file
diff --git a/cmake/tools/dbus-launch.xml b/cmake/tools/dbus-launch.xml
new file mode 100644 (file)
index 0000000..dc34898
--- /dev/null
@@ -0,0 +1,240 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<!-- lifted from troff+man by doclifter -->
+<refentry id='dbuslaunch1'>
+<!--   -->
+<!--  dbus\-launch manual page. -->
+<!--  Copyright (C) 2003 Red Hat, Inc. -->
+
+<refmeta>
+<refentrytitle>dbus-launch</refentrytitle>
+<manvolnum>1</manvolnum>
+</refmeta>
+<refnamediv id='name'>
+<refname>dbus-launch</refname>
+<refpurpose>Utility to start a message bus from a shell script</refpurpose>
+</refnamediv>
+<!-- body begins here -->
+<refsynopsisdiv id='synopsis'>
+<cmdsynopsis>
+  <command>dbus-launch</command>    <arg choice='opt'>--version </arg>
+    <arg choice='opt'>--sh-syntax </arg>
+    <arg choice='opt'>--csh-syntax </arg>
+    <arg choice='opt'>--auto-syntax </arg>
+    <arg choice='opt'>--exit-with-session </arg>
+    <arg choice='opt'>--autolaunch=<replaceable>MACHINEID</replaceable></arg>
+    <arg choice='opt'>--config-file=<replaceable>FILENAME</replaceable></arg>
+    <arg choice='opt'><replaceable>PROGRAM</replaceable></arg>
+    <arg choice='opt' rep='repeat'><replaceable>ARGS</replaceable></arg>
+    <sbr/>
+</cmdsynopsis>
+</refsynopsisdiv>
+
+
+<refsect1 id='description'><title>DESCRIPTION</title>
+<para>The <command>dbus-launch</command> command is used to start a session bus 
+instance of <emphasis remap='I'>dbus-daemon</emphasis> from a shell script.
+It would normally be called from a user's login
+scripts. Unlike the daemon itself, <command>dbus-launch</command> exits, so
+backticks or the $() construct can be used to read information from
+<command>dbus-launch</command>.</para>
+
+<para>With no arguments, <command>dbus-launch</command> will launch a session bus
+instance and print the address and pid of that instance to standard
+output.</para>
+
+<para>You may specify a program to be run; in this case, <command>dbus-launch</command>
+will launch a session bus instance, set the appropriate environment
+variables so the specified program can find the bus, and then execute the
+specified program, with the specified arguments.  See below for
+examples.</para>
+
+<para>If you launch a program, <command>dbus-launch</command> will not print the
+information about the new bus to standard output.</para>
+
+<para>When <command>dbus-launch</command> prints bus information to standard output, by
+default it is in a simple key-value pairs format. However, you may 
+request several alternate syntaxes using the --sh-syntax, --csh-syntax,
+--binary-syntax, or
+--auto-syntax options. Several of these cause <command>dbus-launch</command> to emit shell code
+to set up the environment.</para>
+
+<para>With the --auto-syntax option, <command>dbus-launch</command> looks at the value
+of the SHELL environment variable to determine which shell syntax
+should be used.  If SHELL ends in "csh", then csh-compatible code is
+emitted; otherwise Bourne shell code is emitted.  Instead of passing
+--auto-syntax, you may explicity specify a particular one by using
+--sh-syntax for Bourne syntax, or --csh-syntax for csh syntax.
+In scripts, it's more robust to avoid --auto-syntax and you hopefully
+know which shell your script is written in.</para>
+
+
+<para>See <ulink url='http://www.freedesktop.org/software/dbus/'>http://www.freedesktop.org/software/dbus/</ulink> for more information
+about D-Bus. See also the man page for <emphasis remap='I'>dbus-daemon</emphasis>.</para>
+
+
+<para>Here is an example of how to use <command>dbus-launch</command> with an 
+sh-compatible shell to start the per-session bus daemon:</para>
+<literallayout remap='.nf'>
+
+  ## test for an existing bus daemon, just to be safe
+  if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
+      ## if not found, launch a new one
+      eval `dbus-launch --sh-syntax --exit-with-session`
+      echo "D-Bus per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"
+  fi
+
+</literallayout> <!-- .fi -->
+<para>You might run something like that in your login scripts.</para>
+
+
+<para>Another way to use <command>dbus-launch</command> is to run your main session
+program, like so:</para>
+<literallayout remap='.nf'>
+
+dbus-launch gnome-session
+
+</literallayout> <!-- .fi -->
+<para>The above would likely be appropriate for ~/.xsession or ~/.Xclients.</para>
+
+</refsect1>
+
+<refsect1 id='automatic_launching'><title>AUTOMATIC LAUNCHING</title>
+<para>If DBUS_SESSION_BUS_ADDRESS is not set for a process that tries to use
+D-Bus, by default the process will attempt to invoke dbus-launch with
+the --autolaunch option to start up a new session bus or find the 
+existing bus address on the X display or in a file in
+~/.dbus/session-bus/</para>
+
+
+<para>Whenever an autolaunch occurs, the application that had to
+start a new bus will be in its own little world; it can effectively
+end up starting a whole new session if it tries to use a lot of 
+bus services. This can be suboptimal or even totally broken, depending
+on the app and what it tries to do.</para>
+
+
+<para>There are two common reasons for autolaunch. One is ssh to a remote
+machine. The ideal fix for that would be forwarding of
+DBUS_SESSION_BUS_ADDRESS in the same way that DISPLAY is forwarded.
+In the meantime, you can edit the session.conf config file to 
+have your session bus listen on TCP, and manually set
+DBUS_SESSION_BUS_ADDRESS, if you like.</para>
+
+
+<para>The second common reason for autolaunch is an su to another user, and
+display of X applications running as the second user on the display
+belonging to the first user. Perhaps the ideal fix in this case
+would be to allow the second user to connect to the session bus of the
+first user, just as they can connect to the first user's display.
+However, a mechanism for that has not been coded.</para>
+
+
+<para>You can always avoid autolaunch by manually setting
+DBUS_SESSION_BUS_ADDRESS. Autolaunch happens because the default
+address if none is set is "autolaunch:", so if any other address is
+set there will be no autolaunch. You can however include autolaunch in
+an explicit session bus address as a fallback, for example
+DBUS_SESSION_BUS_ADDRESS="something:,autolaunch:" - in that case if
+the first address doesn't work, processes will autolaunch. (The bus
+address variable contains a comma-separated list of addresses to try.)</para>
+
+
+<para>The --autolaunch option is considered an internal implementation
+detail of libdbus, and in fact there are plans to change it. There's
+no real reason to use it outside of the libdbus implementation anyhow.</para>
+
+</refsect1>
+
+<refsect1 id='options'><title>OPTIONS</title>
+<para>The following options are supported:</para>
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><option>--auto-syntax</option></term>
+  <listitem>
+<para>Choose --csh-syntax or --sh-syntax based on the SHELL environment variable.</para>
+
+<para><option>--binary-syntax</option>
+Write to stdout a nul-terminated bus address, then the bus PID as a
+binary integer of size sizeof(pid_t), then the bus X window ID as a
+binary integer of size sizeof(long). Integers are in the machine's
+byte order, not network byte order or any other canonical byte order.</para>
+
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--close-stderr</option></term>
+  <listitem>
+<para>Close the standard error output stream before starting the D-Bus
+daemon. This is useful if you want to capture dbus-launch error
+messages but you don't want dbus-daemon to keep the stream open to
+your application.</para>
+
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--config-file=FILENAME</option></term>
+  <listitem>
+<para>Pass --config-file=FILENAME to the bus daemon, instead of passing it 
+the --session argument. See the man page for dbus-daemon</para>
+
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--csh-syntax</option></term>
+  <listitem>
+<para>Emit csh compatible code to set up environment variables.</para>
+
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--exit-with-session</option></term>
+  <listitem>
+<para>If this option is provided, a persistent "babysitter" process will be 
+created that watches stdin for HUP and tries to connect to the X
+server. If this process gets a HUP on stdin or loses its X connection,
+it kills the message bus daemon.</para>
+
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--autolaunch=MACHINEID</option></term>
+  <listitem>
+<para>This option implies that <command>dbus-launch</command> should scan for a
+previously-started session and reuse the values found there. If no
+session is found, it will start a new session. The
+--exit-with-session option is implied if --autolaunch is given.
+This option is for the exclusive use of libdbus, you do not want to
+use it manually. It may change in the future.</para>
+
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--sh-syntax</option></term>
+  <listitem>
+<para>Emit Bourne-shell compatible code to set up environment variables.</para>
+
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--version</option></term>
+  <listitem>
+<para>Print the version of dbus-launch</para>
+
+  </listitem>
+  </varlistentry>
+</variablelist>
+</refsect1>
+
+<refsect1 id='author'><title>AUTHOR</title>
+<para>See <ulink url='http://www.freedesktop.org/software/dbus/doc/AUTHORS'>http://www.freedesktop.org/software/dbus/doc/AUTHORS</ulink></para>
+
+</refsect1>
+
+<refsect1 id='bugs'><title>BUGS</title>
+<para>Please send bug reports to the D-Bus mailing list or bug tracker,
+see <ulink url='http://www.freedesktop.org/software/dbus/'>http://www.freedesktop.org/software/dbus/</ulink></para>
+</refsect1>
+</refentry>
+
diff --git a/cmake/tools/dbus-monitor.xml b/cmake/tools/dbus-monitor.xml
new file mode 100644 (file)
index 0000000..b41cace
--- /dev/null
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<!-- lifted from troff+man by doclifter -->
+<refentry id='dbusmonitor1'>
+<!--   -->
+<!--  dbus\-monitor manual page. -->
+<!--  Copyright (C) 2003 Red Hat, Inc. -->
+
+<refmeta>
+<refentrytitle>dbus-monitor</refentrytitle>
+<manvolnum>1</manvolnum>
+</refmeta>
+<refnamediv id='name'>
+<refname>dbus-monitor</refname>
+<refpurpose>debug probe to print message bus messages</refpurpose>
+</refnamediv>
+<!-- body begins here -->
+<refsynopsisdiv id='synopsis'>
+<cmdsynopsis>
+  <command>dbus-monitor</command>    
+    <group choice='opt'><arg choice='plain'>--system </arg><arg choice='plain'>--session </arg><arg choice='plain'>--address <replaceable>ADDRESS</replaceable></arg></group>
+    <group choice='opt'><arg choice='plain'>--profile </arg><arg choice='plain'>--monitor </arg></group>
+    <arg choice='opt'><arg choice='plain'><replaceable>watch</replaceable></arg><arg choice='plain'><replaceable>expressions</replaceable></arg></arg>
+    <sbr/>
+</cmdsynopsis>
+</refsynopsisdiv>
+
+
+<refsect1 id='description'><title>DESCRIPTION</title>
+<para>The <command>dbus-monitor</command> command is used to monitor messages going
+through a D-Bus message bus.  See
+<ulink url='http://www.freedesktop.org/software/dbus/'>http://www.freedesktop.org/software/dbus/</ulink> for more information about
+the big picture.</para>
+
+
+<para>There are two well-known message buses: the systemwide message bus
+(installed on many systems as the "messagebus" service) and the
+per-user-login-session message bus (started each time a user logs in).
+The --system and --session options direct <command>dbus-monitor</command> to
+monitor the system or session buses respectively.  If neither is
+specified, <command>dbus-monitor</command> monitors the session bus.</para>
+
+
+<para><command>dbus-monitor</command> has two different output modes, the 'classic'-style
+monitoring mode and profiling mode. The profiling format is a compact
+format with a single line per message and microsecond-resolution timing
+information. The --profile and --monitor options select the profiling
+and monitoring output format respectively. If neither is specified,
+<command>dbus-monitor</command> uses the monitoring output format.</para>
+
+
+<para>In order to get <command>dbus-monitor</command> to see the messages you are interested
+in, you should specify a set of watch expressions as you would expect to
+be passed to the <emphasis remap='I'>dbus_bus_add_match</emphasis> function.</para>
+
+
+<para>The message bus configuration may keep <command>dbus-monitor</command> from seeing
+all messages, especially if you run the monitor as a non-root user.</para>
+
+</refsect1>
+
+<refsect1 id='options'><title>OPTIONS</title>
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><option>--system</option></term>
+  <listitem>
+<para>Monitor the system message bus.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--session</option></term>
+  <listitem>
+<para>Monitor the session message bus.  (This is the default.)</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--address ADDRESS</option></term>
+  <listitem>
+<para>Monitor an arbitrary message bus given at ADDRESS.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--profile</option></term>
+  <listitem>
+<para>Use the profiling output format.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--monitor</option></term>
+  <listitem>
+<para>Use the monitoring output format.  (This is the default.)</para>
+
+  </listitem>
+  </varlistentry>
+</variablelist>
+</refsect1>
+
+<refsect1 id='example'><title>EXAMPLE</title>
+<para>Here is an example of using dbus-monitor to watch for the gnome typing
+monitor to say things</para>
+<literallayout remap='.nf'>
+
+  dbus-monitor "type='signal',sender='org.gnome.TypingMonitor',interface='org.gnome.TypingMonitor'"
+
+</literallayout> <!-- .fi -->
+
+</refsect1>
+
+<refsect1 id='author'><title>AUTHOR</title>
+<para>dbus-monitor was written by Philip Blundell.
+The profiling output mode was added by Olli Salli.</para>
+
+</refsect1>
+
+<refsect1 id='bugs'><title>BUGS</title>
+<para>Please send bug reports to the D-Bus mailing list or bug tracker,
+see <ulink url='http://www.freedesktop.org/software/dbus/'>http://www.freedesktop.org/software/dbus/</ulink></para>
+</refsect1>
+</refentry>
+
diff --git a/cmake/tools/dbus-send.xml b/cmake/tools/dbus-send.xml
new file mode 100644 (file)
index 0000000..7fefc03
--- /dev/null
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<!-- lifted from troff+man by doclifter -->
+<refentry id='dbussend1'>
+<!--   -->
+<!--  dbus\-send manual page. -->
+<!--  Copyright (C) 2003 Red Hat, Inc. -->
+
+<refmeta>
+<refentrytitle>dbus-send</refentrytitle>
+<manvolnum>1</manvolnum>
+</refmeta>
+<refnamediv id='name'>
+<refname>dbus-send</refname>
+<refpurpose>Send a message to a message bus</refpurpose>
+</refnamediv>
+<!-- body begins here -->
+<refsynopsisdiv id='synopsis'>
+<cmdsynopsis>
+  <command>dbus-send</command>    
+    <group choice='opt'><arg choice='plain'>--system </arg><arg choice='plain'>--session </arg></group>
+    <arg choice='opt'>--dest=<replaceable>NAME</replaceable></arg>
+    <arg choice='opt'>--print-reply </arg>
+    <arg choice='opt'>--type=<replaceable>TYPE</replaceable></arg>
+    <arg choice='plain'><replaceable>&lt;destination</replaceable></arg>
+    <arg choice='plain'><replaceable>object</replaceable></arg>
+    <arg choice='plain'><replaceable>path&gt;</replaceable></arg>
+    <arg choice='plain'><replaceable>&lt;message</replaceable></arg>
+    <arg choice='plain'><replaceable>name&gt;</replaceable></arg>
+    <arg choice='opt' rep='repeat'><replaceable>contents</replaceable></arg>
+    <sbr/>
+</cmdsynopsis>
+</refsynopsisdiv>
+
+
+<refsect1 id='description'><title>DESCRIPTION</title>
+<para>The <command>dbus-send</command> command is used to send a message to a D-Bus message
+bus. See <ulink url='http://www.freedesktop.org/software/dbus/'>http://www.freedesktop.org/software/dbus/</ulink> for more 
+information about the big picture.</para>
+
+
+<para>There are two well-known message buses: the systemwide message bus 
+(installed on many systems as the "messagebus" service) and the 
+per-user-login-session message bus (started each time a user logs in).
+The --system and --session options direct <command>dbus-send</command> to send
+messages to the system or session buses respectively.  If neither is
+specified, <command>dbus-send</command> sends to the session bus.</para>
+
+
+<para>Nearly all uses of <command>dbus-send</command> must provide the --dest argument
+which is the name of a connection on the bus to send the message to. If
+--dest is omitted, no destination is set.</para>
+
+
+<para>The object path and the name of the message to send must always be
+specified. Following arguments, if any, are the message contents
+(message arguments).  These are given as type-specified values and 
+may include containers (arrays, dicts, and variants) as described below.</para>
+
+<literallayout remap='.nf'>
+&lt;contents&gt;   ::= &lt;item&gt; | &lt;container&gt; [ &lt;item&gt; | &lt;container&gt;...]
+&lt;item&gt;       ::= &lt;type&gt;:&lt;value&gt;
+&lt;container&gt;  ::= &lt;array&gt; | &lt;dict&gt; | &lt;variant&gt;
+&lt;array&gt;      ::= array:&lt;type&gt;:&lt;value&gt;[,&lt;value&gt;...] 
+&lt;dict&gt;       ::= dict:&lt;type&gt;:&lt;type&gt;:&lt;key&gt;,&lt;value&gt;[,&lt;key&gt;,&lt;value&gt;...]
+&lt;variant&gt;    ::= variant:&lt;type&gt;:&lt;value&gt;
+&lt;type&gt;       ::= string | int16 | uint 16 | int32 | uint32 | int64 | uint64 | double | byte | boolean | objpath
+</literallayout> <!-- .fi -->
+
+<para>D-Bus supports more types than these, but <command>dbus-send</command> currently
+does not.  Also, <command>dbus-send</command> does not permit empty containers
+or nested containers (e.g. arrays of variants).</para>
+
+
+<para>Here is an example invocation:</para>
+<literallayout remap='.nf'>
+
+  dbus-send --dest=org.freedesktop.ExampleName               \
+            /org/freedesktop/sample/object/name              \
+            org.freedesktop.ExampleInterface.ExampleMethod   \
+            int32:47 string:'hello world' double:65.32       \
+            array:string:"1st item","next item","last item"  \
+            dict:string:int32:"one",1,"two",2,"three",3      \
+            variant:int32:-8                                 \
+            objpath:/org/freedesktop/sample/object/name 
+
+</literallayout> <!-- .fi -->
+
+<para>Note that the interface is separated from a method or signal 
+name by a dot, though in the actual protocol the interface
+and the interface member are separate fields.</para>
+
+</refsect1>
+
+<refsect1 id='options'><title>OPTIONS</title>
+<para>The following options are supported:</para>
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><option>--dest=NAME</option></term>
+  <listitem>
+<para>Specify the name of the connection to receive the message.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--print-reply</option></term>
+  <listitem>
+<para>Block for a reply to the message sent, and print any reply received.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--system</option></term>
+  <listitem>
+<para>Send to the system message bus.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--session</option></term>
+  <listitem>
+<para>Send to the session message bus.  (This is the default.)</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--type=TYPE</option></term>
+  <listitem>
+<para>Specify "method_call" or "signal" (defaults to "signal").</para>
+
+  </listitem>
+  </varlistentry>
+</variablelist>
+</refsect1>
+
+<refsect1 id='author'><title>AUTHOR</title>
+<para>dbus-send was written by Philip Blundell.</para>
+
+</refsect1>
+
+<refsect1 id='bugs'><title>BUGS</title>
+<para>Please send bug reports to the D-Bus mailing list or bug tracker,
+see <ulink url='http://www.freedesktop.org/software/dbus/'>http://www.freedesktop.org/software/dbus/</ulink></para>
+</refsect1>
+</refentry>
+
index 1f2c896..fd6835f 100644 (file)
@@ -25,6 +25,10 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The name of the gettext d
  ## must come before we use the $USE_MAINTAINER_MODE variable later
 AM_MAINTAINER_MODE
 
+m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
+
+AC_DEFINE_UNQUOTED(DBUS_DAEMON_NAME,"dbus-daemon",[Name of executable])
+
 # libtool versioning - this applies to libdbus
 #
 # See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
@@ -64,6 +68,7 @@ AC_ISC_POSIX
 AC_HEADER_STDC
 AC_C_INLINE
 AM_PROG_LIBTOOL
+AC_PROG_MKDIR_P
 
 # Set some internal variables depending on the platform for later use.
 dbus_win=no
@@ -176,6 +181,31 @@ if test x$enable_gcov = xyes; then
 fi
 AM_CONDITIONAL(DBUS_GCOV_ENABLED, test x$enable_gcov = xyes)
 
+# glibc21.m4 serial 3
+dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# Test for the GNU C Library, version 2.1 or newer.
+# From Bruno Haible.
+
+AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
+  ac_cv_gnu_library_2_1,
+  [AC_EGREP_CPP([Lucky GNU user],
+    [
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
+  Lucky GNU user
+ #endif
+#endif
+    ],
+    ac_cv_gnu_library_2_1=yes,
+    ac_cv_gnu_library_2_1=no)
+  ]
+)
+
 #### Integer sizes 
 
 AC_CHECK_SIZEOF(char)
@@ -194,21 +224,32 @@ $ac_cv_sizeof_int)
   dbusint64=int
   dbusint64_constant='(val)'
   dbusuint64_constant='(val)'
+  dbusint64_printf_modifier='""'
   ;;
 $ac_cv_sizeof_long)
   dbusint64=long
   dbusint64_constant='(val##L)'
   dbusuint64_constant='(val##UL)'
+  dbusint64_printf_modifier='"l"'
   ;;
 $ac_cv_sizeof_long_long)
   dbusint64='long long'
   dbusint64_constant='(val##LL)'
   dbusuint64_constant='(val##ULL)'
+  # Ideally we discover what the format is, but this is
+  # only used in verbose mode, so eh...
+  if test x"$ac_cv_gnu_library_2_1" = xyes; then
+    dbusint64_printf_modifier='"ll"'
+  fi
   ;;
 $ac_cv_sizeof___int64)
   dbusint64=__int64
   dbusint64_constant='(val##i64)'
   dbusuint64_constant='(val##ui64)'
+  # See above case
+  if test x"$ac_cv_gnu_library_2_1" = xyes; then
+    dbusint64_printf_modifier='"ll"'
+  fi
   ;;
 esac
 
@@ -223,6 +264,9 @@ else
         DBUS_HAVE_INT64=1
         DBUS_INT64_CONSTANT="$dbusint64_constant"
         DBUS_UINT64_CONSTANT="$dbusuint64_constant"
+       if test x"$dbusint64_printf_modifier" != x; then
+               AC_DEFINE_UNQUOTED(DBUS_INT64_PRINTF_MODIFIER, [$dbusint64_printf_modifier], [Define to printf modifier for 64 bit integer type])
+       fi
         AC_MSG_RESULT($DBUS_INT64_TYPE)
 fi
 
@@ -472,6 +516,10 @@ AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
 
 AC_CHECK_HEADERS(errno.h)
 
+AC_CHECK_HEADERS(signal.h)
+
+AC_CHECK_HEADERS(locale.h)
+
 AC_CHECK_HEADERS(byteswap.h)
 
 AC_CHECK_HEADERS(unistd.h)
@@ -876,7 +924,7 @@ else
     AC_CHECK_LIB(audit, audit_log_user_avc_message, 
                  have_libaudit=yes, have_libaudit=no)
     if test x$have_libaudit = xyes ; then
-        AC_CHECK_LIB(cap, cap_set_proc, 
+        AC_CHECK_LIB(cap-ng, capng_clear,
                  have_libaudit=yes, have_libaudit=no)
     fi
 fi
@@ -884,8 +932,7 @@ fi
 AM_CONDITIONAL(HAVE_LIBAUDIT, test x$have_libaudit = xyes)
 
 if test x$have_libaudit = xyes ; then
-    SELINUX_LIBS="$SELINUX_LIBS -laudit"
-    LIBS="-lcap $LIBS"
+    SELINUX_LIBS="$SELINUX_LIBS -laudit -lcap-ng"
     AC_DEFINE(HAVE_LIBAUDIT,1,[audit daemon SELinux support])
 fi
 
@@ -1133,12 +1180,6 @@ if test "x$GCC" = "xyes"; then
         CFLAGS="$CFLAGS -Wno-pointer-sign"
      fi
      ;;
-  esac  
-  
-  # http://bugs.freedesktop.org/show_bug.cgi?id=19195
-  case " $CFLAGS " in
-  *[\ \        ]-Wno-format[\ \        ]*) ;;
-  *) CFLAGS="$CFLAGS -Wno-format" ;;
   esac
   
   # This one is special - it's not a warning override.
@@ -1402,30 +1443,39 @@ AC_DEFINE_UNQUOTED(DBUS_LIBEXECDIR,"$DBUS_LIBEXECDIR", [Directory for installing
 #### Tell tests where to find certain stuff in builddir
 
 DBUS_PWD=`pwd`
+# Useful in a cross-compilation environment, where the tests are run on the host system.
+AC_ARG_WITH(dbus-test-dir, AS_HELP_STRING([--with-dbus-test-dir=[dirname]],[path where the tests tools are available]),
+                          DBUS_PWD=$withval)
 AC_DEFUN([TEST_PATH], [
 TEST_$1=${DBUS_PWD}/test/$2
 AC_DEFINE_UNQUOTED(TEST_$1, "$TEST_$1",
                    [Full path to test file test/$2 in builddir])
 AC_SUBST(TEST_$1)
 ])
+AC_DEFUN([TEST_PROG], [
+TEST_$1=${DBUS_PWD}/test/$2
+AC_DEFINE_UNQUOTED(TEST_$1, "$TEST_$1$EXEEXT",
+                   [Full path to test file test/$2 in builddir])
+AC_SUBST(TEST_$1)
+])
 
 TEST_PATH(VALID_SERVICE_DIR, data/valid-service-files)
 TEST_PATH(INVALID_SERVICE_DIR, data/invalid-service-files)
 TEST_PATH(VALID_SERVICE_SYSTEM_DIR, data/valid-service-files-system)
 TEST_PATH(INVALID_SERVICE_SYSTEM_DIR, data/invalid-service-files-system)
-TEST_PATH(SERVICE_BINARY, test-service)
-TEST_PATH(SHELL_SERVICE_BINARY, test-shell-service)
-TEST_PATH(EXIT_BINARY, test-exit)
-TEST_PATH(SEGFAULT_BINARY, test-segfault)
-TEST_PATH(SLEEP_FOREVER_BINARY, test-sleep-forever)
-TEST_PATH(PRIVSERVER_BINARY, name-test/test-privserver)
-
-AC_DEFINE_UNQUOTED(TEST_BUS_BINARY, "$DBUS_PWD/bus/dbus-daemon",
+TEST_PROG(SERVICE_BINARY, test-service)
+TEST_PROG(SHELL_SERVICE_BINARY, test-shell-service)
+TEST_PROG(EXIT_BINARY, test-exit)
+TEST_PROG(SEGFAULT_BINARY, test-segfault)
+TEST_PROG(SLEEP_FOREVER_BINARY, test-sleep-forever)
+TEST_PROG(PRIVSERVER_BINARY, name-test/test-privserver)
+
+AC_DEFINE_UNQUOTED(TEST_BUS_BINARY, "$DBUS_PWD/bus/dbus-daemon$EXEEXT",
                    [Full path to the daemon in the builddir])
 AC_SUBST(TEST_BUS_BINARY)
 
 ## Export the non-setuid external helper
-TEST_LAUNCH_HELPER_BINARY="$DBUS_PWD/bus/dbus-daemon-launch-helper-test"
+TEST_LAUNCH_HELPER_BINARY="$DBUS_PWD/bus/dbus-daemon-launch-helper-test$EXEEXT"
 AC_SUBST(TEST_LAUNCH_HELPER_BINARY)
 AC_DEFINE_UNQUOTED(DBUS_TEST_LAUNCH_HELPER_BINARY, "$TEST_LAUNCH_HELPER_BINARY",
                    [Full path to the launch helper test program in the builddir])
diff --git a/dbus-win.patch b/dbus-win.patch
deleted file mode 100644 (file)
index 6811897..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-Index: dbus/dbus-bus.c
-===================================================================
-RCS file: /cvs/dbus/dbus/dbus/dbus-bus.c,v
-retrieving revision 1.64
-diff -u -r1.64 dbus-bus.c
---- dbus/dbus-bus.c    28 Oct 2006 01:41:37 -0000      1.64
-+++ dbus/dbus-bus.c    8 Mar 2007 20:25:40 -0000
-@@ -350,8 +350,10 @@
- {
-   int i;
-   
-+#if !defined(DBUS_WIN) && !defined(DBUS_WINCE)
-+   // qt example pong says "QMutex::lock: Deadlock detected"
-   _DBUS_LOCK (bus);
--
-+#endif
-   /* We are expecting to have the connection saved in only one of these
-    * slots, but someone could in a pathological case set system and session
-    * bus to the same bus or something. Or set one of them to the starter
-@@ -366,7 +368,9 @@
-         }
-     }
-+#if !defined(DBUS_WIN) && !defined(DBUS_WINCE)
-   _DBUS_UNLOCK (bus);
-+#endif
- }
- static DBusConnection *
index cabe2b0..48ec34f 100644 (file)
@@ -15,6 +15,7 @@ lib_LTLIBRARIES=libdbus-1.la
 # Deal with W32 .def and version-info.rc stuff
 #
 if DBUS_WIN
+
 SUFFIXES = rc
 
 .rc.o:
@@ -23,16 +24,10 @@ SUFFIXES = rc
 dbus_res = versioninfo.o
 dbus_res_ldflag = -Wl,$(dbus_res)
 no_undefined = -no-undefined
-export_symbols = -export-symbols $(srcdir)/dbus-1.def
-
-install-def-file:
-       test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
-       $(INSTALL) dbus-1.def $(DESTDIR)$(libdir)/dbus-1.def
-
-uninstall-def-file:
-       -rm $(DESTDIR)$(libdir)/dbus-1.def
+export_symbols =
+export_symvols_internal =
 
-libdbus_1_la_DEPENDENCIES = $(dbus_res) dbus-1.def
+libdbus_1_la_DEPENDENCIES = $(dbus_res)
 intllibs =
 
 else
@@ -42,6 +37,7 @@ no_undefined =
 ## don't export symbols that start with "_" (we use this
 ## convention for internal symbols)
 export_symbols = -export-symbols-regex "^[^_].*"
+export_symbols_internal =
 install-def-file:
 uninstall-def-file:
 
@@ -59,7 +55,9 @@ DBUS_LIB_arch_sources =                       \
        dbus-server-win.h
 
 DBUS_SHARED_arch_sources =                     \
+       dbus-file-win.c                         \
        dbus-pipe-win.c                         \
+       dbus-sockets-win.h                      \
        dbus-sysdeps-win.c                      \
        dbus-sysdeps-win.h                      \
        dbus-sysdeps-thread-win.c               \
@@ -77,6 +75,7 @@ DBUS_LIB_arch_sources =                       \
        dbus-server-unix.h
 
 DBUS_SHARED_arch_sources =                     \
+       dbus-file-unix.c                        \
        dbus-pipe-unix.c                        \
        dbus-sysdeps-unix.c                     \
        dbus-sysdeps-unix.h                     \
@@ -107,7 +106,6 @@ dbusinclude_HEADERS=                                \
        dbus-server.h                           \
        dbus-shared.h                           \
        dbus-signature.h                        \
-       dbus-spawn.h                            \
        dbus-threads.h                          \
        dbus-types.h
 
@@ -143,6 +141,7 @@ DBUS_LIB_SOURCES=                           \
        dbus-message-internal.h                 \
        dbus-message-private.h                  \
        dbus-misc.c                             \
+       dbus-nonce.h                            \
        dbus-nonce.c                            \
        dbus-object-tree.c                      \
        dbus-object-tree.h                      \
@@ -182,6 +181,8 @@ DBUS_LIB_SOURCES=                           \
 DBUS_SHARED_SOURCES=                           \
        dbus-dataslot.c                         \
        dbus-dataslot.h                         \
+       dbus-file.c                 \
+       dbus-file.h                 \
        dbus-hash.c                             \
        dbus-hash.h                             \
        dbus-internals.c                        \
@@ -231,23 +232,26 @@ libdbus_1_la_SOURCES=                             \
        $(DBUS_LIB_SOURCES)                     \
        $(DBUS_SHARED_SOURCES)
 
-libdbus_convenience_la_SOURCES=                        \
+libdbus_internal_la_SOURCES=                   \
        $(DBUS_LIB_SOURCES)                     \
        $(DBUS_SHARED_SOURCES)                  \
        $(DBUS_UTIL_SOURCES)
 
-
 BUILT_SOURCES=$(dbusarchinclude_HEADERS)
-EXTRA_DIST=dbus-arch-deps.h.in dbus-1.def
+EXTRA_DIST=dbus-arch-deps.h.in
+
 
 ## this library is the same as libdbus, but exports all the symbols
 ## and is only used for static linking within the dbus package.
-noinst_LTLIBRARIES=libdbus-convenience.la
+noinst_LTLIBRARIES=libdbus-internal.la
 
+libdbus_1_la_CPPFLAGS= -Ddbus_1_EXPORTS
 libdbus_1_la_LIBADD= $(DBUS_CLIENT_LIBS)
 libdbus_1_la_LDFLAGS= $(export_symbols) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -no-undefined @R_DYNAMIC_LDFLAG@ @PIC_LDFLAGS@
 
-libdbus_convenience_la_LDFLAGS=@R_DYNAMIC_LDFLAG@
+libdbus_internal_la_CPPFLAGS = -DDBUS_STATIC_BUILD
+libdbus_internal_la_LIBADD=$(DBUS_CLIENT_LIBS)
+libdbus_internal_la_LDFLAGS=$(export_symbols_internal) @R_DYNAMIC_LDFLAG@
 
 ## note that TESTS has special meaning (stuff to use in make check)
 ## so if adding tests not to be run in make check, don't add them to 
@@ -266,7 +270,7 @@ noinst_PROGRAMS=$(TESTS)
 dbus_test_SOURCES=                             \
        dbus-test-main.c
 
-dbus_test_LDADD=libdbus-convenience.la $(DBUS_TEST_LIBS)
+dbus_test_LDADD=libdbus-internal.la $(DBUS_TEST_LIBS)
 dbus_test_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
 install-data-local: install-def-file
similarity index 58%
rename from dbus/dbus-1.def
rename to dbus/dbus-1-symbols.def.in
index a06f68f..669af3a 100644 (file)
@@ -1,8 +1,6 @@
-EXPORTS
 _dbus_abort
 _dbus_accept
 _dbus_address_append_escaped
-_dbus_address_test
 _dbus_append_keyring_directory_for_credentials
 _dbus_append_session_config_file
 _dbus_append_system_config_file
@@ -24,25 +22,13 @@ _dbus_auth_needs_decoding
 _dbus_auth_needs_encoding
 _dbus_auth_ref
 _dbus_auth_return_buffer
-_dbus_auth_script_run
 _dbus_auth_server_new
 _dbus_auth_set_context
 _dbus_auth_set_credentials
 _dbus_auth_set_mechanisms
-_dbus_auth_test
 _dbus_auth_unref
-_dbus_babysitter_get_child_exited
-_dbus_babysitter_get_child_exit_status
-_dbus_babysitter_kill_child
-_dbus_babysitter_ref
-_dbus_babysitter_set_child_exit_error
-_dbus_babysitter_set_watch_functions
-_dbus_babysitter_unref
-_dbus_become_daemon
 _dbus_bus_notify_shared_connection_disconnected_unlocked
-_dbus_change_to_daemon_user
 _dbus_check_dir_is_private_to_user
-_dbus_check_fdleaks
 _dbus_check_is_valid_bus_name
 _dbus_check_is_valid_error_name
 _dbus_check_is_valid_interface
@@ -50,7 +36,6 @@ _dbus_check_is_valid_member
 _dbus_check_is_valid_path
 _dbus_check_is_valid_signature
 _dbus_close_socket
-_dbus_command_for_pid
 _dbus_concat_dir_and_file
 _dbus_condvar_free
 _dbus_condvar_free_at_location
@@ -73,7 +58,6 @@ _dbus_connection_has_messages_to_send_unlocked
 _dbus_connection_lock
 _dbus_connection_message_sent
 _dbus_connection_new_for_transport
-_dbus_connection_queue_received_message
 _dbus_connection_queue_received_message_link
 _dbus_connection_queue_synthesized_message_link
 _dbus_connection_ref_unlocked
@@ -81,7 +65,6 @@ _dbus_connection_remove_pending_call
 _dbus_connection_remove_timeout_unlocked
 _dbus_connection_remove_watch_unlocked
 _dbus_connection_send_and_unlock
-_dbus_connection_test_get_locks
 _dbus_connection_toggle_timeout_unlocked
 _dbus_connection_toggle_watch_unlocked
 _dbus_connection_unlock
@@ -112,9 +95,8 @@ _dbus_credentials_new
 _dbus_credentials_new_from_current_process
 _dbus_credentials_ref
 _dbus_credentials_same_user
-_dbus_credentials_test
+_dbus_credentials_to_string_append
 _dbus_credentials_unref
-_dbus_current_generation DATA
 _dbus_daemon_publish_session_bus_address
 _dbus_daemon_unpublish_session_bus_address
 _dbus_data_slot_allocator_alloc
@@ -125,15 +107,9 @@ _dbus_data_slot_list_free
 _dbus_data_slot_list_get
 _dbus_data_slot_list_init
 _dbus_data_slot_list_set
-_dbus_data_slot_test
 _dbus_decompose_path
-_dbus_decrement_fail_alloc_counter
 _dbus_delete_directory
 _dbus_delete_file
-_dbus_directory_close
-_dbus_directory_get_next_file
-_dbus_directory_open
-_dbus_disable_mem_pools
 _dbus_disable_sigpipe
 _dbus_dup_string_array
 _dbus_error_from_errno
@@ -153,15 +129,11 @@ _dbus_get_autolaunch_address
 _dbus_get_config_file_name
 _dbus_get_current_time
 _dbus_get_environment
-_dbus_get_fail_alloc_counter
-_dbus_get_fail_alloc_failures
 _dbus_get_is_errno_eagain_or_ewouldblock
 _dbus_get_is_errno_eintr
 _dbus_get_is_errno_enomem
 _dbus_get_is_errno_nonzero
 _dbus_get_local_machine_uuid_encoded
-_dbus_get_malloc_blocks_outstanding
-_dbus_get_oom_wait
 _dbus_get_standard_session_servicedirs
 _dbus_get_standard_system_servicedirs
 _dbus_get_tmpdir
@@ -169,7 +141,6 @@ _dbus_getenv
 _dbus_getpid
 _dbus_hash_iter_get_int_key
 _dbus_hash_iter_get_string_key
-_dbus_hash_iter_get_two_strings_key
 _dbus_hash_iter_get_ulong_key
 _dbus_hash_iter_get_value
 _dbus_hash_iter_init
@@ -180,32 +151,24 @@ _dbus_hash_iter_set_value
 _dbus_hash_table_free_preallocated_entry
 _dbus_hash_table_get_n_entries
 _dbus_hash_table_insert_int
-_dbus_hash_table_insert_pointer
 _dbus_hash_table_insert_string
 _dbus_hash_table_insert_string_preallocated
-_dbus_hash_table_insert_two_strings
 _dbus_hash_table_insert_ulong
 _dbus_hash_table_lookup_int
-_dbus_hash_table_lookup_pointer
 _dbus_hash_table_lookup_string
-_dbus_hash_table_lookup_two_strings
 _dbus_hash_table_lookup_ulong
 _dbus_hash_table_new
 _dbus_hash_table_preallocate_entry
 _dbus_hash_table_ref
 _dbus_hash_table_remove_all
 _dbus_hash_table_remove_int
-_dbus_hash_table_remove_pointer
 _dbus_hash_table_remove_string
-_dbus_hash_table_remove_two_strings
 _dbus_hash_table_remove_ulong
 _dbus_hash_table_unref
-_dbus_hash_test
 _dbus_header_byteswap
 _dbus_header_copy
 _dbus_header_create
 _dbus_header_delete_field
-_dbus_header_field_to_string
 _dbus_header_free
 _dbus_header_get_field_basic
 _dbus_header_get_field_raw
@@ -220,14 +183,11 @@ _dbus_header_set_field_basic
 _dbus_header_set_serial
 _dbus_header_toggle_flag
 _dbus_header_update_lengths
-_dbus_init_system_log
-_dbus_is_verbose_real
 _dbus_keyring_get_best_key
 _dbus_keyring_get_hex_key
 _dbus_keyring_is_for_credentials
 _dbus_keyring_new_for_credentials
 _dbus_keyring_ref
-_dbus_keyring_test
 _dbus_keyring_unref
 _dbus_keyring_validate_context
 _dbus_list_alloc_link
@@ -245,78 +205,33 @@ _dbus_list_get_last_link
 _dbus_list_get_length
 _dbus_list_insert_after
 _dbus_list_insert_after_link
-_dbus_list_insert_before
 _dbus_list_insert_before_link
 _dbus_list_length_is_one
 _dbus_list_pop_first
 _dbus_list_pop_first_link
 _dbus_list_pop_last
-_dbus_list_pop_last_link
 _dbus_list_prepend
 _dbus_list_prepend_link
 _dbus_list_remove
 _dbus_list_remove_last
 _dbus_list_remove_link
-_dbus_list_test
 _dbus_list_unlink
 _dbus_listen_tcp_socket
-_dbus_lm_strerror
-_dbus_lock_atomic DATA
-_dbus_lock_bus DATA
-_dbus_lock_bus_datas DATA
-_dbus_lock_connection_slots DATA
-_dbus_lock_list DATA
-_dbus_lock_machine_uuid DATA
-_dbus_lock_message_cache DATA
-_dbus_lock_message_slots DATA
-_dbus_lock_pending_call_slots DATA
-_dbus_lock_server_slots DATA
-_dbus_lock_shared_connections DATA
-_dbus_lock_shutdown_funcs DATA
-_dbus_lock_sid_atom_cache DATA
-_dbus_lock_system_users DATA
-_dbus_lock_win_fds DATA
-_dbus_log_info
-_dbus_log_security
-_dbus_loop_add_timeout
-_dbus_loop_add_watch
-_dbus_loop_dispatch
-_dbus_loop_iterate
-_dbus_loop_new
-_dbus_loop_queue_dispatch
-_dbus_loop_quit
-_dbus_loop_ref
-_dbus_loop_remove_timeout
-_dbus_loop_remove_watch
-_dbus_loop_run
-_dbus_loop_unref
 _dbus_make_file_world_readable
 _dbus_marshal_byteswap
-_dbus_marshal_byteswap_test
-_dbus_marshal_header_test
 _dbus_marshal_read_basic
-_dbus_marshal_read_fixed_multi
 _dbus_marshal_read_uint32
-_dbus_marshal_recursive_test
 _dbus_marshal_set_basic
 _dbus_marshal_set_uint32
 _dbus_marshal_skip_array
 _dbus_marshal_skip_basic
-_dbus_marshal_test
-_dbus_marshal_validate_test
 _dbus_marshal_write_basic
 _dbus_marshal_write_fixed_multi
 _dbus_mem_pool_alloc
 _dbus_mem_pool_dealloc
 _dbus_mem_pool_free
 _dbus_mem_pool_new
-_dbus_mem_pool_test
 _dbus_memdup
-_dbus_memory_test
-_dbus_message_contains_unix_fds
-_dbus_message_data_free
-_dbus_message_data_iter_get_and_next
-_dbus_message_data_iter_init
 _dbus_message_get_network_data
 _dbus_message_iter_get_args_valist
 _dbus_message_loader_get_buffer
@@ -332,15 +247,13 @@ _dbus_message_loader_ref
 _dbus_message_loader_return_buffer
 _dbus_message_loader_set_max_message_size
 _dbus_message_loader_unref
-_dbus_message_test
-_dbus_misc_test
 _dbus_mutex_free
 _dbus_mutex_free_at_location
 _dbus_mutex_lock
 _dbus_mutex_new
 _dbus_mutex_new_at_location
 _dbus_mutex_unlock
-_dbus_no_memory_message
+_dbus_no_memory_message DATA
 _dbus_object_tree_dispatch_and_unlock
 _dbus_object_tree_free_all_unlocked
 _dbus_object_tree_get_user_data_unlocked
@@ -348,13 +261,9 @@ _dbus_object_tree_list_registered_and_unlock
 _dbus_object_tree_new
 _dbus_object_tree_ref
 _dbus_object_tree_register
-_dbus_object_tree_test
 _dbus_object_tree_unref
 _dbus_object_tree_unregister_and_unlock
 _dbus_pack_uint32
-_dbus_parse_unix_group_from_config
-_dbus_parse_unix_user_from_config
-_dbus_path_is_absolute
 _dbus_pending_call_complete
 _dbus_pending_call_get_completed_unlocked
 _dbus_pending_call_get_connection_and_lock
@@ -370,7 +279,6 @@ _dbus_pending_call_set_reply_serial_unlocked
 _dbus_pending_call_set_reply_unlocked
 _dbus_pending_call_set_timeout_added_unlocked
 _dbus_pending_call_set_timeout_error_unlocked
-_dbus_pending_call_test
 _dbus_pending_call_unref_and_unlock
 _dbus_pid_for_log
 _dbus_pipe_close
@@ -394,10 +302,8 @@ _dbus_return_if_fail_warning_format DATA
 _dbus_send_credentials_socket
 _dbus_server_add_timeout
 _dbus_server_add_watch
-_dbus_server_debug_pipe_new
 _dbus_server_finalize_base
 _dbus_server_init_base
-_dbus_server_listen_debug_pipe
 _dbus_server_listen_platform_specific
 _dbus_server_listen_socket
 _dbus_server_new_for_socket
@@ -406,65 +312,45 @@ _dbus_server_ref_unlocked
 _dbus_server_remove_timeout
 _dbus_server_remove_watch
 _dbus_server_socket_own_filename
-_dbus_server_test
 _dbus_server_toggle_timeout
 _dbus_server_toggle_watch
 _dbus_server_unref_unlocked
 _dbus_set_bad_address
 _dbus_set_errno_to_zero
-_dbus_set_fail_alloc_counter
-_dbus_set_fail_alloc_failures
 _dbus_set_fd_nonblocking
-_dbus_set_signal_handler
 _dbus_setenv
 _dbus_sha_compute
 _dbus_sha_final
 _dbus_sha_init
-_dbus_sha_test
 _dbus_sha_update
-_dbus_shell_parse_argv
-_dbus_shell_unquote
-_dbus_signature_test
 _dbus_sleep_milliseconds
-_dbus_spawn_async_with_babysitter
-_dbus_spawn_test
 _dbus_split_paths_and_append
-_dbus_stat
 _dbus_strdup
 _dbus_strerror
 _dbus_strerror_from_errno
 _dbus_string_align_length
 _dbus_string_alloc_space
 _dbus_string_append
-_dbus_string_append_4_aligned
-_dbus_string_append_8_aligned
 _dbus_string_append_byte
 _dbus_string_append_byte_as_hex
-_dbus_string_append_double
 _dbus_string_append_int
 _dbus_string_append_len
 _dbus_string_append_printf
 _dbus_string_append_printf_valist
 _dbus_string_append_uint
-_dbus_string_append_unichar
 _dbus_string_array_contains
 _dbus_string_chop_white
 _dbus_string_copy
 _dbus_string_copy_data
-_dbus_string_copy_data_len
 _dbus_string_copy_len
 _dbus_string_copy_to_buffer
 _dbus_string_delete
-_dbus_string_delete_first_word
-_dbus_string_delete_leading_blanks
-_dbus_string_ends_with_c_str
 _dbus_string_equal
 _dbus_string_equal_c_str
 _dbus_string_equal_len
 _dbus_string_equal_substring
 _dbus_string_find
 _dbus_string_find_blank
-_dbus_string_find_byte_backward
 _dbus_string_find_eol
 _dbus_string_find_to
 _dbus_string_free
@@ -473,9 +359,7 @@ _dbus_string_get_const_data
 _dbus_string_get_const_data_len
 _dbus_string_get_data
 _dbus_string_get_data_len
-_dbus_string_get_dirname
 _dbus_string_get_length
-_dbus_string_get_unichar
 _dbus_string_hex_decode
 _dbus_string_hex_encode
 _dbus_string_init
@@ -489,10 +373,8 @@ _dbus_string_insert_alignment
 _dbus_string_insert_byte
 _dbus_string_insert_bytes
 _dbus_string_lengthen
-_dbus_string_lock
 _dbus_string_move
 _dbus_string_move_len
-_dbus_string_parse_double
 _dbus_string_parse_int
 _dbus_string_parse_uint
 _dbus_string_pop_line
@@ -505,18 +387,14 @@ _dbus_string_skip_blank
 _dbus_string_skip_white
 _dbus_string_skip_white_reverse
 _dbus_string_split_on_byte
-_dbus_string_starts_with_c_str
 _dbus_string_steal_data
-_dbus_string_steal_data_len
-_dbus_string_test
+_dbus_string_tolower_ascii
+_dbus_string_toupper_ascii
 _dbus_string_validate_ascii
 _dbus_string_validate_nul
 _dbus_string_validate_utf8
 _dbus_string_zero
 _dbus_swap_array
-_dbus_sysdeps_test
-_dbus_test_oom_handling
-_dbus_threads_init_debug
 _dbus_threads_init_platform_specific
 _dbus_timeout_list_add_timeout
 _dbus_timeout_list_free
@@ -529,7 +407,6 @@ _dbus_timeout_ref
 _dbus_timeout_set_enabled
 _dbus_timeout_set_interval
 _dbus_timeout_unref
-_dbus_transport_debug_pipe_new
 _dbus_transport_disconnect
 _dbus_transport_do_iteration
 _dbus_transport_finalize_base
@@ -551,7 +428,6 @@ _dbus_transport_init_base
 _dbus_transport_new_for_socket
 _dbus_transport_new_for_tcp_socket
 _dbus_transport_open
-_dbus_transport_open_debug_pipe
 _dbus_transport_open_platform_specific
 _dbus_transport_open_socket
 _dbus_transport_queue_messages
@@ -567,7 +443,6 @@ _dbus_transport_unref
 _dbus_type_get_alignment
 _dbus_type_is_valid
 _dbus_type_reader_delete
-_dbus_type_reader_equal_values
 _dbus_type_reader_get_array_length
 _dbus_type_reader_get_current_type
 _dbus_type_reader_get_element_type
@@ -598,9 +473,6 @@ _dbus_type_writer_write_basic
 _dbus_type_writer_write_fixed_multi
 _dbus_type_writer_write_reader
 _dbus_type_writer_write_reader_partial
-_dbus_unix_groups_from_uid
-_dbus_unix_user_is_at_console
-_dbus_unix_user_is_process_owner
 _dbus_unpack_uint16
 _dbus_unpack_uint32
 _dbus_uuid_encode
@@ -614,10 +486,6 @@ _dbus_validate_signature
 _dbus_validate_signature_with_reason
 _dbus_verbose_bytes
 _dbus_verbose_bytes_of_string
-_dbus_verbose_real
-_dbus_verbose_reset_real
-_dbus_verify_daemon_user
-_dbus_wait_for_memory
 _dbus_warn
 _dbus_warn_check_failed
 _dbus_watch_invalidate
@@ -638,228 +506,7 @@ _dbus_win_startup_winsock
 _dbus_win_utf16_to_utf8
 _dbus_win_utf8_to_utf16
 _dbus_win_warn_win_error
-_dbus_windows_user_is_process_owner
-_dbus_write_pid_to_file_and_pipe
 _dbus_write_socket
 _dbus_write_socket_two
-dbus_address_entries_free
-dbus_address_entry_get_method
-dbus_address_entry_get_value
-dbus_address_escape_value
-dbus_address_unescape_value
-dbus_bus_add_match
-dbus_bus_get
-dbus_bus_get_id
-dbus_bus_get_private
-dbus_bus_get_unique_name
-dbus_bus_get_unix_user
-dbus_bus_name_has_owner
-dbus_bus_register
-dbus_bus_release_name
-dbus_bus_remove_match
-dbus_bus_request_name
-dbus_bus_set_unique_name
-dbus_bus_start_service_by_name
-dbus_connection_add_filter
-dbus_connection_allocate_data_slot
-dbus_connection_borrow_message
-dbus_connection_can_send_type
-dbus_connection_close
-dbus_connection_dispatch
-dbus_connection_flush
-dbus_connection_free_data_slot
-dbus_connection_free_preallocated_send
-dbus_connection_get_adt_audit_session_data
-dbus_connection_get_data
-dbus_connection_get_dispatch_status
-dbus_connection_get_is_anonymous
-dbus_connection_get_is_authenticated
-dbus_connection_get_is_connected
-dbus_connection_get_max_message_size
-dbus_connection_get_max_received_size
-dbus_connection_get_object_path_data
-dbus_connection_get_outgoing_size
-dbus_connection_get_outgoing_unix_fds
-dbus_connection_get_server_id
-dbus_connection_get_socket
-dbus_connection_get_unix_fd
-dbus_connection_get_unix_process_id
-dbus_connection_get_unix_user
-dbus_connection_get_windows_user
-dbus_connection_has_messages_to_send
-dbus_connection_list_registered
-dbus_connection_open
-dbus_connection_open_private
-dbus_connection_pop_message
-dbus_connection_preallocate_send
-dbus_connection_read_write
-dbus_connection_read_write_dispatch
-dbus_connection_ref
-dbus_connection_register_fallback
-dbus_connection_register_object_path
-dbus_connection_remove_filter
-dbus_connection_return_message
-dbus_connection_send
-dbus_connection_send_preallocated
-dbus_connection_send_with_reply
-dbus_connection_send_with_reply_and_block
-dbus_connection_set_allow_anonymous
-dbus_connection_set_change_sigpipe
-dbus_connection_set_data
-dbus_connection_set_dispatch_status_function
-dbus_connection_set_exit_on_disconnect
-dbus_connection_set_max_message_size
-dbus_connection_set_max_message_unix_fds
-dbus_connection_set_max_received_size
-dbus_connection_set_max_received_unix_fds
-dbus_connection_set_route_peer_messages
-dbus_connection_set_timeout_functions
-dbus_connection_set_unix_user_function
-dbus_connection_set_wakeup_main_function
-dbus_connection_set_watch_functions
-dbus_connection_set_windows_user_function
-dbus_connection_steal_borrowed_message
-dbus_connection_unref
-dbus_connection_unregister_object_path
-dbus_error_free
-dbus_error_has_name
-dbus_error_init
-dbus_error_is_set
-dbus_free
-dbus_free_string_array
-dbus_get_local_machine_id
-dbus_internal_do_not_use_foreach_message_file
-dbus_internal_do_not_use_generate_bodies
-dbus_internal_do_not_use_load_message_file
-dbus_internal_do_not_use_run_tests
-dbus_internal_do_not_use_try_message_data
-dbus_internal_do_not_use_try_message_file
-dbus_malloc
-dbus_malloc0
-dbus_message_allocate_data_slot
-dbus_message_append_args
-dbus_message_append_args_valist
-dbus_message_copy
-dbus_message_contains_unix_fds
-dbus_message_demarshal
-dbus_message_free_data_slot
-dbus_message_get_args
-dbus_message_get_args_valist
-dbus_message_get_auto_start
-dbus_message_get_data
-dbus_message_get_destination
-dbus_message_get_error_name
-dbus_message_get_interface
-dbus_message_get_member
-dbus_message_get_no_reply
-dbus_message_get_path
-dbus_message_get_path_decomposed
-dbus_message_get_reply_serial
-dbus_message_get_sender
-dbus_message_get_serial
-dbus_message_get_signature
-dbus_message_get_type
-dbus_message_has_destination
-dbus_message_has_interface
-dbus_message_has_member
-dbus_message_has_path
-dbus_message_has_sender
-dbus_message_has_signature
-dbus_message_is_error
-dbus_message_is_method_call
-dbus_message_is_signal
-dbus_message_iter_append_basic
-dbus_message_iter_append_fixed_array
-dbus_message_iter_close_container
-dbus_message_iter_get_arg_type
-dbus_message_iter_get_array_len
-dbus_message_iter_get_basic
-dbus_message_iter_get_element_type
-dbus_message_iter_get_fixed_array
-dbus_message_iter_get_signature
-dbus_message_iter_has_next
-dbus_message_iter_init
-dbus_message_iter_init_append
-dbus_message_iter_next
-dbus_message_iter_open_container
-dbus_message_iter_recurse
-dbus_message_marshal
-dbus_message_new
-dbus_message_new_error
-dbus_message_new_error_printf
-dbus_message_new_method_call
-dbus_message_new_method_return
-dbus_message_new_signal
-dbus_message_ref
-dbus_message_set_auto_start
-dbus_message_set_data
-dbus_message_set_destination
-dbus_message_set_error_name
-dbus_message_set_interface
-dbus_message_set_member
-dbus_message_set_no_reply
-dbus_message_set_path
-dbus_message_set_reply_serial
-dbus_message_set_sender
-dbus_message_type_from_string
-dbus_message_type_to_string
-dbus_message_unref
-dbus_move_error
-dbus_parse_address
-dbus_pending_call_allocate_data_slot
-dbus_pending_call_block
-dbus_pending_call_cancel
-dbus_pending_call_free_data_slot
-dbus_pending_call_get_completed
-dbus_pending_call_get_data
-dbus_pending_call_ref
-dbus_pending_call_set_data
-dbus_pending_call_set_notify
-dbus_pending_call_steal_reply
-dbus_pending_call_unref
-dbus_realloc
-dbus_server_allocate_data_slot
-dbus_server_disconnect
-dbus_server_free_data_slot
-dbus_server_get_address
-dbus_server_get_data
-dbus_server_get_id
-dbus_server_get_is_connected
-dbus_server_listen
-dbus_server_ref
-dbus_server_set_auth_mechanisms
-dbus_server_set_data
-dbus_server_set_new_connection_function
-dbus_server_set_timeout_functions
-dbus_server_set_watch_functions
-dbus_server_unref
-dbus_set_error
-dbus_set_error_const
-dbus_set_error_from_message
-dbus_shutdown
-dbus_signature_iter_get_current_type
-dbus_signature_iter_get_element_type
-dbus_signature_iter_get_signature
-dbus_signature_iter_init
-dbus_signature_iter_next
-dbus_signature_iter_recurse
-dbus_signature_validate
-dbus_signature_validate_single
-dbus_threads_init
-dbus_threads_init_default
-dbus_timeout_get_data
-dbus_timeout_get_enabled
-dbus_timeout_get_interval
-dbus_timeout_handle
-dbus_timeout_set_data
-dbus_type_is_basic
-dbus_type_is_container
-dbus_type_is_fixed
-dbus_watch_get_data
-dbus_watch_get_enabled
-dbus_watch_get_fd
-dbus_watch_get_flags
-dbus_watch_get_socket
-dbus_watch_get_unix_fd
-dbus_watch_handle
-dbus_watch_set_data
+
+
diff --git a/dbus/dbus-1-testsymbols.def.in b/dbus/dbus-1-testsymbols.def.in
new file mode 100644 (file)
index 0000000..ce7731b
--- /dev/null
@@ -0,0 +1,55 @@
+_dbus_address_test
+_dbus_auth_script_run
+_dbus_connection_queue_received_message
+_dbus_connection_test_get_locks
+_dbus_data_slot_test
+_dbus_decrement_fail_alloc_counter
+_dbus_disable_mem_pools
+_dbus_get_fail_alloc_counter
+_dbus_get_fail_alloc_failures
+_dbus_get_malloc_blocks_outstanding
+_dbus_hash_iter_get_two_strings_key
+_dbus_hash_table_insert_pointer
+_dbus_hash_table_insert_two_strings
+_dbus_hash_table_lookup_pointer
+_dbus_hash_table_lookup_two_strings
+_dbus_hash_table_remove_pointer
+_dbus_hash_table_remove_two_strings
+_dbus_hash_test
+_dbus_header_field_to_string
+_dbus_keyring_test
+_dbus_list_insert_before
+_dbus_list_pop_last_link
+_dbus_list_test
+_dbus_marshal_header_test
+_dbus_marshal_read_fixed_multi
+_dbus_marshal_test
+_dbus_mem_pool_test
+_dbus_memory_test
+_dbus_misc_test
+_dbus_object_tree_test
+_dbus_pending_call_test
+_dbus_server_debug_pipe_new
+_dbus_server_listen_debug_pipe
+_dbus_server_test
+_dbus_set_fail_alloc_counter
+_dbus_set_fail_alloc_failures
+_dbus_sha_test
+_dbus_signature_test
+_dbus_string_append_4_aligned
+_dbus_string_append_8_aligned
+_dbus_string_append_double
+_dbus_string_append_unichar
+_dbus_string_compact
+_dbus_string_copy_data_len
+_dbus_string_delete_first_word
+_dbus_string_delete_leading_blanks
+_dbus_string_get_unichar
+_dbus_string_lock
+_dbus_string_parse_double
+_dbus_string_starts_with_c_str
+_dbus_string_steal_data_len
+_dbus_test_oom_handling
+_dbus_threads_init_debug
+_dbus_transport_debug_pipe_new
+_dbus_transport_open_debug_pipe
diff --git a/dbus/dbus-1-verbosesymbols.def.in b/dbus/dbus-1-verbosesymbols.def.in
new file mode 100644 (file)
index 0000000..ee5411c
--- /dev/null
@@ -0,0 +1,3 @@
+_dbus_is_verbose_real
+_dbus_verbose_real
+_dbus_verbose_reset_real
diff --git a/dbus/dbus-1.def.pre b/dbus/dbus-1.def.pre
new file mode 100644 (file)
index 0000000..9771d91
--- /dev/null
@@ -0,0 +1,10 @@
+#include <config.h>
+EXPORTS
+#include "dbus-1-symbols.def.in"
+#if DBUS_BUILD_TESTS
+#include "dbus-1-testsymbols.def.in"
+#endif
+#if DBUS_ENABLE_VERBOSE_MODE
+#include "dbus-1-verbosesymbols.def.in"
+#endif
+
index 07d5339..e51ef0a 100644 (file)
@@ -40,16 +40,22 @@ DBUS_BEGIN_DECLS
 /** Opaque type representing one of the semicolon-separated items in an address */
 typedef struct DBusAddressEntry DBusAddressEntry;
 
+DBUS_EXPORT
 dbus_bool_t dbus_parse_address            (const char         *address,
                                           DBusAddressEntry ***entry,
                                           int                *array_len,
                                           DBusError          *error);
+DBUS_EXPORT
 const char *dbus_address_entry_get_value  (DBusAddressEntry   *entry,
                                           const char         *key);
+DBUS_EXPORT
 const char *dbus_address_entry_get_method (DBusAddressEntry   *entry);
+DBUS_EXPORT
 void        dbus_address_entries_free     (DBusAddressEntry  **entries);
 
+DBUS_EXPORT
 char* dbus_address_escape_value   (const char *value);
+DBUS_EXPORT
 char* dbus_address_unescape_value (const char *value,
                                    DBusError  *error);
 
index 30cd564..39e6c7c 100644 (file)
@@ -24,8 +24,6 @@
 #ifndef DBUS_AUTH_SCRIPT_H
 #define DBUS_AUTH_SCRIPT_H
 
-#include <config.h>
-
 #include <dbus/dbus-memory.h>
 #include <dbus/dbus-types.h>
 #include <dbus/dbus-string.h>
index 09ecdd4..776e8e2 100644 (file)
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-test.h"
 #include "dbus-auth.h"
index 0c12483..3173f34 100644 (file)
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "dbus-auth.h"
 #include "dbus-string.h"
 #include "dbus-list.h"
index e36449c..02a9571 100644 (file)
@@ -36,41 +36,54 @@ DBUS_BEGIN_DECLS
  * @{
  */
 
+DBUS_EXPORT
 DBusConnection *dbus_bus_get              (DBusBusType     type,
                                           DBusError      *error);
+DBUS_EXPORT
 DBusConnection *dbus_bus_get_private      (DBusBusType     type,
                                           DBusError      *error);
 
+DBUS_EXPORT
 dbus_bool_t     dbus_bus_register         (DBusConnection *connection,
                                           DBusError      *error);
+DBUS_EXPORT
 dbus_bool_t     dbus_bus_set_unique_name  (DBusConnection *connection,
                                           const char     *unique_name);
+DBUS_EXPORT
 const char*     dbus_bus_get_unique_name  (DBusConnection *connection);
+DBUS_EXPORT
 unsigned long   dbus_bus_get_unix_user    (DBusConnection *connection,
                                           const char     *name,
                                            DBusError      *error);
+DBUS_EXPORT
 char*           dbus_bus_get_id           (DBusConnection *connection,
                                            DBusError      *error);
+DBUS_EXPORT
 int             dbus_bus_request_name     (DBusConnection *connection,
                                           const char     *name,
                                           unsigned int    flags,
                                           DBusError      *error);
+DBUS_EXPORT
 int             dbus_bus_release_name     (DBusConnection *connection,
                                           const char     *name,
                                           DBusError      *error);
+DBUS_EXPORT
 dbus_bool_t     dbus_bus_name_has_owner   (DBusConnection *connection,
                                           const char     *name,
                                           DBusError      *error);
 
+DBUS_EXPORT
 dbus_bool_t     dbus_bus_start_service_by_name (DBusConnection *connection,
                                                 const char     *name,
                                                 dbus_uint32_t   flags,
                                                 dbus_uint32_t  *reply,
                                                 DBusError      *error);
 
+DBUS_EXPORT
 void            dbus_bus_add_match        (DBusConnection *connection,
                                            const char     *rule,
                                            DBusError      *error);
+DBUS_EXPORT
 void            dbus_bus_remove_match     (DBusConnection *connection,
                                            const char     *rule,
                                            DBusError      *error);
index 55e4cc2..6992f00 100644 (file)
 #define TRACE_LOCKS 1
 
 #define CONNECTION_LOCK(connection)   do {                                      \
-    if (TRACE_LOCKS) { _dbus_verbose ("  LOCK: %s\n", _DBUS_FUNCTION_NAME); }   \
+    if (TRACE_LOCKS) { _dbus_verbose ("LOCK\n"); }   \
     _dbus_mutex_lock ((connection)->mutex);                                      \
     TOOK_LOCK_CHECK (connection);                                               \
   } while (0)
 
 #define CONNECTION_UNLOCK(connection) do {                                              \
-    if (TRACE_LOCKS) { _dbus_verbose ("  UNLOCK: %s\n", _DBUS_FUNCTION_NAME);  }        \
+    if (TRACE_LOCKS) { _dbus_verbose ("UNLOCK\n");  }        \
     RELEASING_LOCK_CHECK (connection);                                                  \
     _dbus_mutex_unlock ((connection)->mutex);                                            \
   } while (0)
@@ -1033,11 +1033,11 @@ _dbus_connection_acquire_io_path (DBusConnection *connection,
   /* We will only touch io_path_acquired which is protected by our mutex */
   CONNECTION_UNLOCK (connection);
   
-  _dbus_verbose ("%s locking io_path_mutex\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("locking io_path_mutex\n");
   _dbus_mutex_lock (connection->io_path_mutex);
 
-  _dbus_verbose ("%s start connection->io_path_acquired = %d timeout = %d\n",
-                 _DBUS_FUNCTION_NAME, connection->io_path_acquired, timeout_milliseconds);
+  _dbus_verbose ("start connection->io_path_acquired = %d timeout = %d\n",
+                 connection->io_path_acquired, timeout_milliseconds);
 
   we_acquired = FALSE;
   
@@ -1045,8 +1045,8 @@ _dbus_connection_acquire_io_path (DBusConnection *connection,
     {
       if (timeout_milliseconds != -1)
         {
-          _dbus_verbose ("%s waiting %d for IO path to be acquirable\n",
-                         _DBUS_FUNCTION_NAME, timeout_milliseconds);
+          _dbus_verbose ("waiting %d for IO path to be acquirable\n",
+                         timeout_milliseconds);
 
           if (!_dbus_condvar_wait_timeout (connection->io_path_cond,
                                            connection->io_path_mutex,
@@ -1066,7 +1066,7 @@ _dbus_connection_acquire_io_path (DBusConnection *connection,
         {
           while (connection->io_path_acquired)
             {
-              _dbus_verbose ("%s waiting for IO path to be acquirable\n", _DBUS_FUNCTION_NAME);
+              _dbus_verbose ("waiting for IO path to be acquirable\n");
               _dbus_condvar_wait (connection->io_path_cond, 
                                   connection->io_path_mutex);
             }
@@ -1079,10 +1079,10 @@ _dbus_connection_acquire_io_path (DBusConnection *connection,
       connection->io_path_acquired = TRUE;
     }
   
-  _dbus_verbose ("%s end connection->io_path_acquired = %d we_acquired = %d\n",
-                 _DBUS_FUNCTION_NAME, connection->io_path_acquired, we_acquired);
+  _dbus_verbose ("end connection->io_path_acquired = %d we_acquired = %d\n",
+                 connection->io_path_acquired, we_acquired);
 
-  _dbus_verbose ("%s unlocking io_path_mutex\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("unlocking io_path_mutex\n");
   _dbus_mutex_unlock (connection->io_path_mutex);
 
   CONNECTION_LOCK (connection);
@@ -1106,18 +1106,18 @@ _dbus_connection_release_io_path (DBusConnection *connection)
 {
   HAVE_LOCK_CHECK (connection);
   
-  _dbus_verbose ("%s locking io_path_mutex\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("locking io_path_mutex\n");
   _dbus_mutex_lock (connection->io_path_mutex);
   
   _dbus_assert (connection->io_path_acquired);
 
-  _dbus_verbose ("%s start connection->io_path_acquired = %d\n",
-                 _DBUS_FUNCTION_NAME, connection->io_path_acquired);
+  _dbus_verbose ("start connection->io_path_acquired = %d\n",
+                 connection->io_path_acquired);
   
   connection->io_path_acquired = FALSE;
   _dbus_condvar_wake_one (connection->io_path_cond);
 
-  _dbus_verbose ("%s unlocking io_path_mutex\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("unlocking io_path_mutex\n");
   _dbus_mutex_unlock (connection->io_path_mutex);
 }
 
@@ -1154,7 +1154,7 @@ _dbus_connection_do_iteration_unlocked (DBusConnection *connection,
                                         unsigned int    flags,
                                         int             timeout_milliseconds)
 {
-  _dbus_verbose ("%s start\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("start\n");
   
   HAVE_LOCK_CHECK (connection);
   
@@ -1173,7 +1173,7 @@ _dbus_connection_do_iteration_unlocked (DBusConnection *connection,
 
   HAVE_LOCK_CHECK (connection);
 
-  _dbus_verbose ("%s end\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("end\n");
 }
 
 /**
@@ -1438,10 +1438,17 @@ _dbus_connection_handle_watch (DBusWatch                   *watch,
 
   connection = data;
 
-  _dbus_verbose ("%s start\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("start\n");
   
   CONNECTION_LOCK (connection);
-  _dbus_connection_acquire_io_path (connection, -1);
+
+  if (!_dbus_connection_acquire_io_path (connection, 1))
+    {
+      /* another thread is handling the message */
+      CONNECTION_UNLOCK (connection);
+      return TRUE;
+    }
+
   HAVE_LOCK_CHECK (connection);
   retval = _dbus_transport_handle_watch (connection->transport,
                                          watch, condition);
@@ -1450,14 +1457,14 @@ _dbus_connection_handle_watch (DBusWatch                   *watch,
 
   HAVE_LOCK_CHECK (connection);
 
-  _dbus_verbose ("%s middle\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("middle\n");
   
   status = _dbus_connection_get_dispatch_status_unlocked (connection);
 
   /* this calls out to user code */
   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
 
-  _dbus_verbose ("%s end\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("end\n");
   
   return retval;
 }
@@ -2010,7 +2017,7 @@ _dbus_connection_send_preallocated_and_unlock (DBusConnection       *connection,
                                                          preallocated,
                                                          message, client_serial);
 
-  _dbus_verbose ("%s middle\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("middle\n");
   status = _dbus_connection_get_dispatch_status_unlocked (connection);
 
   /* this calls out to user code */
@@ -2245,7 +2252,7 @@ check_for_reply_and_update_dispatch_unlocked (DBusConnection  *connection,
                                     _dbus_pending_call_get_reply_serial_unlocked (pending));
   if (reply != NULL)
     {
-      _dbus_verbose ("%s checked for reply\n", _DBUS_FUNCTION_NAME);
+      _dbus_verbose ("checked for reply\n");
 
       _dbus_verbose ("dbus_connection_send_with_reply_and_block(): got reply\n");
 
@@ -2338,7 +2345,7 @@ _dbus_connection_block_pending_call (DBusPendingCall *pending)
 
  recheck_status:
 
-  _dbus_verbose ("%s top of recheck\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("top of recheck\n");
   
   HAVE_LOCK_CHECK (connection);
   
@@ -2351,7 +2358,7 @@ _dbus_connection_block_pending_call (DBusPendingCall *pending)
    */
   if (_dbus_pending_call_get_completed_unlocked (pending))
     {
-      _dbus_verbose ("Pending call completed by dispatch in %s\n", _DBUS_FUNCTION_NAME);
+      _dbus_verbose ("Pending call completed by dispatch\n");
       _dbus_connection_update_dispatch_status_and_unlock (connection, status);
       dbus_pending_call_unref (pending);
       return;
@@ -2433,7 +2440,7 @@ _dbus_connection_block_pending_call (DBusPendingCall *pending)
       goto recheck_status;
     }
 
-  _dbus_verbose ("dbus_connection_send_with_reply_and_block(): Waited %ld milliseconds and got no reply\n",
+  _dbus_verbose ("dbus_connection_send_with_reply_and_block(): Waited %d milliseconds and got no reply\n",
                  elapsed_milliseconds);
 
   _dbus_assert (!_dbus_pending_call_get_completed_unlocked (pending));
@@ -3240,7 +3247,7 @@ reply_handler_timeout (void *data)
                                            _dbus_pending_call_get_timeout_unlocked (pending));
   _dbus_pending_call_set_timeout_added_unlocked (pending, FALSE);
 
-  _dbus_verbose ("%s middle\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("middle\n");
   status = _dbus_connection_get_dispatch_status_unlocked (connection);
 
   /* Unlocks, and calls out to user code */
@@ -3505,7 +3512,7 @@ _dbus_connection_flush_unlocked (DBusConnection *connection)
   while (connection->n_outgoing > 0 &&
          _dbus_connection_get_is_connected_unlocked (connection))
     {
-      _dbus_verbose ("doing iteration in %s\n", _DBUS_FUNCTION_NAME);
+      _dbus_verbose ("doing iteration in\n");
       HAVE_LOCK_CHECK (connection);
       _dbus_connection_do_iteration_unlocked (connection,
                                               DBUS_ITERATION_DO_READING |
@@ -3515,7 +3522,7 @@ _dbus_connection_flush_unlocked (DBusConnection *connection)
     }
 
   HAVE_LOCK_CHECK (connection);
-  _dbus_verbose ("%s middle\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("middle\n");
   status = _dbus_connection_get_dispatch_status_unlocked (connection);
 
   HAVE_LOCK_CHECK (connection);
@@ -3547,7 +3554,7 @@ dbus_connection_flush (DBusConnection *connection)
   /* Unlocks and calls out to user code */
   _dbus_connection_update_dispatch_status_and_unlock (connection, status);
 
-  _dbus_verbose ("%s end\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("end\n");
 }
 
 /**
@@ -3577,13 +3584,13 @@ _dbus_connection_read_write_dispatch (DBusConnection *connection,
 
   if (dispatch && dstatus == DBUS_DISPATCH_DATA_REMAINS)
     {
-      _dbus_verbose ("doing dispatch in %s\n", _DBUS_FUNCTION_NAME);
+      _dbus_verbose ("doing dispatch\n");
       dbus_connection_dispatch (connection);
       CONNECTION_LOCK (connection);
     }
   else if (dstatus == DBUS_DISPATCH_NEED_MEMORY)
     {
-      _dbus_verbose ("pausing for memory in %s\n", _DBUS_FUNCTION_NAME);
+      _dbus_verbose ("pausing for memory\n");
       _dbus_memory_pause_based_on_timeout (timeout_milliseconds);
       CONNECTION_LOCK (connection);
     }
@@ -3592,7 +3599,7 @@ _dbus_connection_read_write_dispatch (DBusConnection *connection,
       CONNECTION_LOCK (connection);
       if (_dbus_connection_get_is_connected_unlocked (connection))
         {
-          _dbus_verbose ("doing iteration in %s\n", _DBUS_FUNCTION_NAME);
+          _dbus_verbose ("doing iteration\n");
           _dbus_connection_do_iteration_unlocked (connection,
                                                   DBUS_ITERATION_DO_READING |
                                                   DBUS_ITERATION_DO_WRITING |
@@ -3743,7 +3750,7 @@ dbus_connection_borrow_message (DBusConnection *connection)
 
   _dbus_return_val_if_fail (connection != NULL, NULL);
 
-  _dbus_verbose ("%s start\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("start\n");
   
   /* this is called for the side effect that it queues
    * up any messages from the transport
@@ -3968,7 +3975,7 @@ dbus_connection_pop_message (DBusConnection *connection)
   DBusMessage *message;
   DBusDispatchStatus status;
 
-  _dbus_verbose ("%s start\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("start\n");
   
   /* this is called for the side effect that it queues
    * up any messages from the transport
@@ -4008,12 +4015,12 @@ _dbus_connection_acquire_dispatch (DBusConnection *connection)
   _dbus_connection_ref_unlocked (connection);
   CONNECTION_UNLOCK (connection);
   
-  _dbus_verbose ("%s locking dispatch_mutex\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("locking dispatch_mutex\n");
   _dbus_mutex_lock (connection->dispatch_mutex);
 
   while (connection->dispatch_acquired)
     {
-      _dbus_verbose ("%s waiting for dispatch to be acquirable\n", _DBUS_FUNCTION_NAME);
+      _dbus_verbose ("waiting for dispatch to be acquirable\n");
       _dbus_condvar_wait (connection->dispatch_cond, 
                           connection->dispatch_mutex);
     }
@@ -4022,7 +4029,7 @@ _dbus_connection_acquire_dispatch (DBusConnection *connection)
 
   connection->dispatch_acquired = TRUE;
 
-  _dbus_verbose ("%s unlocking dispatch_mutex\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("unlocking dispatch_mutex\n");
   _dbus_mutex_unlock (connection->dispatch_mutex);
   
   CONNECTION_LOCK (connection);
@@ -4041,7 +4048,7 @@ _dbus_connection_release_dispatch (DBusConnection *connection)
 {
   HAVE_LOCK_CHECK (connection);
   
-  _dbus_verbose ("%s locking dispatch_mutex\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("locking dispatch_mutex\n");
   _dbus_mutex_lock (connection->dispatch_mutex);
   
   _dbus_assert (connection->dispatch_acquired);
@@ -4049,7 +4056,7 @@ _dbus_connection_release_dispatch (DBusConnection *connection)
   connection->dispatch_acquired = FALSE;
   _dbus_condvar_wake_one (connection->dispatch_cond);
 
-  _dbus_verbose ("%s unlocking dispatch_mutex\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("unlocking dispatch_mutex\n");
   _dbus_mutex_unlock (connection->dispatch_mutex);
 }
 
@@ -4102,8 +4109,7 @@ notify_disconnected_and_dispatch_complete_unlocked (DBusConnection *connection)
   
   if (connection->disconnect_message_link != NULL)
     {
-      _dbus_verbose ("Sending disconnect message from %s\n",
-                     _DBUS_FUNCTION_NAME);
+      _dbus_verbose ("Sending disconnect message\n");
       
       /* If we have pending calls, queue their timeouts - we want the Disconnected
        * to be the last message, after these timeouts.
@@ -4257,7 +4263,7 @@ dbus_connection_get_dispatch_status (DBusConnection *connection)
 
   _dbus_return_val_if_fail (connection != NULL, DBUS_DISPATCH_COMPLETE);
 
-  _dbus_verbose ("%s start\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("start\n");
   
   CONNECTION_LOCK (connection);
 
@@ -4434,7 +4440,7 @@ dbus_connection_dispatch (DBusConnection *connection)
 
   _dbus_return_val_if_fail (connection != NULL, DBUS_DISPATCH_COMPLETE);
 
-  _dbus_verbose ("%s\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("\n");
   
   CONNECTION_LOCK (connection);
   status = _dbus_connection_get_dispatch_status_unlocked (connection);
@@ -4570,7 +4576,7 @@ dbus_connection_dispatch (DBusConnection *connection)
 
   if (result == DBUS_HANDLER_RESULT_NEED_MEMORY)
     {
-      _dbus_verbose ("No memory in %s\n", _DBUS_FUNCTION_NAME);
+      _dbus_verbose ("No memory\n");
       goto out;
     }
   else if (result == DBUS_HANDLER_RESULT_HANDLED)
@@ -4677,7 +4683,7 @@ dbus_connection_dispatch (DBusConnection *connection)
  out:
   if (result == DBUS_HANDLER_RESULT_NEED_MEMORY)
     {
-      _dbus_verbose ("out of memory in %s\n", _DBUS_FUNCTION_NAME);
+      _dbus_verbose ("out of memory\n");
       
       /* Put message back, and we'll start over.
        * Yes this means handlers must be idempotent if they
@@ -4688,7 +4694,7 @@ dbus_connection_dispatch (DBusConnection *connection)
     }
   else
     {
-      _dbus_verbose (" ... done dispatching in %s\n", _DBUS_FUNCTION_NAME);
+      _dbus_verbose (" ... done dispatching\n");
       
       _dbus_list_free_link (message_link);
       dbus_message_unref (message); /* don't want the message to count in max message limits
@@ -4699,7 +4705,7 @@ dbus_connection_dispatch (DBusConnection *connection)
   _dbus_connection_release_dispatch (connection);
   HAVE_LOCK_CHECK (connection);
 
-  _dbus_verbose ("%s before final status update\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("before final status update\n");
   status = _dbus_connection_get_dispatch_status_unlocked (connection);
 
   /* unlocks and calls user code */
@@ -4787,8 +4793,7 @@ dbus_connection_set_watch_functions (DBusConnection              *connection,
 #ifndef DBUS_DISABLE_CHECKS
   if (connection->watches == NULL)
     {
-      _dbus_warn_check_failed ("Re-entrant call to %s is not allowed\n",
-                               _DBUS_FUNCTION_NAME);
+      _dbus_warn_check_failed ("Re-entrant call is not allowed\n");
       return FALSE;
     }
 #endif
@@ -4869,8 +4874,7 @@ dbus_connection_set_timeout_functions   (DBusConnection            *connection,
 #ifndef DBUS_DISABLE_CHECKS
   if (connection->timeouts == NULL)
     {
-      _dbus_warn_check_failed ("Re-entrant call to %s is not allowed\n",
-                               _DBUS_FUNCTION_NAME);
+      _dbus_warn_check_failed ("Re-entrant call is not allowed\n");
       return FALSE;
     }
 #endif
index ede3dcd..3e2a7d8 100644 (file)
@@ -168,133 +168,189 @@ typedef void (* DBusPendingCallNotifyFunction) (DBusPendingCall *pending,
 typedef DBusHandlerResult (* DBusHandleMessageFunction) (DBusConnection     *connection,
                                                          DBusMessage        *message,
                                                          void               *user_data);
-
+DBUS_EXPORT
 DBusConnection*    dbus_connection_open                         (const char                 *address,
                                                                  DBusError                  *error);
+DBUS_EXPORT
 DBusConnection*    dbus_connection_open_private                 (const char                 *address,
                                                                  DBusError                  *error);
+DBUS_EXPORT
 DBusConnection*    dbus_connection_ref                          (DBusConnection             *connection);
+DBUS_EXPORT
 void               dbus_connection_unref                        (DBusConnection             *connection);
+DBUS_EXPORT
 void               dbus_connection_close                        (DBusConnection             *connection);
+DBUS_EXPORT
 dbus_bool_t        dbus_connection_get_is_connected             (DBusConnection             *connection);
+DBUS_EXPORT
 dbus_bool_t        dbus_connection_get_is_authenticated         (DBusConnection             *connection);
+DBUS_EXPORT
 dbus_bool_t        dbus_connection_get_is_anonymous             (DBusConnection             *connection);
+DBUS_EXPORT
 char*              dbus_connection_get_server_id                (DBusConnection             *connection);
+DBUS_EXPORT
 dbus_bool_t        dbus_connection_can_send_type                (DBusConnection             *connection,
                                                                  int                         type);
+
+DBUS_EXPORT
 void               dbus_connection_set_exit_on_disconnect       (DBusConnection             *connection,
                                                                  dbus_bool_t                 exit_on_disconnect);
+DBUS_EXPORT
 void               dbus_connection_flush                        (DBusConnection             *connection);
+DBUS_EXPORT
 dbus_bool_t        dbus_connection_read_write_dispatch          (DBusConnection             *connection,
                                                                  int                         timeout_milliseconds);
+DBUS_EXPORT
 dbus_bool_t        dbus_connection_read_write                   (DBusConnection             *connection,
                                                                  int                         timeout_milliseconds);
+DBUS_EXPORT
 DBusMessage*       dbus_connection_borrow_message               (DBusConnection             *connection);
+DBUS_EXPORT
 void               dbus_connection_return_message               (DBusConnection             *connection,
                                                                  DBusMessage                *message);
+DBUS_EXPORT
 void               dbus_connection_steal_borrowed_message       (DBusConnection             *connection,
                                                                  DBusMessage                *message);
+DBUS_EXPORT
 DBusMessage*       dbus_connection_pop_message                  (DBusConnection             *connection);
+DBUS_EXPORT
 DBusDispatchStatus dbus_connection_get_dispatch_status          (DBusConnection             *connection);
+DBUS_EXPORT
 DBusDispatchStatus dbus_connection_dispatch                     (DBusConnection             *connection);
+DBUS_EXPORT
 dbus_bool_t        dbus_connection_has_messages_to_send         (DBusConnection *connection);
+DBUS_EXPORT
 dbus_bool_t        dbus_connection_send                         (DBusConnection             *connection,
                                                                  DBusMessage                *message,
                                                                  dbus_uint32_t              *client_serial);
+DBUS_EXPORT
 dbus_bool_t        dbus_connection_send_with_reply              (DBusConnection             *connection,
                                                                  DBusMessage                *message,
                                                                  DBusPendingCall           **pending_return,
                                                                  int                         timeout_milliseconds);
+DBUS_EXPORT
 DBusMessage *      dbus_connection_send_with_reply_and_block    (DBusConnection             *connection,
                                                                  DBusMessage                *message,
                                                                  int                         timeout_milliseconds,
                                                                  DBusError                  *error);
+DBUS_EXPORT
 dbus_bool_t        dbus_connection_set_watch_functions          (DBusConnection             *connection,
                                                                  DBusAddWatchFunction        add_function,
                                                                  DBusRemoveWatchFunction     remove_function,
                                                                  DBusWatchToggledFunction    toggled_function,
                                                                  void                       *data,
                                                                  DBusFreeFunction            free_data_function);
+DBUS_EXPORT
 dbus_bool_t        dbus_connection_set_timeout_functions        (DBusConnection             *connection,
                                                                  DBusAddTimeoutFunction      add_function,
                                                                  DBusRemoveTimeoutFunction   remove_function,
                                                                  DBusTimeoutToggledFunction  toggled_function,
                                                                  void                       *data,
                                                                  DBusFreeFunction            free_data_function);
+DBUS_EXPORT
 void               dbus_connection_set_wakeup_main_function     (DBusConnection             *connection,
                                                                  DBusWakeupMainFunction      wakeup_main_function,
                                                                  void                       *data,
                                                                  DBusFreeFunction            free_data_function);
+DBUS_EXPORT
 void               dbus_connection_set_dispatch_status_function (DBusConnection             *connection,
                                                                  DBusDispatchStatusFunction  function,
                                                                  void                       *data,
                                                                  DBusFreeFunction            free_data_function);
+DBUS_EXPORT
 dbus_bool_t        dbus_connection_get_unix_user                (DBusConnection             *connection,
                                                                  unsigned long              *uid);
+DBUS_EXPORT
 dbus_bool_t        dbus_connection_get_unix_process_id          (DBusConnection             *connection,
                                                                  unsigned long              *pid);
+DBUS_EXPORT
 dbus_bool_t        dbus_connection_get_adt_audit_session_data   (DBusConnection             *connection,
                                                                  void                      **data,
                                                                  dbus_int32_t               *data_size);
+DBUS_EXPORT
 void               dbus_connection_set_unix_user_function       (DBusConnection             *connection,
                                                                  DBusAllowUnixUserFunction   function,
                                                                  void                       *data,
                                                                  DBusFreeFunction            free_data_function);
+DBUS_EXPORT
 dbus_bool_t        dbus_connection_get_windows_user             (DBusConnection             *connection,
                                                                  char                      **windows_sid_p); 
+DBUS_EXPORT
 void               dbus_connection_set_windows_user_function    (DBusConnection             *connection,
                                                                  DBusAllowWindowsUserFunction function,
                                                                  void                       *data,
                                                                  DBusFreeFunction            free_data_function);
+DBUS_EXPORT
 void               dbus_connection_set_allow_anonymous          (DBusConnection             *connection,
                                                                  dbus_bool_t                 value);
+DBUS_EXPORT
 void               dbus_connection_set_route_peer_messages      (DBusConnection             *connection,
                                                                  dbus_bool_t                 value);
 
 
 /* Filters */
 
+DBUS_EXPORT
 dbus_bool_t dbus_connection_add_filter    (DBusConnection            *connection,
                                            DBusHandleMessageFunction  function,
                                            void                      *user_data,
                                            DBusFreeFunction           free_data_function);
+DBUS_EXPORT
 void        dbus_connection_remove_filter (DBusConnection            *connection,
                                            DBusHandleMessageFunction  function,
                                            void                      *user_data);
 
 
 /* Other */
+DBUS_EXPORT
 dbus_bool_t dbus_connection_allocate_data_slot (dbus_int32_t     *slot_p);
+DBUS_EXPORT
 void        dbus_connection_free_data_slot     (dbus_int32_t     *slot_p);
+DBUS_EXPORT
 dbus_bool_t dbus_connection_set_data           (DBusConnection   *connection,
                                                 dbus_int32_t      slot,
                                                 void             *data,
                                                 DBusFreeFunction  free_data_func);
+DBUS_EXPORT
 void*       dbus_connection_get_data           (DBusConnection   *connection,
                                                 dbus_int32_t      slot);
 
+DBUS_EXPORT
 void        dbus_connection_set_change_sigpipe (dbus_bool_t       will_modify_sigpipe); 
 
+DBUS_EXPORT
 void dbus_connection_set_max_message_size  (DBusConnection *connection,
                                             long            size);
+DBUS_EXPORT
 long dbus_connection_get_max_message_size  (DBusConnection *connection);
+DBUS_EXPORT
 void dbus_connection_set_max_received_size (DBusConnection *connection,
                                             long            size);
+DBUS_EXPORT
 long dbus_connection_get_max_received_size (DBusConnection *connection);
 
+DBUS_EXPORT
 void dbus_connection_set_max_message_unix_fds (DBusConnection *connection,
                                                long            n);
+DBUS_EXPORT
 long dbus_connection_get_max_message_unix_fds (DBusConnection *connection);
+DBUS_EXPORT
 void dbus_connection_set_max_received_unix_fds(DBusConnection *connection,
                                                long            n);
+DBUS_EXPORT
 long dbus_connection_get_max_received_unix_fds(DBusConnection *connection);
 
+DBUS_EXPORT
 long dbus_connection_get_outgoing_size     (DBusConnection *connection);
+DBUS_EXPORT
 long dbus_connection_get_outgoing_unix_fds (DBusConnection *connection);
 
+DBUS_EXPORT
 DBusPreallocatedSend* dbus_connection_preallocate_send       (DBusConnection       *connection);
+DBUS_EXPORT
 void                  dbus_connection_free_preallocated_send (DBusConnection       *connection,
                                                               DBusPreallocatedSend *preallocated);
+DBUS_EXPORT
 void                  dbus_connection_send_preallocated      (DBusConnection       *connection,
                                                               DBusPreallocatedSend *preallocated,
                                                               DBusMessage          *message,
@@ -335,40 +391,49 @@ struct DBusObjectPathVTable
   void (* dbus_internal_pad4) (void *); /**< Reserved for future expansion */
 };
 
+DBUS_EXPORT
 dbus_bool_t dbus_connection_try_register_object_path (DBusConnection              *connection,
                                                       const char                  *path,
                                                       const DBusObjectPathVTable  *vtable,
                                                       void                        *user_data,
                                                       DBusError                   *error);
 
+DBUS_EXPORT
 dbus_bool_t dbus_connection_register_object_path   (DBusConnection              *connection,
                                                     const char                  *path,
                                                     const DBusObjectPathVTable  *vtable,
                                                     void                        *user_data);
 
+DBUS_EXPORT
 dbus_bool_t dbus_connection_try_register_fallback (DBusConnection              *connection,
                                                    const char                  *path,
                                                    const DBusObjectPathVTable  *vtable,
                                                    void                        *user_data,
                                                    DBusError                   *error);
 
+DBUS_EXPORT
 dbus_bool_t dbus_connection_register_fallback      (DBusConnection              *connection,
                                                     const char                  *path,
                                                     const DBusObjectPathVTable  *vtable,
                                                     void                        *user_data);
+DBUS_EXPORT
 dbus_bool_t dbus_connection_unregister_object_path (DBusConnection              *connection,
                                                     const char                  *path);
 
+DBUS_EXPORT
 dbus_bool_t dbus_connection_get_object_path_data   (DBusConnection              *connection,
                                                     const char                  *path,
                                                     void                       **data_p);
 
+DBUS_EXPORT
 dbus_bool_t dbus_connection_list_registered        (DBusConnection              *connection,
                                                     const char                  *parent_path,
                                                     char                      ***child_entries);
 
+DBUS_EXPORT
 dbus_bool_t dbus_connection_get_unix_fd            (DBusConnection              *connection,
                                                     int                         *fd);
+DBUS_EXPORT
 dbus_bool_t dbus_connection_get_socket             (DBusConnection              *connection,
                                                     int                         *fd);
 
@@ -381,18 +446,26 @@ dbus_bool_t dbus_connection_get_socket             (DBusConnection
  */
 
 #ifndef DBUS_DISABLE_DEPRECATED
+DBUS_EXPORT
 DBUS_DEPRECATED int dbus_watch_get_fd      (DBusWatch        *watch);
 #endif
 
+DBUS_EXPORT
 int          dbus_watch_get_unix_fd (DBusWatch        *watch);
+DBUS_EXPORT
 int          dbus_watch_get_socket  (DBusWatch        *watch);
+DBUS_EXPORT
 unsigned int dbus_watch_get_flags   (DBusWatch        *watch);
+DBUS_EXPORT
 void*        dbus_watch_get_data    (DBusWatch        *watch);
+DBUS_EXPORT
 void         dbus_watch_set_data    (DBusWatch        *watch,
                                      void             *data,
                                      DBusFreeFunction  free_data_function);
+DBUS_EXPORT
 dbus_bool_t  dbus_watch_handle      (DBusWatch        *watch,
                                      unsigned int      flags);
+DBUS_EXPORT
 dbus_bool_t  dbus_watch_get_enabled (DBusWatch        *watch);
 
 /** @} */
@@ -402,12 +475,17 @@ dbus_bool_t  dbus_watch_get_enabled (DBusWatch        *watch);
  * @{
  */
 
+DBUS_EXPORT
 int         dbus_timeout_get_interval (DBusTimeout      *timeout);
+DBUS_EXPORT
 void*       dbus_timeout_get_data     (DBusTimeout      *timeout);
+DBUS_EXPORT
 void        dbus_timeout_set_data     (DBusTimeout      *timeout,
                                        void             *data,
                                        DBusFreeFunction  free_data_function);
+DBUS_EXPORT
 dbus_bool_t dbus_timeout_handle       (DBusTimeout      *timeout);
+DBUS_EXPORT
 dbus_bool_t dbus_timeout_get_enabled  (DBusTimeout      *timeout);
 
 /** @} */
diff --git a/dbus/dbus-convenience.def.pre b/dbus/dbus-convenience.def.pre
new file mode 100644 (file)
index 0000000..89e4480
--- /dev/null
@@ -0,0 +1,6 @@
+#include <config.h>
+EXPORTS
+#include "dbus-internal-symbols.def.in"
+#if DBUS_BUILD_TESTS
+#include "dbus-internal-testsymbols.def.in"
+#endif
index dae6080..0277196 100644 (file)
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-test.h"
 #include "dbus-credentials.h"
index f06d5c0..ff69f3b 100644 (file)
@@ -502,6 +502,49 @@ _dbus_credentials_same_user (DBusCredentials    *credentials,
       strcmp (credentials->windows_sid, other_credentials->windows_sid) == 0));
 }
 
+/**
+ * Convert the credentials in this object to a human-readable
+ * string format, and append to the given string.
+ *
+ * @param credentials the object
+ * @param string append to this string
+ * @returns #FALSE if no memory
+ */
+dbus_bool_t
+_dbus_credentials_to_string_append (DBusCredentials    *credentials,
+                                    DBusString         *string)
+{
+  dbus_bool_t join;
+
+  join = FALSE;
+  if (credentials->unix_uid != DBUS_UID_UNSET)
+    {
+      if (!_dbus_string_append_printf (string, "uid=" DBUS_UID_FORMAT, credentials->unix_uid))
+        goto oom;
+      join = TRUE;
+    }
+  if (credentials->unix_pid != DBUS_PID_UNSET)
+    {
+      if (!_dbus_string_append_printf (string, "%spid=" DBUS_PID_FORMAT, join ? " " : "", credentials->unix_pid))
+        goto oom;
+      join = TRUE;
+    }
+  else
+    join = FALSE;
+  if (credentials->windows_sid != NULL)
+    {
+      if (!_dbus_string_append_printf (string, "%ssid=%s", join ? " " : "", credentials->windows_sid))
+        goto oom;
+      join = TRUE;
+    }
+  else
+    join = FALSE;
+
+  return TRUE;
+oom:
+  return FALSE;
+}
+
 /** @} */
 
 /* tests in dbus-credentials-util.c */
index 25f31b7..ef6124f 100644 (file)
@@ -71,7 +71,8 @@ void             _dbus_credentials_clear                    (DBusCredentials
 DBusCredentials* _dbus_credentials_copy                     (DBusCredentials    *credentials);
 dbus_bool_t      _dbus_credentials_same_user                (DBusCredentials    *credentials,
                                                              DBusCredentials    *other_credentials);
-
+dbus_bool_t      _dbus_credentials_to_string_append         (DBusCredentials    *credentials,
+                                                             DBusString         *string);
 
 DBUS_END_DECLS
 
index 8fab7bb..fd25c41 100644 (file)
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "dbus-dataslot.h"
 #include "dbus-threads-internal.h"
 
index 5d7299f..5f27501 100644 (file)
@@ -21,6 +21,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "dbus-errors.h"
 #include "dbus-internals.h"
 #include "dbus-string.h"
@@ -375,6 +377,7 @@ dbus_set_error (DBusError  *error,
                                 message_from_error (name)))
         {
           _dbus_string_free (&str);
+          va_end (args);
           goto nomem;
         }
     }
index 0ddf247..cf08e5e 100644 (file)
@@ -60,19 +60,26 @@ struct DBusError
 
 #define DBUS_ERROR_INIT { NULL, NULL, TRUE, 0, 0, 0, 0, NULL }
 
+DBUS_EXPORT
 void        dbus_error_init      (DBusError       *error);
+DBUS_EXPORT
 void        dbus_error_free      (DBusError       *error);
+DBUS_EXPORT
 void        dbus_set_error       (DBusError       *error,
                                   const char      *name,
                                   const char      *message,
                                   ...);
+DBUS_EXPORT
 void        dbus_set_error_const (DBusError       *error,
                                   const char      *name,
                                   const char      *message);
+DBUS_EXPORT
 void        dbus_move_error      (DBusError       *src,
                                   DBusError       *dest);
+DBUS_EXPORT
 dbus_bool_t dbus_error_has_name  (const DBusError *error,
                                   const char      *name);
+DBUS_EXPORT
 dbus_bool_t dbus_error_is_set    (const DBusError *error);
 
 /** @} */
diff --git a/dbus/dbus-file-unix.c b/dbus/dbus-file-unix.c
new file mode 100644 (file)
index 0000000..363a278
--- /dev/null
@@ -0,0 +1,401 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-file-unix.c unix related file implementation (internal to D-Bus implementation)
+ * 
+ * Copyright (C) 2002, 2003, 2006  Red Hat, Inc.
+ * Copyright (C) 2003 CodeFactory AB
+ *
+ * Licensed under the Academic Free License version 2.1
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#include <config.h>
+
+#include "dbus-protocol.h"
+#include "dbus-errors.h"
+#include "dbus-file.h"
+#include "dbus-internals.h"
+#include "dbus-sysdeps.h"
+#include "dbus-sysdeps-unix.h"
+
+#include <sys/stat.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+/**
+ * Appends the contents of the given file to the string,
+ * returning error code. At the moment, won't open a file
+ * more than a megabyte in size.
+ *
+ * @param str the string to append to
+ * @param filename filename to load
+ * @param error place to set an error
+ * @returns #FALSE if error was set
+ */
+dbus_bool_t
+_dbus_file_get_contents (DBusString       *str,
+                         const DBusString *filename,
+                         DBusError        *error)
+{
+  int fd;
+  struct stat sb;
+  int orig_len;
+  int total;
+  const char *filename_c;
+
+  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+  
+  filename_c = _dbus_string_get_const_data (filename);
+  
+  /* O_BINARY useful on Cygwin */
+  fd = open (filename_c, O_RDONLY | O_BINARY);
+  if (fd < 0)
+    {
+      dbus_set_error (error, _dbus_error_from_errno (errno),
+                      "Failed to open \"%s\": %s",
+                      filename_c,
+                      _dbus_strerror (errno));
+      return FALSE;
+    }
+
+  _dbus_verbose ("file fd %d opened\n", fd);
+  
+  if (fstat (fd, &sb) < 0)
+    {
+      dbus_set_error (error, _dbus_error_from_errno (errno),
+                      "Failed to stat \"%s\": %s",
+                      filename_c,
+                      _dbus_strerror (errno));
+
+      _dbus_verbose ("fstat() failed: %s",
+                     _dbus_strerror (errno));
+      
+      _dbus_close (fd, NULL);
+      
+      return FALSE;
+    }
+
+  if (sb.st_size > _DBUS_ONE_MEGABYTE)
+    {
+      dbus_set_error (error, DBUS_ERROR_FAILED,
+                      "File size %lu of \"%s\" is too large.",
+                      (unsigned long) sb.st_size, filename_c);
+      _dbus_close (fd, NULL);
+      return FALSE;
+    }
+  
+  total = 0;
+  orig_len = _dbus_string_get_length (str);
+  if (sb.st_size > 0 && S_ISREG (sb.st_mode))
+    {
+      int bytes_read;
+
+      while (total < (int) sb.st_size)
+        {
+          bytes_read = _dbus_read (fd, str,
+                                   sb.st_size - total);
+          if (bytes_read <= 0)
+            {
+              dbus_set_error (error, _dbus_error_from_errno (errno),
+                              "Error reading \"%s\": %s",
+                              filename_c,
+                              _dbus_strerror (errno));
+
+              _dbus_verbose ("read() failed: %s",
+                             _dbus_strerror (errno));
+              
+              _dbus_close (fd, NULL);
+              _dbus_string_set_length (str, orig_len);
+              return FALSE;
+            }
+          else
+            total += bytes_read;
+        }
+
+      _dbus_close (fd, NULL);
+      return TRUE;
+    }
+  else if (sb.st_size != 0)
+    {
+      _dbus_verbose ("Can only open regular files at the moment.\n");
+      dbus_set_error (error, DBUS_ERROR_FAILED,
+                      "\"%s\" is not a regular file",
+                      filename_c);
+      _dbus_close (fd, NULL);
+      return FALSE;
+    }
+  else
+    {
+      _dbus_close (fd, NULL);
+      return TRUE;
+    }
+}
+
+/**
+ * Writes a string out to a file. If the file exists,
+ * it will be atomically overwritten by the new data.
+ *
+ * @param str the string to write out
+ * @param filename the file to save string to
+ * @param error error to be filled in on failure
+ * @returns #FALSE on failure
+ */
+dbus_bool_t
+_dbus_string_save_to_file (const DBusString *str,
+                           const DBusString *filename,
+                           DBusError        *error)
+{
+  int fd;
+  int bytes_to_write;
+  const char *filename_c;
+  DBusString tmp_filename;
+  const char *tmp_filename_c;
+  int total;
+  dbus_bool_t need_unlink;
+  dbus_bool_t retval;
+
+  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+  
+  fd = -1;
+  retval = FALSE;
+  need_unlink = FALSE;
+  
+  if (!_dbus_string_init (&tmp_filename))
+    {
+      dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+      return FALSE;
+    }
+
+  if (!_dbus_string_copy (filename, 0, &tmp_filename, 0))
+    {
+      dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+      _dbus_string_free (&tmp_filename);
+      return FALSE;
+    }
+  
+  if (!_dbus_string_append (&tmp_filename, "."))
+    {
+      dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+      _dbus_string_free (&tmp_filename);
+      return FALSE;
+    }
+
+#define N_TMP_FILENAME_RANDOM_BYTES 8
+  if (!_dbus_generate_random_ascii (&tmp_filename, N_TMP_FILENAME_RANDOM_BYTES))
+    {
+      dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+      _dbus_string_free (&tmp_filename);
+      return FALSE;
+    }
+    
+  filename_c = _dbus_string_get_const_data (filename);
+  tmp_filename_c = _dbus_string_get_const_data (&tmp_filename);
+
+  fd = open (tmp_filename_c, O_WRONLY | O_BINARY | O_EXCL | O_CREAT,
+             0600);
+  if (fd < 0)
+    {
+      dbus_set_error (error, _dbus_error_from_errno (errno),
+                      "Could not create %s: %s", tmp_filename_c,
+                      _dbus_strerror (errno));
+      goto out;
+    }
+
+  _dbus_verbose ("tmp file fd %d opened\n", fd);
+  
+  need_unlink = TRUE;
+  
+  total = 0;
+  bytes_to_write = _dbus_string_get_length (str);
+
+  while (total < bytes_to_write)
+    {
+      int bytes_written;
+
+      bytes_written = _dbus_write (fd, str, total,
+                                   bytes_to_write - total);
+
+      if (bytes_written <= 0)
+        {
+          dbus_set_error (error, _dbus_error_from_errno (errno),
+                          "Could not write to %s: %s", tmp_filename_c,
+                          _dbus_strerror (errno));
+          
+          goto out;
+        }
+
+      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),
+                      "Could not close file %s: %s",
+                      tmp_filename_c, _dbus_strerror (errno));
+
+      goto out;
+    }
+
+  fd = -1;
+  
+  if (rename (tmp_filename_c, filename_c) < 0)
+    {
+      dbus_set_error (error, _dbus_error_from_errno (errno),
+                      "Could not rename %s to %s: %s",
+                      tmp_filename_c, filename_c,
+                      _dbus_strerror (errno));
+
+      goto out;
+    }
+
+  need_unlink = FALSE;
+  
+  retval = TRUE;
+  
+ out:
+  /* close first, then unlink, to prevent ".nfs34234235" garbage
+   * files
+   */
+
+  if (fd >= 0)
+    _dbus_close (fd, NULL);
+        
+  if (need_unlink && unlink (tmp_filename_c) < 0)
+    _dbus_verbose ("Failed to unlink temp file %s: %s\n",
+                   tmp_filename_c, _dbus_strerror (errno));
+
+  _dbus_string_free (&tmp_filename);
+
+  if (!retval)
+    _DBUS_ASSERT_ERROR_IS_SET (error);
+  
+  return retval;
+}
+
+/** Makes the file readable by every user in the system.
+ *
+ * @param filename the filename
+ * @param error error location
+ * @returns #TRUE if the file's permissions could be changed.
+ */
+dbus_bool_t
+_dbus_make_file_world_readable(const DBusString *filename,
+                               DBusError *error)
+{
+  const char *filename_c;
+
+  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+  filename_c = _dbus_string_get_const_data (filename);
+  if (chmod (filename_c, 0644) == -1)
+    {
+      dbus_set_error (error,
+                      DBUS_ERROR_FAILED,
+                      "Could not change permissions of file %s: %s\n",
+                      filename_c,
+                      _dbus_strerror (errno));
+      return FALSE;
+    }
+  return TRUE;
+}
+
+/** Creates the given file, failing if the file already exists.
+ *
+ * @param filename the filename
+ * @param error error location
+ * @returns #TRUE if we created the file and it didn't exist
+ */
+dbus_bool_t
+_dbus_create_file_exclusively (const DBusString *filename,
+                               DBusError        *error)
+{
+  int fd;
+  const char *filename_c;
+
+  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+  
+  filename_c = _dbus_string_get_const_data (filename);
+  
+  fd = open (filename_c, O_WRONLY | O_BINARY | O_EXCL | O_CREAT,
+             0600);
+  if (fd < 0)
+    {
+      dbus_set_error (error,
+                      DBUS_ERROR_FAILED,
+                      "Could not create file %s: %s\n",
+                      filename_c,
+                      _dbus_strerror (errno));
+      return FALSE;
+    }
+
+  _dbus_verbose ("exclusive file fd %d opened\n", fd);
+  
+  if (!_dbus_close (fd, NULL))
+    {
+      dbus_set_error (error,
+                      DBUS_ERROR_FAILED,
+                      "Could not close file %s: %s\n",
+                      filename_c,
+                      _dbus_strerror (errno));
+      return FALSE;
+    }
+  
+  return TRUE;
+}
+
+/**
+ * Deletes the given file.
+ *
+ * @param filename the filename
+ * @param error error location
+ * 
+ * @returns #TRUE if unlink() succeeded
+ */
+dbus_bool_t
+_dbus_delete_file (const DBusString *filename,
+                   DBusError        *error)
+{
+  const char *filename_c;
+
+  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+  
+  filename_c = _dbus_string_get_const_data (filename);
+
+  if (unlink (filename_c) < 0)
+    {
+      dbus_set_error (error, DBUS_ERROR_FAILED,
+                      "Failed to delete file %s: %s\n",
+                      filename_c, _dbus_strerror (errno));
+      return FALSE;
+    }
+  else
+    return TRUE;
+}
diff --git a/dbus/dbus-file-win.c b/dbus/dbus-file-win.c
new file mode 100644 (file)
index 0000000..2dfba00
--- /dev/null
@@ -0,0 +1,393 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-file-win.c windows related file implementation (internal to D-Bus implementation)
+ * 
+ * Copyright (C) 2002, 2003, 2006  Red Hat, Inc.
+ * Copyright (C) 2003 CodeFactory AB
+ *
+ * Licensed under the Academic Free License version 2.1
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#include <config.h>
+#include "dbus-protocol.h"
+#include "dbus-string.h"
+#include "dbus-internals.h"
+#include "dbus-sysdeps-win.h"
+#include "dbus-pipe.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <io.h>
+#include <sys/stat.h>
+
+#include <windows.h>
+/**
+ * Appends the contents of the given file to the string,
+ * returning error code. At the moment, won't open a file
+ * more than a megabyte in size.
+ *
+ * @param str the string to append to
+ * @param filename filename to load
+ * @param error place to set an error
+ * @returns #FALSE if error was set
+ */
+dbus_bool_t
+_dbus_file_get_contents (DBusString       *str,
+                         const DBusString *filename,
+                         DBusError        *error)
+{
+  int fd;
+  struct _stati64 sb;
+  int orig_len;
+  int total;
+  const char *filename_c;
+
+  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+  filename_c = _dbus_string_get_const_data (filename);
+
+  fd = _open (filename_c, O_RDONLY | O_BINARY);
+  if (fd < 0)
+    {
+      dbus_set_error (error, _dbus_error_from_errno (errno),
+                      "Failed to open \"%s\": %s",
+                      filename_c,
+                      strerror (errno));
+      return FALSE;
+    }
+
+  _dbus_verbose ("file %s fd %d opened\n", filename_c, fd);
+
+  if (_fstati64 (fd, &sb) < 0)
+    {
+      dbus_set_error (error, _dbus_error_from_errno (errno),
+                      "Failed to stat \"%s\": %s",
+                      filename_c,
+                      strerror (errno));
+
+      _dbus_verbose ("fstat() failed: %s",
+                     strerror (errno));
+
+      _close (fd);
+
+      return FALSE;
+    }
+
+  if (sb.st_size > _DBUS_ONE_MEGABYTE)
+    {
+      dbus_set_error (error, DBUS_ERROR_FAILED,
+                      "File size %lu of \"%s\" is too large.",
+                      (unsigned long) sb.st_size, filename_c);
+      _close (fd);
+      return FALSE;
+    }
+
+  total = 0;
+  orig_len = _dbus_string_get_length (str);
+  if (sb.st_size > 0 && S_ISREG (sb.st_mode))
+    {
+      int bytes_read;
+
+      while (total < (int) sb.st_size)
+        {
+          bytes_read = _dbus_file_read (fd, str, sb.st_size - total);
+          if (bytes_read <= 0)
+            {
+              dbus_set_error (error, _dbus_error_from_errno (errno),
+                              "Error reading \"%s\": %s",
+                              filename_c,
+                              strerror (errno));
+
+              _dbus_verbose ("read() failed: %s",
+                             strerror (errno));
+
+              _close (fd);
+              _dbus_string_set_length (str, orig_len);
+              return FALSE;
+            }
+          else
+            total += bytes_read;
+        }
+
+      _close (fd);
+      return TRUE;
+    }
+  else if (sb.st_size != 0)
+    {
+      _dbus_verbose ("Can only open regular files at the moment.\n");
+      dbus_set_error (error, DBUS_ERROR_FAILED,
+                      "\"%s\" is not a regular file",
+                      filename_c);
+      _close (fd);
+      return FALSE;
+    }
+  else
+    {
+      _close (fd);
+      return TRUE;
+    }
+}
+
+/**
+ * Writes a string out to a file. If the file exists,
+ * it will be atomically overwritten by the new data.
+ *
+ * @param str the string to write out
+ * @param filename the file to save string to
+ * @param error error to be filled in on failure
+ * @returns #FALSE on failure
+ */
+dbus_bool_t
+_dbus_string_save_to_file (const DBusString *str,
+                           const DBusString *filename,
+                           DBusError        *error)
+{
+  int fd;
+  int bytes_to_write;
+  const char *filename_c;
+  DBusString tmp_filename;
+  const char *tmp_filename_c;
+  int total;
+  const char *str_c;
+  dbus_bool_t need_unlink;
+  dbus_bool_t retval;
+
+  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+  fd = -1;
+  retval = FALSE;
+  need_unlink = FALSE;
+
+  if (!_dbus_string_init (&tmp_filename))
+    {
+      dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+      return FALSE;
+    }
+
+  if (!_dbus_string_copy (filename, 0, &tmp_filename, 0))
+    {
+      dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+      _dbus_string_free (&tmp_filename);
+      return FALSE;
+    }
+
+  if (!_dbus_string_append (&tmp_filename, "."))
+    {
+      dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+      _dbus_string_free (&tmp_filename);
+      return FALSE;
+    }
+
+#define N_TMP_FILENAME_RANDOM_BYTES 8
+  if (!_dbus_generate_random_ascii (&tmp_filename, N_TMP_FILENAME_RANDOM_BYTES))
+    {
+      dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+      _dbus_string_free (&tmp_filename);
+      return FALSE;
+    }
+
+  filename_c = _dbus_string_get_const_data (filename);
+  tmp_filename_c = _dbus_string_get_const_data (&tmp_filename);
+
+  fd = _open (tmp_filename_c, O_WRONLY | O_BINARY | O_EXCL | O_CREAT,
+              0600);
+  if (fd < 0)
+    {
+      dbus_set_error (error, _dbus_error_from_errno (errno),
+                      "Could not create %s: %s", tmp_filename_c,
+                      strerror (errno));
+      goto out;
+    }
+
+  _dbus_verbose ("tmp file %s fd %d opened\n", tmp_filename_c, fd);
+
+  need_unlink = TRUE;
+
+  total = 0;
+  bytes_to_write = _dbus_string_get_length (str);
+  str_c = _dbus_string_get_const_data (str);
+
+  while (total < bytes_to_write)
+    {
+      int bytes_written;
+
+      bytes_written = _write (fd, str_c + total, bytes_to_write - total);
+
+      if (bytes_written <= 0)
+        {
+          dbus_set_error (error, _dbus_error_from_errno (errno),
+                          "Could not write to %s: %s", tmp_filename_c,
+                          strerror (errno));
+          goto out;
+        }
+
+      total += bytes_written;
+    }
+
+  if (_close (fd) < 0)
+    {
+      dbus_set_error (error, _dbus_error_from_errno (errno),
+                      "Could not close file %s: %s",
+                      tmp_filename_c, strerror (errno));
+
+      goto out;
+    }
+
+  fd = -1;
+
+  /* Unlike rename(), MoveFileEx() can replace existing files */
+  if (!MoveFileExA (tmp_filename_c, filename_c, MOVEFILE_REPLACE_EXISTING))
+    {
+      char *emsg = _dbus_win_error_string (GetLastError ());
+      dbus_set_error (error, DBUS_ERROR_FAILED,
+                      "Could not rename %s to %s: %s",
+                      tmp_filename_c, filename_c,
+                      emsg);
+      _dbus_win_free_error_string (emsg);
+
+      goto out;
+    }
+
+  need_unlink = FALSE;
+
+  retval = TRUE;
+
+ out:
+  /* close first, then unlink */
+
+  if (fd >= 0)
+    _close (fd);
+
+  if (need_unlink && _unlink (tmp_filename_c) < 0)
+    _dbus_verbose ("failed to unlink temp file %s: %s\n",
+                   tmp_filename_c, strerror (errno));
+
+  _dbus_string_free (&tmp_filename);
+
+  if (!retval)
+    _DBUS_ASSERT_ERROR_IS_SET (error);
+
+  return retval;
+}
+
+
+/** Creates the given file, failing if the file already exists.
+ *
+ * @param filename the filename
+ * @param error error location
+ * @returns #TRUE if we created the file and it didn't exist
+ */
+dbus_bool_t
+_dbus_create_file_exclusively (const DBusString *filename,
+                               DBusError        *error)
+{
+  int fd;
+  const char *filename_c;
+
+  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+  filename_c = _dbus_string_get_const_data (filename);
+
+  fd = _open (filename_c, O_WRONLY | O_BINARY | O_EXCL | O_CREAT,
+              0600);
+  if (fd < 0)
+    {
+      dbus_set_error (error,
+                      DBUS_ERROR_FAILED,
+                      "Could not create file %s: %s\n",
+                      filename_c,
+                      strerror (errno));
+      return FALSE;
+    }
+
+  _dbus_verbose ("exclusive file %s fd %d opened\n", filename_c, fd);
+
+  if (_close (fd) < 0)
+    {
+      dbus_set_error (error,
+                      DBUS_ERROR_FAILED,
+                      "Could not close file %s: %s\n",
+                      filename_c,
+                      strerror (errno));
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
+/**
+ * Thin wrapper around the read() system call that appends
+ * the data it reads to the DBusString buffer. It appends
+ * up to the given count, and returns the same value
+ * and same errno as read(). The only exception is that
+ * _dbus_file_read() handles EINTR for you. Also, 
+ * _dbus_file_read() can return ENOMEM.
+ * 
+ * @param fd the file descriptor to read from
+ * @param buffer the buffer to append data to
+ * @param count the amount of data to read
+ * @returns the number of bytes read or -1
+ */
+int
+_dbus_file_read (int               fd,
+                 DBusString       *buffer,
+                 int               count)
+{
+  int bytes_read;
+  int start;
+  char *data;
+
+  _dbus_assert (count >= 0);
+
+  start = _dbus_string_get_length (buffer);
+
+  if (!_dbus_string_lengthen (buffer, count))
+    {
+      errno = ENOMEM;
+      return -1;
+    }
+
+  data = _dbus_string_get_data_len (buffer, start, count);
+
+ again:
+
+  bytes_read = _read (fd, data, count);
+
+  if (bytes_read < 0)
+    {
+      if (errno == EINTR)
+        goto again;
+      else
+        {
+          /* put length back (note that this doesn't actually realloc anything) */
+          _dbus_string_set_length (buffer, start);
+          return -1;
+        }
+    }
+  else
+    {
+      /* put length back (doesn't actually realloc) */
+      _dbus_string_set_length (buffer, start + bytes_read);
+
+#if 0
+      if (bytes_read > 0)
+        _dbus_verbose_bytes_of_string (buffer, start, bytes_read);
+#endif
+
+      return bytes_read;
+    }
+}
diff --git a/dbus/dbus-file.c b/dbus/dbus-file.c
new file mode 100644 (file)
index 0000000..350fbd9
--- /dev/null
@@ -0,0 +1,28 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-sysdeps-unix.c Wrappers around UNIX system/libc features (internal to D-Bus implementation)
+ * 
+ * Copyright (C) 2002, 2003, 2006  Red Hat, Inc.
+ * Copyright (C) 2003 CodeFactory AB
+ *
+ * Licensed under the Academic Free License version 2.1
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#include <config.h>
+
+#include "dbus-file.h"
+
diff --git a/dbus/dbus-file.h b/dbus/dbus-file.h
new file mode 100644 (file)
index 0000000..b83fc6d
--- /dev/null
@@ -0,0 +1,65 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* dbus-file.h dbus file related stuff (internal to D-Bus implementation)
+ * 
+ * Copyright (C) 2002, 2003  Red Hat, Inc.
+ * Copyright (C) 2003 CodeFactory AB
+ *
+ * Licensed under the Academic Free License version 2.1
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifndef DBUS_FILE_H
+#define DBUS_FILE_H
+
+//#include <dbus/dbus-types.h>
+#include <dbus/dbus-string.h>
+#include <dbus/dbus-errors.h>
+
+DBUS_BEGIN_DECLS
+
+/**
+ * @addtogroup DBusFile
+ * @{
+ */
+
+/**
+ * File interface
+ */
+dbus_bool_t _dbus_file_exists         (const char       *file);
+dbus_bool_t _dbus_file_get_contents   (DBusString       *str,
+                                       const DBusString *filename,
+                                       DBusError        *error);
+dbus_bool_t _dbus_string_save_to_file (const DBusString *str,
+                                       const DBusString *filename,
+                                       DBusError        *error);
+
+dbus_bool_t _dbus_make_file_world_readable   (const DBusString *filename,
+                                              DBusError *error);
+
+dbus_bool_t    _dbus_create_file_exclusively (const DBusString *filename,
+                                              DBusError        *error);
+dbus_bool_t    _dbus_delete_file             (const DBusString *filename,
+                                              DBusError        *error);
+int _dbus_file_read (int               fd,
+                     DBusString       *buffer,
+                     int               count);
+                                              
+/** @} */
+
+DBUS_END_DECLS
+
+#endif
index e9eba6e..80a494a 100644 (file)
@@ -74,6 +74,7 @@
  * accordance with the terms specified in this license.
  */
 
+#include <config.h>
 #include "dbus-hash.h"
 #include "dbus-internals.h"
 #include "dbus-mempool.h"
diff --git a/dbus/dbus-internal-symbols.def.in b/dbus/dbus-internal-symbols.def.in
new file mode 100644 (file)
index 0000000..1132b10
--- /dev/null
@@ -0,0 +1,48 @@
+_dbus_babysitter_get_child_exited
+_dbus_babysitter_get_child_exit_status
+_dbus_babysitter_kill_child
+_dbus_babysitter_ref
+_dbus_babysitter_set_child_exit_error
+_dbus_babysitter_set_watch_functions
+_dbus_babysitter_unref
+_dbus_become_daemon
+_dbus_change_to_daemon_user
+_dbus_command_for_pid
+_dbus_directory_close
+_dbus_directory_get_next_file
+_dbus_directory_open
+_dbus_get_oom_wait
+_dbus_init_system_log
+_dbus_lm_strerror
+_dbus_log_info
+_dbus_log_security
+_dbus_loop_add_timeout
+_dbus_loop_add_watch
+_dbus_loop_dispatch
+_dbus_loop_iterate
+_dbus_loop_new
+_dbus_loop_queue_dispatch
+_dbus_loop_quit
+_dbus_loop_ref
+_dbus_loop_remove_timeout
+_dbus_loop_remove_watch
+_dbus_loop_run
+_dbus_loop_unref
+_dbus_parse_unix_group_from_config
+_dbus_parse_unix_user_from_config
+_dbus_path_is_absolute
+_dbus_set_signal_handler
+_dbus_shell_parse_argv
+_dbus_shell_unquote
+_dbus_spawn_async_with_babysitter
+_dbus_stat
+_dbus_string_ends_with_c_str
+_dbus_string_find_byte_backward
+_dbus_string_get_dirname
+_dbus_unix_groups_from_uid
+_dbus_unix_user_is_at_console
+_dbus_unix_user_is_process_owner
+_dbus_verify_daemon_user
+_dbus_wait_for_memory
+_dbus_windows_user_is_process_owner
+_dbus_write_pid_to_file_and_pipe
diff --git a/dbus/dbus-internal-testsymbols.def.in b/dbus/dbus-internal-testsymbols.def.in
new file mode 100644 (file)
index 0000000..05dd4e6
--- /dev/null
@@ -0,0 +1,19 @@
+_dbus_auth_test
+_dbus_credentials_test
+_dbus_marshal_byteswap_test
+_dbus_marshal_recursive_test
+_dbus_marshal_validate_test
+_dbus_message_data_free
+_dbus_message_data_iter_get_and_next
+_dbus_message_data_iter_init
+_dbus_message_test
+_dbus_spawn_test
+_dbus_string_test
+_dbus_sysdeps_test
+_dbus_type_reader_equal_values
+dbus_internal_do_not_use_foreach_message_file
+dbus_internal_do_not_use_generate_bodies
+dbus_internal_do_not_use_load_message_file
+dbus_internal_do_not_use_run_tests
+dbus_internal_do_not_use_try_message_data
+dbus_internal_do_not_use_try_message_file
index 4cafb26..1ab6731 100644 (file)
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-protocol.h"
 #include "dbus-marshal-basic.h"
@@ -30,6 +32,7 @@
 #include <stdlib.h>
 #ifdef DBUS_USE_OUTPUT_DEBUG_STRING
 #include <windows.h>
+#include <mbstring.h>
 #endif
 
 /**
@@ -436,7 +439,7 @@ _dbus_verbose_real (const char *format,
   char buf[1024];
   strcpy(buf,module_name);
 #ifdef DBUS_CPP_SUPPORTS_VARIABLE_MACRO_ARGUMENTS
-  vsprintf (buf+strlen(buf), "[%s(%d):%s] ",_dbus_file_path_extract_elements_from_tail(file,2),line,function);
+  sprintf (buf+strlen(buf), "[%s(%d):%s] ",_dbus_file_path_extract_elements_from_tail(file,2),line,function);
 #endif
   vsprintf (buf+strlen(buf),format, args);
   va_end (args);
index 6b2f8cb..61fd818 100644 (file)
@@ -27,8 +27,6 @@
 #ifndef DBUS_INTERNALS_H
 #define DBUS_INTERNALS_H
 
-#include <config.h>
-
 #include <dbus/dbus-memory.h>
 #include <dbus/dbus-types.h>
 #include <dbus/dbus-errors.h>
@@ -146,6 +144,7 @@ void _dbus_real_assert_not_reached (const char *explanation,
 #define _dbus_return_if_fail(condition)
 #define _dbus_return_val_if_fail(condition, val)
 #else
+
 extern const char *_dbus_return_if_fail_warning_format;
 
 #define _dbus_return_if_fail(condition) do {                                       \
index 6dc1e12..031521c 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-keyring.h"
 #include "dbus-protocol.h"
 #include <dbus/dbus-string.h>
index e075ffe..6a16ed6 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-list.h"
 #include "dbus-mempool.h"
index 379c4e2..d1e40ec 100644 (file)
  * this macro in your own code; please consider it to be internal to libdbus.
  */
 
+/*
+ * @def DBUS_EXPORT
+ *
+ * Declare the following symbol as public.  This is currently a noop on
+ * platforms other than Windows.
+ */
+
+#if defined(_WIN32)
+#  if defined(DBUS_STATIC_BUILD)
+#  define DBUS_EXPORT
+#  elif defined(dbus_1_EXPORTS)
+#  define DBUS_EXPORT __declspec(dllexport)
+#  else
+#  define DBUS_EXPORT __declspec(dllimport)
+#  endif
+#else
+#define DBUS_EXPORT
+#endif
+
 /** @} */
 
 #endif /* DBUS_MACROS_H */
index a383358..96ba599 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-mainloop.h"
 
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
index 0055135..ea18dbf 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-marshal-basic.h"
 #include "dbus-signature.h"
@@ -1395,16 +1396,10 @@ _dbus_verbose_bytes (const unsigned char *data,
           if (i > 7 &&
               _DBUS_ALIGN_ADDRESS (&data[i], 8) == &data[i])
             {
-#ifdef DBUS_HAVE_INT64
-              /* I think I probably mean "GNU libc printf" and not "GNUC"
-               * but we'll wait until someone complains. If you hit this,
-               * just turn off verbose mode as a workaround.
-               */
-#if __GNUC__
-              _dbus_verbose (" u64: 0x%llx",
+#ifdef DBUS_INT64_PRINTF_MODIFIER
+              _dbus_verbose (" u64: 0x%" DBUS_INT64_PRINTF_MODIFIER "x",
                              *(dbus_uint64_t*)&data[i-8]);
 #endif
-#endif
               _dbus_verbose (" dbl: %g",
                              *(double*)&data[i-8]);
             }
index fd87a80..0c27fc9 100644 (file)
@@ -25,8 +25,6 @@
 #ifndef DBUS_MARSHAL_BASIC_H
 #define DBUS_MARSHAL_BASIC_H
 
-#include <config.h>
-
 #ifdef HAVE_BYTESWAP_H
 #include <byteswap.h>
 #endif
index c5e92b3..22d7e22 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-marshal-byteswap.h"
 #include "dbus-marshal-basic.h"
 #include "dbus-signature.h"
index 7c8ea7b..be2dd75 100644 (file)
@@ -24,7 +24,6 @@
 #ifndef DBUS_MARSHAL_BYTESWAP_H
 #define DBUS_MARSHAL_BYTESWAP_H
 
-#include <config.h>
 #include <dbus/dbus-protocol.h>
 #include <dbus/dbus-marshal-recursive.h>
 
index d9e9bb5..3f31d7a 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus/dbus-shared.h"
 #include "dbus-marshal-header.h"
 #include "dbus-marshal-recursive.h"
index 0f36efa..fd16c5f 100644 (file)
@@ -24,7 +24,6 @@
 #ifndef DBUS_MARSHAL_HEADER_H
 #define DBUS_MARSHAL_HEADER_H
 
-#include <config.h>
 #include <dbus/dbus-marshal-basic.h>
 #include <dbus/dbus-marshal-validate.h>
 
index f87644c..3508bb0 100644 (file)
@@ -1090,7 +1090,7 @@ run_test_copy (NodeIterationData *nid)
   DBusTypeReader reader;
   DBusTypeWriter writer;
 
-  _dbus_verbose ("%s\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("\n");
 
   src = nid->block;
 
@@ -1153,7 +1153,7 @@ run_test_values_only_write (NodeIterationData *nid)
   dbus_bool_t retval;
   int sig_len;
 
-  _dbus_verbose ("%s\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("\n");
 
   retval = FALSE;
 
@@ -1221,7 +1221,7 @@ run_test_set_values (NodeIterationData *nid)
   dbus_bool_t retval;
   int i;
 
-  _dbus_verbose ("%s\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("\n");
 
   retval = FALSE;
 
@@ -1278,7 +1278,7 @@ run_test_delete_values (NodeIterationData *nid)
   dbus_bool_t retval;
   int t;
 
-  _dbus_verbose ("%s\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("\n");
 
   retval = FALSE;
 
@@ -2651,8 +2651,8 @@ double_read_value (TestTypeNode   *node,
 
   if (!_DBUS_DOUBLES_BITWISE_EQUAL (v, expected))
     {
-#ifdef DBUS_HAVE_INT64
-      _dbus_warn ("Expected double %g got %g\n bits = 0x%llx vs.\n bits = 0x%llx)\n",
+#ifdef DBUS_INT64_PRINTF_MODIFIER
+      _dbus_warn ("Expected double %g got %g\n bits = 0x%" DBUS_INT64_PRINTF_MODIFIER "x vs.\n bits = 0x%" DBUS_INT64_PRINTF_MODIFIER "x)\n",
                   expected, v,
                   *(dbus_uint64_t*)(char*)&expected,
                   *(dbus_uint64_t*)(char*)&v);
index ccf0d22..cb10854 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-marshal-recursive.h"
 #include "dbus-marshal-basic.h"
 #include "dbus-signature.h"
index a743668..97e5466 100644 (file)
@@ -24,7 +24,6 @@
 #ifndef DBUS_MARSHAL_RECURSIVE_H
 #define DBUS_MARSHAL_RECURSIVE_H
 
-#include <config.h>
 #include <dbus/dbus-protocol.h>
 #include <dbus/dbus-list.h>
 
index bbaa9bd..aa470fc 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-marshal-validate.h"
 #include "dbus-marshal-recursive.h"
index 7a623d9..5817de3 100644 (file)
@@ -24,8 +24,6 @@
 #ifndef DBUS_MARSHAL_VALIDATE_H
 #define DBUS_MARSHAL_VALIDATE_H
 
-#include <config.h>
-
 /**
  * @addtogroup DBusMarshal
  *
index 8405f36..af71d5c 100644 (file)
@@ -34,6 +34,7 @@
  * <ghost@aladdin.com>.
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-md5.h"
 #include <string.h>
index 5e93c04..4729626 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-memory.h"
 #include "dbus-internals.h"
 #include "dbus-sysdeps.h"
@@ -244,7 +245,18 @@ dbus_bool_t
 _dbus_decrement_fail_alloc_counter (void)
 {
   _dbus_initialize_malloc_debug ();
-  
+#ifdef DBUS_WIN_FIXME
+  {
+    static dbus_bool_t called = 0;
+    if (!called)
+      {
+        _dbus_warn("TODO: memory allocation testing errors disabled for now\n");
+        called = 1;
+      }
+    return FALSE;
+  }
+#endif
+
   if (fail_alloc_counter <= 0)
     {
       if (backtrace_on_fail_alloc)
index aad439b..ea28423 100644 (file)
@@ -37,19 +37,25 @@ DBUS_BEGIN_DECLS
  * @{
  */
 
+DBUS_EXPORT
 void* dbus_malloc        (size_t bytes);
+DBUS_EXPORT
 void* dbus_malloc0       (size_t bytes);
+DBUS_EXPORT
 void* dbus_realloc       (void  *memory,
                           size_t bytes);
+DBUS_EXPORT
 void  dbus_free          (void  *memory);
 
 #define dbus_new(type, count)  ((type*)dbus_malloc (sizeof (type) * (count)))
 #define dbus_new0(type, count) ((type*)dbus_malloc0 (sizeof (type) * (count)))
 
+DBUS_EXPORT
 void dbus_free_string_array (char **str_array);
 
 typedef void (* DBusFreeFunction) (void *memory);
 
+DBUS_EXPORT
 void dbus_shutdown (void);
 
 /** @} */
index 2a41cb1..680586b 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-mempool.h"
 #include "dbus-internals.h"
 
index 366c53a..57888fa 100644 (file)
@@ -23,8 +23,6 @@
 #ifndef DBUS_MESSAGE_PRIVATE_H
 #define DBUS_MESSAGE_PRIVATE_H
 
-#include <config.h>
-
 #include <dbus/dbus-message.h>
 #include <dbus/dbus-message-internal.h>
 #include <dbus/dbus-string.h>
index a56fcc4..94219f6 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-test.h"
 #include "dbus-message-private.h"
index d053559..3b5941b 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-marshal-recursive.h"
 #include "dbus-marshal-validate.h"
@@ -3839,6 +3840,7 @@ _dbus_message_loader_get_unix_fds(DBusMessageLoader  *loader,
   return TRUE;
 #else
   _dbus_assert_not_reached("Platform doesn't support unix fd passing");
+  return FALSE;
 #endif
 }
 
index a89fcd5..5500492 100644 (file)
@@ -66,166 +66,239 @@ struct DBusMessageIter
   void *pad3;           /**< Don't use this */
 };
 
+DBUS_EXPORT
 DBusMessage* dbus_message_new               (int          message_type);
+DBUS_EXPORT
 DBusMessage* dbus_message_new_method_call   (const char  *bus_name,
                                              const char  *path,
                                              const char  *interface,
                                              const char  *method);
+DBUS_EXPORT
 DBusMessage* dbus_message_new_method_return (DBusMessage *method_call);
+DBUS_EXPORT
 DBusMessage* dbus_message_new_signal        (const char  *path,
                                              const char  *interface,
                                              const char  *name);
+DBUS_EXPORT
 DBusMessage* dbus_message_new_error         (DBusMessage *reply_to,
                                              const char  *error_name,
                                              const char  *error_message);
+DBUS_EXPORT
 DBusMessage* dbus_message_new_error_printf  (DBusMessage *reply_to,
                                              const char  *error_name,
                                              const char  *error_format,
                                             ...);
 
+DBUS_EXPORT
 DBusMessage* dbus_message_copy              (const DBusMessage *message);
 
+DBUS_EXPORT
 DBusMessage*  dbus_message_ref              (DBusMessage   *message);
+DBUS_EXPORT
 void          dbus_message_unref            (DBusMessage   *message);
+DBUS_EXPORT
 int           dbus_message_get_type         (DBusMessage   *message);
+DBUS_EXPORT
 dbus_bool_t   dbus_message_set_path         (DBusMessage   *message,
                                              const char    *object_path);
+DBUS_EXPORT
 const char*   dbus_message_get_path         (DBusMessage   *message);
+DBUS_EXPORT
 dbus_bool_t   dbus_message_has_path         (DBusMessage   *message, 
                                              const char    *object_path);  
+DBUS_EXPORT
 dbus_bool_t   dbus_message_set_interface    (DBusMessage   *message,
                                              const char    *interface);       
+DBUS_EXPORT
 const char*   dbus_message_get_interface    (DBusMessage   *message);
+DBUS_EXPORT
 dbus_bool_t   dbus_message_has_interface    (DBusMessage   *message, 
                                              const char    *interface);
+DBUS_EXPORT
 dbus_bool_t   dbus_message_set_member       (DBusMessage   *message,
                                              const char    *member);
+DBUS_EXPORT
 const char*   dbus_message_get_member       (DBusMessage   *message);
+DBUS_EXPORT
 dbus_bool_t   dbus_message_has_member       (DBusMessage   *message, 
                                              const char    *member);
+DBUS_EXPORT
 dbus_bool_t   dbus_message_set_error_name   (DBusMessage   *message,
                                              const char    *name);
+DBUS_EXPORT
 const char*   dbus_message_get_error_name   (DBusMessage   *message);
+DBUS_EXPORT
 dbus_bool_t   dbus_message_set_destination  (DBusMessage   *message,
                                              const char    *destination);
+DBUS_EXPORT
 const char*   dbus_message_get_destination  (DBusMessage   *message);
+DBUS_EXPORT
 dbus_bool_t   dbus_message_set_sender       (DBusMessage   *message,
                                              const char    *sender);
+DBUS_EXPORT
 const char*   dbus_message_get_sender       (DBusMessage   *message);
+DBUS_EXPORT
 const char*   dbus_message_get_signature    (DBusMessage   *message);
+DBUS_EXPORT
 void          dbus_message_set_no_reply     (DBusMessage   *message,
                                              dbus_bool_t    no_reply);
+DBUS_EXPORT
 dbus_bool_t   dbus_message_get_no_reply     (DBusMessage   *message);
+DBUS_EXPORT
 dbus_bool_t   dbus_message_is_method_call   (DBusMessage   *message,
                                              const char    *interface,
                                              const char    *method);
+DBUS_EXPORT
 dbus_bool_t   dbus_message_is_signal        (DBusMessage   *message,
                                              const char    *interface,
                                              const char    *signal_name);
+DBUS_EXPORT
 dbus_bool_t   dbus_message_is_error         (DBusMessage   *message,
                                              const char    *error_name);
+DBUS_EXPORT
 dbus_bool_t   dbus_message_has_destination  (DBusMessage   *message,
                                              const char    *bus_name);
+DBUS_EXPORT
 dbus_bool_t   dbus_message_has_sender       (DBusMessage   *message,
                                              const char    *unique_bus_name);
+DBUS_EXPORT
 dbus_bool_t   dbus_message_has_signature    (DBusMessage   *message,
                                              const char    *signature);
+DBUS_EXPORT
 dbus_uint32_t dbus_message_get_serial       (DBusMessage   *message);
+DBUS_EXPORT
 void          dbus_message_set_serial       (DBusMessage   *message, 
                                              dbus_uint32_t  serial);
+DBUS_EXPORT
 dbus_bool_t   dbus_message_set_reply_serial (DBusMessage   *message,
                                              dbus_uint32_t  reply_serial);
+DBUS_EXPORT
 dbus_uint32_t dbus_message_get_reply_serial (DBusMessage   *message);
 
+DBUS_EXPORT
 void          dbus_message_set_auto_start   (DBusMessage   *message,
                                              dbus_bool_t    auto_start);
+DBUS_EXPORT
 dbus_bool_t   dbus_message_get_auto_start   (DBusMessage   *message);
 
+DBUS_EXPORT
 dbus_bool_t   dbus_message_get_path_decomposed (DBusMessage   *message,
                                                 char        ***path);
 
+DBUS_EXPORT
 dbus_bool_t dbus_message_append_args          (DBusMessage     *message,
                                               int              first_arg_type,
                                               ...);
+DBUS_EXPORT
 dbus_bool_t dbus_message_append_args_valist   (DBusMessage     *message,
                                               int              first_arg_type,
                                               va_list          var_args);
+DBUS_EXPORT
 dbus_bool_t dbus_message_get_args             (DBusMessage     *message,
                                               DBusError       *error,
                                               int              first_arg_type,
                                               ...);
+DBUS_EXPORT
 dbus_bool_t dbus_message_get_args_valist      (DBusMessage     *message,
                                               DBusError       *error,
                                               int              first_arg_type,
                                               va_list          var_args);
 
+DBUS_EXPORT
 dbus_bool_t dbus_message_contains_unix_fds    (DBusMessage *message);
 
+DBUS_EXPORT
 dbus_bool_t dbus_message_iter_init             (DBusMessage     *message,
                                                 DBusMessageIter *iter);
+DBUS_EXPORT
 dbus_bool_t dbus_message_iter_has_next         (DBusMessageIter *iter);
+DBUS_EXPORT
 dbus_bool_t dbus_message_iter_next             (DBusMessageIter *iter);
+DBUS_EXPORT
 char*       dbus_message_iter_get_signature    (DBusMessageIter *iter);
+DBUS_EXPORT
 int         dbus_message_iter_get_arg_type     (DBusMessageIter *iter);
+DBUS_EXPORT
 int         dbus_message_iter_get_element_type (DBusMessageIter *iter);
+DBUS_EXPORT
 void        dbus_message_iter_recurse          (DBusMessageIter *iter,
                                                 DBusMessageIter *sub);
+DBUS_EXPORT
 void        dbus_message_iter_get_basic        (DBusMessageIter *iter,
                                                 void            *value);
 #ifndef DBUS_DISABLE_DEPRECATED
 /* This function returns the wire protocol size of the array in bytes,
  * you do not want to know that probably
  */
+DBUS_EXPORT
 DBUS_DEPRECATED int         dbus_message_iter_get_array_len    (DBusMessageIter *iter);
 #endif
+DBUS_EXPORT
 void        dbus_message_iter_get_fixed_array  (DBusMessageIter *iter,
                                                 void            *value,
                                                 int             *n_elements);
 
 
+DBUS_EXPORT
 void        dbus_message_iter_init_append        (DBusMessage     *message,
                                                   DBusMessageIter *iter);
+DBUS_EXPORT
 dbus_bool_t dbus_message_iter_append_basic       (DBusMessageIter *iter,
                                                   int              type,
                                                   const void      *value);
+DBUS_EXPORT
 dbus_bool_t dbus_message_iter_append_fixed_array (DBusMessageIter *iter,
                                                   int              element_type,
                                                   const void      *value,
                                                   int              n_elements);
+DBUS_EXPORT
 dbus_bool_t dbus_message_iter_open_container     (DBusMessageIter *iter,
                                                   int              type,
                                                   const char      *contained_signature,
                                                   DBusMessageIter *sub);
+DBUS_EXPORT
 dbus_bool_t dbus_message_iter_close_container    (DBusMessageIter *iter,
                                                   DBusMessageIter *sub);
+DBUS_EXPORT
 void        dbus_message_iter_abandon_container  (DBusMessageIter *iter,
                                                   DBusMessageIter *sub);
 
+DBUS_EXPORT
 void dbus_message_lock    (DBusMessage  *message);
 
+DBUS_EXPORT
 dbus_bool_t  dbus_set_error_from_message  (DBusError    *error,
                                            DBusMessage  *message);
 
 
+DBUS_EXPORT
 dbus_bool_t dbus_message_allocate_data_slot (dbus_int32_t     *slot_p);
+DBUS_EXPORT
 void        dbus_message_free_data_slot     (dbus_int32_t     *slot_p);
+DBUS_EXPORT
 dbus_bool_t dbus_message_set_data           (DBusMessage      *message,
                                              dbus_int32_t      slot,
                                              void             *data,
                                              DBusFreeFunction  free_data_func);
+DBUS_EXPORT
 void*       dbus_message_get_data           (DBusMessage      *message,
                                              dbus_int32_t      slot);
 
+DBUS_EXPORT
 int         dbus_message_type_from_string (const char *type_str);
+DBUS_EXPORT
 const char* dbus_message_type_to_string   (int type);
 
+DBUS_EXPORT
 dbus_bool_t  dbus_message_marshal   (DBusMessage  *msg,
                                      char        **marshalled_data_p,
                                      int          *len_p);
+DBUS_EXPORT
 DBusMessage* dbus_message_demarshal (const char *str,
                                      int         len,
                                      DBusError  *error);
 
+DBUS_EXPORT
 int          dbus_message_demarshal_bytes_needed (const char *str, 
                                                   int len);
 
index f8cb12f..3504bca 100644 (file)
@@ -36,9 +36,10 @@ DBUS_BEGIN_DECLS
  * @addtogroup DBusMisc
  * @{
  */
-
+DBUS_EXPORT
 char*       dbus_get_local_machine_id  (void);
 
+DBUS_EXPORT
 void        dbus_get_version           (int *major_version_p,
                                         int *minor_version_p,
                                         int *micro_version_p);
index cf1424c..3e5070f 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 // major sections of this file are modified code from libassuan, (C) FSF
 #include "dbus-nonce.h"
 #include "dbus-internals.h"
index 4309d15..5aab9e6 100644 (file)
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "dbus-object-tree.h"
 #include "dbus-connection-internal.h"
 #include "dbus-internals.h"
@@ -506,7 +508,7 @@ unlock:
 #endif
     {
       _dbus_connection_ref_unlocked (connection);
-      _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
+      _dbus_verbose ("unlock\n");
       _dbus_connection_unlock (connection);
     }
 
@@ -640,7 +642,7 @@ handle_default_introspect_and_unlock (DBusObjectTree          *tree,
       if (tree->connection)
 #endif
         {
-          _dbus_verbose ("unlock %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+          _dbus_verbose ("unlock\n");
           _dbus_connection_unlock (tree->connection);
         }
       
@@ -655,7 +657,7 @@ handle_default_introspect_and_unlock (DBusObjectTree          *tree,
       if (tree->connection)
 #endif
         {
-          _dbus_verbose ("unlock %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+          _dbus_verbose ("unlock\n");
           _dbus_connection_unlock (tree->connection);
         }
 
@@ -715,7 +717,7 @@ handle_default_introspect_and_unlock (DBusObjectTree          *tree,
     {
       if (!already_unlocked)
         {
-          _dbus_verbose ("unlock %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
+          _dbus_verbose ("unlock\n");
           _dbus_connection_unlock (tree->connection);
         }
     }
@@ -763,7 +765,7 @@ _dbus_object_tree_dispatch_and_unlock (DBusObjectTree          *tree,
       if (tree->connection)
 #endif
         {
-          _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
+          _dbus_verbose ("unlock\n");
           _dbus_connection_unlock (tree->connection);
         }
       
@@ -778,7 +780,7 @@ _dbus_object_tree_dispatch_and_unlock (DBusObjectTree          *tree,
       if (tree->connection)
 #endif
         {
-          _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
+          _dbus_verbose ("unlock\n");
           _dbus_connection_unlock (tree->connection);
         }
       
@@ -844,7 +846,7 @@ _dbus_object_tree_dispatch_and_unlock (DBusObjectTree          *tree,
           if (tree->connection)
 #endif
             {
-              _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
+              _dbus_verbose ("unlock\n");
               _dbus_connection_unlock (tree->connection);
             }
 
@@ -884,7 +886,7 @@ _dbus_object_tree_dispatch_and_unlock (DBusObjectTree          *tree,
       if (tree->connection)
 #endif
         {
-          _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
+          _dbus_verbose ("unlock\n");
           _dbus_connection_unlock (tree->connection);
         }
     }
@@ -924,8 +926,7 @@ _dbus_object_tree_get_user_data_unlocked (DBusObjectTree *tree,
 
   if ((subtree == NULL) || !exact_match)
     {
-      _dbus_verbose ("%s: No object at specified path found\n",
-                     _DBUS_FUNCTION_NAME);
+      _dbus_verbose ("No object at specified path found\n");
       return NULL;
     }
 
@@ -1047,7 +1048,7 @@ _dbus_object_tree_list_registered_and_unlock (DBusObjectTree *tree,
   if (tree->connection)
 #endif
     {
-      _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
+      _dbus_verbose ("unlock\n");
       _dbus_connection_unlock (tree->connection);
     }
 
index 43fad05..e1de656 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-connection-internal.h"
 #include "dbus-pending-call-internal.h"
index b1b4e23..8f64b8b 100644 (file)
@@ -38,23 +38,34 @@ DBUS_BEGIN_DECLS
  * @{
  */
 
+DBUS_EXPORT
 DBusPendingCall* dbus_pending_call_ref       (DBusPendingCall               *pending);
+DBUS_EXPORT
 void         dbus_pending_call_unref         (DBusPendingCall               *pending);
+DBUS_EXPORT
 dbus_bool_t  dbus_pending_call_set_notify    (DBusPendingCall               *pending,
                                               DBusPendingCallNotifyFunction  function,
                                               void                          *user_data,
                                               DBusFreeFunction               free_user_data);
+DBUS_EXPORT
 void         dbus_pending_call_cancel        (DBusPendingCall               *pending);
+DBUS_EXPORT
 dbus_bool_t  dbus_pending_call_get_completed (DBusPendingCall               *pending);
+DBUS_EXPORT
 DBusMessage* dbus_pending_call_steal_reply   (DBusPendingCall               *pending);
+DBUS_EXPORT
 void         dbus_pending_call_block         (DBusPendingCall               *pending);
 
+DBUS_EXPORT
 dbus_bool_t dbus_pending_call_allocate_data_slot (dbus_int32_t     *slot_p);
+DBUS_EXPORT
 void        dbus_pending_call_free_data_slot     (dbus_int32_t     *slot_p);
+DBUS_EXPORT
 dbus_bool_t dbus_pending_call_set_data           (DBusPendingCall  *pending,
                                                   dbus_int32_t      slot,
                                                   void             *data,
                                                   DBusFreeFunction  free_data_func);
+DBUS_EXPORT
 void*       dbus_pending_call_get_data           (DBusPendingCall  *pending,
                                                   dbus_int32_t      slot);
 
index 79a826f..f35024b 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-protocol.h"
 #include "dbus-string.h"
 #include "dbus-internals.h"
index c2917c6..a07e572 100644 (file)
  *
  */
 
+#include <config.h>
 #include "dbus-protocol.h"
 #include "dbus-string.h"
 #include "dbus-internals.h"
 #include "dbus-pipe.h"
 
 #include <io.h>
+#include <errno.h>
 
 /**
  * write data to a pipe.
index 59cf934..60a58b5 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-pipe.h"
 
 /*
index 75b7d2f..cd57533 100644 (file)
@@ -25,8 +25,6 @@
 #ifndef DBUS_PIPE_H
 #define DBUS_PIPE_H
 
-#include <config.h>
-
 #include <dbus/dbus-types.h>
 #include <dbus/dbus-errors.h>
 #include <dbus/dbus-string.h>
index a2284ee..17798e9 100644 (file)
@@ -239,6 +239,8 @@ extern "C" {
 /** Message type of a signal message, see dbus_message_get_type() */
 #define DBUS_MESSAGE_TYPE_SIGNAL        4
 
+#define DBUS_NUM_MESSAGE_TYPES          5
+
 /* Header flags */
 
 /** If set, this flag means that the sender of a message does not care about getting
index 7c7aabd..5f7001c 100644 (file)
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include <dbus/dbus-resources.h>
 #include <dbus/dbus-internals.h>
 
index 8ba6fb6..e18cad7 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-server-debug-pipe.h"
 #include "dbus-transport-socket.h"
index c05d277..cc2de8d 100644 (file)
@@ -23,7 +23,6 @@
 #ifndef DBUS_SERVER_PROTECTED_H
 #define DBUS_SERVER_PROTECTED_H
 
-#include <config.h>
 #include <dbus/dbus-internals.h>
 #include <dbus/dbus-threads-internal.h>
 #include <dbus/dbus-server.h>
@@ -144,13 +143,13 @@ DBusServerListenResult _dbus_server_listen_platform_specific (DBusAddressEntry
 #define TRACE_LOCKS 0
 
 #define SERVER_LOCK(server)   do {                                              \
-    if (TRACE_LOCKS) { _dbus_verbose ("  LOCK: %s\n", _DBUS_FUNCTION_NAME); }   \
+    if (TRACE_LOCKS) { _dbus_verbose ("LOCK\n"); }   \
     _dbus_mutex_lock ((server)->mutex);                                          \
     TOOK_LOCK_CHECK (server);                                                   \
   } while (0)
 
 #define SERVER_UNLOCK(server) do {                                                      \
-    if (TRACE_LOCKS) { _dbus_verbose ("  UNLOCK: %s\n", _DBUS_FUNCTION_NAME);  }        \
+    if (TRACE_LOCKS) { _dbus_verbose ("UNLOCK\n");  }        \
     RELEASING_LOCK_CHECK (server);                                                      \
     _dbus_mutex_unlock ((server)->mutex);                                                \
   } while (0)
index 6a8717a..dbd7213 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-server-socket.h"
 #include "dbus-transport-socket.h"
index 597d0f8..65c9668 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-server-unix.h"
 #include "dbus-server-socket.h"
index ca37669..5cfb73e 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-server-win.h"
 #include "dbus-server-socket.h"
index 974503b..18fa8c4 100644 (file)
@@ -21,6 +21,7 @@
  *
  */ 
 
+#include <config.h>
 #include "dbus-server.h"
 #include "dbus-server-unix.h"
 #include "dbus-server-socket.h"
index 6d7d2fa..bdbefa0 100644 (file)
@@ -48,39 +48,54 @@ typedef void (* DBusNewConnectionFunction) (DBusServer     *server,
                                             DBusConnection *new_connection,
                                             void           *data);
 
+DBUS_EXPORT
 DBusServer* dbus_server_listen           (const char     *address,
                                           DBusError      *error);
+DBUS_EXPORT
 DBusServer* dbus_server_ref              (DBusServer     *server);
+DBUS_EXPORT
 void        dbus_server_unref            (DBusServer     *server);
+DBUS_EXPORT
 void        dbus_server_disconnect       (DBusServer     *server);
+DBUS_EXPORT
 dbus_bool_t dbus_server_get_is_connected (DBusServer     *server);
+DBUS_EXPORT
 char*       dbus_server_get_address      (DBusServer     *server);
+DBUS_EXPORT
 char*       dbus_server_get_id           (DBusServer     *server);
+DBUS_EXPORT
 void        dbus_server_set_new_connection_function (DBusServer                *server,
                                                      DBusNewConnectionFunction  function,
                                                      void                      *data,
                                                      DBusFreeFunction           free_data_function);
+DBUS_EXPORT
 dbus_bool_t dbus_server_set_watch_functions         (DBusServer                *server,
                                                      DBusAddWatchFunction       add_function,
                                                      DBusRemoveWatchFunction    remove_function,
                                                      DBusWatchToggledFunction   toggled_function,
                                                      void                      *data,
                                                      DBusFreeFunction           free_data_function);
+DBUS_EXPORT
 dbus_bool_t dbus_server_set_timeout_functions       (DBusServer                *server,
                                                      DBusAddTimeoutFunction     add_function,
                                                      DBusRemoveTimeoutFunction  remove_function,
                                                      DBusTimeoutToggledFunction toggled_function,
                                                      void                      *data,
                                                      DBusFreeFunction           free_data_function);
+DBUS_EXPORT
 dbus_bool_t dbus_server_set_auth_mechanisms         (DBusServer                *server,
                                                      const char               **mechanisms);
 
+DBUS_EXPORT
 dbus_bool_t dbus_server_allocate_data_slot (dbus_int32_t     *slot_p);
+DBUS_EXPORT
 void        dbus_server_free_data_slot     (dbus_int32_t     *slot_p);
+DBUS_EXPORT
 dbus_bool_t dbus_server_set_data           (DBusServer       *server,
                                             int               slot,
                                             void             *data,
                                             DBusFreeFunction  free_data_func);
+DBUS_EXPORT
 void*       dbus_server_get_data           (DBusServer       *server,
                                             int               slot);
 
index 04e353a..d182752 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-sha.h"
 #include "dbus-marshal-basic.h" /* for byteswap routines */
index 57900d8..111d39d 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#include <config.h>
 #include <string.h>
 #include "dbus-internals.h"
 #include "dbus-list.h"
index b2d0a62..ddc0bcc 100644 (file)
@@ -21,6 +21,8 @@
  *
  */
 
+#include <config.h>
+
 #include "dbus-signature.h"
 #include "dbus-marshal-recursive.h"
 #include "dbus-marshal-basic.h"
index ef3c6f9..ebf00c1 100644 (file)
@@ -50,28 +50,39 @@ typedef struct
   int dummy17;           /**< Don't use this */
 } DBusSignatureIter;
 
+DBUS_EXPORT
 void            dbus_signature_iter_init             (DBusSignatureIter       *iter,
                                                      const char              *signature);
 
+DBUS_EXPORT
 int             dbus_signature_iter_get_current_type (const DBusSignatureIter *iter);
 
+DBUS_EXPORT
 char *          dbus_signature_iter_get_signature    (const DBusSignatureIter *iter);
 
+DBUS_EXPORT
 int             dbus_signature_iter_get_element_type (const DBusSignatureIter *iter);
 
+DBUS_EXPORT
 dbus_bool_t     dbus_signature_iter_next             (DBusSignatureIter       *iter);
 
+DBUS_EXPORT
 void            dbus_signature_iter_recurse          (const DBusSignatureIter *iter,
                                                      DBusSignatureIter       *subiter);
 
+DBUS_EXPORT
 dbus_bool_t     dbus_signature_validate              (const char       *signature,
                                                      DBusError        *error);
 
+DBUS_EXPORT
 dbus_bool_t     dbus_signature_validate_single       (const char       *signature,
                                                      DBusError        *error);
 
+DBUS_EXPORT
 dbus_bool_t     dbus_type_is_basic                   (int            typecode);
+DBUS_EXPORT
 dbus_bool_t     dbus_type_is_container               (int            typecode);
+DBUS_EXPORT
 dbus_bool_t     dbus_type_is_fixed                   (int            typecode);
 
 /** @} */
index de07789..6b9fdf5 100644 (file)
@@ -1,4 +1,4 @@
-#include "config.h"
+#include <config.h>
 
 //#define SPAWN_DEBUG
 
index c3c2fb9..c3be1b7 100644 (file)
@@ -77,8 +77,8 @@ read_ints (int        fd,
   
   while (TRUE)
     {
-      size_t chunk;
-      ssize_t to_read;
+      ssize_t chunk;
+      size_t to_read;
 
       to_read = sizeof (int) * n_ints_in_buf - bytes;
 
@@ -132,9 +132,9 @@ read_pid (int        fd,
   
   while (TRUE)
     {
-      size_t chunk;    
-      ssize_t to_read;
-      
+      ssize_t chunk;
+      size_t to_read;
+
       to_read = sizeof (pid_t) - bytes;
 
       if (to_read == 0)
index 6687a76..365d89a 100644 (file)
@@ -24,8 +24,6 @@
 #ifndef DBUS_STRING_PRIVATE_H
 #define DBUS_STRING_PRIVATE_H
 
-#include <config.h>
-
 #include <dbus/dbus-memory.h>
 #include <dbus/dbus-types.h>
 
index a3e5213..4d42bb0 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-string.h"
 #define DBUS_CAN_USE_DBUS_STRING_PRIVATE 1
@@ -871,7 +872,71 @@ _dbus_string_test (void)
     _dbus_string_free (&str);
     _dbus_string_free (&other);
   }
-  
+
+  {
+    const char upper_string[] = "TOUPPERSTRING";
+    const char lower_string[] = "toupperstring";
+    const char lower2_string[] = "toupperSTRING";
+
+    if (!_dbus_string_init (&str))
+      _dbus_assert_not_reached ("no memory");
+
+    if (!_dbus_string_append (&str, upper_string))
+      _dbus_assert_not_reached ("no memory");
+
+    _dbus_string_tolower_ascii (&str, 0, _dbus_string_get_length(&str));
+
+    if (!_dbus_string_equal_c_str (&str, lower_string))
+      _dbus_assert_not_reached ("_dbus_string_tolower_ascii failed");
+
+    _dbus_string_free (&str);
+
+    if (!_dbus_string_init (&str))
+      _dbus_assert_not_reached ("no memory");
+
+    if (!_dbus_string_append (&str, upper_string))
+      _dbus_assert_not_reached ("no memory");
+
+    _dbus_string_tolower_ascii (&str, 0, 7);
+
+    if (!_dbus_string_equal_c_str (&str, lower2_string))
+      _dbus_assert_not_reached ("_dbus_string_tolower_ascii failed in partial conversion");
+
+    _dbus_string_free (&str);
+  }
+
+  {
+    const char lower_string[] = "toupperstring";
+    const char upper_string[] = "TOUPPERSTRING";
+    const char upper2_string[] = "TOUPPERstring";
+
+    if (!_dbus_string_init (&str))
+      _dbus_assert_not_reached ("no memory");
+
+    if (!_dbus_string_append (&str, lower_string))
+      _dbus_assert_not_reached ("no memory");
+
+    _dbus_string_toupper_ascii (&str, 0, _dbus_string_get_length(&str));
+
+    if (!_dbus_string_equal_c_str (&str, upper_string))
+      _dbus_assert_not_reached ("_dbus_string_toupper_ascii failed");
+
+    _dbus_string_free (&str);
+
+    if (!_dbus_string_init (&str))
+      _dbus_assert_not_reached ("no memory");
+
+    if (!_dbus_string_append (&str, lower_string))
+      _dbus_assert_not_reached ("no memory");
+
+    _dbus_string_toupper_ascii (&str, 0, 7);
+
+    if (!_dbus_string_equal_c_str (&str, upper2_string))
+      _dbus_assert_not_reached ("_dbus_string_toupper_ascii failed in partial conversion");
+
+    _dbus_string_free (&str);
+  }
+
   return TRUE;
 }
 
index d9cf18e..e2eb93b 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-string.h"
 /* we allow a system header here, for speed/convenience */
@@ -1799,7 +1800,18 @@ _dbus_string_split_on_byte (DBusString        *source,
     }
 
 /**
- * Check whether a unicode char is in a valid range.
+ * Check whether a Unicode (5.2) char is in a valid range.
+ *
+ * The first check comes from the Unicode guarantee to never encode
+ * a point above 0x0010ffff, since UTF-16 couldn't represent it.
+ *
+ * The second check covers surrogate pairs (category Cs).
+ *
+ * The last two checks cover "Noncharacter": defined as:
+ *   "A code point that is permanently reserved for
+ *    internal use, and that should never be interchanged. In
+ *    Unicode 3.1, these consist of the values U+nFFFE and U+nFFFF
+ *    (where n is from 0 to 10_16) and the values U+FDD0..U+FDEF."
  *
  * @param Char the character
  */
@@ -1807,7 +1819,7 @@ _dbus_string_split_on_byte (DBusString        *source,
     ((Char) < 0x110000 &&                     \
      (((Char) & 0xFFFFF800) != 0xD800) &&     \
      ((Char) < 0xFDD0 || (Char) > 0xFDEF) &&  \
-     ((Char) & 0xFFFF) != 0xFFFF)
+     ((Char) & 0xFFFE) != 0xFFFE)
 
 #ifdef DBUS_BUILD_TESTS
 /**
@@ -2749,6 +2761,68 @@ _dbus_string_validate_ascii (const DBusString *str,
 }
 
 /**
+ * Converts the given range of the string to lower case.
+ *
+ * @param str the string
+ * @param start first byte index to convert
+ * @param len number of bytes to convert
+ */
+void
+_dbus_string_tolower_ascii (const DBusString *str,
+                            int               start,
+                            int               len)
+{
+  unsigned char *s;
+  unsigned char *end;
+  DBUS_STRING_PREAMBLE (str);
+  _dbus_assert (start >= 0);
+  _dbus_assert (start <= real->len);
+  _dbus_assert (len >= 0);
+  _dbus_assert (len <= real->len - start);
+
+  s = real->str + start;
+  end = s + len;
+
+  while (s != end)
+    {
+      if (*s >= 'A' && *s <= 'Z')
+          *s += 'a' - 'A';
+      ++s;
+    }
+}
+
+/**
+ * Converts the given range of the string to upper case.
+ *
+ * @param str the string
+ * @param start first byte index to convert
+ * @param len number of bytes to convert
+ */
+void
+_dbus_string_toupper_ascii (const DBusString *str,
+                            int               start,
+                            int               len)
+{
+  unsigned char *s;
+  unsigned char *end;
+  DBUS_STRING_PREAMBLE (str);
+  _dbus_assert (start >= 0);
+  _dbus_assert (start <= real->len);
+  _dbus_assert (len >= 0);
+  _dbus_assert (len <= real->len - start);
+
+  s = real->str + start;
+  end = s + len;
+
+  while (s != end)
+    {
+      if (*s >= 'a' && *s <= 'z')
+          *s += 'A' - 'a';
+      ++s;
+    }
+}
+
+/**
  * Checks that the given range of the string is valid UTF-8. If the
  * given range is not entirely contained in the string, returns
  * #FALSE. If the string contains any nul bytes in the given range,
index 7c30111..2f1ed31 100644 (file)
@@ -25,8 +25,6 @@
 #ifndef DBUS_STRING_H
 #define DBUS_STRING_H
 
-#include <config.h>
-
 #include <dbus/dbus-macros.h>
 #include <dbus/dbus-types.h>
 #include <dbus/dbus-memory.h>
@@ -43,7 +41,11 @@ typedef struct DBusString DBusString;
 
 struct DBusString
 {
+#if defined(DBUS_WIN) && defined(_DEBUG)
+  const char *dummy1; /**< placeholder */
+#else
   const void *dummy1; /**< placeholder */
+#endif
   int   dummy2;       /**< placeholder */
   int   dummy3;       /**< placeholder */
   int   dummy4;       /**< placeholder */
@@ -284,6 +286,12 @@ dbus_bool_t   _dbus_string_hex_decode            (const DBusString  *source,
                                                  int               *end_return,
                                                   DBusString        *dest,
                                                   int                insert_at);
+void          _dbus_string_tolower_ascii         (const DBusString  *str,
+                                                  int                start,
+                                                  int                len);
+void          _dbus_string_toupper_ascii         (const DBusString  *str,
+                                                  int                start,
+                                                  int                len);
 dbus_bool_t   _dbus_string_validate_ascii        (const DBusString  *str,
                                                   int                start,
                                                   int                len);
index 46e4204..7073751 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-sysdeps.h"
 #include "dbus-threads.h"
index 4c4d22f..55c0bf7 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-sysdeps.h"
 #include "dbus-sysdeps-win.h"
index 0d3e999..fc27d51 100644 (file)
@@ -1550,7 +1550,7 @@ _dbus_read_credentials_socket  (int              client_fd,
 #elif defined(HAVE_CMSGCRED)
     struct cmsgcred *cred;
 
-    cred = (struct cmsgcred *) CMSG_DATA (&cmsg);
+    cred = (struct cmsgcred *) CMSG_DATA (&cmsg.hdr);
     pid_read = cred->cmcred_pid;
     uid_read = cred->cmcred_euid;
 #elif defined(LOCAL_CREDS)
@@ -2348,7 +2348,8 @@ _dbus_poll (DBusPollFD *fds,
 }
 
 /**
- * Get current time, as in gettimeofday().
+ * Get current time, as in gettimeofday(). Use the monotonic clock if
+ * available, to avoid problems when the system time changes.
  *
  * @param tv_sec return location for number of seconds
  * @param tv_usec return location for number of microseconds (thousandths)
@@ -2359,371 +2360,22 @@ _dbus_get_current_time (long *tv_sec,
 {
   struct timeval t;
 
+#ifdef HAVE_MONOTONIC_CLOCK
+  struct timespec ts;
+  clock_gettime (CLOCK_MONOTONIC, &ts);
+
+  if (tv_sec)
+    *tv_sec = ts.tv_sec;
+  if (tv_usec)
+    *tv_usec = ts.tv_nsec / 1000;
+#else
   gettimeofday (&t, NULL);
 
   if (tv_sec)
     *tv_sec = t.tv_sec;
   if (tv_usec)
     *tv_usec = t.tv_usec;
-}
-
-/**
- * Appends the contents of the given file to the string,
- * returning error code. At the moment, won't open a file
- * more than a megabyte in size.
- *
- * @param str the string to append to
- * @param filename filename to load
- * @param error place to set an error
- * @returns #FALSE if error was set
- */
-dbus_bool_t
-_dbus_file_get_contents (DBusString       *str,
-                         const DBusString *filename,
-                         DBusError        *error)
-{
-  int fd;
-  struct stat sb;
-  int orig_len;
-  int total;
-  const char *filename_c;
-
-  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
-  
-  filename_c = _dbus_string_get_const_data (filename);
-  
-  /* O_BINARY useful on Cygwin */
-  fd = open (filename_c, O_RDONLY | O_BINARY);
-  if (fd < 0)
-    {
-      dbus_set_error (error, _dbus_error_from_errno (errno),
-                      "Failed to open \"%s\": %s",
-                      filename_c,
-                      _dbus_strerror (errno));
-      return FALSE;
-    }
-
-  _dbus_verbose ("file fd %d opened\n", fd);
-  
-  if (fstat (fd, &sb) < 0)
-    {
-      dbus_set_error (error, _dbus_error_from_errno (errno),
-                      "Failed to stat \"%s\": %s",
-                      filename_c,
-                      _dbus_strerror (errno));
-
-      _dbus_verbose ("fstat() failed: %s",
-                     _dbus_strerror (errno));
-      
-      _dbus_close (fd, NULL);
-      
-      return FALSE;
-    }
-
-  if (sb.st_size > _DBUS_ONE_MEGABYTE)
-    {
-      dbus_set_error (error, DBUS_ERROR_FAILED,
-                      "File size %lu of \"%s\" is too large.",
-                      (unsigned long) sb.st_size, filename_c);
-      _dbus_close (fd, NULL);
-      return FALSE;
-    }
-  
-  total = 0;
-  orig_len = _dbus_string_get_length (str);
-  if (sb.st_size > 0 && S_ISREG (sb.st_mode))
-    {
-      int bytes_read;
-
-      while (total < (int) sb.st_size)
-        {
-          bytes_read = _dbus_read (fd, str,
-                                   sb.st_size - total);
-          if (bytes_read <= 0)
-            {
-              dbus_set_error (error, _dbus_error_from_errno (errno),
-                              "Error reading \"%s\": %s",
-                              filename_c,
-                              _dbus_strerror (errno));
-
-              _dbus_verbose ("read() failed: %s",
-                             _dbus_strerror (errno));
-              
-              _dbus_close (fd, NULL);
-              _dbus_string_set_length (str, orig_len);
-              return FALSE;
-            }
-          else
-            total += bytes_read;
-        }
-
-      _dbus_close (fd, NULL);
-      return TRUE;
-    }
-  else if (sb.st_size != 0)
-    {
-      _dbus_verbose ("Can only open regular files at the moment.\n");
-      dbus_set_error (error, DBUS_ERROR_FAILED,
-                      "\"%s\" is not a regular file",
-                      filename_c);
-      _dbus_close (fd, NULL);
-      return FALSE;
-    }
-  else
-    {
-      _dbus_close (fd, NULL);
-      return TRUE;
-    }
-}
-
-/**
- * Writes a string out to a file. If the file exists,
- * it will be atomically overwritten by the new data.
- *
- * @param str the string to write out
- * @param filename the file to save string to
- * @param error error to be filled in on failure
- * @returns #FALSE on failure
- */
-dbus_bool_t
-_dbus_string_save_to_file (const DBusString *str,
-                           const DBusString *filename,
-                           DBusError        *error)
-{
-  int fd;
-  int bytes_to_write;
-  const char *filename_c;
-  DBusString tmp_filename;
-  const char *tmp_filename_c;
-  int total;
-  dbus_bool_t need_unlink;
-  dbus_bool_t retval;
-
-  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
-  
-  fd = -1;
-  retval = FALSE;
-  need_unlink = FALSE;
-  
-  if (!_dbus_string_init (&tmp_filename))
-    {
-      dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
-      return FALSE;
-    }
-
-  if (!_dbus_string_copy (filename, 0, &tmp_filename, 0))
-    {
-      dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
-      _dbus_string_free (&tmp_filename);
-      return FALSE;
-    }
-  
-  if (!_dbus_string_append (&tmp_filename, "."))
-    {
-      dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
-      _dbus_string_free (&tmp_filename);
-      return FALSE;
-    }
-
-#define N_TMP_FILENAME_RANDOM_BYTES 8
-  if (!_dbus_generate_random_ascii (&tmp_filename, N_TMP_FILENAME_RANDOM_BYTES))
-    {
-      dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
-      _dbus_string_free (&tmp_filename);
-      return FALSE;
-    }
-    
-  filename_c = _dbus_string_get_const_data (filename);
-  tmp_filename_c = _dbus_string_get_const_data (&tmp_filename);
-
-  fd = open (tmp_filename_c, O_WRONLY | O_BINARY | O_EXCL | O_CREAT,
-             0600);
-  if (fd < 0)
-    {
-      dbus_set_error (error, _dbus_error_from_errno (errno),
-                      "Could not create %s: %s", tmp_filename_c,
-                      _dbus_strerror (errno));
-      goto out;
-    }
-
-  _dbus_verbose ("tmp file fd %d opened\n", fd);
-  
-  need_unlink = TRUE;
-  
-  total = 0;
-  bytes_to_write = _dbus_string_get_length (str);
-
-  while (total < bytes_to_write)
-    {
-      int bytes_written;
-
-      bytes_written = _dbus_write (fd, str, total,
-                                   bytes_to_write - total);
-
-      if (bytes_written <= 0)
-        {
-          dbus_set_error (error, _dbus_error_from_errno (errno),
-                          "Could not write to %s: %s", tmp_filename_c,
-                          _dbus_strerror (errno));
-          
-          goto out;
-        }
-
-      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),
-                      "Could not close file %s: %s",
-                      tmp_filename_c, _dbus_strerror (errno));
-
-      goto out;
-    }
-
-  fd = -1;
-  
-  if (rename (tmp_filename_c, filename_c) < 0)
-    {
-      dbus_set_error (error, _dbus_error_from_errno (errno),
-                      "Could not rename %s to %s: %s",
-                      tmp_filename_c, filename_c,
-                      _dbus_strerror (errno));
-
-      goto out;
-    }
-
-  need_unlink = FALSE;
-  
-  retval = TRUE;
-  
- out:
-  /* close first, then unlink, to prevent ".nfs34234235" garbage
-   * files
-   */
-
-  if (fd >= 0)
-    _dbus_close (fd, NULL);
-        
-  if (need_unlink && unlink (tmp_filename_c) < 0)
-    _dbus_verbose ("Failed to unlink temp file %s: %s\n",
-                   tmp_filename_c, _dbus_strerror (errno));
-
-  _dbus_string_free (&tmp_filename);
-
-  if (!retval)
-    _DBUS_ASSERT_ERROR_IS_SET (error);
-  
-  return retval;
-}
-
-/** Makes the file readable by every user in the system.
- *
- * @param filename the filename
- * @param error error location
- * @returns #TRUE if the file's permissions could be changed.
- */
-dbus_bool_t
-_dbus_make_file_world_readable(const DBusString *filename,
-                               DBusError *error)
-{
-  const char *filename_c;
-
-  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
-
-  filename_c = _dbus_string_get_const_data (filename);
-  if (chmod (filename_c, 0644) == -1)
-    {
-      dbus_set_error (error,
-                      DBUS_ERROR_FAILED,
-                      "Could not change permissions of file %s: %s\n",
-                      filename_c,
-                      _dbus_strerror (errno));
-      return FALSE;
-    }
-  return TRUE;
-}
-
-/** Creates the given file, failing if the file already exists.
- *
- * @param filename the filename
- * @param error error location
- * @returns #TRUE if we created the file and it didn't exist
- */
-dbus_bool_t
-_dbus_create_file_exclusively (const DBusString *filename,
-                               DBusError        *error)
-{
-  int fd;
-  const char *filename_c;
-
-  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
-  
-  filename_c = _dbus_string_get_const_data (filename);
-  
-  fd = open (filename_c, O_WRONLY | O_BINARY | O_EXCL | O_CREAT,
-             0600);
-  if (fd < 0)
-    {
-      dbus_set_error (error,
-                      DBUS_ERROR_FAILED,
-                      "Could not create file %s: %s\n",
-                      filename_c,
-                      _dbus_strerror (errno));
-      return FALSE;
-    }
-
-  _dbus_verbose ("exclusive file fd %d opened\n", fd);
-  
-  if (!_dbus_close (fd, NULL))
-    {
-      dbus_set_error (error,
-                      DBUS_ERROR_FAILED,
-                      "Could not close file %s: %s\n",
-                      filename_c,
-                      _dbus_strerror (errno));
-      return FALSE;
-    }
-  
-  return TRUE;
-}
-
-/**
- * Deletes the given file.
- *
- * @param filename the filename
- * @param error error location
- * 
- * @returns #TRUE if unlink() succeeded
- */
-dbus_bool_t
-_dbus_delete_file (const DBusString *filename,
-                   DBusError        *error)
-{
-  const char *filename_c;
-
-  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
-  
-  filename_c = _dbus_string_get_const_data (filename);
-
-  if (unlink (filename_c) < 0)
-    {
-      dbus_set_error (error, DBUS_ERROR_FAILED,
-                      "Failed to delete file %s: %s\n",
-                      filename_c, _dbus_strerror (errno));
-      return FALSE;
-    }
-  else
-    return TRUE;
+#endif
 }
 
 /**
index 96b44e2..81758e0 100644 (file)
@@ -25,7 +25,6 @@
 #ifndef DBUS_SYSDEPS_UNIX_H
 #define DBUS_SYSDEPS_UNIX_H
 
-#include <config.h>
 #include <dbus/dbus-sysdeps.h>
 
 #ifdef DBUS_WIN
index d969d0a..94f580b 100644 (file)
@@ -21,6 +21,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "dbus-sysdeps.h"
 #include "dbus-sysdeps-unix.h"
 #include "dbus-internals.h"
 #include <dirent.h>
 #include <sys/un.h>
 #include <syslog.h>
-#include <syslog.h>
-#ifdef HAVE_LIBAUDIT
-#include <sys/prctl.h>
-#include <sys/capability.h>
-#include <libaudit.h>
-#endif /* HAVE_LIBAUDIT */
 
 #ifdef HAVE_SYS_SYSLIMITS_H
 #include <sys/syslimits.h>
@@ -309,6 +305,9 @@ _dbus_verify_daemon_user (const char *user)
   return _dbus_get_user_id_and_primary_group (&u, NULL, NULL);
 }
 
+
+/* The HAVE_LIBAUDIT case lives in selinux.c */
+#ifndef HAVE_LIBAUDIT
 /**
  * Changes the user and group the bus is running as.
  *
@@ -323,13 +322,9 @@ _dbus_change_to_daemon_user  (const char    *user,
   dbus_uid_t uid;
   dbus_gid_t gid;
   DBusString u;
-#ifdef HAVE_LIBAUDIT
-  dbus_bool_t we_were_root;
-  cap_t new_caps;
-#endif
-  
+
   _dbus_string_init_const (&u, user);
-  
+
   if (!_dbus_get_user_id_and_primary_group (&u, &uid, &gid))
     {
       dbus_set_error (error, DBUS_ERROR_FAILED,
@@ -337,59 +332,7 @@ _dbus_change_to_daemon_user  (const char    *user,
                       user);
       return FALSE;
     }
-  
-#ifdef HAVE_LIBAUDIT
-  we_were_root = _dbus_geteuid () == 0;
-  new_caps = NULL;
-  /* have a tmp set of caps that we use to transition to the usr/grp dbus should
-   * run as ... doesn't really help. But keeps people happy.
-   */
-    
-  if (we_were_root)
-    {
-      cap_value_t new_cap_list[] = { CAP_AUDIT_WRITE };
-      cap_value_t tmp_cap_list[] = { CAP_AUDIT_WRITE, CAP_SETUID, CAP_SETGID };
-      cap_t tmp_caps = cap_init();
-        
-      if (!tmp_caps || !(new_caps = cap_init ()))
-        {
-          dbus_set_error (error, DBUS_ERROR_FAILED,
-                          "Failed to initialize drop of capabilities: %s\n",
-                          _dbus_strerror (errno));
-
-          if (tmp_caps)
-            cap_free (tmp_caps);
-
-          return FALSE;
-        }
 
-      /* assume these work... */
-      cap_set_flag (new_caps, CAP_PERMITTED, 1, new_cap_list, CAP_SET);
-      cap_set_flag (new_caps, CAP_EFFECTIVE, 1, new_cap_list, CAP_SET);
-      cap_set_flag (tmp_caps, CAP_PERMITTED, 3, tmp_cap_list, CAP_SET);
-      cap_set_flag (tmp_caps, CAP_EFFECTIVE, 3, tmp_cap_list, CAP_SET);
-      
-      if (prctl (PR_SET_KEEPCAPS, 1, 0, 0, 0) == -1)
-        {
-          dbus_set_error (error, _dbus_error_from_errno (errno),
-                          "Failed to set keep-capabilities: %s\n",
-                          _dbus_strerror (errno));
-          cap_free (tmp_caps);
-          goto fail;
-        }
-        
-      if (cap_set_proc (tmp_caps) == -1)
-        {
-          dbus_set_error (error, DBUS_ERROR_FAILED,
-                          "Failed to drop capabilities: %s\n",
-                          _dbus_strerror (errno));
-          cap_free (tmp_caps);
-          goto fail;
-        }
-      cap_free (tmp_caps);
-    }
-#endif /* HAVE_LIBAUDIT */
-  
   /* setgroups() only works if we are a privileged process,
    * so we don't return error on failure; the only possible
    * failure is that we don't have perms to do it.
@@ -400,7 +343,7 @@ _dbus_change_to_daemon_user  (const char    *user,
   if (setgroups (0, NULL) < 0)
     _dbus_warn ("Failed to drop supplementary groups: %s\n",
                 _dbus_strerror (errno));
-  
+
   /* Set GID first, or the setuid may remove our permission
    * to change the GID
    */
@@ -409,85 +352,78 @@ _dbus_change_to_daemon_user  (const char    *user,
       dbus_set_error (error, _dbus_error_from_errno (errno),
                       "Failed to set GID to %lu: %s", gid,
                       _dbus_strerror (errno));
-      goto fail;
+      return FALSE;
     }
-  
+
   if (setuid (uid) < 0)
     {
       dbus_set_error (error, _dbus_error_from_errno (errno),
                       "Failed to set UID to %lu: %s", uid,
                       _dbus_strerror (errno));
-      goto fail;
-    }
-  
-#ifdef HAVE_LIBAUDIT
-  if (we_were_root)
-    {
-      if (cap_set_proc (new_caps))
-        {
-          dbus_set_error (error, DBUS_ERROR_FAILED,
-                          "Failed to drop capabilities: %s\n",
-                          _dbus_strerror (errno));
-          goto fail;
-        }
-      cap_free (new_caps);
-
-      /* should always work, if it did above */      
-      if (prctl (PR_SET_KEEPCAPS, 0, 0, 0, 0) == -1)
-        {
-          dbus_set_error (error, _dbus_error_from_errno (errno),
-                          "Failed to unset keep-capabilities: %s\n",
-                          _dbus_strerror (errno));
-          return FALSE;
-        }
+      return FALSE;
     }
-#endif
-
- return TRUE;
-
- fail:
-#ifdef HAVE_LIBAUDIT
- if (!we_were_root)
-   {
-     /* should always work, if it did above */
-     prctl (PR_SET_KEEPCAPS, 0, 0, 0, 0);
-     cap_free (new_caps);
-   }
-#endif
 
return FALSE;
 return TRUE;
 }
+#endif /* !HAVE_LIBAUDIT */
 
 void 
 _dbus_init_system_log (void)
 {
   openlog ("dbus", LOG_PID, LOG_DAEMON);
 }
-
 /**
- * Log an informative message.  Intended for use primarily by
- * the system bus.
+ * Log a message to the system log file (e.g. syslog on Unix).
  *
+ * @param severity a severity value
  * @param msg a printf-style format string
  * @param args arguments for the format string
+ *
  */
-void 
-_dbus_log_info (const char *msg, va_list args)
+void
+_dbus_system_log (DBusSystemLogSeverity severity, const char *msg, ...)
 {
-  vsyslog (LOG_DAEMON|LOG_NOTICE, msg, args);
+  va_list args;
+
+  va_start (args, msg);
+
+  _dbus_system_logv (severity, msg, args);
+
+  va_end (args);
 }
 
 /**
- * Log a security-related message.  Intended for use primarily by
- * the system bus.
+ * Log a message to the system log file (e.g. syslog on Unix).
  *
+ * @param severity a severity value
  * @param msg a printf-style format string
  * @param args arguments for the format string
+ *
+ * If the FATAL severity is given, this function will terminate the program
+ * with an error code.
  */
-void 
-_dbus_log_security (const char *msg, va_list args)
+void
+_dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args)
 {
-  vsyslog (LOG_AUTH|LOG_NOTICE, msg, args);
+  int flags;
+  switch (severity)
+    {
+      case DBUS_SYSTEM_LOG_INFO:
+        flags =  LOG_DAEMON | LOG_NOTICE;
+        break;
+      case DBUS_SYSTEM_LOG_SECURITY:
+        flags = LOG_AUTH | LOG_NOTICE;
+        break;
+      case DBUS_SYSTEM_LOG_FATAL:
+        flags = LOG_DAEMON|LOG_CRIT;
+      default:
+        return;
+    }
+
+  vsyslog (flags, msg, args);
+
+  if (severity == DBUS_SYSTEM_LOG_FATAL)
+    exit (1);
 }
 
 /** Installs a UNIX signal handler
@@ -1113,7 +1049,7 @@ _dbus_string_get_dirname  (const DBusString *filename,
 static void
 string_squash_nonprintable (DBusString *str)
 {
-  char *buf;
+  unsigned char *buf;
   int i, len; 
   
   buf = _dbus_string_get_data (str);
index b9ebc82..7b2472f 100644 (file)
@@ -22,6 +22,8 @@
  *
  */
 
+#include <config.h>
+
 #define STRSAFE_NO_DEPRECATE
 
 #include "dbus-sysdeps.h"
@@ -231,27 +233,37 @@ _dbus_init_system_log (void)
 }
 
 /**
- * Log an informative message.  Intended for use primarily by
- * the system bus.
+ * Log a message to the system log file (e.g. syslog on Unix).
  *
+ * @param severity a severity value
  * @param msg a printf-style format string
  * @param args arguments for the format string
+ *
  */
 void
-_dbus_log_info (const char *msg, va_list args)
+_dbus_system_log (DBusSystemLogSeverity severity, const char *msg, ...)
 {
-    // FIXME!
+  va_list args;
+
+  va_start (args, msg);
+
+  _dbus_system_logv (severity, msg, args);
+
+  va_end (args);
 }
 
 /**
- * Log a security-related message.  Intended for use primarily by
- * the system bus.
+ * Log a message to the system log file (e.g. syslog on Unix).
  *
+ * @param severity a severity value
  * @param msg a printf-style format string
  * @param args arguments for the format string
+ *
+ * If the FATAL severity is given, this function will terminate the program
+ * with an error code.
  */
 void
-_dbus_log_security (const char *msg, va_list args)
+_dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args)
 {
     // FIXME!
 }
index 67e19f7..68669cf 100644 (file)
@@ -21,6 +21,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "dbus-sysdeps.h"
 #include "dbus-internals.h"
 #include "dbus-string.h"
index c323820..4b32e09 100644 (file)
@@ -26,6 +26,8 @@
  *
  */
 
+#include <config.h>
+
 #define STRSAFE_NO_DEPRECATE
 
 #ifndef DBUS_WINCE
@@ -83,7 +85,7 @@ extern BOOL WINAPI ConvertSidToStringSidA (PSID Sid, LPSTR *StringSid);
 
 typedef int socklen_t;
 
-static char*
+char*
 _dbus_win_error_string (int error_number)
 {
   char *msg;
@@ -102,7 +104,7 @@ _dbus_win_error_string (int error_number)
   return msg;
 }
 
-static void
+void
 _dbus_win_free_error_string (char *string)
 {
   LocalFree (string);
@@ -118,8 +120,9 @@ _dbus_win_free_error_string (char *string)
  * the data it reads to the DBusString buffer. It appends
  * up to the given count, and returns the same value
  * and same errno as read(). The only exception is that
- * _dbus_read() handles EINTR for you. _dbus_read() can
- * return ENOMEM, even though regular UNIX read doesn't.
+ * _dbus_read_socket() handles EINTR for you. 
+ * _dbus_read_socket() can return ENOMEM, even though 
+ * regular UNIX read doesn't.
  *
  * @param fd the file descriptor to read from
  * @param buffer the buffer to append data to
@@ -275,31 +278,12 @@ _dbus_close_socket (int        fd,
 void
 _dbus_fd_set_close_on_exec (int handle)
 {
-#ifdef ENABLE_DBUSSOCKET
-  DBusSocket *s;
-  if (handle < 0)
-    return;
-
-  _dbus_lock_sockets();
-
-  _dbus_handle_to_socket_unlocked (handle, &s);
-  s->close_on_exec = TRUE;
-
-  _dbus_unlock_sockets();
-#else
-  /* TODO unic code.
-  int val;
-  
-  val = fcntl (fd, F_GETFD, 0);
-  
-  if (val < 0)
-    return;
-
-  val |= FD_CLOEXEC;
-  
-  fcntl (fd, F_SETFD, val);
-  */
-#endif
+  if ( !SetHandleInformation( (HANDLE) handle,
+                        HANDLE_FLAG_INHERIT | HANDLE_FLAG_PROTECT_FROM_CLOSE,
+                        0 /*disable both flags*/ ) )
+    {
+      _dbus_win_warn_win_error ("Disabling socket handle inheritance failed:", GetLastError());
+    }
 }
 
 /**
@@ -705,7 +689,7 @@ _dbus_pid_for_log (void)
 static dbus_bool_t
 _dbus_getsid(char **sid)
 {
-  HANDLE process_token = NULL;
+  HANDLE process_token = INVALID_HANDLE_VALUE;
   TOKEN_USER *token_user = NULL;
   DWORD n;
   PSID psid;
@@ -739,7 +723,7 @@ _dbus_getsid(char **sid)
   retval = TRUE;
 
 failed:
-  if (process_token != NULL)
+  if (process_token != INVALID_HANDLE_VALUE)
     CloseHandle (process_token);
 
   _dbus_verbose("_dbus_getsid() returns %d\n",retval);
@@ -1912,21 +1896,23 @@ _dbus_get_current_time (long *tv_sec,
                         long *tv_usec)
 {
   FILETIME ft;
-  dbus_uint64_t *time64 = (dbus_uint64_t *) &ft;
+  dbus_uint64_t time64;
 
   GetSystemTimeAsFileTime (&ft);
 
+  memcpy (&time64, &ft, sizeof (time64));
+
   /* Convert from 100s of nanoseconds since 1601-01-01
   * to Unix epoch. Yes, this is Y2038 unsafe.
   */
-  *time64 -= DBUS_INT64_CONSTANT (116444736000000000);
-  *time64 /= 10;
+  time64 -= DBUS_INT64_CONSTANT (116444736000000000);
+  time64 /= 10;
 
   if (tv_sec)
-    *tv_sec = *time64 / 1000000;
+    *tv_sec = time64 / 1000000;
 
   if (tv_usec)
-    *tv_usec = *time64 % 1000000;
+    *tv_usec = time64 % 1000000;
 }
 
 
@@ -1938,354 +1924,6 @@ _dbus_disable_sigpipe (void)
 {
 }
 
-
-/* _dbus_read() is static on Windows, only used below in this file.
- */
-static int
-_dbus_read (int               fd,
-            DBusString       *buffer,
-            int               count)
-{
-  int bytes_read;
-  int start;
-  char *data;
-
-  _dbus_assert (count >= 0);
-
-  start = _dbus_string_get_length (buffer);
-
-  if (!_dbus_string_lengthen (buffer, count))
-    {
-      errno = ENOMEM;
-      return -1;
-    }
-
-  data = _dbus_string_get_data_len (buffer, start, count);
-
- again:
-
-  bytes_read = _read (fd, data, count);
-
-  if (bytes_read < 0)
-    {
-      if (errno == EINTR)
-        goto again;
-      else
-        {
-          /* put length back (note that this doesn't actually realloc anything) */
-          _dbus_string_set_length (buffer, start);
-          return -1;
-        }
-    }
-  else
-    {
-      /* put length back (doesn't actually realloc) */
-      _dbus_string_set_length (buffer, start + bytes_read);
-
-#if 0
-      if (bytes_read > 0)
-        _dbus_verbose_bytes_of_string (buffer, start, bytes_read);
-#endif
-
-      return bytes_read;
-    }
-}
-
-/**
- * Appends the contents of the given file to the string,
- * returning error code. At the moment, won't open a file
- * more than a megabyte in size.
- *
- * @param str the string to append to
- * @param filename filename to load
- * @param error place to set an error
- * @returns #FALSE if error was set
- */
-dbus_bool_t
-_dbus_file_get_contents (DBusString       *str,
-                         const DBusString *filename,
-                         DBusError        *error)
-{
-  int fd;
-  struct _stati64 sb;
-  int orig_len;
-  int total;
-  const char *filename_c;
-
-  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
-
-  filename_c = _dbus_string_get_const_data (filename);
-
-  fd = _open (filename_c, O_RDONLY | O_BINARY);
-  if (fd < 0)
-    {
-      dbus_set_error (error, _dbus_error_from_errno (errno),
-                      "Failed to open \"%s\": %s",
-                      filename_c,
-                      strerror (errno));
-      return FALSE;
-    }
-
-  _dbus_verbose ("file %s fd %d opened\n", filename_c, fd);
-
-  if (_fstati64 (fd, &sb) < 0)
-    {
-      dbus_set_error (error, _dbus_error_from_errno (errno),
-                      "Failed to stat \"%s\": %s",
-                      filename_c,
-                      strerror (errno));
-
-      _dbus_verbose ("fstat() failed: %s",
-                     strerror (errno));
-
-      _close (fd);
-
-      return FALSE;
-    }
-
-  if (sb.st_size > _DBUS_ONE_MEGABYTE)
-    {
-      dbus_set_error (error, DBUS_ERROR_FAILED,
-                      "File size %lu of \"%s\" is too large.",
-                      (unsigned long) sb.st_size, filename_c);
-      _close (fd);
-      return FALSE;
-    }
-
-  total = 0;
-  orig_len = _dbus_string_get_length (str);
-  if (sb.st_size > 0 && S_ISREG (sb.st_mode))
-    {
-      int bytes_read;
-
-      while (total < (int) sb.st_size)
-        {
-          bytes_read = _dbus_read (fd, str, sb.st_size - total);
-          if (bytes_read <= 0)
-            {
-              dbus_set_error (error, _dbus_error_from_errno (errno),
-                              "Error reading \"%s\": %s",
-                              filename_c,
-                              strerror (errno));
-
-              _dbus_verbose ("read() failed: %s",
-                             strerror (errno));
-
-              _close (fd);
-              _dbus_string_set_length (str, orig_len);
-              return FALSE;
-            }
-          else
-            total += bytes_read;
-        }
-
-      _close (fd);
-      return TRUE;
-    }
-  else if (sb.st_size != 0)
-    {
-      _dbus_verbose ("Can only open regular files at the moment.\n");
-      dbus_set_error (error, DBUS_ERROR_FAILED,
-                      "\"%s\" is not a regular file",
-                      filename_c);
-      _close (fd);
-      return FALSE;
-    }
-  else
-    {
-      _close (fd);
-      return TRUE;
-    }
-}
-
-/**
- * Writes a string out to a file. If the file exists,
- * it will be atomically overwritten by the new data.
- *
- * @param str the string to write out
- * @param filename the file to save string to
- * @param error error to be filled in on failure
- * @returns #FALSE on failure
- */
-dbus_bool_t
-_dbus_string_save_to_file (const DBusString *str,
-                           const DBusString *filename,
-                           DBusError        *error)
-{
-  int fd;
-  int bytes_to_write;
-  const char *filename_c;
-  DBusString tmp_filename;
-  const char *tmp_filename_c;
-  int total;
-  const char *str_c;
-  dbus_bool_t need_unlink;
-  dbus_bool_t retval;
-
-  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
-
-  fd = -1;
-  retval = FALSE;
-  need_unlink = FALSE;
-
-  if (!_dbus_string_init (&tmp_filename))
-    {
-      dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
-      return FALSE;
-    }
-
-  if (!_dbus_string_copy (filename, 0, &tmp_filename, 0))
-    {
-      dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
-      _dbus_string_free (&tmp_filename);
-      return FALSE;
-    }
-
-  if (!_dbus_string_append (&tmp_filename, "."))
-    {
-      dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
-      _dbus_string_free (&tmp_filename);
-      return FALSE;
-    }
-
-#define N_TMP_FILENAME_RANDOM_BYTES 8
-  if (!_dbus_generate_random_ascii (&tmp_filename, N_TMP_FILENAME_RANDOM_BYTES))
-    {
-      dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
-      _dbus_string_free (&tmp_filename);
-      return FALSE;
-    }
-
-  filename_c = _dbus_string_get_const_data (filename);
-  tmp_filename_c = _dbus_string_get_const_data (&tmp_filename);
-
-  fd = _open (tmp_filename_c, O_WRONLY | O_BINARY | O_EXCL | O_CREAT,
-              0600);
-  if (fd < 0)
-    {
-      dbus_set_error (error, _dbus_error_from_errno (errno),
-                      "Could not create %s: %s", tmp_filename_c,
-                      strerror (errno));
-      goto out;
-    }
-
-  _dbus_verbose ("tmp file %s fd %d opened\n", tmp_filename_c, fd);
-
-  need_unlink = TRUE;
-
-  total = 0;
-  bytes_to_write = _dbus_string_get_length (str);
-  str_c = _dbus_string_get_const_data (str);
-
-  while (total < bytes_to_write)
-    {
-      int bytes_written;
-
-      bytes_written = _write (fd, str_c + total, bytes_to_write - total);
-
-      if (bytes_written <= 0)
-        {
-          dbus_set_error (error, _dbus_error_from_errno (errno),
-                          "Could not write to %s: %s", tmp_filename_c,
-                          strerror (errno));
-          goto out;
-        }
-
-      total += bytes_written;
-    }
-
-  if (_close (fd) < 0)
-    {
-      dbus_set_error (error, _dbus_error_from_errno (errno),
-                      "Could not close file %s: %s",
-                      tmp_filename_c, strerror (errno));
-
-      goto out;
-    }
-
-  fd = -1;
-
-  /* Unlike rename(), MoveFileEx() can replace existing files */
-  if (MoveFileExA (tmp_filename_c, filename_c, MOVEFILE_REPLACE_EXISTING) < 0)
-    {
-      char *emsg = _dbus_win_error_string (GetLastError ());
-      dbus_set_error (error, DBUS_ERROR_FAILED,
-                      "Could not rename %s to %s: %s",
-                      tmp_filename_c, filename_c,
-                      emsg);
-      _dbus_win_free_error_string (emsg);
-
-      goto out;
-    }
-
-  need_unlink = FALSE;
-
-  retval = TRUE;
-
- out:
-  /* close first, then unlink */
-
-  if (fd >= 0)
-    _close (fd);
-
-  if (need_unlink && _unlink (tmp_filename_c) < 0)
-    _dbus_verbose ("failed to unlink temp file %s: %s\n",
-                   tmp_filename_c, strerror (errno));
-
-  _dbus_string_free (&tmp_filename);
-
-  if (!retval)
-    _DBUS_ASSERT_ERROR_IS_SET (error);
-
-  return retval;
-}
-
-
-/** Creates the given file, failing if the file already exists.
- *
- * @param filename the filename
- * @param error error location
- * @returns #TRUE if we created the file and it didn't exist
- */
-dbus_bool_t
-_dbus_create_file_exclusively (const DBusString *filename,
-                               DBusError        *error)
-{
-  int fd;
-  const char *filename_c;
-
-  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
-
-  filename_c = _dbus_string_get_const_data (filename);
-
-  fd = _open (filename_c, O_WRONLY | O_BINARY | O_EXCL | O_CREAT,
-              0600);
-  if (fd < 0)
-    {
-      dbus_set_error (error,
-                      DBUS_ERROR_FAILED,
-                      "Could not create file %s: %s\n",
-                      filename_c,
-                      strerror (errno));
-      return FALSE;
-    }
-
-  _dbus_verbose ("exclusive file %s fd %d opened\n", filename_c, fd);
-
-  if (_close (fd) < 0)
-    {
-      dbus_set_error (error,
-                      DBUS_ERROR_FAILED,
-                      "Could not close file %s: %s\n",
-                      filename_c,
-                      strerror (errno));
-      return FALSE;
-    }
-
-  return TRUE;
-}
-
-
 /**
  * Creates a directory; succeeds if the directory
  * is created or already existed.
@@ -2622,6 +2260,24 @@ static void dump_backtrace_for_thread(HANDLE hThread)
     sf.AddrPC.Offset = context.Eip;
     sf.AddrPC.Mode = AddrModeFlat;
     dwImageType = IMAGE_FILE_MACHINE_I386;
+#elif _M_X64
+  dwImageType                = IMAGE_FILE_MACHINE_AMD64;
+  sf.AddrPC.Offset    = context.Rip;
+  sf.AddrPC.Mode      = AddrModeFlat;
+  sf.AddrFrame.Offset = context.Rsp;
+  sf.AddrFrame.Mode   = AddrModeFlat;
+  sf.AddrStack.Offset = context.Rsp;
+  sf.AddrStack.Mode   = AddrModeFlat;
+#elif _M_IA64
+  dwImageType                 = IMAGE_FILE_MACHINE_IA64;
+  sf.AddrPC.Offset    = context.StIIP;
+  sf.AddrPC.Mode      = AddrModeFlat;
+  sf.AddrFrame.Offset = context.IntSp;
+  sf.AddrFrame.Mode   = AddrModeFlat;
+  sf.AddrBStore.Offset= context.RsBSP;
+  sf.AddrBStore.Mode  = AddrModeFlat;
+  sf.AddrStack.Offset = context.IntSp;
+  sf.AddrStack.Mode   = AddrModeFlat;
 #else
 # error You need to fill in the STACKFRAME structure for your architecture
 #endif
@@ -2963,11 +2619,7 @@ _dbus_get_autolaunch_address (DBusString *address,
   LPSTR lpFile;
   char dbus_exe_path[MAX_PATH];
   char dbus_args[MAX_PATH * 2];
-#ifdef _DEBUG
-  const char * daemon_name = "dbus-daemond.exe";
-#else
-  const char * daemon_name = "dbus-daemon.exe";
-#endif
+  const char * daemon_name = DBUS_DAEMON_NAME ".exe";
 
   mutex = _dbus_global_lock ( cDBusAutolaunchMutex );
 
@@ -2999,7 +2651,8 @@ _dbus_get_autolaunch_address (DBusString *address,
 //  printf("create process \"%s\" %s\n", dbus_exe_path, dbus_args);
   if(CreateProcessA(dbus_exe_path, dbus_args, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi))
     {
-
+      CloseHandle (pi.hThread);
+      CloseHandle (pi.hProcess);
       retval = _dbus_get_autolaunch_shm( address );
     }
   
@@ -3206,10 +2859,13 @@ _dbus_get_install_root(char *prefix, int len)
     //folder's name happens to end with the *bytes*
     //"\\bin"... (I.e. the second byte of some Han character and then
     //the Latin "bin", but that is not likely I think...
-    if (lastSlash - prefix > 3 && strncmp(lastSlash - 4, "\\bin", 4) == 0)
+    if (lastSlash - prefix >= 4 && strnicmp(lastSlash - 4, "\\bin", 4) == 0)
         lastSlash[-3] = 0;
-    else if (lastSlash - prefix > 3 && (strncmp(lastSlash - 10, "\\bin\\Debug", 10) == 0 || strncmp(lastSlash - 10, "\\bin\\Release", 10) == 0))
+    else if (lastSlash - prefix >= 10 && strnicmp(lastSlash - 10, "\\bin\\debug", 10) == 0)
         lastSlash[-9] = 0;
+    else if (lastSlash - prefix >= 12 && strnicmp(lastSlash - 12, "\\bin\\release", 12) == 0)
+        lastSlash[-11] = 0;
+
     return TRUE;
 }
 
@@ -3336,6 +2992,7 @@ _dbus_append_keyring_directory_for_credentials (DBusString      *directory,
   DBusString dotdir;
   dbus_uid_t uid;
   const char *homepath;
+  const char *homedrive;
 
   _dbus_assert (credentials != NULL);
   _dbus_assert (!_dbus_credentials_are_anonymous (credentials));
@@ -3343,6 +3000,12 @@ _dbus_append_keyring_directory_for_credentials (DBusString      *directory,
   if (!_dbus_string_init (&homedir))
     return FALSE;
 
+  homedrive = _dbus_getenv("HOMEDRIVE");
+  if (homedrive != NULL && *homedrive != '\0')
+    {
+      _dbus_string_append(&homedir,homedrive);
+    }
+
   homepath = _dbus_getenv("HOMEPATH");
   if (homepath != NULL && *homepath != '\0')
     {
index c65caa8..15ce831 100644 (file)
@@ -57,6 +57,10 @@ extern void *_dbus_win_get_dll_hmodule (void);
 void _dbus_win_startup_winsock (void);
 void _dbus_win_warn_win_error  (const char *message,
                                 int         code);
+                                
+char * _dbus_win_error_string (int error_number);
+void _dbus_win_free_error_string (char *string);
+
 extern const char* _dbus_lm_strerror  (int error_number);
 
 
index 1f4c3a2..de9f904 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-sysdeps.h"
 #include "dbus-threads.h"
@@ -34,7 +35,9 @@
  *
  * These are the standard ANSI C headers...
  */
+#if HAVE_LOCALE_H
 #include <locale.h>
+#endif
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -49,6 +52,9 @@ _DBUS_DEFINE_GLOBAL_LOCK (system_users);
 
 #ifdef DBUS_WIN
   #include <stdlib.h>
+#elif (defined __APPLE__)
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
 #else
 extern char **environ;
 #endif
@@ -619,10 +625,14 @@ ascii_strtod (const char *nptr,
 
   fail_pos = NULL;
 
+#if HAVE_LOCALE_H
   locale_data = localeconv ();
   decimal_point = locale_data->decimal_point;
-  decimal_point_len = strlen (decimal_point);
+#else
+  decimal_point = ".";
+#endif
 
+  decimal_point_len = strlen (decimal_point);
   _dbus_assert (decimal_point_len != 0);
   
   decimal_point_pos = NULL;
index 50998f0..a52709c 100644 (file)
@@ -25,9 +25,8 @@
 #ifndef DBUS_SYSDEPS_H
 #define DBUS_SYSDEPS_H
 
-#include <config.h>
-
 #include <dbus/dbus-errors.h>
+#include <dbus/dbus-file.h>
 #include <dbus/dbus-string.h>
 #include <dbus/dbus-pipe.h>
 
@@ -295,23 +294,8 @@ void _dbus_get_current_time (long *tv_sec,
                              long *tv_usec);
 
 /**
- * File/directory interface
+ * directory interface
  */
-dbus_bool_t _dbus_file_exists         (const char       *file);
-dbus_bool_t _dbus_file_get_contents   (DBusString       *str,
-                                       const DBusString *filename,
-                                       DBusError        *error);
-dbus_bool_t _dbus_string_save_to_file (const DBusString *str,
-                                       const DBusString *filename,
-                                       DBusError        *error);
-
-dbus_bool_t _dbus_make_file_world_readable   (const DBusString *filename,
-                                              DBusError *error);
-
-dbus_bool_t    _dbus_create_file_exclusively (const DBusString *filename,
-                                              DBusError        *error);
-dbus_bool_t    _dbus_delete_file             (const DBusString *filename,
-                                              DBusError        *error);
 dbus_bool_t    _dbus_create_directory        (const DBusString *filename,
                                               DBusError        *error);
 dbus_bool_t    _dbus_delete_directory        (const DBusString *filename,
@@ -431,11 +415,18 @@ 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. 
+typedef enum {
+  DBUS_SYSTEM_LOG_INFO,
+  DBUS_SYSTEM_LOG_SECURITY,
+  DBUS_SYSTEM_LOG_FATAL
+} DBusSystemLogSeverity;
+
+void _dbus_system_log (DBusSystemLogSeverity severity, const char *msg, ...) _DBUS_GNUC_PRINTF (2, 3);
+void _dbus_system_logv (DBusSystemLogSeverity severity, 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.
  */
 #if !defined (DBUS_VA_COPY)
 #  if defined (__GNUC__) && defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
@@ -504,6 +495,9 @@ unsigned long _dbus_pid_for_log (void);
  */
 dbus_pid_t    _dbus_getpid (void);
 
+dbus_bool_t _dbus_change_to_daemon_user (const char *user,
+                                         DBusError  *error);
+
 void _dbus_flush_caches (void);
 
 /** @} */
index 1bb7c90..b04bebc 100644 (file)
  */
 
 
+#include <config.h>
 #include "dbus-types.h"
 #include "dbus-test.h"
 #include <stdio.h>
 #include <stdlib.h>
+#if HAVE_LOCALE_H
 #include <locale.h>
+#endif
 
 int
 main (int    argc,
@@ -35,8 +38,9 @@ main (int    argc,
   const char *test_data_dir;
   const char *specific_test;
 
+#if HAVE_LOCALE_H
   setlocale(LC_ALL, "");
-
+#endif
   
   if (argc > 1)
     test_data_dir = argv[1];
index b425ae7..37b68ba 100644 (file)
@@ -20,6 +20,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+#include <config.h>
 #include "dbus-threads.h"
 #include "dbus-internals.h"
 #include "dbus-threads-internal.h"
index 1fd83f2..ba07ca5 100644 (file)
@@ -186,7 +186,9 @@ typedef struct
   
 } DBusThreadFunctions;
 
+DBUS_EXPORT
 dbus_bool_t  dbus_threads_init         (const DBusThreadFunctions *functions);
+DBUS_EXPORT
 dbus_bool_t  dbus_threads_init_default (void);
 
 /** @} */
index 0d92ca1..a1d6ce5 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-timeout.h"
 #include "dbus-list.h"
index a3c8f3e..44b9d78 100644 (file)
@@ -23,8 +23,6 @@
 #ifndef DBUS_TRANSPORT_PROTECTED_H
 #define DBUS_TRANSPORT_PROTECTED_H
 
-#include <config.h>
-
 #include <dbus/dbus-internals.h>
 #include <dbus/dbus-errors.h>
 #include <dbus/dbus-transport.h>
index dc9933d..1d4c2bf 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-connection-internal.h"
 #include "dbus-nonce.h"
@@ -72,7 +73,7 @@ free_watches (DBusTransport *transport)
 {
   DBusTransportSocket *socket_transport = (DBusTransportSocket*) transport;
 
-  _dbus_verbose ("%s start\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("start\n");
   
   if (socket_transport->read_watch)
     {
@@ -94,7 +95,7 @@ free_watches (DBusTransport *transport)
       socket_transport->write_watch = NULL;
     }
 
-  _dbus_verbose ("%s end\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("end\n");
 }
 
 static void
@@ -102,7 +103,7 @@ socket_finalize (DBusTransport *transport)
 {
   DBusTransportSocket *socket_transport = (DBusTransportSocket*) transport;
 
-  _dbus_verbose ("%s\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("\n");
   
   free_watches (transport);
 
@@ -176,8 +177,7 @@ check_read_watch (DBusTransport *transport)
   DBusTransportSocket *socket_transport = (DBusTransportSocket*) transport;
   dbus_bool_t need_read_watch;
 
-  _dbus_verbose ("%s: fd = %d\n",
-                 _DBUS_FUNCTION_NAME, socket_transport->fd);
+  _dbus_verbose ("fd = %d\n",socket_transport->fd);
   
   if (transport->connection == NULL)
     return;
@@ -700,8 +700,7 @@ do_reading (DBusTransport *transport)
   int total;
   dbus_bool_t oom;
 
-  _dbus_verbose ("%s: fd = %d\n", _DBUS_FUNCTION_NAME,
-                 socket_transport->fd);
+  _dbus_verbose ("fd = %d\n",socket_transport->fd);
   
   /* No messages without authentication! */
   if (!_dbus_transport_get_is_authenticated (transport))
@@ -983,7 +982,7 @@ socket_disconnect (DBusTransport *transport)
 {
   DBusTransportSocket *socket_transport = (DBusTransportSocket*) transport;
 
-  _dbus_verbose ("%s\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("\n");
   
   free_watches (transport);
   
@@ -1118,7 +1117,7 @@ socket_do_iteration (DBusTransport *transport,
        */
       if (flags & DBUS_ITERATION_BLOCK)
         {
-          _dbus_verbose ("unlock %s pre poll\n", _DBUS_FUNCTION_NAME);
+          _dbus_verbose ("unlock pre poll\n");
           _dbus_connection_unlock (transport->connection);
         }
       
@@ -1130,7 +1129,7 @@ socket_do_iteration (DBusTransport *transport,
 
       if (flags & DBUS_ITERATION_BLOCK)
         {
-          _dbus_verbose ("lock %s post poll\n", _DBUS_FUNCTION_NAME);
+          _dbus_verbose ("lock post poll\n");
           _dbus_connection_lock (transport->connection);
         }
       
@@ -1357,16 +1356,14 @@ _dbus_transport_new_for_tcp_socket (const char     *host,
                  host, port);
   
   transport = _dbus_transport_new_for_socket (fd, NULL, &address);
+  _dbus_string_free (&address);
   if (transport == NULL)
     {
       dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
       _dbus_close_socket (fd, NULL);
-      _dbus_string_free (&address);
       fd = -1;
     }
 
-  _dbus_string_free (&address);
-  
   return transport;
 
 error:
index 2f2a3da..6a713d1 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-connection-internal.h"
 #include "dbus-transport-unix.h"
index 1545c71..faaf1bd 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-connection-internal.h"
 #include "dbus-transport-socket.h"
index d8f34ee..f33dc60 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-transport-protected.h"
 #include "dbus-transport-unix.h"
 #include "dbus-transport-socket.h"
@@ -474,7 +475,7 @@ _dbus_transport_unref (DBusTransport *transport)
   transport->refcount -= 1;
   if (transport->refcount == 0)
     {
-      _dbus_verbose ("%s: finalizing\n", _DBUS_FUNCTION_NAME);
+      _dbus_verbose ("finalizing\n");
       
       _dbus_assert (transport->vtable->finalize != NULL);
       
@@ -493,7 +494,7 @@ _dbus_transport_unref (DBusTransport *transport)
 void
 _dbus_transport_disconnect (DBusTransport *transport)
 {
-  _dbus_verbose ("%s start\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("start\n");
   
   _dbus_assert (transport->vtable->disconnect != NULL);
   
@@ -504,7 +505,7 @@ _dbus_transport_disconnect (DBusTransport *transport)
   
   transport->disconnected = TRUE;
 
-  _dbus_verbose ("%s end\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("end\n");
 }
 
 /**
@@ -541,14 +542,14 @@ auth_via_unix_user_function (DBusTransport *transport)
   unix_user_data = transport->unix_user_data;
   uid = _dbus_credentials_get_unix_uid (auth_identity);
               
-  _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("unlock\n");
   _dbus_connection_unlock (connection);
 
   allow = (* unix_user_function) (connection,
                                   uid,
                                   unix_user_data);
               
-  _dbus_verbose ("lock %s post unix user function\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("lock post unix user function\n");
   _dbus_connection_lock (connection);
 
   if (allow)
@@ -592,14 +593,14 @@ auth_via_windows_user_function (DBusTransport *transport)
       return FALSE;
     }
                 
-  _dbus_verbose ("unlock %s\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("unlock\n");
   _dbus_connection_unlock (connection);
 
   allow = (* windows_user_function) (connection,
                                      windows_sid,
                                      windows_user_data);
               
-  _dbus_verbose ("lock %s post windows user function\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("lock post windows user function\n");
   _dbus_connection_lock (connection);
 
   if (allow)
@@ -745,7 +746,7 @@ _dbus_transport_get_is_authenticated (DBusTransport *transport)
 
               if (transport->expected_guid == NULL)
                 {
-                  _dbus_verbose ("No memory to complete auth in %s\n", _DBUS_FUNCTION_NAME);
+                  _dbus_verbose ("No memory to complete auth\n");
                   return FALSE;
                 }
             }
@@ -980,7 +981,7 @@ _dbus_transport_do_iteration (DBusTransport  *transport,
                                        timeout_milliseconds);
   _dbus_transport_unref (transport);
 
-  _dbus_verbose ("%s end\n", _DBUS_FUNCTION_NAME);
+  _dbus_verbose ("end\n");
 }
 
 static dbus_bool_t
index f75d1bc..8679f74 100644 (file)
@@ -20,6 +20,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+#include <config.h>
 #define DBUS_USERDB_INCLUDES_PRIVATE 1
 #include "dbus-userdb.h"
 #include "dbus-test.h"
index 5a153c6..4a317ba 100644 (file)
@@ -20,6 +20,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+#include <config.h>
 #define DBUS_USERDB_INCLUDES_PRIVATE 1
 #include "dbus-userdb.h"
 #include "dbus-hash.h"
@@ -226,7 +227,8 @@ static DBusString process_homedir;
 static void
 shutdown_system_db (void *data)
 {
-  _dbus_user_database_unref (system_db);
+  if (system_db != NULL)
+    _dbus_user_database_unref (system_db);
   system_db = NULL;
   _dbus_string_free (&process_username);
   _dbus_string_free (&process_homedir);
@@ -345,7 +347,8 @@ _dbus_user_database_flush_system (void)
 {
   _dbus_user_database_lock_system ();
    
-  _dbus_user_database_flush (system_db);
+   if (system_db != NULL)
+    _dbus_user_database_flush (system_db);
 
   _dbus_user_database_unlock_system ();
 }
index 5c571e8..6d7c0ae 100644 (file)
@@ -20,6 +20,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+#include <config.h>
 #include "dbus-uuidgen.h"
 #include "dbus-internals.h"
 #include "dbus-string.h"
index 484dbbe..5acb202 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include "dbus-internals.h"
 #include "dbus-watch.h"
 #include "dbus-list.h"
@@ -649,8 +650,7 @@ dbus_watch_handle (DBusWatch    *watch,
 #ifndef DBUS_DISABLE_CHECKS
   if (watch->fd < 0 || watch->flags == 0)
     {
-      _dbus_warn_check_failed ("%s: Watch is invalid, it should have been removed\n",
-                               _DBUS_FUNCTION_NAME);
+      _dbus_warn_check_failed ("Watch is invalid, it should have been removed\n");
       return TRUE;
     }
 #endif
index e1c8e4d..f76335f 100644 (file)
@@ -1,5 +1,7 @@
 EXTRA_DIST=                                    \
        busconfig.dtd                           \
+       diagram.png                             \
+       diagram.svg                             \
        introspect.dtd                          \
        dbus-faq.xml                            \
        dbus-specification.xml                  \
@@ -7,7 +9,8 @@ EXTRA_DIST=                                     \
        dbus-tutorial.xml                       \
        dcop-howto.txt                          \
        file-boilerplate.c                      \
-       introspect.xsl
+       introspect.xsl                          \
+       system-activation.txt
 
 HTML_FILES=                                    \
        dbus-faq.html                           \
@@ -18,7 +21,7 @@ HTML_FILES=                                   \
 if DBUS_XML_DOCS_ENABLED
 all-local: $(HTML_FILES)
 
-EXTRA_DIST += $(HTML_FILES) system-activation.txt
+EXTRA_DIST += $(HTML_FILES)
 
 dbus-specification.html: dbus-specification.xml
        $(XMLTO) html-nochunks $<
index 901e665..71574c0 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" standalone="no"?>
+<?xml version="1.0" standalone="no" ?>
 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
 [
@@ -7,8 +7,8 @@
 <article id="index">
   <articleinfo>
     <title>D-Bus Specification</title>
-    <releaseinfo>Version 0.12</releaseinfo>
-    <date>7 November 2006</date>
+    <releaseinfo>Version 0.13</releaseinfo>
+    <date>23 Dezember 2009</date>
     <authorgroup>
       <author>
        <firstname>Havoc</firstname>
           directory.
         </para>
         <para>
+          Throughout this description, "hex encoding" must output the digits
+          from a to f in lower-case; the digits A to F must not be used
+          in the DBUS_COOKIE_SHA1 mechanism.
+        </para>
+        <para>
           Authentication proceeds as follows:
           <itemizedlist>
             <listitem>
        length path name.  Names which were shorter than the fixed length
        would be padded by Nul bytes.
       </para>
+      <para>
+        Unix domain sockets are not available on windows. 
+      </para>
+      <sect3 id="transports-unix-domain-sockets-addresses">
+        <title>Server Address Format</title>
+        <para> 
+          Unix domain socket addresses are identified by the "unix:" prefix 
+          and support the following key/value pairs:
+        </para>
+        <informaltable>
+         <tgroup cols="3">
+          <thead>
+           <row>
+            <entry>Name</entry>
+            <entry>Values</entry>
+            <entry>Description</entry>
+           </row>
+          </thead>
+          <tbody>
+           <row>
+            <entry>path</entry>
+            <entry>(path)</entry>
+            <entry>path of the unix domain socket. If set, the "tmpdir" and "abstract" key must not be set.</entry>
+          </row>
+          <row>
+            <entry>tmpdir</entry>
+            <entry>(path)</entry>
+            <entry>temporary directory in which a socket file with a random file name starting with 'dbus-' will be created by the server. This key can only be used in server addresses, not in client addresses. If set, the "path" and "abstract" key must not be set.</entry>
+          </row>
+          <row>
+            <entry>abstract</entry>
+            <entry>(string)</entry>
+            <entry>unique string (path) in the abstract namespace. If set, the "path" or "tempdir" key must not be set.</entry>
+          </row>
+        </tbody>
+        </tgroup>
+       </informaltable>
+      </sect3>
     </sect2>
     <sect2 id="transports-tcp-sockets">
       <title>TCP Sockets</title>
       <para>
-        The tcp transport provides TCP/IP based connections between clients 
+        The tcp transport provides TCP/IP based connections between clients
         located on the same or different hosts. 
       </para>
-      <para>  
-        Windows notes: Because the tcp stack on windows do not provide sending 
-        credentials over a tcp connection, the EXTERNAL authentification 
-        mechanismus do not work. 
-      </para>
       <para>
         Using tcp transport without any additional secure authentification mechanismus 
         over a network is unsecure. 
       </para>
+      <para>  
+        Windows notes: Because of the tcp stack on windows does not provide sending 
+        credentials over a tcp connection, the EXTERNAL authentification 
+        mechanismus does not work. 
+      </para>
+      <sect3 id="transports-tcp-sockets-addresses">
+        <title>Server Address Format</title>
+        <para> 
+         TCP/IP socket addresses are identified by the "tcp:" prefix 
+         and support the following key/value pairs:
+        </para>
+        <informaltable>
+         <tgroup cols="3">
+          <thead>
+           <row>
+            <entry>Name</entry>
+            <entry>Values</entry>
+            <entry>Description</entry>
+           </row>
+          </thead>
+          <tbody>
+           <row>
+            <entry>host</entry>
+            <entry>(string)</entry>
+            <entry>dns name or ip address</entry>
+          </row>
+          <row>
+           <entry>port</entry>
+           <entry>(number)</entry>
+           <entry>The tcp port the server will open. A zero value let the server 
+            choose a free port provided from the underlaying operating system. 
+            libdbus is able to retrieve the real used port from the server.  
+           </entry>
+          </row>
+          <row>
+           <entry>family</entry>
+           <entry>(string)</entry>
+           <entry>If set, provide the type of socket family either "ipv4" or "ipv6". If unset, the family is unspecified.</entry>
+          </row>
+         </tbody>
+        </tgroup>
+       </informaltable>
+      </sect3>
     </sect2>
     <sect2 id="transports-nonce-tcp-sockets">
       <title>Nonce-secured TCP Sockets</title>
         key-value pair and send it over the socket. After that, the
         transport behaves like an unsecured tcp transport.
       </para>
+      <sect3 id="transports-nonce-tcp-sockets-addresses">
+        <title>Server Address Format</title>
+        <para> 
+         Nonce TCP/IP socket addresses uses the "nonce-tcp:" prefix 
+         and support the following key/value pairs:
+        </para>
+        <informaltable>
+         <tgroup cols="3">
+          <thead>
+           <row>
+            <entry>Name</entry>
+            <entry>Values</entry>
+            <entry>Description</entry>
+           </row>
+          </thead>
+          <tbody>
+           <row>
+            <entry>host</entry>
+            <entry>(string)</entry>
+            <entry>dns name or ip address</entry>
+          </row>
+          <row>
+           <entry>port</entry>
+           <entry>(number)</entry>
+           <entry>The tcp port the server will open. A zero value let the server 
+            choose a free port provided from the underlaying operating system. 
+            libdbus is able to retrieve the real used port from the server.  
+           </entry>
+          </row>
+          <row>
+           <entry>family</entry>
+           <entry>(string)</entry>
+           <entry>If set, provide the type of socket family either "ipv4" or "ipv6". If unset, the family is unspecified.</entry>
+          </row>
+          <row>
+           <entry>noncefile</entry>
+           <entry>(path)</entry>
+           <entry>file location containing the secret</entry>
+          </row>
+         </tbody>
+        </tgroup>
+       </informaltable>
+      </sect3>
     </sect2>
 
   </sect1>
index ead399b..ec0b9d8 100644 (file)
@@ -61,7 +61,9 @@ test_sleep_forever_SOURCES =                  \
 decode_gcov_SOURCES=                           \
        decode-gcov.c
 
-TEST_LIBS=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_TEST_LIBS)
+# When any programs are not linked to libdbus-internal, fix this.
+AM_CPPFLAGS=-DDBUS_STATIC_BUILD
+TEST_LIBS=$(top_builddir)/dbus/libdbus-internal.la $(DBUS_TEST_LIBS)
 
 test_service_LDADD=libdbus-testutils.la $(TEST_LIBS)
 test_service_LDFLAGS=@R_DYNAMIC_LDFLAG@
index 8ed4432..f85bd20 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 
+#include <config.h>
 #include <dbus/dbus.h>
 #include <sys/stat.h>
 #include <sys/types.h>
diff --git a/test/data/valid-config-files-system/debug-allow-all-fail.conf.cmake b/test/data/valid-config-files-system/debug-allow-all-fail.conf.cmake
new file mode 100644 (file)
index 0000000..0c73d8c
--- /dev/null
@@ -0,0 +1,16 @@
+<!-- Bus that listens on a debug pipe and doesn't create any restrictions -->
+
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+  <listen>@TEST_LISTEN@</listen>
+  <type>system</type>
+  <servicehelper>@TEST_LAUNCH_HELPER_BINARY@</servicehelper>
+  <servicedir>@TEST_INVALID_SERVICE_SYSTEM_DIR@</servicedir>
+  <policy context="default">
+    <allow send_interface="*"/>
+    <allow receive_interface="*"/>
+    <allow own="*"/>
+    <allow user="*"/>
+  </policy>
+</busconfig>
diff --git a/test/data/valid-config-files-system/debug-allow-all-pass.conf.cmake b/test/data/valid-config-files-system/debug-allow-all-pass.conf.cmake
new file mode 100644 (file)
index 0000000..d46ec18
--- /dev/null
@@ -0,0 +1,16 @@
+<!-- Bus that listens on a debug pipe and doesn't create any restrictions -->
+
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+  <listen>@TEST_LISTEN@</listen>
+  <type>system</type>
+  <servicehelper>@TEST_LAUNCH_HELPER_BINARY@</servicehelper>
+  <servicedir>@TEST_VALID_SERVICE_SYSTEM_DIR@</servicedir>
+  <policy context="default">
+    <allow send_interface="*"/>
+    <allow receive_interface="*"/>
+    <allow own="*"/>
+    <allow user="*"/>
+  </policy>
+</busconfig>
index f26afd3..3b2a152 100644 (file)
@@ -27,6 +27,7 @@
  *
  */
 
+#include <config.h>
 #define DBUS_COMPILATION /* cheat */
 #include <dbus/dbus-list.h>
 #include <dbus/dbus-string.h>
index d8e72d1..11dc56d 100644 (file)
@@ -16,57 +16,52 @@ if DBUS_BUILD_TESTS
 
 ## we use noinst_PROGRAMS not check_PROGRAMS for TESTS so that we
 ## build even when not doing "make check"
-noinst_PROGRAMS=test-names test-pending-call-dispatch test-pending-call-timeout test-threads-init test-ids test-shutdown test-privserver test-privserver-client
-
-test_names_SOURCES=                            \
-       test-names.c
-
-test_names_LDADD=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_TEST_LIBS)
-test_names_LDFLAGS=@R_DYNAMIC_LDFLAG@
+noinst_PROGRAMS=test-pending-call-dispatch test-pending-call-timeout test-threads-init test-ids test-shutdown test-privserver test-privserver-client
 
+AM_CPPFLAGS = -DDBUS_STATIC_BUILD
 test_pending_call_dispatch_SOURCES =           \
        test-pending-call-dispatch.c
 
-test_pending_call_dispatch_LDADD=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_TEST_LIBS)
+test_pending_call_dispatch_LDADD=$(top_builddir)/dbus/libdbus-internal.la $(DBUS_TEST_LIBS)
 test_pending_call_dispatch_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
 test_pending_call_timeout_SOURCES =            \
        test-pending-call-timeout.c
 
-test_pending_call_timeout_LDADD=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_TEST_LIBS)
+test_pending_call_timeout_LDADD=$(top_builddir)/dbus/libdbus-internal.la $(DBUS_TEST_LIBS)
 test_pending_call_timeout_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
 test_threads_init_SOURCES =            \
        test-threads-init.c
 
-test_threads_init_LDADD=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_TEST_LIBS)
+test_threads_init_LDADD=$(top_builddir)/dbus/libdbus-internal.la $(DBUS_TEST_LIBS)
 test_threads_init_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
 test_ids_SOURCES =            \
        test-ids.c
 
-test_ids_LDADD=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_TEST_LIBS)
+test_ids_LDADD=$(top_builddir)/dbus/libdbus-internal.la $(DBUS_TEST_LIBS)
 test_ids_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
 test_shutdown_SOURCES =            \
        test-shutdown.c
 
 test_shutdown_CFLAGS=
-test_shutdown_LDADD=$(top_builddir)/dbus/libdbus-convenience.la ../libdbus-testutils.la $(DBUS_TEST_LIBS)
+test_shutdown_LDADD=$(top_builddir)/dbus/libdbus-internal.la ../libdbus-testutils.la $(DBUS_TEST_LIBS)
 test_shutdown_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
 test_privserver_SOURCES =            \
        test-privserver.c
 
 test_privserver_CFLAGS=
-test_privserver_LDADD=$(top_builddir)/dbus/libdbus-convenience.la ../libdbus-testutils.la $(DBUS_TEST_LIBS)
+test_privserver_LDADD=$(top_builddir)/dbus/libdbus-internal.la ../libdbus-testutils.la $(DBUS_TEST_LIBS)
 test_privserver_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
 test_privserver_client_SOURCES =            \
        test-privserver-client.c
 
 test_privserver_client_CFLAGS=
-test_privserver_client_LDADD=$(top_builddir)/dbus/libdbus-convenience.la ../libdbus-testutils.la $(DBUS_TEST_LIBS)
+test_privserver_client_LDADD=$(top_builddir)/dbus/libdbus-internal.la ../libdbus-testutils.la $(DBUS_TEST_LIBS)
 test_privserver_client_LDFLAGS=@R_DYNAMIC_LDFLAG@
 
 endif
index 4eb2425..832ce0a 100755 (executable)
@@ -33,9 +33,6 @@ fi
 echo "running test-ids"
 ${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-ids || die "test-ids failed"
 
-echo "running test-names"
-${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-names || die "test-names failed"
-
 echo "running test-pending-call-dispatch"
 ${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-pending-call-dispatch || die "test-pending-call-dispatch failed"
 
index f08d4ac..8f63d04 100644 (file)
@@ -1,3 +1,4 @@
+#include <config.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/test/name-test/test-names.c b/test/name-test/test-names.c
deleted file mode 100644 (file)
index b09f363..0000000
+++ /dev/null
@@ -1,565 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dbus/dbus.h>
-#include <dbus/dbus-connection-internal.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#define REMOVE_CONNECTION 0
-#define ADD_CONNECTION 1
-#define ALLOW_REPLACEMENT DBUS_NAME_FLAG_ALLOW_REPLACEMENT
-#define REPLACE_EXISTING DBUS_NAME_FLAG_REPLACE_EXISTING
-#define DO_NOT_QUEUE DBUS_NAME_FLAG_DO_NOT_QUEUE
-
-#define PRIMARY_OWNER DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER
-#define IN_QUEUE DBUS_REQUEST_NAME_REPLY_IN_QUEUE
-#define EXISTS DBUS_REQUEST_NAME_REPLY_EXISTS
-#define ALREADY_OWNER DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER
-
-#define RELEASED DBUS_RELEASE_NAME_REPLY_RELEASED
-#define NON_EXISTANT DBUS_RELEASE_NAME_REPLY_NON_EXISTENT
-#define NOT_OWNER DBUS_RELEASE_NAME_REPLY_NOT_OWNER
-
-#define NUM_CONN 4
-#define TEST_NAME "org.freedesktop.DBus.TestSuite.NameTest"
-#define NUM_TRIES_TIL_FAIL 15
-
-typedef struct {
-  int command;
-
-  int connection_number;
-  dbus_uint32_t flags;
-
-  dbus_uint32_t expected_result;
-
-  int expected_queue[NUM_CONN];
-} CommandAndResult;
-
-static CommandAndResult test_data[] = {
-  {ADD_CONNECTION, 0, ALLOW_REPLACEMENT | REPLACE_EXISTING,
-   PRIMARY_OWNER, {0,-1,-1,-1}},
-  {ADD_CONNECTION, 0, REPLACE_EXISTING,
-   ALREADY_OWNER, {0,-1,-1,-1}},
-  {ADD_CONNECTION, 1, ALLOW_REPLACEMENT | REPLACE_EXISTING,
-   IN_QUEUE, {0,1,-1,-1}},
-  {REMOVE_CONNECTION, 0, 0,
-   RELEASED, {1,-1,-1,-1}},
-  {ADD_CONNECTION, 0, REPLACE_EXISTING | DO_NOT_QUEUE,
-   PRIMARY_OWNER, {0,1,-1,-1}},
-  {ADD_CONNECTION, 2, ALLOW_REPLACEMENT,
-   IN_QUEUE, {0,1,2,-1}},
-  {ADD_CONNECTION, 2, ALLOW_REPLACEMENT | REPLACE_EXISTING,
-   IN_QUEUE, {0,2,1,-1}},
-  {ADD_CONNECTION, 0, ALLOW_REPLACEMENT | DO_NOT_QUEUE,
-   ALREADY_OWNER, {0,2,1,-1}},
-  {ADD_CONNECTION, 1, ALLOW_REPLACEMENT | REPLACE_EXISTING,
-   PRIMARY_OWNER, {1,2,-1,-1}},
-  {ADD_CONNECTION, 0, REPLACE_EXISTING,
-   PRIMARY_OWNER, {0,1,2,-1}},
-  {ADD_CONNECTION, 2, DO_NOT_QUEUE,
-   EXISTS, {0,1,-1,-1}},
-  {REMOVE_CONNECTION, 2, 0,
-   NOT_OWNER, {0,1,-1,-1}},
-  {ADD_CONNECTION, 3, 0,
-   IN_QUEUE, {0,1,3,-1}},
-  {ADD_CONNECTION, 0, ALLOW_REPLACEMENT,
-   ALREADY_OWNER, {0,1,3,-1}},
-  {ADD_CONNECTION, 2, ALLOW_REPLACEMENT,
-   IN_QUEUE, {0,1,3,2}}
-};
-
-static dbus_bool_t
-check_connection (DBusConnection *conn,
-                  int iteration,
-                  DBusConnection *uniq_conn[NUM_CONN])
-{
-  DBusMessage *reply;
-  DBusMessage *method;
-  DBusError error;
-  char **list;
-  int len, i;
-  const char *name;
-
-  reply = NULL;
-  method = NULL;
-  list = NULL;
-
-  dbus_error_init (&error);
-
-  name = TEST_NAME;
-  method = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
-                                         DBUS_PATH_DBUS,
-                                         DBUS_INTERFACE_DBUS,
-                                         "ListQueuedOwners");
-
-  if (method == NULL)
-    goto out;
-
-  if (!dbus_message_append_args (method,
-                                 DBUS_TYPE_STRING, &name,
-                                 DBUS_TYPE_INVALID))
-    {
-      fprintf (stderr, "Error appending args\n") ;
-      goto out;
-    }
-
-  reply = dbus_connection_send_with_reply_and_block (conn,
-                                                     method,
-                                                     -1,
-                                                     &error);
-
-  if (reply == NULL)
-    {
-      fprintf (stderr, "Error calling ListQueuedOwners: %s\n", error.message);
-      dbus_error_free (&error);
-      goto out;
-    }
-
-
-
-  if (!dbus_message_get_args (reply,
-                              &error,
-                              DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
-                              &list, &len,
-                              DBUS_TYPE_INVALID))
-    {
-      fprintf (stderr, "Error getting args: %s\n", error.message);
-      dbus_error_free (&error);
-      goto out;
-    }
-
-  printf ("Iteration %i: ", iteration);
-
-  if (len > NUM_CONN)
-    {
-      fprintf (stderr, "There are %i connections in the queue,"
-               " we are only expecting up to %i connections!\n",
-               len,
-               NUM_CONN);
-      goto out;
-    }
-
-  for (i = 0; i < len; i++)
-    {
-      int expected_conn_num;
-      const char *expected_uname;
-
-      if (i > 0)
-        printf (", ");
-
-      printf ("%s", list[i]);
-
-      expected_conn_num = test_data[iteration].expected_queue[i];
-
-      if (expected_conn_num == -1)
-        {
-          fprintf (stderr,
-                   "\nDid not expect this last connection"
-                   " to be in the queue!\n");
-          goto out;
-        }
-
-      expected_uname =
-        dbus_bus_get_unique_name (uniq_conn[expected_conn_num]);
-
-      if (strcmp (list[i], expected_uname) != 0)
-        {
-          fprintf (stderr,
-                   "\n%s expected but %s is in the queue!\n",
-                   expected_uname,
-                   list[i]);
-
-          goto out;
-        }
-    }
-
-  printf ("\n");
-
-  dbus_message_unref (method);
-  dbus_message_unref (reply);
-  dbus_free_string_array (list);
-  return TRUE;
-
- out:
-  if (method != NULL)
-    dbus_message_unref (method);
-
-  if (reply != NULL)
-    dbus_message_unref (reply);
-
-  if (list != NULL)
-    dbus_free_string_array (list);
-
-  return FALSE;
-}
-
-static dbus_bool_t
-match_acquired_or_lost_signal (DBusConnection *conn, const char *member, const char *name)
-{
-  int tries;
-  DBusMessage *msg;
-  const char *interface = "org.freedesktop.DBus";
-
-  for (tries = 0; tries < NUM_TRIES_TIL_FAIL; tries++)
-    {
-      _dbus_connection_lock (conn);
-      _dbus_connection_do_iteration_unlocked (conn,
-                                              DBUS_ITERATION_DO_READING |
-                                              DBUS_ITERATION_DO_WRITING |
-                                              DBUS_ITERATION_BLOCK,
-                                              0);
-      _dbus_connection_unlock (conn);
-      msg = dbus_connection_pop_message (conn);
-      if (msg != NULL)
-        {
-          if (dbus_message_is_signal (msg,
-                                      interface,
-                                      member))
-            {
-              const char *n;
-              DBusError error;
-              dbus_error_init (&error);
-
-              dbus_message_get_args (msg, &error, DBUS_TYPE_STRING, &n, DBUS_TYPE_INVALID);
-
-              if (dbus_error_is_set (&error))
-                {
-                  fprintf (stderr, "Error getting args: %s\n", error.message);
-                  dbus_error_free (&error);
-                  dbus_message_unref (msg);
-                  return FALSE;
-                }
-
-              if (strcmp (n, name) == 0)
-                {
-                  dbus_message_unref (msg);
-                  break;
-                }
-            }
-          dbus_message_unref (msg);
-        }
-    }
-
-  if (tries == NUM_TRIES_TIL_FAIL)
-    {
-      fprintf (stderr, "Did not receive the expected %s.%s signal!!!\n", interface, member);
-      return FALSE;
-    }
-
-  return TRUE;
-}
-
-static dbus_bool_t
-match_name_owner_changed_signal (DBusConnection *conn,
-                                 const char     *bus_name,
-                                 const char     *lost_name,
-                                 const char     *acquired_name)
-{
-  int tries;
-  DBusMessage *msg;
-
-  for (tries = 0; tries < NUM_TRIES_TIL_FAIL; tries++)
-    {
-      _dbus_connection_lock (conn);
-      _dbus_connection_do_iteration_unlocked (conn,
-                                              DBUS_ITERATION_DO_READING |
-                                              DBUS_ITERATION_DO_WRITING |
-                                              DBUS_ITERATION_BLOCK,
-                                              0);
-      _dbus_connection_unlock (conn);
-      msg = dbus_connection_pop_message (conn);
-
-      if (msg != NULL)
-        {
-          if (dbus_message_is_signal (msg,
-                                      "org.freedesktop.DBus",
-                                      "NameOwnerChanged"))
-            {
-              const char *n;
-              const char *ln;
-              const char *an;
-              DBusError error;
-              dbus_error_init (&error);
-
-              dbus_message_get_args (msg, &error, DBUS_TYPE_STRING, &n, DBUS_TYPE_STRING, &ln, DBUS_TYPE_STRING, &an, DBUS_TYPE_INVALID);
-
-              if (dbus_error_is_set (&error))
-                {
-                  fprintf (stderr, "Error getting args: %s\n", error.message);
-                  dbus_error_free (&error);
-                  dbus_message_unref (msg);
-                  return FALSE;
-                }
-
-              if (strcmp (n, bus_name) == 0)
-                {
-                  if ((lost_name == NULL && strcmp (ln, "") == 0)
-                      || strcmp (lost_name, ln) == 0)
-                    {
-                      if ((acquired_name == NULL && strcmp (an, "") == 0)
-                          || strcmp (acquired_name, an) == 0)
-                        {
-                          dbus_message_unref (msg);
-                          break;
-                        }
-                      else
-                        {
-                          fprintf (stderr, "Error: name %s was expected to be acquired but we got %s instead\n", acquired_name, an);
-                          dbus_message_unref (msg);
-                          return FALSE;
-                        }
-                    }
-                  else
-                    {
-                      fprintf (stderr, "Error: name %s was expected to be lost but we got %s instead\n", lost_name, ln);
-                      dbus_message_unref (msg);
-                      return FALSE;
-                    }
-                }
-            }
-          dbus_message_unref (msg);
-        }
-    }
-
-  if (tries == NUM_TRIES_TIL_FAIL)
-    {
-      fprintf (stderr, "Did not receive the expected NameOwnerChanged signal, bus_name %s lost_name %s acquired_name %s\n",
-               bus_name ? bus_name : "(null)",
-               lost_name ? lost_name : "(null)",
-               acquired_name ? acquired_name : "(null)");
-      return FALSE;
-    }
-
-  return TRUE;
-}
-
-
-static dbus_bool_t
-check_signals (DBusConnection *monitor,
-               int iteration,
-               DBusConnection *conn[NUM_CONN])
-{
-  DBusConnection *lost_conn = NULL;
-  DBusConnection *acquired_conn = NULL;
-  const char *lost_name;
-  const char *acquired_name;
-
-  if (iteration == 0)
-    {
-      int i;
-      i = test_data[iteration].expected_queue[0];
-
-      if (i >= 0)
-        acquired_conn = conn[i];
-    }
-  else
-    {
-      int i;
-      i = test_data[iteration - 1].expected_queue[0];
-
-      if (i >= 0)
-        lost_conn = conn[i];
-
-      i = test_data[iteration].expected_queue[0];
-
-      if (i >= 0)
-        acquired_conn = conn[i];
-
-      if (acquired_conn == lost_conn)
-        acquired_conn = lost_conn = NULL;
-    }
-
-  lost_name = lost_conn == NULL? NULL :
-    dbus_bus_get_unique_name (lost_conn);
-
-  acquired_name = acquired_conn == NULL? NULL :
-    dbus_bus_get_unique_name (acquired_conn);
-
-  if (lost_name != NULL)
-    if (!match_acquired_or_lost_signal (lost_conn,
-                                        "NameLost",
-                                        TEST_NAME))
-      return FALSE;
-
-  if (acquired_name != NULL)
-    if (!match_acquired_or_lost_signal (acquired_conn,
-                                        "NameAcquired",
-                                        TEST_NAME))
-      return FALSE;
-
-  if (acquired_name != NULL || lost_name != NULL)
-    if (!match_name_owner_changed_signal (monitor,
-                                          TEST_NAME,
-                                          lost_name,
-                                          acquired_name))
-      return FALSE;
-
-  return TRUE;
-}
-
-int
-main (int argc, char *argv[])
-{
-  DBusConnection *conn[NUM_CONN];
-  DBusConnection *monitor;
-  DBusError error;
-  int i;
-  int test_data_len;
-
-  test_data_len = sizeof (test_data) / sizeof (CommandAndResult);
-
-  dbus_error_init (&error);
-
-  conn[0] = dbus_bus_get_private (DBUS_BUS_SESSION, &error);
-  if (dbus_error_is_set (&error))
-    {
-      fprintf (stderr, "*** Failed to open connection 0 to session bus: %s\n",
-               error.message);
-      dbus_error_free (&error);
-      return 1;
-    }
-
-  if (!match_acquired_or_lost_signal (conn[0],
-                                      "NameAcquired",
-                                      dbus_bus_get_unique_name (conn[0])))
-    return 1;
-
-  conn[1] = dbus_bus_get_private (DBUS_BUS_SESSION, &error);
-  if (dbus_error_is_set (&error))
-    {
-      fprintf (stderr, "*** Failed to open connection 1 to session bus: %s\n",
-               error.message);
-      dbus_error_free (&error);
-      return 1;
-    }
-
-  if (!match_acquired_or_lost_signal (conn[1],
-                                      "NameAcquired",
-                                      dbus_bus_get_unique_name (conn[1])))
-    return 1;
-
-
-  conn[2] = dbus_bus_get_private (DBUS_BUS_SESSION, &error);
-  if (dbus_error_is_set (&error))
-    {
-      fprintf (stderr, "*** Failed to open connection 2 to session bus: %s\n",
-               error.message);
-      dbus_error_free (&error);
-      return 1;
-    }
-
-  if (!match_acquired_or_lost_signal (conn[2],
-                                      "NameAcquired",
-                                      dbus_bus_get_unique_name (conn[2])))
-    return 1;
-
-
-  conn[3] = dbus_bus_get_private (DBUS_BUS_SESSION, &error);
-  if (dbus_error_is_set (&error))
-    {
-      fprintf (stderr, "*** Failed to open connection 3 to session bus: %s\n",
-               error.message);
-      dbus_error_free (&error);
-      return 1;
-    }
-
-  if (!match_acquired_or_lost_signal (conn[3],
-                                      "NameAcquired",
-                                      dbus_bus_get_unique_name (conn[3])))
-    return 1;
-
-
-  monitor = dbus_bus_get (DBUS_BUS_SESSION, &error);
-  if (dbus_error_is_set (&error))
-    {
-      fprintf (stderr, "*** Failed to open monitoring connection to session bus: %s\n",
-               error.message);
-      dbus_error_free (&error);
-      return 1;
-    }
-
-  if (!match_acquired_or_lost_signal (monitor,
-                                      "NameAcquired",
-                                      dbus_bus_get_unique_name (monitor)))
-    return 1;
-
-  dbus_bus_add_match (monitor, "", &error);
-  if (dbus_error_is_set (&error))
-    {
-      fprintf (stderr, "*** Failed to set filter on monitoring connection: %s\n",
-               error.message);
-      dbus_error_free (&error);
-      return 1;
-    }
-
-
-  for (i = 0; i < NUM_CONN; i++)
-    dbus_connection_set_exit_on_disconnect (conn[i], FALSE);
-
-  for (i = 0; i < test_data_len; i++)
-    {
-      dbus_uint32_t result;
-      result = 0;
-
-      if (test_data[i].command == ADD_CONNECTION)
-        {
-          result = dbus_bus_request_name (conn[test_data[i].connection_number],
-                                          TEST_NAME,
-                                          test_data[i].flags,
-                                          &error);
-
-          if (dbus_error_is_set (&error))
-            {
-              fprintf (stderr, "Error on addition in iteration %i: %s\n", i, error.message);
-              dbus_error_free (&error);
-              return 1;
-            }
-        }
-      else if (test_data[i].command == REMOVE_CONNECTION)
-        {
-          result = dbus_bus_release_name (conn[test_data[i].connection_number],
-                                          TEST_NAME,
-                                          &error);
-          if (dbus_error_is_set (&error))
-            {
-              fprintf (stderr, "*** Failed to remove connection %i in iteration %i: %s\n",
-                       test_data[i].connection_number,
-                       i,
-                       error.message);
-              dbus_error_free (&error);
-              return 1;
-            }
-        }
-      else
-        {
-          fprintf (stderr, "Command #%i not a valid command!\n", test_data[i].command);
-          return 1;
-        }
-
-
-      if (result != test_data[i].expected_result)
-        {
-          fprintf (stderr, "Results recived (%i) are not the expected results (%i) in iteration %i\n",
-                   result,
-                   test_data[i].expected_result,
-                   i);
-          return 1;
-        }
-
-      if (!check_connection (monitor, i, conn))
-        {
-          fprintf (stderr, "Failed at iteration %i\n", i);
-          return 1;
-        }
-
-      if (!check_signals (monitor, i, conn))
-        {
-          fprintf (stderr, "Failed at iteration %i\n", i);
-          return 1;
-        }
-    }
-
-  return 0;
-}
index 5472649..57582d4 100644 (file)
@@ -7,6 +7,7 @@
 * and blocking.
 **/
 
+#include <config.h>
 #include <dbus/dbus.h>
 #include <dbus/dbus-sysdeps.h>
 #include <stdio.h>
index 53a0c3a..381113b 100644 (file)
@@ -3,6 +3,7 @@
 * specific and infinite timeout.
 **/
 
+#include <config.h>
 #include <dbus/dbus.h>
 #include <dbus/dbus-sysdeps.h>
 #include <stdio.h>
index 5af470a..d02eea8 100644 (file)
@@ -1,3 +1,4 @@
+#include <config.h>
 #include "../test-utils.h"
 
 static void
index c814001..100e0cf 100644 (file)
@@ -1,3 +1,4 @@
+#include <config.h>
 #include "../test-utils.h"
 
 static void
index e76c1ea..526c1cb 100644 (file)
@@ -1,4 +1,5 @@
 
+#include <config.h>
 #include "../test-utils.h"
 
 static DBusLoop *loop;
index 8cda413..5e22852 100644 (file)
@@ -2,6 +2,7 @@
  * Test to make sure late thread initialization works
  */
 
+#include <config.h>
 #include <dbus/dbus.h>
 #include <dbus/dbus-sysdeps.h>
 #include <stdio.h>
index c013467..b479a9c 100644 (file)
@@ -1,3 +1,4 @@
+#include <config.h>
 #include <stdio.h>
 #include <stdlib.h>
 #define DBUS_COMPILATION
index 68bd333..f1a5505 100644 (file)
@@ -1,3 +1,4 @@
+#include <config.h>
 #include <dbus/dbus.h>
 
 #define DBUS_COMPILATION /* cheat and use dbus-sysdeps */
index abb9586..f335818 100644 (file)
@@ -1,5 +1,4 @@
 /* This is a process that just exits with a failure code */
-
 int
 main (int argc, char **argv)
 {
index e618e99..2736635 100644 (file)
@@ -1,4 +1,4 @@
-
+#include <config.h>
 #include "test-utils.h"
 
 static DBusLoop *loop;
index bf4d964..329a21f 100644 (file)
@@ -1,7 +1,9 @@
 /* This is simply a process that segfaults */
 #include <config.h>
 #include <stdlib.h>
+#ifdef HAVE_SIGNAL_H
 #include <signal.h>
+#endif
 
 #ifdef HAVE_SETRLIMIT
 #include <sys/resource.h>
index 2bd2dbc..6627ea7 100644 (file)
@@ -1,3 +1,4 @@
+#include <config.h>
 
 #include "test-utils.h"
 #ifdef HAVE_UNISTD_H
@@ -411,7 +412,9 @@ main (int    argc,
       name = argv[1];
 #ifndef DBUS_WIN
       do_fork = strcmp (argv[2], "fork") == 0;
-#endif      
+#else
+      do_fork = FALSE;
+#endif
     }
 
   /* The bare minimum for simulating a program "daemonizing"; the intent
@@ -428,6 +431,7 @@ main (int    argc,
       sleep (1);
     }
 #endif
+
   dbus_error_init (&error);
   connection = dbus_bus_get (DBUS_BUS_STARTER, &error);
   if (connection == NULL)
index 21801c7..57c1612 100644 (file)
@@ -1,3 +1,4 @@
+#include <config.h>
 
 #include "test-utils.h"
 
index d875cc9..eda20cd 100644 (file)
@@ -1,3 +1,4 @@
+#include <config.h>
 #include "test-utils.h"
 
 typedef struct
index 90d8776..3e1e55e 100644 (file)
@@ -1,6 +1,5 @@
 #ifndef TEST_UTILS_H
 #define TEST_UTILS_H
-#include <config.h>
 #ifndef DBUS_COMPILATION
 #define DBUS_COMPILATION /* Cheat and use private stuff */
 #endif
index 9cf3d72..906d129 100644 (file)
@@ -4,10 +4,10 @@ INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_X_CFLAGS) -DDBUS_LOCALEDIR
 
 extra_bin_programs=
 if DBUS_UNIX
-extra_bin_programs += dbus-launch dbus-cleanup-sockets dbus-uuidgen
+extra_bin_programs += dbus-cleanup-sockets dbus-uuidgen
 endif
 
-bin_PROGRAMS=dbus-send dbus-monitor $(extra_bin_programs)
+bin_PROGRAMS=dbus-launch dbus-send dbus-monitor $(extra_bin_programs)
 
 dbus_send_SOURCES=                             \
        dbus-print-message.c                    \
@@ -19,10 +19,16 @@ dbus_monitor_SOURCES=                               \
        dbus-print-message.c                    \
        dbus-print-message.h
 
+if DBUS_WIN
+dbus_launch_SOURCES=                           \
+       dbus-launch-win.c                       \
+       dbus-launch.h
+else
 dbus_launch_SOURCES=                           \
        dbus-launch.c                           \
        dbus-launch-x11.c                       \
        dbus-launch.h
+endif
 
 dbus_cleanup_sockets_SOURCES=                  \
        dbus-cleanup-sockets.c
index 352a28d..140238e 100644 (file)
@@ -20,6 +20,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+#include <config.h>
 #include <windows.h>
 #include <stdio.h>
 #include <string.h>
@@ -90,12 +91,9 @@ int main(int argc,char **argv)
       showConsole = 1; 
 #endif
   GetModuleFileName(NULL,dbusDaemonPath,sizeof(dbusDaemonPath));
-
-#ifdef _DEBUG
-      daemon_name = "dbus-daemond.exe";
-#else
-      daemon_name = "dbus-daemon.exe";
-#endif
+  
+  daemon_name = DBUS_DAEMON_NAME ".exe";
+  
   if ((p = _mbsrchr (dbusDaemonPath, '\\'))) 
     {
       *(p+1)= '\0';
@@ -134,7 +132,7 @@ int main(int argc,char **argv)
   if (result == 0) 
     {
       if (verbose)
-          fprintf(stderr, "Could not start dbus-daemon error=%d",GetLastError());
+          fprintf(stderr, "Could not start " DBUS_DAEMON_NAME ". error=%d",GetLastError());
       return 4;
     }
    
index 56d7f74..fe49222 100644 (file)
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "dbus-launch.h"
 
 #ifdef DBUS_BUILD_X11
@@ -459,5 +461,7 @@ x11_handle_event (void)
 }  
 
 #else
+void dummy_dbus_launch_x11 (void);
+
 void dummy_dbus_launch_x11 (void) { }
 #endif
index 912afba..ec4c9a5 100644 (file)
@@ -21,6 +21,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "dbus-launch.h"
 #include <stdlib.h>
 #include <ctype.h>
@@ -405,6 +407,7 @@ signal_handler (int sig)
 #ifdef SIGHUP
     case SIGHUP:
 #endif
+    case SIGINT:
     case SIGTERM:
       got_sighup = TRUE;
       break;
@@ -429,6 +432,7 @@ kill_bus_when_session_ends (void)
   act.sa_flags   = 0;
   sigaction (SIGHUP,  &act, NULL);
   sigaction (SIGTERM,  &act, NULL);
+  sigaction (SIGINT,  &act, NULL);
   
 #ifdef DBUS_BUILD_X11
   x11_init();
index d0d0617..8220bb8 100644 (file)
@@ -24,7 +24,6 @@
 #ifndef DBUS_LAUNCH_H
 #define DBUS_LAUNCH_H
 
-#include <config.h>
 #include <sys/types.h>
 
 #ifndef TRUE
index 873108b..c368128 100644 (file)
@@ -33,8 +33,6 @@
 
 #include <time.h>
 
-#include <signal.h>
-
 #include "dbus-print-message.h"
 
 #ifdef DBUS_WIN
@@ -214,6 +212,13 @@ main (int argc, char *argv[])
   
   int i = 0, j = 0, numFilters = 0;
   char **filters = NULL;
+
+  /* Set stdout to be unbuffered; this is basically so that if people
+   * do dbus-monitor > file, then send SIGINT via Control-C, they
+   * don't lose the last chunk of messages.
+   */
+  setvbuf (stdout, NULL, _IOLBF, 0);
+
   for (i = 1; i < argc; i++)
     {
       char *arg = argv[i];
@@ -339,10 +344,7 @@ main (int argc, char *argv[])
     exit (1);
   }
 
-  /* we handle SIGINT so exit() is reached and flushes stdout */
-  signal (SIGINT, sigint_handler);
-  while (dbus_connection_read_write_dispatch(connection, -1)
-          && !sigint_received)
+  while (dbus_connection_read_write_dispatch(connection, -1))
     ;
   exit (0);
  lose:
index 8a8e351..0b8ca26 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#include <config.h>
 #include "dbus-print-message.h"
 
 #include <stdlib.h>
+#include "config.h"
 
 static const char*
 type_to_name (int message_type)
@@ -225,7 +228,11 @@ print_iter (DBusMessageIter *iter, dbus_bool_t literal, int depth)
          {
            dbus_int64_t val;
            dbus_message_iter_get_basic (iter, &val);
-           printf ("int64 %lld\n", val);
+#ifdef DBUS_INT64_PRINTF_MODIFIER
+        printf ("int64 %" DBUS_INT64_PRINTF_MODIFIER "d\n", val);
+#else
+        printf ("int64 (omitted)\n");
+#endif
            break;
          }
 
@@ -233,7 +240,11 @@ print_iter (DBusMessageIter *iter, dbus_bool_t literal, int depth)
          {
            dbus_uint64_t val;
            dbus_message_iter_get_basic (iter, &val);
-           printf ("uint64 %llu\n", val);
+#ifdef DBUS_INT64_PRINTF_MODIFIER
+        printf ("uint64 %" DBUS_INT64_PRINTF_MODIFIER "u\n", val);
+#else
+        printf ("uint64 (omitted)\n");
+#endif
            break;
          }