From 5ee47e3bb465db1c5bf0774700971374edd09bbd Mon Sep 17 00:00:00 2001
From: Eric Wong <e@80x24.org>
Date: Thu, 16 Sep 2021 14:15:20 -0600
Subject: [PATCH] lei_pmdir: do not attempt to trigger network auth

Since some commands access both Maildirs and IMAP/NNTP servers
at the same time, LeiPmdir may see the same lei->{auth} and
lei->{net} objects as the sibling LeiInput-based workers.
Delete those at fork and do not attempt to do authentication in
those cases, since "net_merge_continue" will not be a registered
op and cause PktOp to fail even if authentication /can/ work
from a LeiPmdir worker.
---
 lib/PublicInbox/LeiPmdir.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/LeiPmdir.pm b/lib/PublicInbox/LeiPmdir.pm
index 59cf886e..23bccb4f 100644
--- a/lib/PublicInbox/LeiPmdir.pm
+++ b/lib/PublicInbox/LeiPmdir.pm
@@ -32,7 +32,8 @@ sub new {
 sub ipc_atfork_child {
 	my ($self) = @_;
 	my $ipt = $self->{ipt} // die 'BUG: no self->{ipt}';
-	$ipt->{lei} = $self->{lei};
+	my $lei = $ipt->{lei} = $self->{lei};
+	delete @$lei{qw(auth net)}; # no network access in this worker
 	$ipt->ipc_atfork_child; # calls _lei_atfork_child;
 }
 
-- 
2.50.0