summaryrefslogtreecommitdiff
path: root/lib/util/util_runcmd.c
Commit message (Collapse)AuthorAgeFilesLines
* Revert "lib/util: make use of tfork in samba_runcmd_send()"Ralph Boehme2017-04-301-56/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 292e46ab12d8ec172c9d3b26330d8d6028a1d5a5. Processes run by tfork will have a parent pid of 1, they won't be childs of the caller anymore. When the source4 samba process uses samba_runcmd_send() to launch smbd and winbindd the resulting process hierarchy becomes: PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND 1 516 510 510 ? -1 S 111 0:02 avahi-daemon: running [samba-ad.local] 1 29209 29209 29209 ? -1 Ss 0 0:00 ./bin/samba 29209 29210 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29211 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29213 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29215 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29216 29209 29209 ? -1 R 0 0:00 \_ ./bin/samba 29209 29217 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29218 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29220 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29221 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29222 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29223 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29224 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 29209 29225 29209 29209 ? -1 S 0 0:00 \_ ./bin/samba 1 29214 29209 29209 ? -1 S 0 0:00 ./bin/samba 29214 29219 29219 29219 ? -1 Ss 0 0:00 \_ /home/slow/git/samba/scratch/bin/smbd -D --option=server role check:inhibit=yes --foreground 29219 29236 29219 29219 ? -1 S 0 0:00 \_ /home/slow/git/samba/scratch/bin/smbd -D --option=server role check:inhibit=yes --foreground 29219 29237 29219 29219 ? -1 S 0 0:00 \_ /home/slow/git/samba/scratch/bin/smbd -D --option=server role check:inhibit=yes --foreground 29219 29238 29219 29219 ? -1 S 0 0:00 \_ /home/slow/git/samba/scratch/bin/smbd -D --option=server role check:inhibit=yes --foreground 1 29228 29209 29209 ? -1 S 0 0:00 ./bin/samba 29228 29230 29230 29230 ? -1 Ss 0 0:00 \_ /home/slow/git/samba/scratch/bin/winbindd -D --option=server role check:inhibit=yes --foreground 29230 29239 29230 29230 ? -1 S 0 0:00 \_ /home/slow/git/samba/scratch/bin/winbindd -D --option=server role check:inhibit=yes --foreground They will still be in the same process group and session, but just not be a child or subchild. For childs of the source4 samba process this might be non desirable. killing all processes by sending a signal to the main samba process still works, because a pipe is used between the samba process and the smbd and winbindd childs. Both watch for EOF on the pipe. In the output above smbd and winbindd are in their own process group ans session because they call become_daemon(). See also the discussion in this mailthread: <https://lists.samba.org/archive/samba-technical/2017-April/120257.html> Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Sun Apr 30 17:21:05 CEST 2017 on sn-devel-144
* lib/util: make use of tfork in samba_runcmd_send()Ralph Boehme2017-04-201-47/+56
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* check-password-script: Allow AD to execute these scriptsGarming Sam2016-07-051-13/+1
| | | | | | | In contrast to source3, this is run as root and without substitution. Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba_dnsupdate: do not interpret failure count as unix error codeBob Campbell2016-06-031-2/+2
| | | | | | Signed-off-by: Bob Campbell <bobcampbell@catalyst.net.nz> Pair-programmed-with: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* typo: mplementation => implementationGarming Sam2016-05-061-1/+1
| | | | | Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* Fix a few printf format errorsVolker Lendecke2015-05-071-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: Make ECHILD in samba_runcmd_io_handler an errorAndrew Bartlett2015-03-171-1/+5
| | | | | | | | | | | | | We now print out a nasty message and set and error if we get ECHILD, as we no longer set SIGIGN on SIGCHLD in the standard process model. This was why samba_kcc was able to fail totally without us noticing. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jelmer Vernooij <jelmer@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Tue Mar 17 07:05:43 CET 2015 on sn-devel-104
* param: Add null checks for upcoming str_list_make changesGarming Sam2014-07-071-0/+4
| | | | | | | | | | | | | In changing str_list_make to str_list_make_v3, the list can be NULL. These are some additional checks to try to avoid any problems. Where lists are dealt with, they typically check both if the list is empty or the list is NULL. Change-Id: I9012c31dbd9832ce877728bcb3346616ba64c4c5 Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Nadezhda Ivanova <nivanova@samba.org>
* lib/util: fix const warningsStefan Metzmacher2014-04-021-2/+5
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* util: Remove unused fde_stdin in samba_runcmd.Andreas Schneider2012-12-121-22/+5
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
* runcmd: use set_close_on_exec()Andrew Tridgell2011-12-221-0/+8
| | | | | | | this prevents a fd leak to child processes Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Thu Dec 22 14:00:06 CET 2011 on sn-devel-104
* runcmd: use a pipe for stdin to child processesAndrew Tridgell2011-12-221-7/+46
| | | | | this allows child processes to detect the exit of the parent by looking for EOF on stdin
* Fix a bunch of "warning: variable ‘XXXX’ set but not used ↵Jeremy Allison2011-11-211-2/+1
| | | | | | | [-Wunused-but-set-variable]" warnings from the new gcc. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Mon Nov 21 23:39:08 CET 2011 on sn-devel-104
* tdb: Use <tdb.h> to include tdb so system headers are found when building ↵Jelmer Vernooij2011-02-281-1/+1
| | | | against system tdb.
* Use <tevent.h> so the system tevent gets included, if enabled.Jelmer Vernooij2011-02-281-2/+2
|
* util-runcmd: ignore spurious ECHILD errorsAndrew Tridgell2010-04-201-0/+14
| | | | | | | | | | when we get ECHILD in samba_runcmd it is because the parent has set SIGCHLD to SIG_IGN. In that case the child status information is lost. We then have to fallback on the logging of child error messages for any useful information on what happened to the child. A longer term fix is to stop using SIG_IGN for SIGCHLD in the standard process model of s4.
* runcmd: use tevent_re_initialise() to close socketsAndrew Tridgell2010-04-191-0/+4
| | | | this ensures that all event fds are closed in the child
* util: on FreeBSD true is in /usr/bin. Use execvp to find itAndrew Tridgell2010-03-261-1/+1
|
* lib/util: change samba_runcmd() to use tevent_req _send/_recvStefan Metzmacher2010-03-091-139/+180
| | | | metze
* s4-dns: use a loadparm list for samba_runcmd() commandsAndrew Tridgell2010-02-261-5/+5
| | | | | | This allows commands with multiple arguments and quoting to be used, while still avoiding running a shell (and this having shell expansion problems)
* util: added samba_runcmd()Andrew Tridgell2010-02-171-0/+253
This allows us to run a child command in an async fashion, with control over logging of stdout and stderr (which appears in the Samba log file). This is useful for ensuring we don't miss important messages from rndc commands (for example). Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>