From: Volker Lendecke Date: Fri, 30 Jul 2021 09:43:08 +0000 (+0200) Subject: samba-bgqd: Fix samba-bgqd with "clustering=yes"/"include=registry" X-Git-Tag: ldb-2.5.0~1043 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7818513053aabda046645583fa5bb79a03e2b5ac;p=thirdparty%2Fsamba.git samba-bgqd: Fix samba-bgqd with "clustering=yes"/"include=registry" With the above combination, some flavor of lp_load() already initializes global_event_ctx, for which the closeall_except() later on will happily close the epoll fd for. If we want to close all file descriptors at startup, this must be the very first thing overall. Can't really write a proper test for this with knownfail that is removed with the fix, because if we have clustering+include=registry, the whole clusteredmember environment does not even start up. Signed-off-by: Volker Lendecke Reviewed-by: Stefan Metzmacher Autobuild-User(master): Stefan Metzmacher Autobuild-Date(master): Sat Jul 31 16:58:41 UTC 2021 on sn-devel-184 --- diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index dc1c14e9628..d0ef659da99 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -517,6 +517,7 @@ sub setup_clusteredmember server signing = on clustering = yes ctdbd socket = ${socket} + include = registry dbwrap_tdb_mutexes:* = yes ${require_mutexes} "; diff --git a/source3/printing/samba-bgqd.c b/source3/printing/samba-bgqd.c index 4b96fc43092..8ac6ec525b2 100644 --- a/source3/printing/samba-bgqd.c +++ b/source3/printing/samba-bgqd.c @@ -195,6 +195,44 @@ static int closeall_except(int *fds, size_t num_fds) return 0; } +static int closeall_except_fd_params( + size_t num_fd_params, + const char *fd_params[], + int argc, + const char *argv[]) +{ + int fds[num_fd_params+3]; + size_t i; + struct poptOption long_options[num_fd_params + 1]; + poptContext pc; + int ret; + + for (i=0; i