static void test_get_set(void **state) { #ifndef HAVE_OPENPAM const char *svc; #endif enum pamtest_err perr; struct pam_testcase tests[] = { pam_test(PAMTEST_OPEN_SESSION, PAM_SUCCESS), pam_test(PAMTEST_GETENVLIST, PAM_SUCCESS), }; (void) state; /* unused */ #ifndef HAVE_OPENPAM test_setenv("PAM_SERVICE"); #endif test_setenv("PAM_USER"); test_setenv("PAM_USER_PROMPT"); test_setenv("PAM_TTY"); test_setenv("PAM_RUSER"); test_setenv("PAM_RHOST"); test_setenv("PAM_AUTHTOK"); test_setenv("PAM_OLDAUTHTOK"); #ifdef PAM_XDISPLAY test_setenv("PAM_XDISPLAY"); #endif #ifdef PAM_AUTHTOK_TYPE test_setenv("PAM_AUTHTOK_TYPE"); #endif perr = run_pamtest("pwrap_get_set", "trinity", NULL, tests); assert_int_equal(perr, PAMTEST_ERR_OK); /* PAM_SERVICE is a special case, Linux's libpam lowercases it. * OpenPAM only allows PAM_SERVICE to be set by pam_start() */ #ifndef HAVE_OPENPAM svc = string_in_list(tests[1].case_out.envlist, "PAM_SERVICE"); assert_non_null(svc); assert_string_equal(svc, "test_pam_service"); #endif test_getenv(tests[1].case_out.envlist, "PAM_USER"); test_getenv(tests[1].case_out.envlist, "PAM_USER_PROMPT"); test_getenv(tests[1].case_out.envlist, "PAM_TTY"); test_getenv(tests[1].case_out.envlist, "PAM_RUSER"); test_getenv(tests[1].case_out.envlist, "PAM_RHOST"); test_getenv(tests[1].case_out.envlist, "PAM_AUTHTOK"); test_getenv(tests[1].case_out.envlist, "PAM_OLDAUTHTOK"); #ifdef PAM_XDISPLAY test_getenv(tests[1].case_out.envlist, "PAM_XDISPLAY"); #endif #ifdef PAM_AUTHTOK_TYPE test_getenv(tests[1].case_out.envlist, "PAM_AUTHTOK_TYPE"); #endif pamtest_free_env(tests[1].case_out.envlist); }
bool torture_local_replace(struct torture_context *ctx) { bool ret = true; ret &= test_ftruncate(); ret &= test_strlcpy(); ret &= test_strlcat(); ret &= test_mktime(); ret &= test_initgroups(); ret &= test_memmove(); ret &= test_strdup(); ret &= test_setlinebuf(); ret &= test_vsyslog(); ret &= test_timegm(); ret &= test_setenv(); ret &= test_strndup(); ret &= test_strnlen(); ret &= test_waitpid(); ret &= test_seteuid(); ret &= test_setegid(); ret &= test_asprintf(); ret &= test_snprintf(); ret &= test_vasprintf(); ret &= test_vsnprintf(); ret &= test_opendir(); ret &= test_readdir(); ret &= test_telldir(); ret &= test_seekdir(); ret &= test_dlopen(); ret &= test_chroot(); ret &= test_bzero(); ret &= test_strerror(); ret &= test_errno(); ret &= test_mkdtemp(); ret &= test_mkstemp(); ret &= test_pread(); ret &= test_pwrite(); ret &= test_getpass(); ret &= test_inet_ntoa(); ret &= test_strtoll(); ret &= test_strtoull(); ret &= test_va_copy(); ret &= test_FUNCTION(); ret &= test_MIN(); ret &= test_MAX(); ret &= test_socketpair(); ret &= test_strptime(); ret &= test_getifaddrs(); ret &= test_utime(); ret &= test_utimes(); ret &= test_memmem(); return ret; }
int run_main (int argc, ACE_TCHAR *argv[]) { int c = 0; int handle_inherit = 0; /* Disable inheritance by default */ bool ischild = false; ACE_TString temp_file_name; ACE_Get_Opt getopt (argc, argv, ACE_TEXT ("ch:f:")); while ((c = getopt ()) != -1) switch ((char) c) { case 'c': ischild = true; break; case 'h': handle_inherit = ACE_OS::atoi (getopt.opt_arg ()); break; case 'f': temp_file_name = getopt.opt_arg (); break; default: // Don't forgive bad options ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Bad option\n")), -1); break; } if (ischild) { ACE_TCHAR lognm[MAXPATHLEN]; int const mypid (ACE_OS::getpid ()); ACE_OS::snprintf (lognm, MAXPATHLEN, ACE_TEXT ("Process_Test-child-%d"), mypid); ACE_START_TEST (lognm); int result = check_temp_file (temp_file_name); // Check descriptor inheritance if (result == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Could not retrieve open files\n")), -1); else if (result == handle_inherit) result = 0; else ACE_ERROR ((LM_ERROR, ACE_TEXT ("Handle inheritance test failed with ") ACE_TEXT ("%d, expected %d\n"), result, handle_inherit)); ACE_END_LOG; return result; } else { ACE_START_TEST (ACE_TEXT ("Process_Test")); int status = test_setenv (); // The rest of this test relies on the ability to get a list of open // files for a process and examine each file descriptor to see which // file is open, matching against an expected opened file name. // Although most systems provide some mechanism to do this, the code // in this test uses Linux-specific techniques. Thus, although it // is possible to add the code for the checks on, for example, // HP-UX (pstat_getproc, pstat_getpathname) and // AIX (/proc is available, but there's no self and the fds are not links // to the opened file names), the code isn't here at present. #if defined (ACE_LACKS_FORK) || defined (ACE_LACKS_READLINK) || !defined(ACE_LINUX) ACE_ERROR ((LM_INFO, ACE_TEXT ("The remainder of this test is not supported on this platform\n"))); #else // Test handle inheritance set to true if (!status) status = run_parent (true); // ... and set to false if (!status) run_parent (false); #endif /* ! ACE_LACKS_FORK */ ACE_END_TEST; return status; } }