Re: [exim] Perl integration - context?

Top Pagina
Delete this message
Reply to this message
Auteur: Felipe Gasper
Datum:  
Aan: Andrew C Aitchison
CC: exim users
Onderwerp: Re: [exim] Perl integration - context?


> On Jun 9, 2021, at 3:00 PM, Andrew C Aitchison <andrew@???> wrote:
>
> On Wed, 9 Jun 2021, Felipe Gasper via Exim-users wrote:
>
>> Hello,
>>
>>     Is it possible with Eximâ??s Perl integration to create a reference
>>     that will last throughout a messageâ??s delivery and then be reaped?

>>
>>     Iâ??d like to explore an flock-based lock for mail delivery that
>>     would allow an external process to suspend delivery by holding a
>>     lock on a designated path: if Exim/Perl does flock($fh, LOCK_SH)
>>     and fails EAGAIN, then Exim will defer acceptance of the message.

>>
>>     When the flock() succeeds, ideally that flock()ed Perl $fh will
>>     last until delivery is done and then be reaped. Is it safe to
>>     store that in a Perl global, then call something else at the end
>>     of the routing that deletes/undefs that global? Or is there some
>>     cleaner way to give Exim such a reference and have Exim hold onto
>>     it for me until routing/delivery is over?

>
> I am reminded of the exim_lock utility, though that is an external process.
>
> I'm a bit confused.
> Are you trying to stop a second message from being accepted *into the
> exim queue* whilst the first is being routed/delivered ?


The idea is more to prevent message delivery during a backup or account reconfiguration.

I specifically want to avoid this:

1. External process suspends user’s mail delivery.
2. External process gets SIGKILL.
3. User gets no more mail until user complains ($$) and someone manually ($$) reenables the user’s mail.

Using flock() for this would cause the mail suspension to go away automatically once whatever holds that lock goes away:

1. External process flock(EX)s user’s special designated file.
2. Exim tries to flock(SH) that same file, gets EAGAIN.
3. Exim tells clients :defer:
4. External process finishes or gets SIGKILL.
5. User can receive mail again, no manual intervention needed.

Alternatively:

1. Exim flock(SH)s the user’s special file.
2. External process tries to flock(EX), gets EAGAIN. Either retries later or just fails.

-FG