diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-07-07 16:50:40 +0200 |
---|---|---|
committer | Tomáš Mráz <t8m@users.noreply.github.com> | 2019-07-08 10:09:13 +0200 |
commit | 1d29b70de605ad1d291fdd7d5d2caea0f5996c56 (patch) | |
tree | f68b0b7f76154ac92ca51b8e7dcac8a1e823f617 | |
parent | 3e679423755e170e9049f11a75dbdbd7e69d84f6 (diff) | |
download | libpwquality-git-1d29b70de605ad1d291fdd7d5d2caea0f5996c56.tar.gz |
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.
-rw-r--r-- | src/settings.c | 6 |
1 files changed, 5 insertions, 1 deletions
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 <ctype.h> #include <errno.h> #include <dirent.h> +#include <crack.h> #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; |