summaryrefslogtreecommitdiff
path: root/src/shared/libcrypt-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-09-11 08:27:43 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-09-15 11:52:30 +0200
commit35e22827a9b74321e5ad13c5b9c9b7cff1fb0b96 (patch)
tree3271c43ecf36cba762c18e084838185b38df5089 /src/shared/libcrypt-util.c
parent9de324c3c919f20fd49e1d25579f5a66cac0eaa0 (diff)
downloadsystemd-35e22827a9b74321e5ad13c5b9c9b7cff1fb0b96.tar.gz
shared/libcrypt-util: do not refuse passwords if some other hash is unsupported
Diffstat (limited to 'src/shared/libcrypt-util.c')
-rw-r--r--src/shared/libcrypt-util.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/shared/libcrypt-util.c b/src/shared/libcrypt-util.c
index 66f345ee5f..c5d98671bd 100644
--- a/src/shared/libcrypt-util.c
+++ b/src/shared/libcrypt-util.c
@@ -182,8 +182,12 @@ int test_password_one(const char *hashed_password, const char *password) {
errno = 0;
k = crypt_ra(password, hashed_password, &cd_data, &cd_size);
- if (!k)
- return errno_or_else(EINVAL);
+ if (!k) {
+ if (errno == ENOMEM)
+ return -ENOMEM;
+ /* Unknown or unavailable hashing method or string too short */
+ return 0;
+ }
return streq(k, hashed_password);
}