839
839
load_passwd_file ()
841
gchar *data, **lines;
841
gchar *path, *data, **lines;
844
g_file_get_contents (g_getenv ("LIGHTDM_TEST_PASSWD_FILE"), &data, NULL, NULL);
844
path = g_build_filename (g_getenv ("LIGHTDM_TEST_ROOT"), "etc", "passwd", NULL);
845
g_file_get_contents (path, &data, NULL, NULL);
845
847
lines = g_strsplit (data, "\n", -1);
1180
1182
GMainLoop *loop;
1181
1183
gchar *greeter = NULL, *script_name, *config_file, *path, *path1, *path2, *ld_preload, *ld_library_path, *home_dir;
1182
GString *passwd_data;
1184
GString *passwd_data, *group_data;
1183
1185
GSource *status_source;
1184
1186
gchar cwd[1024];
1185
1187
GError *error = NULL;
1288
1290
quit (EXIT_FAILURE);
1290
1292
g_chmod (temp_dir, 0755);
1293
g_setenv ("LIGHTDM_TEST_ROOT", temp_dir, TRUE);
1292
1295
/* Set up a skeleton file system */
1293
1296
g_mkdir_with_parents (g_strdup_printf ("%s/etc", temp_dir), 0755);
1372
1374
{"multi-info-prompt","password", TRUE, "Multi Info Prompt", NULL, NULL, NULL, NULL, 1022},
1373
1375
/* This account uses two factor authentication */
1374
1376
{"two-factor", "password", TRUE, "Two Factor", NULL, NULL, NULL, NULL, 1023},
1377
/* This account has a special group */
1378
{"group-member", "password", TRUE, "Group Member", NULL, NULL, NULL, NULL, 1024},
1375
1379
{NULL, NULL, FALSE, NULL, NULL, NULL, NULL, NULL, 0}
1377
1381
passwd_data = g_string_new ("");
1382
group_data = g_string_new ("");
1379
1384
for (i = 0; users[i].user_name; i++)
1426
1431
g_key_file_free (dmrc_file);
1433
/* Add passwd file entry */
1428
1434
g_string_append_printf (passwd_data, "%s:%s:%d:%d:%s:%s/home/%s:/bin/sh\n", users[i].user_name, users[i].password, users[i].uid, users[i].uid, users[i].real_name, temp_dir, users[i].user_name);
1436
/* Add group file entry */
1437
g_string_append_printf (group_data, "%s:x:%d:%s\n", users[i].user_name, users[i].uid, users[i].user_name);
1430
path = g_build_filename (temp_dir, "passwd", NULL);
1431
g_setenv ("LIGHTDM_TEST_PASSWD_FILE", path, TRUE);
1439
path = g_build_filename (temp_dir, "etc", "passwd", NULL);
1432
1440
g_file_set_contents (path, passwd_data->str, -1, NULL);
1434
1442
g_string_free (passwd_data, TRUE);
1444
/* Add an extra test group */
1445
g_string_append_printf (group_data, "test-group:x:111:\n");
1447
path = g_build_filename (temp_dir, "etc", "group", NULL);
1448
g_file_set_contents (path, group_data->str, -1, NULL);
1450
g_string_free (group_data, TRUE);
1436
1452
/* Start D-Bus services */
1437
1453
if (!g_key_file_get_boolean (config, "test-runner-config", "disable-console-kit", NULL))
1438
1454
start_console_kit_daemon ();