summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Hozza <thozza@redhat.com>2013-05-02 15:54:40 +0200
committerTomas Hozza <thozza@redhat.com>2013-05-02 15:54:40 +0200
commit4242e4f1c1afb7db4c37971fc6a4cee347177f78 (patch)
tree38674b94f36d5fb45ef91b385e6d3c5ef6e092fa
parent7731d63afbb82518c676ab8da70a09a616b7a9ea (diff)
downloadbind-4242e4f1c1afb7db4c37971fc6a4cee347177f78.tar.gz
bind-4242e4f1c1afb7db4c37971fc6a4cee347177f78.tar.xz
bind-4242e4f1c1afb7db4c37971fc6a4cee347177f78.zip
Fix zone2sqlite to quote table names when creating/dropping/inserting (#919417)
Signed-off-by: Tomas Hozza <thozza@redhat.com>
-rw-r--r--bind-9.9-sdb-zone2sqlite-table-name.patch51
-rw-r--r--bind.spec8
2 files changed, 58 insertions, 1 deletions
diff --git a/bind-9.9-sdb-zone2sqlite-table-name.patch b/bind-9.9-sdb-zone2sqlite-table-name.patch
new file mode 100644
index 0000000..e8adf22
--- /dev/null
+++ b/bind-9.9-sdb-zone2sqlite-table-name.patch
@@ -0,0 +1,51 @@
+From 75f51e2f14d9fce2001aa91ad444e327321a19c3 Mon Sep 17 00:00:00 2001
+From: Tomas Hozza <thozza@redhat.com>
+Date: Thu, 2 May 2013 15:05:51 +0200
+Subject: [PATCH] Table name should be quoted when used in SQL commands
+
+Table name should be quoted when dropping/creating/inserting in
+some table. Currently zone2sqlite is unable to handle table
+names starting with ".", "-", number, etc.
+
+This can be solved by using "%Q" instead of "%q" in sqlite3_mprintf()
+calls when inserting table name.
+
+Signed-off-by: Tomas Hozza <thozza@redhat.com>
+---
+ contrib/sdb/sqlite/zone2sqlite.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/contrib/sdb/sqlite/zone2sqlite.c b/contrib/sdb/sqlite/zone2sqlite.c
+index b583d2b..7b9260a 100644
+--- a/contrib/sdb/sqlite/zone2sqlite.c
++++ b/contrib/sdb/sqlite/zone2sqlite.c
+@@ -129,7 +129,7 @@ addrdata(dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata)
+ dataarray[isc_buffer_usedlength(&b)] = 0;
+
+ sql = sqlite3_mprintf(
+- "INSERT INTO %q (NAME, TTL, RDTYPE, RDATA)"
++ "INSERT INTO %Q (NAME, TTL, RDTYPE, RDATA)"
+ " VALUES ('%q', %d, '%q', '%q') ",
+ dbi.table,
+ namearray, ttl, typearray, dataarray);
+@@ -208,7 +208,7 @@ main(int argc, char *argv[])
+ closeandexit(1);
+ }
+
+- sql = sqlite3_mprintf("DROP TABLE %q ", dbi.table);
++ sql = sqlite3_mprintf("DROP TABLE %Q ", dbi.table);
+ printf("%s\n", sql);
+ res = sqlite3_exec(dbi.db, sql, NULL, NULL, &errmsg);
+ sqlite3_free(sql);
+@@ -231,7 +231,7 @@ main(int argc, char *argv[])
+ #endif
+
+ sql = sqlite3_mprintf(
+- "CREATE TABLE %q "
++ "CREATE TABLE %Q "
+ "(NAME TEXT, TTL INTEGER, RDTYPE TEXT, RDATA TEXT) ",
+ dbi.table);
+ printf("%s\n", sql);
+--
+1.8.1.4
+
diff --git a/bind.spec b/bind.spec
index eac9a27..67d796c 100644
--- a/bind.spec
+++ b/bind.spec
@@ -26,7 +26,7 @@ Summary: The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) serv
Name: bind
License: ISC
Version: 9.9.3
-Release: 0.3.%{PREVER}%{?dist}
+Release: 0.4.%{PREVER}%{?dist}
Epoch: 32
Url: http://www.isc.org/products/BIND/
Buildroot:%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -87,6 +87,8 @@ Patch138:bind99-opts.patch
Patch11: bind-9.3.2b2-sdbsrc.patch
Patch12: bind-9.5-sdb.patch
Patch62: bind-9.5-sdb-sqlite-bld.patch
+# ISC-Bugs #33375
+Patch139:bind-9.9-sdb-zone2sqlite-table-name.patch
# needs inpection
Patch17: bind-9.3.2b1-fix_sdb_ldap.patch
@@ -291,6 +293,7 @@ cp -fp contrib/sdb/ldap/ldapdb.[ch] bin/named-sdb
# SDB postgreSQL
cp -fp contrib/sdb/pgsql/pgsqldb.[ch] bin/named-sdb
# SDB sqlite
+%patch139 -p1 -b .table_name
cp -fp contrib/sdb/sqlite/sqlitedb.[ch] bin/named-sdb
# SDB Berkeley DB - needs to be ported to DB4!
#cp -fp contrib/sdb/bdb/bdb.[ch] bin/named_sdb
@@ -778,6 +781,9 @@ rm -rf ${RPM_BUILD_ROOT}
%endif
%changelog
+* Thu May 02 2013 Tomas Hozza <thozza@redhat.com> 32:9.9.3-0.4.rc1
+- Fix zone2sqlite to quote table names when creating/dropping/inserting (#919417)
+
* Fri Apr 19 2013 Adam Tkac <atkac redhat com> 32:9.9.3-0.3.rc1
- fix crash in nsupdate when processing "-r" parameter (#949544)