crane-denny / amavisd-milter

Other
0 stars 0 forks source link

fork after initializing milter socket #1

Open fanto666 opened 5 years ago

fanto666 commented 5 years ago

amavisd-milter 1.6.1 does daemonize, and opens milter socket after that, exiting if it returns error

We want to change the socket permissions after daemon is started, and this order of commands makes it problematic, e.g. debian bug 854180 (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=854180)

the daemon() should be called after calling smfi_opensocket().

This would also make possible to return error in case of impossibility to create socket, so the caller knows it failed.

this patch moves the daemonising section after opening socket. I have tried with amavisd-milter 1.6.1 and 1.5.0, works nicely.

you can find it at test.fantomas.sk/amavisd-milter-main.c.patch

fanto666 commented 5 years ago

added patch in .txt format - github does not support .patch files. amavisd-milter-main.c.patch.txt

crane-denny commented 5 years ago

Hey Matus,

thx for the patch! :) Have you already feedback from Petr about applying it or not?

Cheers

fanto666 commented 5 years ago

hello, Petr seems has merged the change in https://github.com/prehor/amavisd-milter/commit/c90c7ceadd0b8984c70c620f4342e7ce4e0f8976