about summary refs log tree commit homepage
path: root/xt
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-06-16 05:05:40 +0000
committerEric Wong <e@yhbt.net>2020-06-16 21:41:56 +0000
commit07caa8528db2ac22d81a0763e1cefd59acd827f1 (patch)
treeaae828ad005dc59ad66d9e7d620d81bf669ba796 /xt
parent95efed60fe2d20ee4382c485e7faf58b3fee25af (diff)
downloadpublic-inbox-07caa8528db2ac22d81a0763e1cefd59acd827f1.tar.gz
For properly parsing IMAP search requests, it's easier to use a
recursive descent parser generator to deal with subqueries and
the "OR" statement.

Parse::RecDescent was chosen since it's mature, well-known,
widely available and already used by our optional dependencies:
Inline::C and Mail::IMAPClient.  While it's possible to build
Xapian queries without using the Xapian string query parser;
this iteration of the IMAP parser still builds a string which is
passed to Xapian's query parser for ease-of-diagnostics.

Since this is a recursive descent parser dealing with untrusted
inputs, subqueries have a nesting limit of 10.  I expect that is
more than adequate for real-world use.
Diffstat (limited to 'xt')
-rw-r--r--xt/mem-imapd-tls.t3
1 files changed, 2 insertions, 1 deletions
diff --git a/xt/mem-imapd-tls.t b/xt/mem-imapd-tls.t
index 648a0ad3..97e67d30 100644
--- a/xt/mem-imapd-tls.t
+++ b/xt/mem-imapd-tls.t
@@ -9,7 +9,8 @@ use Socket qw(SOCK_STREAM IPPROTO_TCP SOL_SOCKET);
 use PublicInbox::TestCommon;
 use PublicInbox::Syscall qw(:epoll);
 use PublicInbox::DS;
-require_mods(qw(DBD::SQLite Email::Address::XS||Mail::Address));
+require_mods(qw(DBD::SQLite Email::Address::XS||Mail::Address
+        Parse::RecDescent));
 my $inboxdir = $ENV{GIANT_INBOX_DIR};
 my $TEST_TLS;
 SKIP: {