Stephan Bosch [Wed, 10 Oct 2018 22:49:33 +0000 (00:49 +0200)]
lib-smtp: client: transaction: Add alternative function for adding a recipient on an application-provided pool.
This allows modifying the recipient object beyond approval. Before, it was
always moved to the transaction pool, thereby invalidating the original returned
pointer. This way, the data_calback and context can be set at a later time,
e.g. when the DATA command is being processed. This makes a choice between
LMTP-style and SMTP-style replies to the DATA command a bit easier to handle.
Also, the recipient is entirely allocated on a single pool between the client
and server side, which should improve memory consumption a little. As a bonus,
this removes the need to have dummy DATA callbacks.
Stephan Bosch [Sun, 14 Oct 2018 20:34:50 +0000 (22:34 +0200)]
submission: Fix starting secondary backends created before the server-side transaction is fully created.
Record an array of those backends and start them once the transaction is
created. Before, this was implemented using the array of approved recipients
(which each point to their backend). However, this does not work, since there
can be no approved recipients when there is no server-side transaction yet.
Stephan Bosch [Sun, 14 Oct 2018 21:00:11 +0000 (23:00 +0200)]
submission: relay backend: Properly manage the trans_started flag.
Sometimes it was not set at all. This didn't lead to problems in most cases, but
this was at least confusing while debugging. Also, the flag is set before the
client transaction is actually started, making sure (future) recursive problems
will not occur.
Stephan Bosch [Sun, 7 Oct 2018 19:37:00 +0000 (21:37 +0200)]
lib-smtp: server: Create the definitive recipient object right at the reception of the RCPT command.
Before, it first allocated stuff on the command pool, which gets freed when the RCPT
command finishes. Allocating the recipient data on its own pool from the start
considerably simplifies the code and prevents very nasty bugs.
Stephan Bosch [Sun, 7 Oct 2018 18:34:12 +0000 (20:34 +0200)]
lib-smtp: server: Allocate each recipient on its own pool.
This way, the application can associate data with the recipient, which
implicitly goes away either when the transaction is finished or the recipient is
denied.
Stephan Bosch [Tue, 2 Oct 2018 02:28:10 +0000 (04:28 +0200)]
lib-smtp: client: transaction: Move initiation of command submission after starting the transaction timeout.
This is a precaution against the emergence of segfaults when command submission
somehow terminates the transaction in a future version (actually, a segfault
did emerge in an earlier version of this set of changes). Also it is a cosmetic
change: putting the most important act at the end of the function makes more
sense in this case.
Stephan Bosch [Tue, 2 Oct 2018 19:44:48 +0000 (21:44 +0200)]
lib-smtp: client: transaction: Don't trigger next transaction unless all RCPT replies are received and DATA is submitted.
Triggering the next transaction when DATA submitted while not all RCPT replies
are received (as it was before) is problematic when commands are submitted
immediately by the transaction (which is added in a later commit).
Stephan Bosch [Sat, 29 Sep 2018 13:31:58 +0000 (15:31 +0200)]
lib-smtp: client: transaction: Set the number of expected DATA replies > 1 only for LMTP.
This was already OK for when all recipients were added at the time the data
command was to be sent. However, for more dynamic transactions involving
pipelining, this was not handled correctly.
Note that the special handling of '*' only kicks in when in
"search" and "explicitprefix" mode (as passed in through the
settings), and currently, only for the simple mode, not tr29.
Logic is that words followed by a '*' create a prefix search token.
A new token is begun immediately after that. So "foo*bar" is 2 tokens
"foo*" and "bar", when in explicit prefix search tokenisation mode.
Phil Carmody [Wed, 16 May 2018 14:37:29 +0000 (17:37 +0300)]
lib-fts: tokenizer-generic - add more history to break detection
For example, going from non-word to non-word is a different type
of break (not really a break) from the transition from a word to
a non-word. Presently, that distinction isn't needed, but it will
be for explicit prefix searches.
Phil Carmody [Fri, 11 May 2018 10:34:40 +0000 (13:34 +0300)]
lib-fts: generic simple tokeniser - distinguish "letters" from non-"letters"
prev_type is only compared against SINGLE_QUOTE, so there will be no
behavioural differences. However, maintaining the state that we've just
seen something we are prepared to search for (very loosely, a "letter")
rather than something that we threw away (word breaks) will be important
when it comes to explicit prefix query parsing.
Phil Carmody [Wed, 16 May 2018 14:11:27 +0000 (17:11 +0300)]
lib-fts: tokenizer-generic - move related helpers together in file
They're logically related, and not specifically simple or tr29 related,
so keep them together, so either tokeniser can use them. Cosmetic only,
no functional changes.
Phil Carmody [Wed, 16 May 2018 14:04:35 +0000 (17:04 +0300)]
lib-fts: tokenizer-generic - move state history setting into helper
We can read the value directly, but for encapsulation it's best to do
the shifting of the token type history into a helper in a similar way
as how it is done for tr29 tokenising.