/* Load the plugin. */
verifier = load_plugin(&handle);
- /* Set up our krb5.conf with the dictionary configuration. */
+ /* Set up our krb5.conf with a basic configuration. */
setup_argv[0] = test_file_path("data/make-krb5-conf");
if (setup_argv[0] == NULL)
bail("cannot find data/make-krb5-conf in the test suite");
tmpdir = test_tmpdir();
setup_argv[1] = path;
setup_argv[2] = tmpdir;
- setup_argv[3] = (char *) "password_dictionary";
- basprintf(&setup_argv[4], "%s/data/dictionary", getenv("BUILD"));
- setup_argv[5] = NULL;
+ setup_argv[3] = NULL;
run_setup((const char **) setup_argv);
/* Point KRB5_CONFIG at the newly-generated krb5.conf file. */
putenv(krb5_config);
free(krb5_config_empty);
+ /* Run principal tests. */
+ for (i = 0; i < ARRAY_SIZE(principal_tests); i++)
+ is_password_test(verifier, &principal_tests[i]);
+
+#ifdef HAVE_CRACKLIB
+
+ /* Add CrackLib tests. */
+ setup_argv[3] = (char *) "password_dictionary";
+ basprintf(&setup_argv[4], "%s/data/dictionary", getenv("BUILD"));
+ setup_argv[5] = NULL;
+ run_setup((const char **) setup_argv);
+
/* Now, run all of the tests. */
for (i = 0; i < ARRAY_SIZE(cracklib_tests); i++)
is_password_test(verifier, &cracklib_tests[i]);
- for (i = 0; i < ARRAY_SIZE(principal_tests); i++)
- is_password_test(verifier, &principal_tests[i]);
/*
* Add length restrictions and a maximum length for CrackLib. This should
for (i = 0; i < ARRAY_SIZE(length_tests); i++)
is_password_test(verifier, &length_tests[i]);
+ /* Free the memory allocated for the CrackLib test. */
+ free(setup_argv[4]);
+
+#else
+
+ /* Otherwise, mark the CrackLib tests as skipped. */
+ count = ARRAY_SIZE(cracklib_tests) + ARRAY_SIZE(length_tests);
+ skip_block(count * 2, "not built with CDB support");
+
+#endif /* !HAVE_CRACKLIB */
+
/* Add simple character class restrictions. */
- setup_argv[5] = (char *) "minimum_different";
- setup_argv[6] = (char *) "8";
- setup_argv[7] = (char *) "require_ascii_printable";
+ setup_argv[3] = (char *) "minimum_different";
+ setup_argv[4] = (char *) "8";
+ setup_argv[5] = (char *) "require_ascii_printable";
+ setup_argv[6] = (char *) "true";
+ setup_argv[7] = (char *) "require_non_letter";
setup_argv[8] = (char *) "true";
- setup_argv[9] = (char *) "require_non_letter";
- setup_argv[10] = (char *) "true";
- setup_argv[11] = NULL;
+ setup_argv[9] = NULL;
run_setup((const char **) setup_argv);
/* Run the simple character class tests. */
is_password_test(verifier, &letter_tests[i]);
/* Add complex character class restrictions and remove the dictionary. */
- free(setup_argv[4]);
setup_argv[3] = (char *) "require_classes";
setup_argv[4] = (char *) "8-19:lower,upper 8-15:digit 8-11:symbol 24-24:3";
setup_argv[5] = NULL;