SquidGuard db problem
-
While trying to solve a different problem I found that running db_verify on various domains.db files (in my case coming from shallalist) failed (see also http://forum.pfsense.org/index.php/topic,43675.285.html).
Has anybody else observed this too? It seems that the "out-of-order" keys do not result in runtime problems.
-
On sqlite, binary from version 3 does not open files from version 2.
Isn't this the same issue you are getting?
trying to check a db from a different version.
-
Isn't this the same issue you are getting?
pfSense2 installs a rather old version of the Berkeley db (4.2). The database files are generated and read by the binaries of the same version and I used the db utilities that came with the 4.2 version, so this should not be an issue.
On the other hand, the squidGuard version is rather new (with references to db 4.7 and later) and subtle differences in the C API could be responsible for the broken database. Meanwhile I also had a look at the C sources of squidGuard and there is an appreciable amount of low level char* handling. This should be checked as well for subtle bugs. I'll report once I know how things are done there.
-
I retrieved the squidGuard tar ball and compiled it with db 4.8 under cygwin on my Windows machine. Using the configuration test1.conf of the squidGuard distribution I generated the db files. The outcome is the same as on my pfSense2 box:
$ ../src/squidGuard -d -c test1.conf -C all
…
db4.8_verify: Page 16: out-of-order key at entry 546
db4.8_verify: Page 16: out-of-order key at entry 554
db4.8_verify: Page 16: out-of-order key at entry 558
db4.8_verify: Page 16: out-of-order key at entry 560
db4.8_verify: Page 16: out-of-order key at entry 564
db4.8_verify: Page 16: out-of-order key at entry 566
db4.8_verify: Page 16: out-of-order key at entry 568
db4.8_verify: domains.db: DB_VERIFY_BAD: Database verification failedI'd say the problem is the squidGuard binary.
(to be continued) -
This is another example where reading part of the docs is worse than none.
squidGuard uses its own compare function (domainCompare()), so db_verify() cannot possibly know about the intended sort order. This is why verifying fails. The -o flag allows for skipping the sort order verification and when checking the domains.db files
db_verify -o domains.db
should be called. Needless to say, all db files are ok.