From b0118b2533d699fb188f3a2f198c25b472fed982 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Mon, 25 Mar 2024 12:02:20 +0000 Subject: [PATCH 1/2] homework: add missing assert 'cache' is used unconditionally in this function, so add an assert. CID#1540860 --- src/home/homework.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/home/homework.c b/src/home/homework.c index afc1142298..6e89daaf01 100644 --- a/src/home/homework.c +++ b/src/home/homework.c @@ -56,6 +56,7 @@ int user_record_authenticate( assert(h); assert(secret); + assert(cache); /* Tries to authenticate a user record with the supplied secrets. i.e. checks whether at least one * supplied plaintext passwords matches a hashed password field of the user record. Or if a @@ -78,7 +79,7 @@ int user_record_authenticate( * to force re-authentication. */ /* First, let's see if we already have a volume key from the keyring */ - if (cache && cache->volume_key && + if (cache->volume_key && json_variant_is_blank_object(json_variant_by_key(secret->json, "secret"))) { log_info("LUKS volume key from keyring unlocks user record."); return 1; From ccd956887f7e890e135e4f2ec73a47163fe2674e Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Mon, 25 Mar 2024 12:05:28 +0000 Subject: [PATCH 2/2] test: add missing return value check in test-dirent-util CID#1540029 Follow-up for 6a57d86bf9d7f8d6f5d339f57665dfb2e1d191c5 --- src/test/test-dirent-util.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/test/test-dirent-util.c b/src/test/test-dirent-util.c index f9816973bf..be0496904f 100644 --- a/src/test/test-dirent-util.c +++ b/src/test/test-dirent-util.c @@ -23,10 +23,8 @@ TEST (test_dirent_ensure_type) { .d_name = "test", }; - assert_se(de.d_type == DT_UNKNOWN); - dir_fd = 0; - dirent_ensure_type(dir_fd, &de); + assert_se(dirent_ensure_type(dir_fd, &de) == -ENOTDIR); /* Test when d_name is "." or ".." */ strcpy(de.d_name, ".");