From 1d29b70de605ad1d291fdd7d5d2caea0f5996c56 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 7 Jul 2019 16:50:40 +0200 Subject: cracklib: return built-in cracklib dictionary when queried It's sometimes usuful to know the dictionary used by the cracklib invocation hidden in libpwquality (for example to gracefully disable such checks in some environments that lack the dictionary file automatically). Right now, this is not queriable however, and libpwquality only allows to query the setting configured in libpwquality itself. Let's fix that and expose the cracklib built-in path, too, if nothing was explicitly configured otherwise. --- src/settings.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/settings.c b/src/settings.c index 922a55d..4bb414f 100644 --- a/src/settings.c +++ b/src/settings.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "pwquality.h" #include "pwqprivate.h" @@ -467,7 +468,10 @@ pwquality_get_str_value(pwquality_settings_t *pwq, int setting, const char **val *value = pwq->bad_words; break; case PWQ_SETTING_DICT_PATH: - *value = pwq->dict_path; + if (pwq->dict_path) + *value = pwq->dict_path; + else + *value = GetDefaultCracklibDict(); break; default: return PWQ_ERROR_NON_STR_SETTING; -- cgit v1.2.1