From ccaa20cb99781ff09cca7fbd2bd5bdc87157de7a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 9 Jul 2018 06:51:41 +1200 Subject: [PATCH] build: Link correctly to setproctitle if not in libbsd libbsd becomes essentially globally linked due to providing other key features so this missing dependency was missed. BUG: https://bugzilla.samba.org/show_bug.cgi?id=9863 Signed-off-by: Andrew Bartlett --- lib/replace/wscript | 15 ++++++++++++++- lib/util/wscript_build | 3 ++- source3/winbindd/wscript_build | 1 + source4/smbd/wscript_build | 11 ++++++++--- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/lib/replace/wscript b/lib/replace/wscript index fd00a42d5b6..b58feb9563c 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -349,8 +349,17 @@ def configure(conf): strlcpy_in_bsd = True if not conf.CHECK_FUNCS('getpeereid'): conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') + + # Allow these targets to be depended on even if not on the target + # system. + conf.SET_TARGET_TYPE('setproctitle', 'EMPTY') + if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): - conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') + if conf.CHECK_FUNCS_IN('setproctitle', + 'bsd', + headers='sys/types.h bsd/unistd.h'): + conf.DEFINE('HAVE_SETPROCTITLE_IN_BSD', 1) + if not conf.CHECK_FUNCS('setproctitle_init'): conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h') @@ -833,6 +842,10 @@ def build(bld): bld.SAMBA_SUBSYSTEM('samba_intl', source='', use_global_deps=False,deps=bld.env.intl_libs) + if bld.CONFIG_SET('HAVE_SETPROCTITLE_IN_BSD'): + bld.SAMBA_SUBSYSTEM('setproctitle', source='', + use_global_deps=False, deps='bsd') + def dist(): '''makes a tarball for distribution''' samba_dist.dist() diff --git a/lib/util/wscript_build b/lib/util/wscript_build index ded91f67d9f..b22c1251ff2 100644 --- a/lib/util/wscript_build +++ b/lib/util/wscript_build @@ -124,7 +124,8 @@ else: util_str.c util_str_common.c ms_fnmatch.c server_id.c dprintf.c tevent_debug.c memcache.c unix_match.c tfork.c''', - deps='samba-util-core DYNCONFIG close-low-fd tiniparser genrand util_str_hex', + deps='''samba-util-core DYNCONFIG close-low-fd + tiniparser genrand util_str_hex setproctitle''', public_deps='talloc tevent execinfo pthread LIBCRYPTO charset util_setid', public_headers='debug.h attr.h byteorder.h data_blob.h memory.h safe_string.h time.h talloc_stack.h string_wrappers.h idtree.h idtree_random.h blocking.h signal.h substitute.h fault.h genrand.h tfork.h', header_path= [ ('dlinklist.h samba_util.h', '.'), ('*', 'util') ], diff --git a/source3/winbindd/wscript_build b/source3/winbindd/wscript_build index a23c44566ed..79929721ef2 100644 --- a/source3/winbindd/wscript_build +++ b/source3/winbindd/wscript_build @@ -279,6 +279,7 @@ bld.SAMBA3_BINARY('winbindd', TDB_VALIDATE MESSAGING LIBLSA + bsd ''', enabled=bld.env.build_winbind, install_path='${SBINDIR}') diff --git a/source4/smbd/wscript_build b/source4/smbd/wscript_build index ef0aaf773c1..6fa3aa46a73 100644 --- a/source4/smbd/wscript_build +++ b/source4/smbd/wscript_build @@ -21,7 +21,8 @@ bld.SAMBA_BINARY('samba', source='server.c', subsystem_name='service', deps='''events process_model service samba-hostconfig samba-util POPT_SAMBA - popt gensec registry ntvfs share cluster COMMON_SCHANNEL SECRETS''', + popt gensec registry ntvfs share cluster COMMON_SCHANNEL SECRETS + setproctitle''', pyembed=True, install_path='${SBINDIR}', enabled=bld.AD_DC_BUILD_IS_ENABLED() @@ -40,7 +41,9 @@ bld.SAMBA_MODULE('process_model_standard', source='process_standard.c', subsystem='process_model', init_function='process_model_standard_init', - deps='MESSAGING events ldbsamba process_model samba-sockets cluster messages_dgm', + deps='''MESSAGING events ldbsamba process_model + samba-sockets cluster messages_dgm + setproctitle''', internal_module=False ) @@ -48,6 +51,8 @@ bld.SAMBA_MODULE('process_model_prefork', source='process_prefork.c', subsystem='process_model', init_function='process_model_prefork_init', - deps='MESSAGING events ldbsamba cluster samba-sockets process_model messages_dgm', + deps='''MESSAGING events ldbsamba cluster + samba-sockets process_model messages_dgm + setproctitle''', internal_module=False ) -- 2.14.4