db.c: Check certificates before opening database
db.c: Check certificates before opening database

This gets rid of a lot of valgrind warnings about the separate process
created when trying to run ncdc-gen-cert.

Tilka/ncdc,Tilka/ncdc,srijan/ncdc,srijan/ncdc,srijan/ncdc