]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
verify-tofu: return errors from store functions if callback fails
authorDaiki Ueno <ueno@gnu.org>
Tue, 24 Nov 2020 09:54:06 +0000 (10:54 +0100)
committerDaiki Ueno <ueno@gnu.org>
Tue, 24 Nov 2020 09:54:06 +0000 (10:54 +0100)
Signed-off-by: Daiki Ueno <ueno@gnu.org>
lib/verify-tofu.c

index 5cedeed1184fd803061b1743290b56255d06ea8c..4e65c739f78ab912d07e003e9e32e507ab9d12b4 100644 (file)
@@ -560,12 +560,16 @@ gnutls_store_pubkey(const char *db_name,
 
        _gnutls_debug_log("Configuration file: %s\n", db_name);
 
-       tdb->store(db_name, host, service, expiration, &pubkey);
+       ret = tdb->store(db_name, host, service, expiration, &pubkey);
 
        if (need_free) {
                _gnutls_free_datum(&pubkey);
        }
 
+       if (ret < 0) {
+               return gnutls_assert_val(GNUTLS_E_DB_ERROR);
+       }
+
        return GNUTLS_E_SUCCESS;
 }
 
@@ -638,8 +642,11 @@ gnutls_store_commitment(const char *db_name,
 
        _gnutls_debug_log("Configuration file: %s\n", db_name);
 
-       tdb->cstore(db_name, host, service, expiration,
-               (gnutls_digest_algorithm_t)me->id, hash);
+       ret = tdb->cstore(db_name, host, service, expiration,
+                         (gnutls_digest_algorithm_t)me->id, hash);
+       if (ret < 0) {
+               return gnutls_assert_val(GNUTLS_E_DB_ERROR);
+       }
 
        return 0;
 }