Bug 894294

Summary: squidGuard: database update: BDB1565 DB->put: method not permitted before handle's open method
Product: [Fedora] Fedora Reporter: Bojan Smojver <bojan>
Component: squidGuardAssignee: Gwyn Ciesla <gwync>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 18CC: cjmurnane, gilson.soares, gwync, itamar, online
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-02 04:24:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Proposed patch for squidGuard RPM none

Description Bojan Smojver 2013-01-11 10:52:36 UTC
Description of problem:
SquidGuard cannot update its own DB files.

Version-Release number of selected component (if applicable):
squidGuard-1.4-15.fc18.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. /usr/bin/squidGuard -C all
2. BDB1565 DB->put: method not permitted before handle's open method
  
Actual results:
Databases never updated.

Expected results:
Worked in F-17.

Additional info:

Comment 1 Chuck Murnane 2013-01-16 00:09:28 UTC
According to http://www.squidguard.org/Doc/known_issues.html,

squidGuard 1.4-alpha and below:
Compilation error with BerkeleyDB 4.7

Reason:
Some old stuff has (finally) been removed from the db sources. SquidGuard unfortunately still uses the old syntax (historical reasons).

Fix/Workaround:
BerkeleyDB up to version 4.6 is known to work properly.
Will be fixed in the next version. 



Fedora 18 has libdb 5.3.21-3.fc18 and libdb4 4.8.30-5.fc18, so the fix may be to wait for upstream.

Comment 2 Bojan Smojver 2013-01-16 10:07:11 UTC
Waiting for upstream may suck - if it was not addressed by now, it probably won't be any time soon. Also, having a non-working package in Fedora proper is no good. I will try to work on a patch when I get a bit of free time.

Comment 3 Gwyn Ciesla 2013-01-16 17:05:47 UTC
In the mean time, I've posted f18 builds of 1.5 beta here:

http://fedorapeople.org/~limb/squidGuard/

If those work for you I'll push this to rawhide and f18.

Comment 4 Chuck Murnane 2013-01-16 18:17:26 UTC
I tried the 386 version of the 1,5 beta squidGuard package. Unfortunately, it fails with the same error message as the 1,4 version in the Fedora 18 repository:

/usr/bin/squidGuard -d -C all -c /etc/squid/squidGuard.conf
2013-01-16 13:13:32 [4487] INFO: New setting: dbhome: /var/squidGuard/blacklists/blacklists
2013-01-16 13:13:32 [4487] INFO: New setting: logdir: /var/log/squidGuard
2013-01-16 13:13:32 [4487] init domainlist /var/squidGuard/blacklists/blacklists/ads/domains
BDB1565 DB->put: method not permitted before handle's open method
2013-01-16 13:13:32 [4487] FATAL: sgDbLoadTextFile: put: Invalid argument
2013-01-16 13:13:32 [4487] ERROR: Going into emergency mode

Comment 5 Anthony Kehoe 2013-01-19 10:24:56 UTC
I also tried using the x86_64 version and had the same issue. I also had a requirement to enable LDAP, so recompiled a src RPM with 1.5 beta.

2013-01-19 02:26:17 [39551] INFO: New setting: dbhome: /var/squidGuard/BL
2013-01-19 02:26:17 [39551] INFO: New setting: logdir: /var/log/squidGuard
2013-01-19 02:26:17 [39551] INFO: New setting: ldapbinddn: cn=*snip*
2013-01-19 02:26:17 [39551] INFO: New setting: ldapbindpass: ***************
2013-01-19 02:26:17 [39551] INFO: New setting: ldapcachetime: 300
2013-01-19 02:26:17 [39551] INFO: New setting: ldapprotover: 3
2013-01-19 02:26:17 [39551] init domainlist /var/squidGuard/BL/adv/domains
BDB1565 DB->put: method not permitted before handle's open method
2013-01-19 02:26:17 [39551] FATAL: sgDbLoadTextFile: put: Invalid argument
2013-01-19 02:26:17 [39551] ERROR: Going into emergency mode

Comment 6 Bojan Smojver 2013-01-21 02:00:52 UTC
Created attachment 684010 [details]
Proposed patch for squidGuard RPM

Comment 7 Gilson Soares 2013-01-22 11:59:21 UTC
Bojan
 The above x86_64 RPM produces the same error for me.
 As I only deals with RPM (no source/diffs//compiling/etc), could you post the binary RPM with above diff applied ?

Comment 8 Bojan Smojver 2013-01-22 12:19:34 UTC
(In reply to comment #7)

> could you post
> the binary RPM with above diff applied ?

The package maintainer will surely build the packages soon, now that the patch is available.

If you want to build one yourself, just:

- download the patch (https://bugzilla.redhat.com/attachment.cgi?id=684010)
- fedpkg clone squidGuard
- apply the patch to that git repo
- fedpkg local

That should build the package for you.

Comment 9 Gilson Soares 2013-01-22 17:57:34 UTC
Thanks Bojan for your prompt reply.

I stopped at "apply the patch to that git repo".
How I do thar ?

Comment 10 Gilson Soares 2013-01-22 17:58:27 UTC
Thanks Bojan for your prompt reply.

I stopped at "apply the patch to that git repo".
How I do that ?

Comment 11 Bojan Smojver 2013-01-22 23:28:28 UTC
(In reply to comment #10)

> I stopped at "apply the patch to that git repo".
> How I do that ?

cd squidGuard (this is the git repo you just cloned)
patch -p1 < /path/to/the/downloaded/squidGuard-rpm-db5.patch

Comment 12 Chuck Murnane 2013-01-23 00:22:13 UTC
I applied the patch, rebuilt the RPM, installed it, but no change in the error:

/usr/bin/squidGuard -d -C all -c /etc/squid/squidGuard.conf
2013-01-22 19:18:07 [4331] New setting: dbhome: /var/squidGuard/blacklists/blacklists
2013-01-22 19:18:07 [4331] New setting: logdir: /var/log/squidGuard
2013-01-22 19:18:07 [4331] init domainlist /var/squidGuard/blacklists/blacklists/ads/domains
BDB1565 DB->put: method not permitted before handle's open method
2013-01-22 19:18:07 [4331] sgDbLoadTextFile: put: Invalid argument
2013-01-22 19:18:07 [4331] Going into emergency mode

This is the 32 bit version. libdb-devel-5.3.21-3.fc18.i686 is installed.

Comment 13 Bojan Smojver 2013-01-23 00:39:20 UTC
(In reply to comment #12)
> I applied the patch, rebuilt the RPM, installed it, but no change in the
> error:

I cannot explain it, other than to say that it runs on my x86_64 bit system just fine:

# rpm -q squidGuard
squidGuard-1.4-16.fc19.x86_64

# ps -ef | grep squidGuard
root       967   895  0 11:38 pts/0    00:00:00 grep --color=auto squidGuard
squid    30531 12713  0 03:40 ?        00:00:01 (squidGuard) -c /etc/squid/squidGuard.conf
squid    31775 12713  0 07:46 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    31808 12713  0 07:52 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    31809 12713  0 07:52 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    31810 12713  0 07:52 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    31811 12713  0 07:52 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    31812 12713  0 07:52 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    31813 12713  0 07:52 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    31814 12713  0 07:52 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    32394 12713  0 09:19 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    32557 12713  0 09:43 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    32558 12713  0 09:43 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    32559 12713  0 09:43 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    32560 12713  0 09:43 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    32561 12713  0 09:43 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    32562 12713  0 09:43 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    32563 12713  0 09:43 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    32564 12713  0 09:43 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    32565 12713  0 09:43 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf
squid    32566 12713  0 09:43 ?        00:00:00 (squidGuard) -c /etc/squid/squidGuard.conf

From the log:
---------------
2013-01-23 09:43:42 [32564] squidGuard 1.4 started (1358894622.445)
2013-01-23 09:43:42 [32564] squidGuard ready for requests (1358894622.480)
---------------

Comment 14 Chuck Murnane 2013-01-23 02:54:23 UTC
I looked over my actions again and found that I had made an error in applying the patch. I rebuilt the i686 version and now it is working as expected.
Thank you.

Comment 15 Gilson Soares 2013-01-23 14:45:41 UTC
Pay attention...

I copied all my DBs from Fedora 17 into Fedora 18 and they works fine (squidGuard -c cfg)

So... the problem ONLY occurs when you try to build the DBs (squidGuard -C all)

Comment 16 Gilson Soares 2013-01-23 15:11:50 UTC
(In reply to comment #11)
> (In reply to comment #10)
> 
> > I stopped at "apply the patch to that git repo".
> > How I do that ?
> 
> cd squidGuard (this is the git repo you just cloned)
> patch -p1 < /path/to/the/downloaded/squidGuard-rpm-db5.patch

SOLVED !
I was able to rebuild the RPM.

The new patched binary worked fine.
It was able do create the DBs files correctly.

Thanks for support.

Comment 17 Gwyn Ciesla 2013-01-23 16:36:05 UTC
Got it, thanks for the patch and testing, I'll get this out ASAP.

Comment 18 Fedora Update System 2013-01-23 17:20:05 UTC
squidGuard-1.4-16.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/squidGuard-1.4-16.fc18

Comment 19 Fedora Update System 2013-01-24 21:55:16 UTC
Package squidGuard-1.4-16.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing squidGuard-1.4-16.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-1394/squidGuard-1.4-16.fc18
then log in and leave karma (feedback).

Comment 20 Fedora Update System 2013-02-02 04:24:21 UTC
squidGuard-1.4-16.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.