(kadm5_add_passwd_quality_verifier): if NULL is passed in, load defaults

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14801 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-04-15 11:13:12 +00:00
parent ffbe1f7b1a
commit bb3421e14d

View File

@@ -320,18 +320,15 @@ kadm5_setup_passwd_quality_check(krb5_context context,
#endif /* HAVE_DLOPEN */
}
krb5_error_code
kadm5_add_passwd_quality_verifier(krb5_context context,
const char *check_library)
{
#ifdef HAVE_DLOPEN
static krb5_error_code
add_verifier(krb5_context context, const char *check_library)
{
struct kadm5_pw_policy_verifier *v, **tmp;
void *handle;
int i;
if(check_library == NULL)
return EINVAL;
handle = dlopen(check_library, RTLD_NOW);
if(handle == NULL) {
krb5_warnx(context, "failed to open `%s'", check_library);
@@ -372,10 +369,42 @@ kadm5_add_passwd_quality_verifier(krb5_context context,
verifiers = tmp;
verifiers[num_verifiers] = v;
num_verifiers++;
#endif /* HAVE_DLOPEN */
return 0;
}
#endif
krb5_error_code
kadm5_add_passwd_quality_verifier(krb5_context context,
const char *check_library)
{
#ifdef HAVE_DLOPEN
if(check_library == NULL) {
krb5_error_code ret;
char **tmp;
tmp = krb5_config_get_strings(context, NULL,
"password_quality",
"policy-libraries",
NULL);
if(tmp == NULL)
return 0;
while(tmp) {
ret = add_verifier(context, *tmp);
if (ret)
return ret;
tmp++;
}
}
return add_verifier(context, check_library);
#else
return 0;
#endif /* HAVE_DLOPEN */
}
/*
*
*/