Mysqldyn dlz compile failed
Summary
Can't compile mysqldyn dlz on Ubuntu 18.04.
Linux bind9-compile 4.15.0-65-generic #74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
BIND version used
root@bind9-compile:/opt/bind9# sbin/named -V
BIND 9.15.5 (Development Release) <id:87676a6ac0>
running on Linux x86_64 4.15.0-65-generic #74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019
built by make with '--prefix=/opt/bind9/' '--with-dlz-mysql=yes'
compiled by GCC 7.4.0
compiled with OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
linked to OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
compiled with libxml2 version: 2.9.4
linked to libxml2 version: 20904
compiled with json-c version: 0.12.1
linked to json-c version: 0.12.1
compiled with zlib version: 1.2.11
linked to zlib version: 1.2.11
threads support is enabled
default paths:
named configuration: /opt/bind9/etc/named.conf
rndc configuration: /opt/bind9/etc/rndc.conf
DNSSEC root key: /opt/bind9/etc/bind.keys
nsupdate session key: /opt/bind9/var/run/named/session.key
named PID file: /opt/bind9/var/run/named/named.pid
named lock file: /opt/bind9/var/run/named/named.lock
Steps to reproduce
cd bind9/contrib/dlz/modules/mysqldyn/
make
cc -fPIC -Wall -g -I../include -I/usr/include/mysql -shared -o dlz_mysqldyn_mod.so \
dlz_mysqldyn_mod.c dlz_dbi.o -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -latomic -ldl
dlz_mysqldyn_mod.c: In function ‘makerecord’:
dlz_mysqldyn_mod.c:832:35: error: ‘saveptr’ undeclared (first use in this function)
real_name = strtok_r(buf, "\t", &saveptr);
^~~~~~~
dlz_mysqldyn_mod.c:832:35: note: each undeclared identifier is reported only once for each function it appears in
Makefile:13: recipe for target 'dlz_mysqldyn_mod.so' failed
make: *** [dlz_mysqldyn_mod.so] Error 1
What is the current bug behavior?
Can't compile mysqldyn dlz.
Possible fixes
Declare saveptr on line 832 in dlz_mysqldyn_mod.c.
char* saveptr = 0;
/*
* The format is:
* FULLNAME\tTTL\tDCLASS\tTYPE\tDATA
*
* The DATA field is space separated, and is in the data format
* for the type used by dig
*/
char* saveptr = 0;
real_name = strtok_r(buf, "\t", &saveptr);
if (real_name == NULL)
goto error;
ttlstr = strtok_r(NULL, "\t", &saveptr);
if (ttlstr == NULL || sscanf(ttlstr, "%d", &ttlvalue) != 1)
goto error;
dclass = strtok_r(NULL, "\t", &saveptr);
if (dclass == NULL)
goto error;
type = strtok_r(NULL, "\t", &saveptr);
if (type == NULL)
goto error;
data = strtok_r(NULL, "\t", &saveptr);
if (data == NULL)
goto error;