*
* Written by Russ Allbery <eagle@eyrie.org>
* Copyright 2017, 2020 Russ Allbery <eagle@eyrie.org>
- * Copyright 2010, 2013, 2014
+ * Copyright 2010, 2013-2014
* The Board of Trustees of the Leland Stanford Junior University
*
- * See LICENSE for licensing terms.
+ * SPDX-License-Identifier: MIT
*/
#include <config.h>
char *path;
krb5_error_code code;
krb5_pwqual_vtable vtable = NULL;
- krb5_error_code (*init)(krb5_context, int, int, krb5_plugin_vtable);
+ pwqual_strength_initvt *init;
/* Load the module. */
path = test_file_path("../plugin/.libs/strength.so");
test_file_path_free(path);
/* Find the entry point function. */
- init = dlsym(*handle, "pwqual_strength_initvt");
+ init = (pwqual_strength_initvt *) dlsym(*handle, "pwqual_strength_initvt");
if (init == NULL)
bail("cannot get pwqual_strength_initvt symbol: %s", dlerror());
is_password_test(ctx, vtable, data, &principal_tests[i]);
# ifdef HAVE_CRACKLIB
- /* Run the CrackLib tests if CrackLib is available, otherwise skip them. */
- for (i = 0; i < ARRAY_SIZE(cracklib_tests); i++)
+ /*
+ * Run the CrackLib tests if CrackLib is available, otherwise skip them.
+ * If built with the system CrackLib, skip tests that are marked as only
+ * working with the tougher rules of our embedded CrackLib.
+ */
+ for (i = 0; i < ARRAY_SIZE(cracklib_tests); i++) {
+# ifdef HAVE_SYSTEM_CRACKLIB
+ if (cracklib_tests[i].skip_for_system_cracklib) {
+ skip_block(2, "not built with embedded CrackLib");
+ continue;
+ }
+# endif
is_password_test(ctx, vtable, data, &cracklib_tests[i]);
+ }
# else
count = ARRAY_SIZE(cracklib_tests);
skip_block(count * 2, "not built with CrackLib support");
bail("cannot find data/make-krb5-conf in the test suite");
setup_argv[1] = path;
setup_argv[2] = tmpdir;
- setup_argv[3] = NULL;
/* Point KRB5_CONFIG at the newly-generated krb5.conf file. */
basprintf(&krb5_config, "KRB5_CONFIG=%s/krb5.conf", tmpdir);
is_int(0, code, "Plugin initialization (krb5.conf dictionary)");
if (code != 0)
bail("cannot continue after plugin initialization failure");
- for (i = 0; i < ARRAY_SIZE(cracklib_tests); i++)
+ for (i = 0; i < ARRAY_SIZE(cracklib_tests); i++) {
+# ifdef HAVE_SYSTEM_CRACKLIB
+ if (cracklib_tests[i].skip_for_system_cracklib) {
+ skip_block(2, "not built with embedded CrackLib");
+ continue;
+ }
+# endif
is_password_test(ctx, vtable, data, &cracklib_tests[i]);
+ }
vtable->close(ctx, data);
/*
/* Otherwise mark the CrackLib tests as skipped. */
count = ARRAY_SIZE(cracklib_tests) + ARRAY_SIZE(length_tests);
- skip_block(count * 2 + 1, "not built with CrackLib support");
+ skip_block(count * 2 + 2, "not built with CrackLib support");
# endif /* !HAVE_CRACKLIB */