pwquality: fix quality_check_password return value
authorDmitry V. Levin <ldv@strace.io>
Wed, 5 Jul 2023 08:00:00 +0000 (08:00 +0000)
committerDmitry V. Levin <ldv@strace.io>
Thu, 6 Jul 2023 10:59:41 +0000 (10:59 +0000)
commit7fc3f9c032cad0690c08fcdee190d83f1c7a6d53
treec4b4b10ef29fad85f8cf119f913204e11941c49c
parent29dd2e253c74c7ab2fed6fb6a67a87089197253f
pwquality: fix quality_check_password return value

quality_check_password() used to return the same value 0 in two
different cases: when pwq_allocate_context() failed with a
ERRNO_IS_NOT_SUPPORTED() code, and when pwquality_check() rejected the
password.  As result, users of quality_check_password() used to report
password weakness also in case when the underlying library was not
available.

Fix this by changing quality_check_password() to forward the
ERRNO_IS_NOT_SUPPORTED() code to its callers, and change the callers
to handle this case gracefully.
src/cryptenroll/cryptenroll-password.c
src/firstboot/firstboot.c
src/shared/pwquality-util.c