diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 8 | ||||
-rw-r--r-- | test/Makefile.in | 84 | ||||
-rw-r--r-- | test/dbus-daemon.c | 50 | ||||
-rw-r--r-- | test/fdpass.c | 25 | ||||
-rw-r--r-- | test/manual-paths.c | 73 | ||||
-rw-r--r-- | test/name-test/Makefile.in | 4 |
6 files changed, 213 insertions, 31 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index c2a55c9e..5d49b68e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -130,6 +130,10 @@ manual_dir_iter_SOURCES = manual-dir-iter.c manual_dir_iter_CPPFLAGS = $(static_cppflags) manual_dir_iter_LDADD = $(top_builddir)/dbus/libdbus-internal.la +manual_paths_SOURCES = manual-paths.c +manual_paths_CPPFLAGS = $(static_cppflags) +manual_paths_LDADD = $(top_builddir)/dbus/libdbus-internal.la + manual_tcp_SOURCES = manual-tcp.c manual_tcp_CPPFLAGS = $(static_cppflags) manual_tcp_LDADD = $(top_builddir)/dbus/libdbus-internal.la @@ -151,6 +155,10 @@ installable_manual_tests = \ manual-tcp \ $(NULL) +if DBUS_WIN +installable_manual_tests += manual-paths +endif + if DBUS_WITH_GLIB installable_tests += \ test-corrupt \ diff --git a/test/Makefile.in b/test/Makefile.in index 01a0879e..afad10f6 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -90,16 +90,17 @@ host_triplet = @host@ # or libdbus-testutils-internal and libdbus-internal - never both in the # same binary. @DBUS_WITH_DBUS_GLIB_TRUE@am__append_2 = libdbus-testutils.la -@DBUS_ENABLE_EMBEDDED_TESTS_FALSE@TESTS = $(am__EXEEXT_8) +@DBUS_ENABLE_EMBEDDED_TESTS_FALSE@TESTS = $(am__EXEEXT_9) @DBUS_ENABLE_EMBEDDED_TESTS_TRUE@TESTS = ../bus/test-bus$(EXEEXT) \ @DBUS_ENABLE_EMBEDDED_TESTS_TRUE@ ../dbus/test-dbus$(EXEEXT) \ @DBUS_ENABLE_EMBEDDED_TESTS_TRUE@ $(am__append_3) \ -@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@ $(am__EXEEXT_8) +@DBUS_ENABLE_EMBEDDED_TESTS_TRUE@ $(am__EXEEXT_9) @DBUS_ENABLE_EMBEDDED_TESTS_TRUE@@DBUS_UNIX_TRUE@am__append_3 = ../bus/test-bus-launch-helper$(EXEEXT) \ @DBUS_ENABLE_EMBEDDED_TESTS_TRUE@@DBUS_UNIX_TRUE@ ../bus/test-bus-system$(EXEEXT) -noinst_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_6) -testexec_PROGRAMS = $(am__EXEEXT_7) -@DBUS_WITH_GLIB_TRUE@am__append_4 = \ +noinst_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_7) +testexec_PROGRAMS = $(am__EXEEXT_8) +@DBUS_WIN_TRUE@am__append_4 = manual-paths +@DBUS_WITH_GLIB_TRUE@am__append_5 = \ @DBUS_WITH_GLIB_TRUE@ test-corrupt \ @DBUS_WITH_GLIB_TRUE@ test-dbus-daemon \ @DBUS_WITH_GLIB_TRUE@ test-dbus-daemon-eavesdrop \ @@ -115,16 +116,16 @@ testexec_PROGRAMS = $(am__EXEEXT_7) @DBUS_WITH_GLIB_TRUE@ test-uid-permissions \ @DBUS_WITH_GLIB_TRUE@ $(NULL) -@DBUS_WITH_GLIB_TRUE@am__append_5 = \ +@DBUS_WITH_GLIB_TRUE@am__append_6 = \ @DBUS_WITH_GLIB_TRUE@ manual-authz \ @DBUS_WITH_GLIB_TRUE@ $(NULL) -@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__append_6 = $(installable_tests) @DBUS_ENABLE_MODULAR_TESTS_TRUE@am__append_7 = $(installable_tests) -@DBUS_ENABLE_INSTALLED_TESTS_TRUE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__append_8 = $(installable_tests) $(installable_manual_tests) -@DBUS_ENABLE_INSTALLED_TESTS_TRUE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__append_9 = $(installable_test_meta) \ +@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__append_8 = $(installable_tests) +@DBUS_ENABLE_INSTALLED_TESTS_TRUE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__append_9 = $(installable_tests) $(installable_manual_tests) +@DBUS_ENABLE_INSTALLED_TESTS_TRUE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__append_10 = $(installable_test_meta) \ @DBUS_ENABLE_INSTALLED_TESTS_TRUE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@ $(installable_test_meta_with_config) -@DBUS_ENABLE_INSTALLED_TESTS_FALSE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__append_10 = $(installable_tests) $(installable_manual_tests) +@DBUS_ENABLE_INSTALLED_TESTS_FALSE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__append_11 = $(installable_tests) $(installable_manual_tests) subdir = test DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp $(top_srcdir)/test-driver @@ -188,13 +189,14 @@ libdbus_testutils_la_OBJECTS = $(am_libdbus_testutils_la_OBJECTS) @DBUS_WITH_GLIB_TRUE@ test-uid-permissions$(EXEEXT) am__EXEEXT_3 = test-shell$(EXEEXT) test-printf$(EXEEXT) \ $(am__EXEEXT_2) -@DBUS_WITH_GLIB_TRUE@am__EXEEXT_4 = manual-authz$(EXEEXT) -am__EXEEXT_5 = manual-dir-iter$(EXEEXT) manual-tcp$(EXEEXT) \ - $(am__EXEEXT_4) -@DBUS_ENABLE_INSTALLED_TESTS_FALSE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__EXEEXT_6 = $(am__EXEEXT_3) \ -@DBUS_ENABLE_INSTALLED_TESTS_FALSE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@ $(am__EXEEXT_5) -@DBUS_ENABLE_INSTALLED_TESTS_TRUE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__EXEEXT_7 = $(am__EXEEXT_3) \ -@DBUS_ENABLE_INSTALLED_TESTS_TRUE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@ $(am__EXEEXT_5) +@DBUS_WIN_TRUE@am__EXEEXT_4 = manual-paths$(EXEEXT) +@DBUS_WITH_GLIB_TRUE@am__EXEEXT_5 = manual-authz$(EXEEXT) +am__EXEEXT_6 = manual-dir-iter$(EXEEXT) manual-tcp$(EXEEXT) \ + $(am__EXEEXT_4) $(am__EXEEXT_5) +@DBUS_ENABLE_INSTALLED_TESTS_FALSE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__EXEEXT_7 = $(am__EXEEXT_3) \ +@DBUS_ENABLE_INSTALLED_TESTS_FALSE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@ $(am__EXEEXT_6) +@DBUS_ENABLE_INSTALLED_TESTS_TRUE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__EXEEXT_8 = $(am__EXEEXT_3) \ +@DBUS_ENABLE_INSTALLED_TESTS_TRUE@@DBUS_ENABLE_MODULAR_TESTS_TRUE@ $(am__EXEEXT_6) am__installdirs = "$(DESTDIR)$(testexecdir)" \ "$(DESTDIR)$(testmetadir)" PROGRAMS = $(noinst_PROGRAMS) $(testexec_PROGRAMS) @@ -207,6 +209,9 @@ am_manual_dir_iter_OBJECTS = \ manual_dir_iter_OBJECTS = $(am_manual_dir_iter_OBJECTS) manual_dir_iter_DEPENDENCIES = \ $(top_builddir)/dbus/libdbus-internal.la +am_manual_paths_OBJECTS = manual_paths-manual-paths.$(OBJEXT) +manual_paths_OBJECTS = $(am_manual_paths_OBJECTS) +manual_paths_DEPENDENCIES = $(top_builddir)/dbus/libdbus-internal.la am_manual_tcp_OBJECTS = manual_tcp-manual-tcp.$(OBJEXT) manual_tcp_OBJECTS = $(am_manual_tcp_OBJECTS) manual_tcp_DEPENDENCIES = $(top_builddir)/dbus/libdbus-internal.la @@ -331,8 +336,9 @@ am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libdbus_testutils_internal_la_SOURCES) \ $(libdbus_testutils_la_SOURCES) $(manual_authz_SOURCES) \ - $(manual_dir_iter_SOURCES) $(manual_tcp_SOURCES) \ - $(test_corrupt_SOURCES) $(test_dbus_daemon_SOURCES) \ + $(manual_dir_iter_SOURCES) $(manual_paths_SOURCES) \ + $(manual_tcp_SOURCES) $(test_corrupt_SOURCES) \ + $(test_dbus_daemon_SOURCES) \ $(test_dbus_daemon_eavesdrop_SOURCES) test-exit.c \ $(test_fdpass_SOURCES) $(test_loopback_SOURCES) \ $(test_marshal_SOURCES) $(test_monitor_SOURCES) test-names.c \ @@ -345,8 +351,8 @@ SOURCES = $(libdbus_testutils_internal_la_SOURCES) \ DIST_SOURCES = $(am__libdbus_testutils_internal_la_SOURCES_DIST) \ $(am__libdbus_testutils_la_SOURCES_DIST) \ $(manual_authz_SOURCES) $(manual_dir_iter_SOURCES) \ - $(manual_tcp_SOURCES) $(test_corrupt_SOURCES) \ - $(test_dbus_daemon_SOURCES) \ + $(manual_paths_SOURCES) $(manual_tcp_SOURCES) \ + $(test_corrupt_SOURCES) $(test_dbus_daemon_SOURCES) \ $(test_dbus_daemon_eavesdrop_SOURCES) test-exit.c \ $(test_fdpass_SOURCES) $(test_loopback_SOURCES) \ $(test_marshal_SOURCES) $(test_monitor_SOURCES) test-names.c \ @@ -580,7 +586,7 @@ am__set_TESTS_bases = \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) -@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__EXEEXT_8 = $(am__EXEEXT_3) +@DBUS_ENABLE_MODULAR_TESTS_TRUE@am__EXEEXT_9 = $(am__EXEEXT_3) TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver @@ -631,6 +637,8 @@ ACLOCAL = @ACLOCAL@ ADT_LIBS = @ADT_LIBS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPARMOR_CFLAGS = @APPARMOR_CFLAGS@ +APPARMOR_LIBS = @APPARMOR_LIBS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -685,6 +693,7 @@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ +DUCKTYPE = @DUCKTYPE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -774,6 +783,7 @@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ +YELP_BUILD = @YELP_BUILD@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -916,19 +926,22 @@ test_syslog_LDADD = libdbus-testutils-internal.la $(GLIB_LIBS) manual_dir_iter_SOURCES = manual-dir-iter.c manual_dir_iter_CPPFLAGS = $(static_cppflags) manual_dir_iter_LDADD = $(top_builddir)/dbus/libdbus-internal.la +manual_paths_SOURCES = manual-paths.c +manual_paths_CPPFLAGS = $(static_cppflags) +manual_paths_LDADD = $(top_builddir)/dbus/libdbus-internal.la manual_tcp_SOURCES = manual-tcp.c manual_tcp_CPPFLAGS = $(static_cppflags) manual_tcp_LDADD = $(top_builddir)/dbus/libdbus-internal.la EXTRA_DIST = dbus-test-runner $(in_data) $(static_data) testexecdir = $(libexecdir)/installed-tests/dbus testmetadir = $(datadir)/installed-tests/dbus -testmeta_DATA = $(am__append_9) -installable_tests = test-shell test-printf $(NULL) $(am__append_4) +testmeta_DATA = $(am__append_10) +installable_tests = test-shell test-printf $(NULL) $(am__append_5) installable_manual_tests = manual-dir-iter manual-tcp $(NULL) \ - $(am__append_5) + $(am__append_4) $(am__append_6) installable_test_meta = $(installable_tests:=.test) installable_test_meta_with_config = $(installable_tests:=_with_config.test) -installcheck_tests = $(am__append_7) +installcheck_tests = $(am__append_8) installcheck_environment = \ XDG_RUNTIME_DIR=@abs_top_builddir@/test/XDG_RUNTIME_DIR \ DBUS_TEST_DAEMON=$(DESTDIR)$(DBUS_DAEMONDIR)/dbus-daemon$(EXEEXT) \ @@ -1274,6 +1287,10 @@ manual-dir-iter$(EXEEXT): $(manual_dir_iter_OBJECTS) $(manual_dir_iter_DEPENDENC @rm -f manual-dir-iter$(EXEEXT) $(AM_V_CCLD)$(LINK) $(manual_dir_iter_OBJECTS) $(manual_dir_iter_LDADD) $(LIBS) +manual-paths$(EXEEXT): $(manual_paths_OBJECTS) $(manual_paths_DEPENDENCIES) $(EXTRA_manual_paths_DEPENDENCIES) + @rm -f manual-paths$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(manual_paths_OBJECTS) $(manual_paths_LDADD) $(LIBS) + manual-tcp$(EXEEXT): $(manual_tcp_OBJECTS) $(manual_tcp_DEPENDENCIES) $(EXTRA_manual_tcp_DEPENDENCIES) @rm -f manual-tcp$(EXEEXT) $(AM_V_CCLD)$(LINK) $(manual_tcp_OBJECTS) $(manual_tcp_LDADD) $(LIBS) @@ -1389,6 +1406,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbus_testutils_internal_la-test-utils.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/manual_authz-manual-authz.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/manual_dir_iter-manual-dir-iter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/manual_paths-manual-paths.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/manual_tcp-manual-tcp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-exit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-segfault.Po@am__quote@ @@ -1481,6 +1499,20 @@ manual_dir_iter-manual-dir-iter.obj: manual-dir-iter.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(manual_dir_iter_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o manual_dir_iter-manual-dir-iter.obj `if test -f 'manual-dir-iter.c'; then $(CYGPATH_W) 'manual-dir-iter.c'; else $(CYGPATH_W) '$(srcdir)/manual-dir-iter.c'; fi` +manual_paths-manual-paths.o: manual-paths.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(manual_paths_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT manual_paths-manual-paths.o -MD -MP -MF $(DEPDIR)/manual_paths-manual-paths.Tpo -c -o manual_paths-manual-paths.o `test -f 'manual-paths.c' || echo '$(srcdir)/'`manual-paths.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/manual_paths-manual-paths.Tpo $(DEPDIR)/manual_paths-manual-paths.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='manual-paths.c' object='manual_paths-manual-paths.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(manual_paths_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o manual_paths-manual-paths.o `test -f 'manual-paths.c' || echo '$(srcdir)/'`manual-paths.c + +manual_paths-manual-paths.obj: manual-paths.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(manual_paths_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT manual_paths-manual-paths.obj -MD -MP -MF $(DEPDIR)/manual_paths-manual-paths.Tpo -c -o manual_paths-manual-paths.obj `if test -f 'manual-paths.c'; then $(CYGPATH_W) 'manual-paths.c'; else $(CYGPATH_W) '$(srcdir)/manual-paths.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/manual_paths-manual-paths.Tpo $(DEPDIR)/manual_paths-manual-paths.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='manual-paths.c' object='manual_paths-manual-paths.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(manual_paths_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o manual_paths-manual-paths.obj `if test -f 'manual-paths.c'; then $(CYGPATH_W) 'manual-paths.c'; else $(CYGPATH_W) '$(srcdir)/manual-paths.c'; fi` + manual_tcp-manual-tcp.o: manual-tcp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(manual_tcp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT manual_tcp-manual-tcp.o -MD -MP -MF $(DEPDIR)/manual_tcp-manual-tcp.Tpo -c -o manual_tcp-manual-tcp.o `test -f 'manual-tcp.c' || echo '$(srcdir)/'`manual-tcp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/manual_tcp-manual-tcp.Tpo $(DEPDIR)/manual_tcp-manual-tcp.Po diff --git a/test/dbus-daemon.c b/test/dbus-daemon.c index 6b0e9b8a..26786fc2 100644 --- a/test/dbus-daemon.c +++ b/test/dbus-daemon.c @@ -28,6 +28,8 @@ #include "test-utils-glib.h" +#include <string.h> + #ifdef DBUS_UNIX # include <unistd.h> # include <sys/types.h> @@ -305,7 +307,8 @@ test_creds (Fixture *f, enum { SEEN_UNIX_USER = 1, SEEN_PID = 2, - SEEN_WINDOWS_SID = 4 + SEEN_WINDOWS_SID = 4, + SEEN_LINUX_SECURITY_LABEL = 8 } seen = 0; if (m == NULL) @@ -371,6 +374,28 @@ test_creds (Fixture *f, g_assert_not_reached (); #endif } + else if (g_strcmp0 (name, "WindowsSID") == 0) + { +#ifdef G_OS_WIN32 + gchar *sid; + guint32 result; + char *self_sid; + + g_assert (!(seen & SEEN_WINDOWS_SID)); + g_assert_cmpuint (dbus_message_iter_get_arg_type (&var_iter), ==, + DBUS_TYPE_STRING); + dbus_message_iter_get_basic (&var_iter, &sid); + g_message ("%s of this process is %s", name, sid); + if (_dbus_getsid (&self_sid, 0)) + { + g_assert_cmpstr (self_sid, ==, sid); + LocalFree(self_sid); + } + seen |= SEEN_WINDOWS_SID; +#else + g_assert_not_reached (); +#endif + } else if (g_strcmp0 (name, "ProcessID") == 0) { guint32 u32; @@ -389,6 +414,27 @@ test_creds (Fixture *f, #endif seen |= SEEN_PID; } + else if (g_strcmp0 (name, "LinuxSecurityLabel") == 0) + { +#ifdef __linux__ + gchar *label; + int len; + DBusMessageIter ay_iter; + + g_assert (!(seen & SEEN_LINUX_SECURITY_LABEL)); + g_assert_cmpuint (dbus_message_iter_get_arg_type (&var_iter), ==, + DBUS_TYPE_ARRAY); + dbus_message_iter_recurse (&var_iter, &ay_iter); + g_assert_cmpuint (dbus_message_iter_get_arg_type (&ay_iter), ==, + DBUS_TYPE_BYTE); + dbus_message_iter_get_fixed_array (&ay_iter, &label, &len); + g_message ("%s of this process is %s", name, label); + g_assert_cmpuint (strlen (label) + 1, ==, len); + seen |= SEEN_LINUX_SECURITY_LABEL; +#else + g_assert_not_reached (); +#endif + } dbus_message_iter_next (&arr_iter); } @@ -402,9 +448,7 @@ test_creds (Fixture *f, #endif #ifdef G_OS_WIN32 - /* FIXME: when implemented: g_assert (seen & SEEN_WINDOWS_SID); - */ #endif } diff --git a/test/fdpass.c b/test/fdpass.c index fa958da8..96f9427f 100644 --- a/test/fdpass.c +++ b/test/fdpass.c @@ -57,9 +57,11 @@ _DBUS_STATIC_ASSERT (MAX_MESSAGE_UNIX_FDS <= 253); /* Arbitrary; included here to avoid relying on the default. */ #define MAX_INCOMING_UNIX_FDS (MAX_MESSAGE_UNIX_FDS * 4) -/* Arbitrary, except that MAX_MESSAGE_UNIX_FDS * SOME_MESSAGES must be +/* Arbitrary, except that MAX_MESSAGE_UNIX_FDS * SOME_MESSAGES should be * less than the process's file descriptor limit. */ -#define SOME_MESSAGES 50 +#define SOME_MESSAGES 20 +/* To cover some situations on Linux we want this to be true. */ +_DBUS_STATIC_ASSERT (MAX_MESSAGE_UNIX_FDS * SOME_MESSAGES > 256); /* Linux won't allow more than 253 fds per sendmsg(). */ #define TOO_MANY_FDS 255 @@ -809,6 +811,25 @@ main (int argc, { test_init (&argc, &argv); +#ifdef HAVE_GETRLIMIT + { + struct rlimit lim; + + if (getrlimit (RLIMIT_NOFILE, &lim) < 0) + g_error ("Failed to get RLIMIT_NOFILE limit: %s", g_strerror (errno)); + + if (lim.rlim_cur != RLIM_INFINITY && + /* only run if we have a fairly generous margin of error + * for stdout, stderr, duplicates, the D-Bus connection, etc. */ + lim.rlim_cur < 2 * MAX_MESSAGE_UNIX_FDS * SOME_MESSAGES) + { + g_message ("not enough RLIMIT_NOFILE to run this test"); + /* Autotools exit code for "all skipped" */ + return 77; + } + } +#endif + g_test_add ("/relay", Fixture, NULL, setup, test_relay, teardown); g_test_add ("/limit", Fixture, NULL, setup, diff --git a/test/manual-paths.c b/test/manual-paths.c new file mode 100644 index 00000000..4ce3ffc7 --- /dev/null +++ b/test/manual-paths.c @@ -0,0 +1,73 @@ +/* + * Simple manual paths check + * + * syntax: manual-paths + * +*/ + +#include "config.h" +#include "dbus/dbus-list.h" +#include "dbus/dbus-internals.h" +#include "dbus/dbus-sysdeps.h" + +#include <stdio.h> + +dbus_bool_t print_install_root() +{ + char runtime_prefix[1000]; + + if (!_dbus_get_install_root(runtime_prefix, sizeof(runtime_prefix))) + { + fprintf(stderr, "dbus_get_install_root() failed\n"); + return FALSE; + } + fprintf(stdout, "dbus_get_install_root() returned '%s'\n", runtime_prefix); + return TRUE; +} + +dbus_bool_t print_service_dirs() +{ + DBusList *dirs; + DBusList *link; + dirs = NULL; + + if (!_dbus_get_standard_session_servicedirs (&dirs)) + _dbus_assert_not_reached ("couldn't get standard dirs"); + + while ((link = _dbus_list_pop_first_link (&dirs))) + { + printf ("default service dir: %s\n", (char *)link->data); + dbus_free (link->data); + _dbus_list_free_link (link); + } + dbus_free (dirs); + return TRUE; +} + +dbus_bool_t print_replace_install_prefix(const char *s) +{ + const char *s2 = _dbus_replace_install_prefix(s); + if (!s2) + return FALSE; + + fprintf(stdout, "replaced '%s' by '%s'\n", s, s2); + return TRUE; +} + +int +main (int argc, char **argv) +{ + if (!print_install_root()) + return -1; + + if (!print_service_dirs()) + return -2; + + if (!print_replace_install_prefix(DBUS_BINDIR "/dbus-daemon")) + return -3; + + if (!print_replace_install_prefix("c:\\Windows\\System32\\testfile")) + return -4; + + return 0; +} diff --git a/test/name-test/Makefile.in b/test/name-test/Makefile.in index 62357838..0b6ba20a 100644 --- a/test/name-test/Makefile.in +++ b/test/name-test/Makefile.in @@ -410,6 +410,8 @@ ACLOCAL = @ACLOCAL@ ADT_LIBS = @ADT_LIBS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPARMOR_CFLAGS = @APPARMOR_CFLAGS@ +APPARMOR_LIBS = @APPARMOR_LIBS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -464,6 +466,7 @@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ +DUCKTYPE = @DUCKTYPE@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -553,6 +556,7 @@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ +YELP_BUILD = @YELP_BUILD@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ |