Bug 432497

Summary: bind-sdb 9.5.0-23.b1 doesn't load DLZ zones
Product: [Fedora] Fedora Reporter: Graeme Fowler <rhbugzilla>
Component: bindAssignee: Adam Tkac <atkac>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 8CC: geustace, mike.kirkpatrick, ovasik, tlyons
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: 9.5.0-26.b3.fc8 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-10 13:50:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Graeme Fowler 2008-02-12 12:46:19 UTC
Description of problem:

bind-sdb 9.5.0-23.b1 doesn't load DLZ zones

Version-Release number of selected component (if applicable):

9.5.0-23.b1

How reproducible:

Install bind-sdb RPM. Attempt to use DLZ zone. It fails to load.

Steps to Reproduce:
1. Install bind-sdb RPM
2. Configure stub, mysql, pgsql, ldap etc zone per DLZ docs
3. Restart bind
  
Actual results:

bind starts up, loads SDB drivers but ignores DLZ config.

Expected results:

Would expect to see lines in log of severity info or warning regarding DLZ
drivers being loaded and the DLZ zone itself being loaded. None appear.

Additional info:

Creating a config snippet of the form:

dlz "Mysql zone" {
   database "mysql
   {host=localhost dbname=dns_data ssl=tRue}
   {select zone from dns_records where zone = '%zone%'}
   {select ttl, type, mx_priority, case when lower(type)='txt' then concat('\"',
data, '\"')
        else data end from dns_records where zone = '%zone%' and host = '%record%'
        and not (type = 'SOA' or type = 'NS')}
   {select ttl, type, mx_priority, data, resp_person, serial, refresh, retry,
expire, minimum
        from dns_records where zone = '%zone%' and (type = 'SOA' or type='NS')}
   {select ttl, type, host, mx_priority, data, resp_person, serial, refresh,
retry, expire,
        minimum from dns_records where zone = '%zone%' and not (type = 'SOA' or
type = 'NS')}
   {select zone from xfr_table where zone = '%zone%' and client = '%client%'}
   {update data_count set count = count + 1 where zone ='%zone%'}";
};

[lifted directly from the DLZ stock docs on sf.net]

should throw an error because the DB doesn't exist on my test box. It doesn't,
and no attempt is made to connect to the DB at all.

It looks like although the config is checked and sane, bind simply ignores it.

If this needs to go wider, please let me know. I'll bring it up on bind-users if
required.

Comment 1 Graeme Fowler 2008-02-13 15:28:07 UTC
If I rebuild the RPM from source but set the SDB switch to "off":

%{?!SDB:        %define SDB         0}

Then the resulting named binary loads the DLZ drivers as expected (this using
the known, broken DLZ zone statement from the original entry):

Feb 13 15:23:41 ernie named[18835]: Loading 'Mysql zone' using driver mysql
Feb 13 15:23:41 ernie named[18835]: mysql driver failed to create database
connection after 4 attempts
Feb 13 15:23:41 ernie named[18835]: SDLZ driver failed to load.
Feb 13 15:23:41 ernie named[18835]: DLZ driver failed to load.
Feb 13 15:23:41 ernie named[18835]: loading configuration: failure
Feb 13 15:23:41 ernie named[18835]: exiting (due to fatal error)

Looks like the patch applied to the RPM to build the SDB version accidentally
switches off DLZ.

Comment 2 Todd Lyons 2008-02-13 23:58:14 UTC
I downloaded the latest srpm by atkac, built it on a 64 bit box,
and it does not show DLZ loading.  According to the changelogs, DLZ is rolled
into the SDB patchset, and the build process shows that configure is told to 
use it, it builds, it links, and makes shared libs (seems successful).  The
logs show what is available as bind-sdb starts:

Feb 13 14:17:24 dns52 named-sdb[9645]: starting BIND 9.5.0b1 -u named -t
/var/named/chroot -f
Feb 13 14:17:24 dns52 named-sdb[9645]: found 1 CPU, using 1 worker thread
Feb 13 14:17:24 dns52 named-sdb[9645]: SDB ldap zone database module loaded.
Feb 13 14:17:24 dns52 named-sdb[9645]: SDB postgreSQL DB zone database module
loaded.
Feb 13 14:17:24 dns52 named-sdb[9645]: SDB sqlite3 DB zone database module loaded.
Feb 13 14:17:24 dns52 named-sdb[9645]: SDB directory DB zone database module loaded.
Feb 13 14:17:24 dns52 named-sdb[9645]: loading configuration from '/etc/named.conf'
Feb 13 14:17:24 dns52 named-sdb[9645]: listening on IPv4 interface lo, 127.0.0.1#53
<snip>

DLZ is not listed, nor is SDB-mysql (which may be the same thing, but in
my reading, I didn't think they were the same, at any rate I only want DLZ).
Neither is there any reference to the dlz configuration and it's (in)ability
to connect to the mysql db running on localhost.  There is absolutely no 
connection attempt to any mysql database I configure.  Also, nothing gets
logged in the mysql query log (it is turned on).

My named.conf includes /etc/named.dlz, which contains this:

dlz "Mysql zone" {
   database "mysql
   {host=localhost user=dns dbname=dns ssl=false}
   {SELECT name AS zone FROM domain WHERE name = '%zone%'}
   {SELECT '86400' AS ttl,
        domain_record_type.type,domain_record.name AS host,
        case when lower(domain_record_type.type) = 'mx' then domain_record.value
end AS mx_priority,
        case when lower(domain_record_type.type) != 'mx' then
domain_record.value end AS data,
        'ns1.ivenue.com' AS primary_ns,
        'hostmaster.ivenue.com' AS resp_person,
        '2008021300' AS serial, 36000 AS refresh, 1800 AS retry, 3600000 AS
expire, 86400 AS minimum
        FROM domain_record,domain,domain_record_type
        WHERE domain.name='%zone%' AND
domain_record_type.id=domain_record.type_id AND domain_record.name='%record%'}";
};

Here's what was installed:
# rpm -qa | egrep ^bind
bind-libs-9.5.0-22.b1
bind-chroot-9.5.0-22.b1
bind-utils-9.5.0-22.b1
bind-sdb-9.5.0-22.b1
bind-9.5.0-22.b1

The only thing that I see that is odd when dealing with DLZ is this aclocal
warning very early in the build process (quoted in its entirety to provide context):
+ libtoolize --copy --force
Remember to add `AC_PROG_LIBTOOL' to `configure.in'.
Using `AC_PROG_RANLIB' is rendered obsolete by `AC_PROG_LIBTOOL'
You should add the contents of `/usr/share/aclocal/libtool.m4' to `aclocal.m4'.
+ aclocal
configure.in:2329: warning: underquoted definition of NOM_PATH_FILE
  run info '(automake)Extending aclocal'
  or see http://sources.redhat.com/automake/automake.html#Extending-aclocal
contrib/dlz/config.dlz.in:38: warning: underquoted definition of DLZ_ADD_DRIVER
+ autoconf

That same message appears in the SDB disabled build as well though, so that's
probably unrelated.

Rebuilding with SDB disabled causes DLZ to connect to the database server and
perform lookups.  I can provide buildlogs for both building with default SDB
enabled and SDB manually disabled by me.

Comment 3 Adam Tkac 2008-02-14 12:56:18 UTC
Hm, it looks that DLZ sources is not compiled with -DDLZ*

Comment 4 Graeme Fowler 2008-02-14 13:17:28 UTC
Good spot - I have 72 lines of -DDLZ* in my non-SDB build log, yet only 18 in
the -SDB build log.

I have to admit that my rpmbuild-foo has just left me, so I'm going to find
tracking this omission in the relevant patch somewhat tricky...

Comment 5 Adam Tkac 2008-02-14 15:10:42 UTC
Would it be possible test proposed update, please?
http://koji.fedoraproject.org/koji/taskinfo?taskID=426746

Comment 6 Graeme Fowler 2008-02-14 18:03:38 UTC
Looks OK - installed bin, bind-sdb, bind-libs and bind-utils from koji and I now
get this with my known-to-be-broken DLZ zone:

Feb 14 18:00:52 ernie named-sdb[23575]: starting BIND 9.5.0b2 -u named
Feb 14 18:00:52 ernie named-sdb[23575]: found 2 CPUs, using 2 worker threads
Feb 14 18:00:52 ernie named-sdb[23575]: SDB ldap zone database module loaded.
Feb 14 18:00:52 ernie named-sdb[23575]: SDB postgreSQL DB zone database module
loaded.
Feb 14 18:00:52 ernie named-sdb[23575]: SDB sqlite3 DB zone database module loaded.
Feb 14 18:00:52 ernie named-sdb[23575]: SDB directory DB zone database module
loaded.
Feb 14 18:00:52 ernie named-sdb[23575]: loading configuration from '/etc/named.conf'
Feb 14 18:00:52 ernie named-sdb[23575]: the working directory is not writable
Feb 14 18:00:52 ernie named-sdb[23575]: listening on IPv4 interface lo, 127.0.0.1#53
Feb 14 18:00:52 ernie named-sdb[23575]: listening on IPv4 interface eth1,
192.168.7.254#53
Feb 14 18:00:52 ernie named-sdb[23575]: Loading 'Mysql zone' using driver mysql
Feb 14 18:00:52 ernie named-sdb[23575]: mysql driver failed to create database
connection after 4 attempts
Feb 14 18:00:52 ernie named-sdb[23575]: SDLZ driver failed to load.
Feb 14 18:00:52 ernie named-sdb[23575]: DLZ driver failed to load.
Feb 14 18:00:52 ernie named-sdb[23575]: loading configuration: failure
Feb 14 18:00:52 ernie named-sdb[23575]: exiting (due to fatal error)


Comment 7 Todd Lyons 2008-02-14 23:09:02 UTC
Can you provide the srpm so I can rebuild it on my system?  Many thanks!

Comment 8 Adam Tkac 2008-02-15 10:53:36 UTC
(In reply to comment #7)
> Can you provide the srpm so I can rebuild it on my system?  Many thanks!

http://people.redhat.com/atkac/bind/ is updated

Comment 9 Todd Lyons 2008-02-15 15:35:53 UTC
Rebuilt and installed on my test system, the new bind-sdb works properly with
DLZ configuration.

Comment 10 Michael D. Kirkpatrick 2008-04-27 16:21:27 UTC
Myabe I am just dense here....

I am running into the same problem with using the bind-sdb RPM.  I pulled down 
the srpm at http://people.redhat.com/atkac/bind/ and recompiled.  Same issue.  
On top of that, when I try ./configure --with-dlz-mysql=yes I get errors.  I 
am obviously missing something here... Does anyone have instructions on the 
exact process on how to compile and install?  If there are sources I am 
needing that are not included in this srpm, please let me know.

A fully compiled rpm with these fixes would also be greatly appreciated.

I am using fedora 8 with mysql installed and setup correctly.(In reply to 
comment #9)
> Rebuilt and installed on my test system, the new bind-sdb works properly with
> DLZ configuration.



Comment 11 Fedora Update System 2008-04-28 14:57:09 UTC
bind-9.5.0-26.b3.fc8 has been submitted as an update for Fedora 8

Comment 12 Todd Lyons 2008-04-28 15:45:04 UTC
I am still using bind-chroot-9.5.0-25.1.b2.x86_64.rpm (my locally built version
of the SRPM mentioned in my previous comments).  I did download
bind-9.5.0-29.3.b2.fc9.src.rpm from the project page mentioned in comment 8 and
rebuilt it successfully, but haven't tried running it yet.  But since you seem
to be unable to simply build it, your issue should only be minor I would think.

WARNING: You didn't provide any info as far as build output, so the following is
a guess.

During the build sequence of the rpm, the DLZ module checks to see what kind of
backends you want it to support.  Here is a snippet from ./configure:

checking for Postgres DLZ driver... checking for pg_config... /usr/bin/pg_config
using PostgreSQL from /usr/lib64 and /usr/include
checking for MySQL DLZ driver... using mysql from /usr/lib64/mysql and
/usr/include/mysql
checking for Berkeley DB DLZ driver... no
checking for file system DLZ driver... yes
checking for LDAP DLZ driver... using LDAP from /usr/lib64 and /usr/include
checking for ODBC DLZ driver... using ODBC from /usr
checking for stub DLZ driver... no
checking for DLZ... yes

If you don't have any of the support packages for those individual drivers, you
won't get a build with DLZ support (last line which says yes or no).

1.  Make sure you have the development packages for the appropriate driver.  For
example, to build with mysql support you need mysql-devel or to build with ldap
support you need openldap-devel, etc.  You can have any number of them
installed, it only uses the one you have configured in your config file.
2.  If using a 64 bit environment, you really only need to install the 64 bit
version of the development package.  If you do 'yum install mysql-devel', you
might be suprised to find it installing *two* packages, one is the i386 version
and the other is the x86_64 version.  The quick and easy solution is to 'yum
install mysql-devel.x86_64'.  This doesn't apply to you if you're running a
standard 32 bit install.

Take a close look at the points raised in #1 and I think you'll find your
problem.  If not, more info is required.

Hope that helps!

Comment 13 Michael D. Kirkpatrick 2008-04-29 02:15:34 UTC
I feel stupid here.  I was trying to compile and install the 64 bit version on 
a 32 bit system.  Didn't work out so well.  I pulled down the proper version 
and it compiled and installed without any problems.  Thanks.

Comment 14 Fedora Update System 2008-04-29 20:59:40 UTC
bind-9.5.0-26.b3.fc8 has been pushed to the Fedora 8 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update bind'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F8/FEDORA-2008-3402

Comment 15 Fedora Update System 2008-05-10 13:50:05 UTC
bind-9.5.0-26.b3.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.