win32: misc warning fixes
[platform/upstream/glib.git] / gio / gdbusaddress.c
index 36997b1..8c1d31c 100644 (file)
@@ -37,6 +37,7 @@
 #include "giostream.h"
 #include "gasyncresult.h"
 #include "gsimpleasyncresult.h"
+#include "glib-private.h"
 #include "gdbusprivate.h"
 #include "giomodule-priv.h"
 #include "gdbusdaemon.h"
@@ -450,7 +451,7 @@ _g_dbus_address_parse_entry (const gchar  *address_entry,
       g_set_error (error,
                    G_IO_ERROR,
                    G_IO_ERROR_INVALID_ARGUMENT,
-                   _("Address element `%s', does not contain a colon (:)"),
+                   _("Address element `%s' does not contain a colon (:)"),
                    address_entry);
       goto out;
     }
@@ -471,7 +472,7 @@ _g_dbus_address_parse_entry (const gchar  *address_entry,
           g_set_error (error,
                        G_IO_ERROR,
                        G_IO_ERROR_INVALID_ARGUMENT,
-                       _("Key/Value pair %d, `%s', in address element `%s', does not contain an equal sign"),
+                       _("Key/Value pair %d, `%s', in address element `%s' does not contain an equal sign"),
                        n,
                        kv_pair,
                        address_entry);
@@ -1022,6 +1023,14 @@ get_session_address_dbus_launch (GError **error)
   restore_dbus_verbose = FALSE;
   old_dbus_verbose = NULL;
 
+  /* Don't run binaries as root if we're setuid. */
+  if (GLIB_PRIVATE_CALL (g_check_setuid) ())
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                  _("Cannot spawn a message bus when setuid"));
+      goto out;
+    }
+
   machine_id = _g_dbus_get_machine_id (error);
   if (machine_id == NULL)
     {
@@ -1263,7 +1272,7 @@ publish_session_bus (const char *address)
 }
 
 static void
-unpublish_session_bus ()
+unpublish_session_bus (void)
 {
   HANDLE init_mutex;
 
@@ -1313,6 +1322,8 @@ idle_timeout_cb (GDBusDaemon *daemon, gpointer user_data)
   g_main_loop_quit (loop);
 }
 
+__declspec(dllexport) void CALLBACK g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow);
+
 __declspec(dllexport) void CALLBACK
 g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow)
 {
@@ -1324,8 +1335,6 @@ g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow
   if (g_getenv ("GDBUS_DAEMON_DEBUG") != NULL)
     open_console_window ();
 
-  g_type_init ();
-
   loop = g_main_loop_new (NULL, FALSE);
 
   address = "nonce-tcp:";