daemons: Do not notify systemd in child processes started by main samba
authorSamuel Cabrero <scabrero@samba.org>
Fri, 26 Feb 2021 09:36:02 +0000 (10:36 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 1 Mar 2021 03:50:35 +0000 (03:50 +0000)
commit309c81e7e2a124982cf1ab961070f7c0420b5ae7
treeb65df201ed0af8d014c27ed1c1238cf1113ab9d6
parent65f21ed5e463770ddb9d595de5e5e7047b3884ef
daemons: Do not notify systemd in child processes started by main samba

When samba runs as ADDC only the main 'samba' daemon have to notify
its status to systemd because our systemd unit files contains implied
NotifyAccess=main since commit d1740fb3d5a72cb49e30b330bb0b01e7ef3e09cc.

This commit adds a function to disable the systemd notification in the
smbd and winbinddd child processes started by the main 'samba' daemon in
AD DC mode to avoid warnings like:

systemd[1]: samba-ad-dc.service: Got notification message from PID 26194,
    but reception only permitted for main PID 26187
systemd[1]: samba-ad-dc.service: Got notification message from PID 26222,
    but reception only permitted for main PID 26187

$ pstree -p
...
├─samba(26187)─┬─tfork(26189)(26188)───s3fs[master](26189)───tfork(26194)(26193)───smbd(26194)─┬─cleanupd(+
│              │                                                                               ├─lpqd(2623+
│              │                                                                               └─smbd-noti+
│              ├─tfork(26191)(26190)───rpc[master](26191)─┬─tfork(26198)(26195)───rpc(0)(26198)
│              │                                          ├─tfork(26200)(26199)───rpc(1)(26200)
│              │                                          ├─tfork(26206)(26201)───rpc(2)(26206)
│              │                                          └─tfork(26212)(26207)───rpc(3)(26212)
│              ├─tfork(26196)(26192)───nbt[master](26196)
│              ├─tfork(26202)(26197)───wrepl[master](26202)
│              ├─tfork(26204)(26203)───ldap[master](26204)─┬─tfork(26242)(26241)───ldap(0)(26242)
│              │                                           ├─tfork(26244)(26243)───ldap(1)(26244)
│              │                                           ├─tfork(26246)(26245)───ldap(2)(26246)
│              │                                           └─tfork(26248)(26247)───ldap(3)(26248)
│              ├─tfork(26208)(26205)───cldap[master](26208)
│              ├─tfork(26210)(26209)───kdc[master](26210)───tfork(26218)(26215)───krb5kdc(26218)
│              ├─tfork(26213)(26211)───drepl[master](26213)
│              ├─tfork(26216)(26214)───winbindd[master(26216)───tfork(26222)(26219)───winbindd(26222)───wi+
│              ├─tfork(26220)(26217)───ntp_signd[maste(26220)
│              ├─tfork(26223)(26221)───kcc[master](26223)
│              ├─tfork(26225)(26224)───dnsupdate[maste(26225)
│              └─tfork(26227)(26226)───dns[master](26227)

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/util/become_daemon.c
lib/util/become_daemon.h
source3/smbd/server.c
source3/winbindd/winbindd.c