Slightly more robuse unauthorized db checker

Change-Id: I9b706d6a79d3b80d85a52653791b49e73754f7f1