"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/test-utils-glib.c" between
dbus-1.13.12.tar.xz and dbus-1.13.14.tar.xz

About: D-Bus is an inter-process communication (IPC) system, allowing multiple, concurrently-running applications to communicate with one another. D-Bus supplies both a system daemon and a per-user-login-session daemon. Development version.

test-utils-glib.c  (dbus-1.13.12.tar.xz):test-utils-glib.c  (dbus-1.13.14.tar.xz)
skipping to change at line 129 skipping to change at line 129
{ {
g_test_skip ("cannot use alternative uid when not uid 0"); g_test_skip ("cannot use alternative uid when not uid 0");
return NULL; return NULL;
} }
switch (user) switch (user)
{ {
case TEST_USER_ROOT: case TEST_USER_ROOT:
break; break;
case TEST_USER_ROOT_DROP_TO_MESSAGEBUS:
case TEST_USER_MESSAGEBUS: case TEST_USER_MESSAGEBUS:
pwd = getpwnam (DBUS_USER); pwd = getpwnam (DBUS_USER);
if (pwd == NULL) if (pwd == NULL)
{ {
gchar *message = g_strdup_printf ("user '%s' does not exist", gchar *message = g_strdup_printf ("user '%s' does not exist",
DBUS_USER); DBUS_USER);
g_test_skip (message); g_test_skip (message);
g_free (message); g_free (message);
return NULL; return NULL;
} }
if (user == TEST_USER_ROOT_DROP_TO_MESSAGEBUS)
{
/* Let the dbus-daemon start as root and drop privileges
* itself */
pwd = NULL;
}
break; break;
case TEST_USER_OTHER: case TEST_USER_OTHER:
pwd = getpwnam (DBUS_TEST_USER); pwd = getpwnam (DBUS_TEST_USER);
if (pwd == NULL) if (pwd == NULL)
{ {
gchar *message = g_strdup_printf ("user '%s' does not exist", gchar *message = g_strdup_printf ("user '%s' does not exist",
DBUS_TEST_USER); DBUS_TEST_USER);
skipping to change at line 204 skipping to change at line 212
#ifdef DBUS_UNIX #ifdef DBUS_UNIX
child_setup, (gpointer) pwd, child_setup, (gpointer) pwd,
#else #else
NULL, NULL, NULL, NULL,
#endif #endif
daemon_pid, daemon_pid,
NULL, /* child's stdin = /dev/null */ NULL, /* child's stdin = /dev/null */
&address_fd, &address_fd,
NULL, /* child's stderr = our stderr */ NULL, /* child's stderr = our stderr */
&error); &error);
/* The other uid might not have access to our build directory if we
* are building in /root or something */
if (user != TEST_USER_ME &&
g_getenv ("DBUS_TEST_UNINSTALLED") != NULL &&
error != NULL &&
error->domain == G_SPAWN_ERROR &&
(error->code == G_SPAWN_ERROR_CHDIR ||
error->code == G_SPAWN_ERROR_ACCES ||
error->code == G_SPAWN_ERROR_PERM))
{
g_prefix_error (&error, "Unable to launch %s as other user: ",
binary);
g_test_skip (error->message);
g_clear_error (&error);
return NULL;
}
g_assert_no_error (error); g_assert_no_error (error);
g_ptr_array_free (argv, TRUE); g_ptr_array_free (argv, TRUE);
g_strfreev (envp); g_strfreev (envp);
address = g_string_new (NULL); address = g_string_new (NULL);
/* polling until the dbus-daemon writes out its address is a bit stupid, /* polling until the dbus-daemon writes out its address is a bit stupid,
* but at least it's simple, unlike dbus-launch... in principle we could * but at least it's simple, unlike dbus-launch... in principle we could
* use select() here, but life's too short */ * use select() here, but life's too short */
skipping to change at line 402 skipping to change at line 428
break; break;
case TEST_USER_MESSAGEBUS: case TEST_USER_MESSAGEBUS:
username = DBUS_USER; username = DBUS_USER;
break; break;
case TEST_USER_OTHER: case TEST_USER_OTHER:
username = DBUS_TEST_USER; username = DBUS_TEST_USER;
break; break;
/* TEST_USER_ROOT_DROP_TO_MESSAGEBUS is only meaningful for
* test_get_dbus_daemon(), not as a client */
case TEST_USER_ROOT_DROP_TO_MESSAGEBUS:
g_return_val_if_reached (FALSE);
case TEST_USER_ME: case TEST_USER_ME:
default: default:
g_return_val_if_reached (FALSE); g_return_val_if_reached (FALSE);
} }
if (getresuid (&ruid, &euid, &suid) != 0) if (getresuid (&ruid, &euid, &suid) != 0)
g_error ("getresuid: %s", g_strerror (errno)); g_error ("getresuid: %s", g_strerror (errno));
if (ruid != 0 || euid != 0 || suid != 0) if (ruid != 0 || euid != 0 || suid != 0)
{ {
skipping to change at line 448 skipping to change at line 479
switch (user) switch (user)
{ {
case TEST_USER_ROOT: case TEST_USER_ROOT:
case TEST_USER_MESSAGEBUS: case TEST_USER_MESSAGEBUS:
case TEST_USER_OTHER: case TEST_USER_OTHER:
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
"setresuid() not available, or unsure about " "setresuid() not available, or unsure about "
"credentials-passing semantics on this platform"); "credentials-passing semantics on this platform");
return FALSE; return FALSE;
/* TEST_USER_ROOT_DROP_TO_MESSAGEBUS is only meaningful for
* test_get_dbus_daemon(), not as a client */
case TEST_USER_ROOT_DROP_TO_MESSAGEBUS:
g_return_val_if_reached (FALSE);
case TEST_USER_ME: case TEST_USER_ME:
default: default:
g_return_val_if_reached (FALSE); g_return_val_if_reached (FALSE);
} }
#endif #endif
} }
/* Undo the effect of a successful call to become_other_user() */ /* Undo the effect of a successful call to become_other_user() */
static void static void
 End of changes. 5 change blocks. 
0 lines changed or deleted 36 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)