Also, future-proof index_index() return codes by requiring success
to return a positive value.
Reviewed-by: Rich Salz <rsalz@openssl.org>
return retdb;
}
+/*
+ * Returns > 0 on success, <= 0 on error
+ */
int index_index(CA_DB *db)
{
if (!TXT_DB_create_index(db->db, DB_serial, NULL,
if (db == NULL)
goto end;
- if (!index_index(db))
+ if (index_index(db) <= 0)
goto end;
if (get_certificate_status(ser_status, db) != 1)
BIO_printf(bio_err, "generating index\n");
}
- if (!index_index(db))
+ if (index_index(db) <= 0)
goto end;
/*****************************************************************/
if (ridx_filename != NULL) {
rdb = load_index(ridx_filename, NULL);
- if (rdb == NULL || !index_index(rdb)) {
+ if (rdb == NULL || index_index(rdb) <= 0) {
ret = 1;
goto end;
}
if (index_changed(rdb)) {
CA_DB *newrdb = load_index(ridx_filename, NULL);
- if (newrdb != NULL) {
+ if (newrdb != NULL && index_index(newrdb) > 0) {
free_index(rdb);
rdb = newrdb;
} else {
+ free_index(newrdb);
log_message(LOG_ERR, "error reloading updated index: %s",
ridx_filename);
}