From 07caa8528db2ac22d81a0763e1cefd59acd827f1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 16 Jun 2020 05:05:40 +0000 Subject: imap: *SEARCH: use Parse::RecDescent 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. --- xt/mem-imapd-tls.t | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'xt') 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: { -- cgit v1.2.3-24-ge0c7