This was not a problem in 4.15; but is a problem in both 4.16 and 4.17.
I use lpr printing:
print command = /links/samba/etc/bin.smbd/lpr-print.sh '%M' '%I' '%m' '%U' '%T' '%c' '%p' '%J' '%s'
The Client IP passed to the script (%I) is always 0.0.0.0
This also seems to affect the enforcement of the "hosts allow" parameter (but only for printer shares, other shares work correctly).
Another note: a preexec script:
preexec = /links/samba/etc/bin.smbd/preexec.sh '%P' '%S' '%a' '%M' '%I' '%m' '%U' '%T'
does get the ip address (%I) of the client connecting to a printer share
(I use this mostly for access debugging, and for more precise access controls on some shares).
I finally figured out what the problem was when trying to get 4.16.5 working (although it seems to also be a problem with 4.17.0rc5).
I am surprised that I couldn't find another bug report of this problem (I was hoping to just add on to it).
Spoolss is now a separate process. I'm guessing we need to fix up the substitution parameter. Just a quick guess.