nicm / fdm

fdm source code
269 stars 50 forks source link

HOME seems to get lost somewhere #66

Closed poolpOrg closed 5 years ago

poolpOrg commented 5 years ago

hello,

It seems that maildir delivery doesn't honor the '-h' option as the home gets reset back to the passwd home somewhere in the code path.

Below is a sample verbose log of me reproducing the issue:

$ export HOME=/tmp2; fdm -vv -h -m -a mda fetch < /etc/myname 
version is: fdm 1.9, started at: Tue Sep 17 09:52:46 2019
running on: OpenBSD 6.5 GENERIC.MP#1 amd64
host is: mailbrix.mx mailbrix.mx 95.179.171.116
home is: /tmp2
loading configuration from /etc/fdm.conf
[...]
mda: deliver started, pid 88708
mda: deliver user is: _vusers (1002/1002), home is: /var/maildir
mda: saving to maildir /var/maildir/
mda: creating /var
mda: creating /var/maildir//cur
mda: creating /var/maildir//new
mda: creating /var/maildir//tmp
mda: writing to /var/maildir//tmp/1568713966.88708_0.mailbrix.mx
mda: moving .../tmp/1568713966.88708_0.mailbrix.mx to .../new/1568713966.88708_0.mailbrix.mx
mda: message 1 delivered (rule 3, maildir) in 0.015 seconds
parent: sending exit message to child 88708
mda: deleting message 1
parent: child 88708 returned 0
parent: 1 children, 1 dead children
mda: 1 messages processed (0 kept) in 0.020 seconds (average 0.020)
mda: finished processing. exiting
parent: sending exit message to child 14033
parent: child 14033 returned 0
parent: finished, total time 0.023 seconds
nicm commented 5 years ago

Hi

No... it looks it up again and doesn't take account of it being the current user, maybe we could do this:

diff --git a/lookup-passwd.c b/lookup-passwd.c index fd2b854..f2bada6 100644 --- a/lookup-passwd.c +++ b/lookup-passwd.c @@ -44,7 +44,10 @@ passwd_lookup(const char user) ud = xmalloc(sizeof ud);

ud->name = xstrdup(pw->pw_name);

On Tue, Sep 17, 2019 at 03:01:14AM -0700, Gilles Chehade wrote:

hello,

It seems that maildir delivery doesn't honor the '-h' option as the home gets reset back to the passwd home somewhere in the code path.

Below is a sample verbose log of me reproducing the issue:

$ export HOME=/tmp2; fdm -vv -h -m -a mda fetch < /etc/myname version is: fdm 1.9, started at: Tue Sep 17 09:52:46 2019 running on: OpenBSD 6.5 GENERIC.MP#1 amd64 host is: mailbrix.mx mailbrix.mx 95.179.171.116 home is: /tmp2 loading configuration from /etc/fdm.conf [...] mda: deliver started, pid 88708 mda: deliver user is: _vusers (1002/1002), home is: /var/maildir mda: saving to maildir /var/maildir/ mda: creating /var mda: creating /var/maildir//cur mda: creating /var/maildir//new mda: creating /var/maildir//tmp mda: writing to /var/maildir//tmp/1568713966.88708_0.mailbrix.mx mda: moving .../tmp/1568713966.88708_0.mailbrix.mx to .../new/1568713966.88708_0.mailbrix.mx mda: message 1 delivered (rule 3, maildir) in 0.015 seconds parent: sending exit message to child 88708 mda: deleting message 1 parent: child 88708 returned 0 parent: 1 children, 1 dead children mda: 1 messages processed (0 kept) in 0.020 seconds (average 0.020) mda: finished processing. exiting parent: sending exit message to child 14033 parent: child 14033 returned 0 parent: finished, total time 0.023 seconds

- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

poolpOrg commented 5 years ago

mh, will give it a try very shortly and tell you how it goes, thanks for looking into this !

poolpOrg commented 5 years ago

minor nit, getuid() needs unistd.h to avoid warning but diff tested and works for me !

nicm commented 5 years ago

OK great, I have applied it now, thanks!