Abhijit Menon-Sen [Mon, 15 Sep 2008 09:13:14 +0000 (14:43 +0530)]
Update VERSION.
Arnt Gulbrandsen [Mon, 15 Sep 2008 07:59:21 +0000 (09:59 +0200)]
obey soft-bounce even if the reject comes from a sieve script
Arnt Gulbrandsen [Sat, 13 Sep 2008 06:21:45 +0000 (08:21 +0200)]
the session initialiser does select on dm where mailbox=$1 and modseq>$2
all the time, so we need an index or that will be dog slow on a large db
untested
Arnt Gulbrandsen [Thu, 11 Sep 2008 15:48:26 +0000 (17:48 +0200)]
continue splitting messages and mailbox_messages.
the trivia fetcher conflated the two, which led to strange failures and
race conditions, all very unusual but decidedly buggy.
as a bonus change, the injector now records that the message it caches
contains information. this makes whip happy, not sure why. but from now on
the cache may actually lead to speedups.
Arnt Gulbrandsen [Thu, 11 Sep 2008 09:47:58 +0000 (11:47 +0200)]
make the AddressCreator generally more similar to HRC.
important difference: the AC has an optimisation where it skips using a
savepoint for the first select. because of this, the caller has to look at
whether the AC is done, not just send more queries (or? hm? not sure.
maybe it would work anyway, due to the magic of subtransactions.) and the
AC may have to notify the caller itself, not rely on sub->commit().
Arnt Gulbrandsen [Thu, 11 Sep 2008 09:02:50 +0000 (11:02 +0200)]
stop saying 'select distinct ...' in the Selector. it bothered too many
callers, and I don't think it has been necessary for a while. six months
or so.
update callers.
tweak the Transaction logic in Fetcher so it'll use a Transaction only
when really needed or told to, and lock the messages so a big query won't
accidentally collide with an expunge.
Arnt Gulbrandsen [Thu, 11 Sep 2008 09:01:38 +0000 (11:01 +0200)]
addresscreator must go back to selecting addresses if the copy fails.
also initialise a variable that accidentally wasn't.
Arnt Gulbrandsen [Thu, 11 Sep 2008 08:55:27 +0000 (10:55 +0200)]
don't send the notify if we only did select, not copy.
don't send it even if we do select/copy/rollback/select/release.
Arnt Gulbrandsen [Thu, 11 Sep 2008 08:54:41 +0000 (10:54 +0200)]
if a session update makes a command able to proceed, then let it.
Arnt Gulbrandsen [Thu, 11 Sep 2008 08:53:25 +0000 (10:53 +0200)]
no point in blocking the flag-update fetch, it'll be set to executing
again in a moment anyway.
Arnt Gulbrandsen [Thu, 11 Sep 2008 08:49:37 +0000 (10:49 +0200)]
add a debug message which we ought to remove again in a few releases, when
it's clear whether slow DNS resolution is why aox sometimes starts slowly.
Arnt Gulbrandsen [Thu, 11 Sep 2008 08:47:45 +0000 (10:47 +0200)]
better error message.
there were too many questions about the previous message, so we'd better
make some effort to give a more helpful message. the previous one didn't
give people enough information to report the bug well, hopefully this one
will.
Arnt Gulbrandsen [Thu, 11 Sep 2008 08:46:47 +0000 (10:46 +0200)]
minor optimisation: avoid sending a query that almost always is a no-op
Arnt Gulbrandsen [Wed, 10 Sep 2008 13:33:55 +0000 (15:33 +0200)]
make the fetcher use a transaction if it is to fetch dynamic data, to be
sure that the reported modseq is in sync with the other queries. (I'm not
sure this is sufficient, but I also don't care greatly.)
allow setters to provide a transaction, of which the fetcher will use a
subtransaction (so the fetcher gets exclusive use of the transaction for a
little while).
use the new setter for flag-update fetches, so noone will be able to sneak
in and expunge the message after fetch has found it, but before the
fetcher has retrieved data.
Arnt Gulbrandsen [Wed, 10 Sep 2008 13:31:55 +0000 (15:31 +0200)]
don't ask for the current rows while we're trying to add new rows. it
might be safe, but we might want to roll back the COPY, and we don't know
that yet.
also use Transaction::restart(). I thought I'd submitted this, but not.
Arnt Gulbrandsen [Wed, 10 Sep 2008 11:42:16 +0000 (13:42 +0200)]
tell jam where schema.pg is IN THE RIGHT FORMAT
Arnt Gulbrandsen [Wed, 10 Sep 2008 09:47:45 +0000 (11:47 +0200)]
add new function Transaction::restart(), to roll back and restart a
subtransaction.
use it in the callers that expected rollback() to do this.
Arnt Gulbrandsen [Tue, 9 Sep 2008 14:49:10 +0000 (16:49 +0200)]
actually startup wipes out the mailbox tree too (sort of), so use the same
mechanism to make sure SASL authenticaiton will wait until the server has
started up.
Arnt Gulbrandsen [Tue, 9 Sep 2008 14:47:55 +0000 (16:47 +0200)]
make refreshing() return true only if mailboxes might disappear.
refreshing() should now return false always during normal operation, which
fixes a serious race between append and login. Login would never complete.
Arnt Gulbrandsen [Tue, 9 Sep 2008 13:25:00 +0000 (15:25 +0200)]
q-p lines that start with "--" or "From "
If a string includes a line starting with From, but there's no other
reason to q-p it, then we don't q-p it.
Arnt Gulbrandsen [Tue, 9 Sep 2008 12:06:22 +0000 (14:06 +0200)]
no need to tell the owner that we've been able to begin
Arnt Gulbrandsen [Tue, 9 Sep 2008 12:03:07 +0000 (14:03 +0200)]
if the HRC failed completely and can't go either forwards or backwards, it
has to release its subtransaction by calling ->commit().
calling the parent transaction's notify() isn't necessary, Transaction
does it itself when the parent can go on.
Arnt Gulbrandsen [Tue, 9 Sep 2008 11:57:19 +0000 (13:57 +0200)]
1. make Transaction::subTransaction() just return an object, without
locking the parent. makes it possible to create lots of subtransactions
and use them one by one, as Injector does via HRC.
2. lock the parent when control passes to the subtransaction instead. the
trampoline releases the parent when control passes back.
3. make Transaction::execute() do nothing when the object is blocked.
Injector accidentally called it.
Abhijit Menon-Sen [Mon, 8 Sep 2008 23:26:15 +0000 (04:56 +0530)]
Avoid enqueueing into the blocked parent transaction.
Abhijit Menon-Sen [Mon, 8 Sep 2008 23:25:06 +0000 (04:55 +0530)]
Use this->id() when making a SELECT/COPY in any HelperRowCreator.
Abhijit Menon-Sen [Mon, 8 Sep 2008 22:01:40 +0000 (03:31 +0530)]
Fix typo.
Arnt Gulbrandsen [Mon, 8 Sep 2008 14:16:23 +0000 (16:16 +0200)]
edit the Received: format to avoid triggering SA's RCVD_NUMERIC_whatever
rule.
http://archives.oryx.com/archives/mailstore-users/2197/thread
Arnt Gulbrandsen [Tue, 26 Aug 2008 14:01:32 +0000 (16:01 +0200)]
log authenticated used in the Received line.
log the address rather than login just in case someone feels the urge to
try password guessing with the login.
Abhijit Menon-Sen [Mon, 8 Sep 2008 11:34:56 +0000 (17:04 +0530)]
Convert HelperRowCreator to use subtransactions.
Needs a careful once-over.
Abhijit Menon-Sen [Mon, 8 Sep 2008 11:25:54 +0000 (16:55 +0530)]
Make the injector ask the *creators for newly-created ids.
Abhijit Menon-Sen [Mon, 8 Sep 2008 11:16:35 +0000 (16:46 +0530)]
Fetch newly-created ids from the HelperRowCreator.
Abhijit Menon-Sen [Mon, 8 Sep 2008 10:42:30 +0000 (16:12 +0530)]
Get rid of the bogus rollback() functions in Flag etc.
We'll depend on real transaction semantics instead, with
no risk of races.
Signed-off-by: Abhijit Menon-Sen <ams@oryx.com>
Abhijit Menon-Sen [Mon, 8 Sep 2008 08:53:52 +0000 (14:23 +0530)]
Make the HelperRowCreator(s) remember the names they create.
1. add() and id() methods for HelperRowCreator.
2. processSelect() just calls add on the creator itself.
Abhijit Menon-Sen [Mon, 8 Sep 2008 08:41:09 +0000 (14:11 +0530)]
Delete unneeded d class.
Arnt Gulbrandsen [Mon, 8 Sep 2008 09:14:45 +0000 (11:14 +0200)]
make SURE we use only asfd@as.df as mail from... shouldn't matter, the
address we use as sender ought never to have a display-name. but it's
better to be sure.
Arnt Gulbrandsen [Mon, 8 Sep 2008 09:03:11 +0000 (11:03 +0200)]
help imaptest with RFC 5256, where a SORT extension makes demands on what
APPEND should do with nonconformant data.
Arnt Gulbrandsen [Mon, 8 Sep 2008 08:27:18 +0000 (10:27 +0200)]
add a specific Message::parse() command and use it for parsing messages
instead of a constructor.
callers that wished to pass a specific parent now have to call
setParent(). there is one such caller.
the next change will make IMAP APPEND take advantage of this.
Abhijit Menon-Sen [Mon, 8 Sep 2008 05:36:33 +0000 (11:06 +0530)]
Convert insertBodyparts() to use subtransactions.
Makes d->ignoreError go away. Good.
Abhijit Menon-Sen [Mon, 8 Sep 2008 05:19:31 +0000 (10:49 +0530)]
Convert AddressCreator to use subtransactions.
Arnt Gulbrandsen [Sun, 7 Sep 2008 15:22:08 +0000 (17:22 +0200)]
do lsub correctly. 2.12 fodder, (assuming that anyone ever cares about odd
lsub behaviour).
Arnt Gulbrandsen [Fri, 5 Sep 2008 19:33:09 +0000 (21:33 +0200)]
a message without a subject should have an empty base-subject, not none
Arnt Gulbrandsen [Fri, 5 Sep 2008 13:37:28 +0000 (15:37 +0200)]
if there is no read-write session where we might advertise \recent, then
advertise it in a read-only session. 3501 doesn't demand this, but an
example suggests it and imaptest likes it.
there are unspecified areas concerning \recent when messages are appended
to multiselected mailboxes. aox does what comes easiest.
Abhijit Menon-Sen [Fri, 5 Sep 2008 09:31:48 +0000 (15:01 +0530)]
Use a trampoline to detect the end of a subtransaction.
Arnt Gulbrandsen [Thu, 4 Sep 2008 16:54:29 +0000 (18:54 +0200)]
make sure the EXPUNGE responses are sent as the last responses of the last
command where we can send them. they could be sent too early by mistake,
something imaptest ran into.
(if there isn't a last command, don't send EXPUNGE.)
Arnt Gulbrandsen [Thu, 4 Sep 2008 13:57:18 +0000 (15:57 +0200)]
sent mail to the smarthost in order of retry date.
if we're five seconds past one message's retry time and three seconds past
another's, we'll try the five-second one first. this gives us a little
more flexibility if the smarthost doesn't want to accept one message and
spends a long time. the bad message will get a new retry date and other
messages will then be tried first during the next run.
Arnt Gulbrandsen [Thu, 4 Sep 2008 13:54:34 +0000 (15:54 +0200)]
change Message::baseSubject() to use the algorithm in the final RFC 5256.
also uses titlecase instead of lowercase.
may differ from 5256 in two ways:
- 5256 doesn't define space, we use all unicode space characters
- 5256 doesn't say whether "Subject: " is the same as no subject field
(it's not for us)
update callers.
ideally, we should drop all contents of thread_members and threads when we
upgrade to 3.0.1 (and 2.12?) since the old and new content isn't the same
(lower case vs. titlecase, etc).
Arnt Gulbrandsen [Thu, 4 Sep 2008 12:30:01 +0000 (14:30 +0200)]
searches for 'smaller 128' didn't work when embedded within boolean logic. fix.
Arnt Gulbrandsen [Wed, 3 Sep 2008 21:00:01 +0000 (23:00 +0200)]
rework the spool manager to use only one query.
when there's only one query, there's no scope for things to get out of
sync.
also less state machinery in general. d->again is almost all there is, it
means "might want to look at the tables again, maybe one of them changed
after you sent the query".
Arnt Gulbrandsen [Wed, 3 Sep 2008 11:59:08 +0000 (13:59 +0200)]
update last_attempt on EVERY delivery attempt, not just those that produce
final resolution for that recipient
Arnt Gulbrandsen [Wed, 3 Sep 2008 09:24:53 +0000 (11:24 +0200)]
stop using deliveres.tried_at. use only dr.last_attempt instead. (tried_at
is logically required to be the maximum last_attempt for its delivery.)
move the bottleneck query from DA to SM, so SM won't create a DA which
does nothing. the SM would loop quickly creating lots of DAs for messages
which couldn't be delivered yet because an attempt had been made less than
one hour previously. massive load on the database.
Arnt Gulbrandsen [Wed, 3 Sep 2008 09:23:14 +0000 (11:23 +0200)]
demand that the server answers the TCP connection within four seconds,
but allow more time for the banner.
if the error message changes, then our state changed, and it's advisable
to notify the owner.
this is necessary to handle the case where the smarthost is down when aox
starts up.
Arnt Gulbrandsen [Wed, 3 Sep 2008 08:16:24 +0000 (10:16 +0200)]
set the log the right way and log a little more
Abhijit Menon-Sen [Tue, 2 Sep 2008 06:15:33 +0000 (11:45 +0530)]
Initial support for subtransactions.
Mostly works, but doesn't set Completed on correctly-finished
subtransactions, because the state doesn't go back to Idle,
and Postgres has no way to tell when the subtransaction's
finished for good.
Abhijit Menon-Sen [Tue, 26 Aug 2008 17:47:14 +0000 (23:17 +0530)]
Make "aox delete mailbox" really delete mailboxes sensibly.
1. Refuse to delete mailboxes containing (either existing or deleted)
messages, and
2. Provide a -f flag to delete the messages too.
Arnt Gulbrandsen [Sun, 24 Aug 2008 11:17:14 +0000 (13:17 +0200)]
make a note about how we handle the RFC 1047 race
Abhijit Menon-Sen [Mon, 15 Sep 2008 05:02:57 +0000 (10:32 +0530)]
Don't segfault.
Arnt Gulbrandsen [Tue, 2 Sep 2008 14:37:13 +0000 (16:37 +0200)]
set an own log id, and set it properly, where EventHandler::notify() will look
Arnt Gulbrandsen [Tue, 2 Sep 2008 13:59:22 +0000 (15:59 +0200)]
smtpclient could work itself into a no-good state. fix.
there was a race. if the smarthost closed the connection JUST when a new
message was spooled for deliveries, then smtpclient would be asked to
deliver, find itself unable to, reconnect, but never actually get anything
done, there would just be a sequence of five-minute connections doing
nothing.
this fixes the race by simplifying the notification model. the owner and
user (spoolmanager and deliveryagent) are notified (newly via notify()
instead of execute() whenever the smtpclient changes state in react, no
more, no less.
Arnt Gulbrandsen [Tue, 2 Sep 2008 13:52:35 +0000 (15:52 +0200)]
don't call die() when someone sends STORE and then closes the connection
instead, throw Invariant directly, so the cleanup logic closes the
connection without involving a breakpoint on die()
Arnt Gulbrandsen [Tue, 2 Sep 2008 12:38:58 +0000 (14:38 +0200)]
the search was fubared if the sort program contained two or more entries
and size wasn't the last. fix.
Arnt Gulbrandsen [Tue, 2 Sep 2008 12:21:54 +0000 (14:21 +0200)]
the query order has changed; we need to wait on the new second query
before proceeding. otherwise we'll have an occasional segfault.
Arnt Gulbrandsen [Tue, 2 Sep 2008 12:00:41 +0000 (14:00 +0200)]
expunge could deadlock with store if one session tried to change flags on
a particular message while another tries to expunge it.
this change fixes that by locking the affected messages first in both
cases, and only then locking the mailboxes row to get a modseq.
I decided to change expunge rather than store since one of them would have
to become slower, and I'd rather slow down expunge than store.
Arnt Gulbrandsen [Mon, 1 Sep 2008 13:50:43 +0000 (15:50 +0200)]
unfuck accidentally changed 'not' logic.
we want to delete flags rows for a particular flag if there is at least
one message with that flag set in our UID range. (ie. the opposite of zero
is >=1, not all.)
Arnt Gulbrandsen [Fri, 29 Aug 2008 12:33:43 +0000 (14:33 +0200)]
constrain sender differently now that we have a better list
Abhijit Menon-Sen [Wed, 27 Aug 2008 19:14:15 +0000 (00:44 +0530)]
Don't allow the injector to see recoverable errors in helperrowcreator.
(Because it'll try to rollback the transaction, even if the last queries
enqueued by the helper would have reset the error.)
This is just a stopgap solution.
Abhijit Menon-Sen [Wed, 27 Aug 2008 11:49:09 +0000 (17:19 +0530)]
Guard Timer::notify in try/catch.
Abhijit Menon-Sen [Wed, 27 Aug 2008 11:20:59 +0000 (16:50 +0530)]
Don't dereference a pointer we just set to 0.
Abhijit Menon-Sen [Wed, 27 Aug 2008 11:01:35 +0000 (16:31 +0530)]
Wrong column name in fetch.
Arnt Gulbrandsen [Tue, 26 Aug 2008 13:34:03 +0000 (15:34 +0200)]
pattern a*b may match children of a/c.
Arnt Gulbrandsen [Tue, 26 Aug 2008 12:54:01 +0000 (14:54 +0200)]
don't send * 0 EXPUNGE.
it's not clear to me why it could happen, but it's clear to me how to
prevent such responses from being sent, and the change should have no
adverse effects on the various state machines. it can lead to a
superfluous EXISTS response, that's all.
Arnt Gulbrandsen [Tue, 26 Aug 2008 12:50:22 +0000 (14:50 +0200)]
compute MSNs only when we send the response, instead of computing
responses as soon as possible and then trickling out.
Arnt Gulbrandsen [Tue, 26 Aug 2008 10:59:54 +0000 (12:59 +0200)]
send \noselect when a client asks for the separator
Arnt Gulbrandsen [Tue, 26 Aug 2008 09:32:26 +0000 (11:32 +0200)]
sort always sorted the entire mailbox.
the search program was disregarded in 3.0.0. fix.
Arnt Gulbrandsen [Tue, 26 Aug 2008 08:07:52 +0000 (10:07 +0200)]
implement 5257 section 4.9
5257 4.9 says "if you've also done 5256, you MUST ...", but I implemented
5257 before 5256 and forgot about this when implementing 5256. oops.
messages without an annotation sort after those with. I think that's
correct but can't find any rule in either RFC now.
Arnt Gulbrandsen [Tue, 26 Aug 2008 07:52:38 +0000 (09:52 +0200)]
update for RFC 5257 *sigh*
Arnt Gulbrandsen [Mon, 25 Aug 2008 20:33:51 +0000 (22:33 +0200)]
reference the RFCs we implement
Arnt Gulbrandsen [Mon, 25 Aug 2008 20:32:57 +0000 (22:32 +0200)]
this implements RFC 5257 and more, so say so
Arnt Gulbrandsen [Mon, 25 Aug 2008 14:34:04 +0000 (16:34 +0200)]
we handle I18NLEVEL=1 (practically a no-op in our case), so advertise it.
this is a little sneaky. whether we comply or not depends on what postgres
does, but we don't check that postgres does the right thing.
Arnt Gulbrandsen [Mon, 25 Aug 2008 14:29:17 +0000 (16:29 +0200)]
when sorting by subject we need to smash to lower case
Arnt Gulbrandsen [Mon, 25 Aug 2008 13:22:46 +0000 (15:22 +0200)]
make the code handle the correct append syntax, as given by a combination
of RFC 3501, 3502, 4466, 4469 and 5258.
Arnt Gulbrandsen [Mon, 25 Aug 2008 12:06:59 +0000 (14:06 +0200)]
segfaults are such fun. not.
Arnt Gulbrandsen [Mon, 25 Aug 2008 11:37:06 +0000 (13:37 +0200)]
no need to rebuild privileges.inc when the top-level directory changes;
it depends only on schema.pg and list-privileges
Arnt Gulbrandsen [Mon, 25 Aug 2008 11:29:00 +0000 (13:29 +0200)]
simplify Granter and update callers
Arnt Gulbrandsen [Mon, 25 Aug 2008 10:04:19 +0000 (12:04 +0200)]
fix bad line wrapping
Arnt Gulbrandsen [Mon, 25 Aug 2008 10:03:47 +0000 (12:03 +0200)]
aox upgrade schema talks about what it does, so don't make an exception
for granting privileges
Abhijit Menon-Sen [Mon, 25 Aug 2008 04:11:56 +0000 (09:41 +0530)]
Don't advertise LISTEXT before authentication.
Arnt Gulbrandsen [Fri, 22 Aug 2008 15:08:27 +0000 (17:08 +0200)]
we implement 5256 as well (imap sort)
Arnt Gulbrandsen [Fri, 22 Aug 2008 14:04:18 +0000 (16:04 +0200)]
our listext is like what RFC 5258 describes
Abhijit Menon-Sen [Sun, 24 Aug 2008 11:07:21 +0000 (16:37 +0530)]
Avoid excessively long timeout.
(Submitted by accident with an earlier change.)
Arnt Gulbrandsen [Sun, 24 Aug 2008 11:08:57 +0000 (13:08 +0200)]
that _is_ an error, so log it like that
Arnt Gulbrandsen [Sun, 24 Aug 2008 10:48:59 +0000 (12:48 +0200)]
roll back a transaction if something throws Invariant while processing it
Abhijit Menon-Sen [Sun, 24 Aug 2008 07:06:09 +0000 (12:36 +0530)]
Be careful to not hold locks and die.
Abhijit Menon-Sen [Fri, 22 Aug 2008 12:43:28 +0000 (18:13 +0530)]
Cure the symptoms of the /3.0.0foo disease.
Arnt Gulbrandsen [Fri, 22 Aug 2008 10:42:14 +0000 (12:42 +0200)]
be slightly more flexible about guessing content-type:
if we have to guess, we first set a default, then try to guess something,
and if we can't guess, we don't touch the default.
Arnt Gulbrandsen [Fri, 22 Aug 2008 10:34:30 +0000 (12:34 +0200)]
authenticate can also contains passwords (base64-encoded, but still)
Arnt Gulbrandsen [Fri, 22 Aug 2008 10:15:12 +0000 (12:15 +0200)]
the code to not close listeners only caught one of the two instances. this
catches the other.
also closes the connection instead of just forgetting it.
also forgets about connections even if they're already closed.
Arnt Gulbrandsen [Thu, 21 Aug 2008 12:14:13 +0000 (14:14 +0200)]
build an actual, working query for aox tune database
this also is prettier. we like =any($x) much better than building long
boolean chains.
Arnt Gulbrandsen [Thu, 21 Aug 2008 12:06:19 +0000 (14:06 +0200)]
pg versions differ in how the indexdef is returned, so use the name more and
the defintion less
Abhijit Menon-Sen [Wed, 20 Aug 2008 11:12:50 +0000 (16:42 +0530)]
The sender's copy is delivered through the smarthost.
Arnt Gulbrandsen [Wed, 20 Aug 2008 10:33:29 +0000 (12:33 +0200)]
don't try to use tsearch2 on pg 8.1 or 8.2