parent
2ec538ff35
commit
2cd6000f32
@ -0,0 +1,57 @@
|
|||||||
|
From f6981127673b56265254b2891ac1539e036fe321 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kenichi Ishigaki <ishigaki@cpan.org>
|
||||||
|
Date: Tue, 16 Feb 2016 12:55:38 +0900
|
||||||
|
Subject: [PATCH] register perl tokenizer only if DBD::SQLite is compiled with
|
||||||
|
-DSQLITE_ENABLE_FTS3_TOKENIZER
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Petr Písař: Ported to 1.50.
|
||||||
|
|
||||||
|
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||||
|
---
|
||||||
|
SQLite.xs | 4 ++++
|
||||||
|
dbdimp.c | 3 ++-
|
||||||
|
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/SQLite.xs b/SQLite.xs
|
||||||
|
index 5b51aef..f20e511 100644
|
||||||
|
--- a/SQLite.xs
|
||||||
|
+++ b/SQLite.xs
|
||||||
|
@@ -288,7 +288,11 @@ register_fts3_perl_tokenizer(dbh)
|
||||||
|
ALIAS:
|
||||||
|
DBD::SQLite::db::sqlite_register_fts3_perl_tokenizer = 1
|
||||||
|
CODE:
|
||||||
|
+#if SQLITE_ENABLE_FTS3_TOKENIZER
|
||||||
|
RETVAL = sqlite_db_register_fts3_perl_tokenizer(aTHX_ dbh);
|
||||||
|
+#else
|
||||||
|
+ RETVAL = 0;
|
||||||
|
+#endif
|
||||||
|
OUTPUT:
|
||||||
|
RETVAL
|
||||||
|
|
||||||
|
diff --git a/dbdimp.c b/dbdimp.c
|
||||||
|
index 6a6924b..b36bc67 100644
|
||||||
|
--- a/dbdimp.c
|
||||||
|
+++ b/dbdimp.c
|
||||||
|
@@ -2623,6 +2623,7 @@ sqlite_db_backup_to_file(pTHX_ SV *dbh, char *filename)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
+#if SQLITE_VERSION_NUMBER < 3011000 || SQLITE_ENABLE_FTS3_TOKENIZER
|
||||||
|
typedef struct perl_tokenizer {
|
||||||
|
sqlite3_tokenizer base;
|
||||||
|
SV *coderef; /* the perl tokenizer is a coderef that takes
|
||||||
|
@@ -2912,7 +2913,7 @@ int sqlite_db_register_fts3_perl_tokenizer(pTHX_ SV *dbh)
|
||||||
|
|
||||||
|
return sqlite3_finalize(pStmt);
|
||||||
|
}
|
||||||
|
-
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
--
|
||||||
|
2.5.0
|
||||||
|
|
@ -0,0 +1,33 @@
|
|||||||
|
From 58ba45f1797370e220eb627e6b7aec1d567db257 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kenichi Ishigaki <ishigaki@cpan.org>
|
||||||
|
Date: Tue, 16 Feb 2016 13:06:51 +0900
|
||||||
|
Subject: [PATCH] see if SQLITE_ENABLE_FTS3_TOKENIZER environmental variable is
|
||||||
|
set, for those who do need perl tokenizer
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||||
|
---
|
||||||
|
Makefile.PL | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/Makefile.PL b/Makefile.PL
|
||||||
|
index db5ddb5..dde27d9 100644
|
||||||
|
--- a/Makefile.PL
|
||||||
|
+++ b/Makefile.PL
|
||||||
|
@@ -230,6 +230,11 @@ my @CC_DEFINE = (
|
||||||
|
'-DNDEBUG=1',
|
||||||
|
);
|
||||||
|
|
||||||
|
+# for upstream security concern, this should be set only if requested
|
||||||
|
+if ($ENV{SQLITE_ENABLE_FTS3_TOKENIZER}) {
|
||||||
|
+ push @CC_DEFINE, '-DSQLITE_ENABLE_FTS3_TOKENIZER'; # for sqlite >= 3.11.0
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
if (DEVELOPER_ONLY) {
|
||||||
|
# for sqlite >= 3.8.8
|
||||||
|
push @CC_DEFINE, '-DSQLITE_ENABLE_API_ARMOR';
|
||||||
|
--
|
||||||
|
2.5.0
|
||||||
|
|
@ -0,0 +1,32 @@
|
|||||||
|
From abed684c431beab32d20da69e344bf3075102a1e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kenichi Ishigaki <ishigaki@cpan.org>
|
||||||
|
Date: Tue, 16 Feb 2016 11:55:27 +0900
|
||||||
|
Subject: [PATCH] two-arg fts3_tokenizer() is disabled by default for security
|
||||||
|
concerns as of SQLite 3.11.0, unless DBD::SQLite is compiled with
|
||||||
|
-DSQLITE_ENABLE_FTS3_TOKENIZER
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||||
|
---
|
||||||
|
t/43_fts3.t | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/t/43_fts3.t b/t/43_fts3.t
|
||||||
|
index 7af6c2e..64910ee 100644
|
||||||
|
--- a/t/43_fts3.t
|
||||||
|
+++ b/t/43_fts3.t
|
||||||
|
@@ -33,6 +33,9 @@ BEGIN {
|
||||||
|
if (!grep /ENABLE_FTS3/, DBD::SQLite::compile_options()) {
|
||||||
|
plan skip_all => 'FTS3 is disabled for this DBD::SQLite';
|
||||||
|
}
|
||||||
|
+ if ($DBD::SQLite::sqlite_version_number >= 3011000 and !grep /ENABLE_FTS3_TOKENIZER/, DBD::SQLite::compile_options()) {
|
||||||
|
+ plan skip_all => 'FTS3 tokenizer is disabled for this DBD::SQLite';
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
use Test::NoWarnings;
|
||||||
|
|
||||||
|
--
|
||||||
|
2.5.0
|
||||||
|
|
Loading…
Reference in new issue