The branch, master has been updated via d03991f569b selftest:Samba4: use 'smbcontrol samba shutdown' via 832776c0fcf s4:server: add support for 'smbcontrol samba shutdown' via 5bd7a8e5685 s4:server: avoid using pid=0 for the parent 'samba' process via 3a0c1da432c s4:messaging: add support 'smbcontrol <pid> debug/debuglevel' via 12b9adec3ff manpages/samba.7.xml: smbcontrol can also work with 'samba' via 7a7a5ccf501 ldb: The test api.py should not rely on order of entries in dict via 29f9618e38c dns.idl: fix DNS_RCODE from 0xF to 0x1F via 0b66cf93f2c python/tests/dns*: make use of dns.DNS_RCODE/dns.DNS_OPCODE via 8e7b63a1711 'articles' variable causes a dependency loop via c0ed5bd0504 third_party/resolv_wrapper: fix HAVE_RESOLV_IPV6_NSADDRS for struct __res_state via b2050db67b4 wafsamba/replace: move __STDC_WANT_LIB_EXT1__ to CFLAGS via e49df24e80a replace: only include <sys/capability.h> with HAVE_POSIX_CAPABILITIES via 8061983d488 wscript: separate embedded_heimdal from system_heimdal from 60b062d614e vfs_gpfs: Fix the 32-bit build
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit d03991f569b54ae0a11911b622107fbae701715d Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jan 17 23:50:45 2019 +0100 selftest:Samba4: use 'smbcontrol samba shutdown' BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752 Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Björn Baumbach <bbaumb...@samba.org> Autobuild-User(master): Andreas Schneider <a...@cryptomilk.org> Autobuild-Date(master): Wed Jan 30 01:51:48 CET 2019 on sn-devel-144 commit 832776c0fcf7cc658c128765514755c2d15b06a6 Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jan 17 16:27:10 2019 +0100 s4:server: add support for 'smbcontrol samba shutdown' BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752 Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Björn Baumbach <bbaumb...@samba.org> commit 5bd7a8e5685caa09067745b108ef7e53e3108e97 Author: Stefan Metzmacher <me...@samba.org> Date: Mon Jan 28 16:29:51 2019 +0100 s4:server: avoid using pid=0 for the parent 'samba' process It confuses the 'samba-tool processes' output and log messages. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752 Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Björn Baumbach <bbaumb...@samba.org> commit 3a0c1da432c53de234b54bac90a3fb84534994eb Author: Stefan Metzmacher <me...@samba.org> Date: Tue Jan 15 01:39:06 2019 +0100 s4:messaging: add support 'smbcontrol <pid> debug/debuglevel' BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752 Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Björn Baumbach <bbaumb...@samba.org> commit 12b9adec3ff48f4356f9ff865891dc3c652ff86b Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jan 17 16:29:37 2019 +0100 manpages/samba.7.xml: smbcontrol can also work with 'samba' BUG: https://bugzilla.samba.org/show_bug.cgi?id=13752 Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Björn Baumbach <bbaumb...@samba.org> commit 7a7a5ccf501f89c530970bde072509ed86d7bd89 Author: Lukas Slebodnik <lsleb...@fedoraproject.org> Date: Tue Jan 22 10:04:02 2019 +0100 ldb: The test api.py should not rely on order of entries in dict Test failed on s390x but there is a simple reproducer for any architecture. The built-in function repr returns the canonical string representation of the object. We needn't care about order attributes in string representation. Therefore test should pass for any order. for i in {1..30}; do PYTHONHASHSEED=random \ python2 -c 'import ldb; msg = ldb.Message(); msg.dn = ldb.Dn(ldb.Ldb(), "dc=foo29"); msg["dc"] = b"foo"; print(repr(msg)) ' done ====================================================================== FAIL: test_repr (__main__.LdbMsgTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests/python/api.py", line 2322, in test_repr "Message({'dn': Dn('dc=foo29'), 'dc': MessageElement(['foo'])})") AssertionError: "Message({'dc': MessageElement(['foo']), 'dn': Dn('dc=foo29')})" != "Message({'dn': Dn('dc=foo29'), 'dc': MessageElement(['foo'])})" ---------------------------------------------------------------------- Ran 1025 tests in 29.146s FAILED (failures=1) Signed-off-by: Lukas Slebodnik <lsleb...@fedoraproject.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Andreas Schneider <a...@samba.org> commit 29f9618e38c42e8ccbabc5d2eedae94287c67355 Author: Stefan Metzmacher <me...@samba.org> Date: Wed Jan 23 09:32:08 2019 +0100 dns.idl: fix DNS_RCODE from 0xF to 0x1F commit 74206984daa9c707a38675df88d6bbe660d876bc introduced TSIG related error codes up to DNS_RCODE_BADALG = 0x15 Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit 0b66cf93f2c46e3ccb537757f8132894a6526b7b Author: Stefan Metzmacher <me...@samba.org> Date: Wed Jan 23 09:31:17 2019 +0100 python/tests/dns*: make use of dns.DNS_RCODE/dns.DNS_OPCODE Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Volker Lendecke <v...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit 8e7b63a17112c012652d0c85ef8a45870e83d589 Author: David Mulder <dmul...@suse.com> Date: Sat Jan 26 08:53:18 2019 -0700 'articles' variable causes a dependency loop This 'articles' variable contains 'smbdotconf/parameters.all.xml' and causes a dependency loop when creating parameters.all.xml Signed-off-by: David Mulder <dmul...@suse.com> Reviewed-by: Andrew Bartlet <abart...@samba.org> Reviewed-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andreas Schneider <a...@samba.org> commit c0ed5bd05041e6a7a44c020588d9a1272f4be101 Author: Stefan Metzmacher <me...@samba.org> Date: Fri Jan 25 15:12:46 2019 +0100 third_party/resolv_wrapper: fix HAVE_RESOLV_IPV6_NSADDRS for struct __res_state Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit b2050db67b47ab5d8ac9bf5b223b3a3289eb854e Author: Stefan Metzmacher <me...@samba.org> Date: Sun Jan 27 20:27:42 2019 +0100 wafsamba/replace: move __STDC_WANT_LIB_EXT1__ to CFLAGS This fixes the build of python bindings, which use memset_s() (via ZERO_STRUCT). In python bindings Python.h needs to be the first header, which means is already includes string.h. Defining __STDC_WANT_LIB_EXT1__ in replace.h is too late in that case. This fixes the --check-c-compiler=gcc --picky-developer on FreeBSD 12. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit e49df24e80a1c0bc2a1cc46c026e2aebfd5d6ddd Author: Stefan Metzmacher <me...@samba.org> Date: Fri Jan 25 23:52:34 2019 +0100 replace: only include <sys/capability.h> with HAVE_POSIX_CAPABILITIES On FreeBSD <sys/capability.h> is a legacy wrapper to <sys/capsicum.h>, which implements something different. With FreeBSD 12 including <sys/capability.h> generates a compiler warning/error. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit 8061983d4882f3ba3f12da71443b035d7b672eec Author: Stefan Metzmacher <me...@samba.org> Date: Thu Jan 24 02:31:10 2019 +0100 wscript: separate embedded_heimdal from system_heimdal This allows to default (embedded_heimdal) to build even with a broken krb5-config file from Heimdal. In the system_heimdal case we parse the content of krb5-config instead of just executing it. This fails on FreeBSD 12 as krb5-config contains iso-8859-1 characters, which can't be parsed as unicode python buffers when using python3. Fixing the system_heimdal case is a task for another day, I guess it will only work once we imported a current heimdal version and actually tested the system_heimdal case. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> ----------------------------------------------------------------------- Summary of changes: buildtools/wafsamba/wscript | 9 +++ docs-xml/manpages/samba.7.xml | 2 +- docs-xml/wscript_build | 4 +- lib/ldb/tests/python/api.py | 14 +++-- lib/replace/replace.h | 10 +++- lib/replace/system/capability.h | 2 + librpc/idl/dns.idl | 3 +- python/samba/tests/dns_base.py | 4 +- python/samba/tests/dns_forwarder.py | 4 +- selftest/target/Samba4.pm | 9 +++ source4/heimdal_build/wscript_configure | 94 ------------------------------- source4/lib/messaging/messaging.c | 72 ++++++++++++++++++++++++ source4/smbd/server.c | 39 ++++++++++++- third_party/resolv_wrapper/wscript | 2 +- wscript | 11 ++-- wscript_configure_embedded_heimdal | 1 + wscript_configure_system_heimdal | 99 +++++++++++++++++++++++++++++++++ 17 files changed, 258 insertions(+), 121 deletions(-) create mode 100644 wscript_configure_embedded_heimdal create mode 100644 wscript_configure_system_heimdal Changeset truncated at 500 lines: diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript index 7b8fb01db5e..57d8a1504e1 100644 --- a/buildtools/wafsamba/wscript +++ b/buildtools/wafsamba/wscript @@ -444,6 +444,15 @@ def configure(conf): conf.DEFINE('_GNU_SOURCE', 1, add_to_cflags=True) conf.DEFINE('_XOPEN_SOURCE_EXTENDED', 1, add_to_cflags=True) + # + # Needs to be defined before std*.h and string*.h are included + # As Python.h already brings string.h we need it in CFLAGS. + # See memset_s() details here: + # https://en.cppreference.com/w/c/string/byte/memset + # + if conf.CHECK_CFLAGS(['-D__STDC_WANT_LIB_EXT1__=1'] + conf.env.WERROR_CFLAGS): + conf.ADD_CFLAGS('-D__STDC_WANT_LIB_EXT1__=1') + # on Tru64 certain features are only available with _OSF_SOURCE set to 1 # and _XOPEN_SOURCE set to 600 if conf.env['SYSTEM_UNAME_SYSNAME'] == 'OSF1': diff --git a/docs-xml/manpages/samba.7.xml b/docs-xml/manpages/samba.7.xml index 5b72d659871..836ed23619f 100644 --- a/docs-xml/manpages/samba.7.xml +++ b/docs-xml/manpages/samba.7.xml @@ -166,7 +166,7 @@ <manvolnum>1</manvolnum></citerefentry></term> <listitem><para><command>smbcontrol</command> is a utility that can change the behaviour of running - <command>smbd</command>, <command>nmbd</command> and + <command>samba</command>, <command>smbd</command>, <command>nmbd</command> and <command>winbindd</command> daemons. </para></listitem> </varlistentry> diff --git a/docs-xml/wscript_build b/docs-xml/wscript_build index 86600ae4a82..796b685c709 100644 --- a/docs-xml/wscript_build +++ b/docs-xml/wscript_build @@ -140,11 +140,11 @@ def smbdotconf_generate_parameter_list(task): # Since nothing really forces sorting in glob, we have to sort by file name # POSIX file systems aren't required to return sorted content but we want # smb.conf parameters to be sorted alphabetically -sources = bld.path.ant_glob("smbdotconf/**/*.xml", flat=False) +parameter_all = 'smbdotconf/parameters.all.xml' +sources = bld.path.ant_glob("smbdotconf/**/*.xml", flat=False, excl=parameter_all) articles = " ".join(sorted([x.path_from(bld.path) for x in sources], key=lambda m: m.split(os.sep)[-1])) -parameter_all = 'smbdotconf/parameters.all.xml' bld.SAMBA_GENERATOR(parameter_all, source=articles, target=parameter_all, diff --git a/lib/ldb/tests/python/api.py b/lib/ldb/tests/python/api.py index 1d9f33f8f73..e8826b5af3b 100755 --- a/lib/ldb/tests/python/api.py +++ b/lib/ldb/tests/python/api.py @@ -2317,12 +2317,14 @@ class LdbMsgTests(TestCase): "Message({'dc': MessageElement([b'foo']), 'dn': Dn('dc=foo29')}).text", ]) else: - self.assertEqual( - repr(self.msg), - "Message({'dn': Dn('dc=foo29'), 'dc': MessageElement(['foo'])})") - self.assertEqual( - repr(self.msg.text), - "Message({'dn': Dn('dc=foo29'), 'dc': MessageElement(['foo'])}).text") + self.assertIn(repr(self.msg), [ + "Message({'dn': Dn('dc=foo29'), 'dc': MessageElement(['foo'])})", + "Message({'dc': MessageElement(['foo']), 'dn': Dn('dc=foo29')})", + ]) + self.assertIn(repr(self.msg.text), [ + "Message({'dn': Dn('dc=foo29'), 'dc': MessageElement(['foo'])}).text", + "Message({'dc': MessageElement(['foo']), 'dn': Dn('dc=foo29')}).text", + ]) def test_len(self): self.assertEqual(0, len(self.msg)) diff --git a/lib/replace/replace.h b/lib/replace/replace.h index 76898f013f8..212ed265d4a 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -36,8 +36,14 @@ #include <standards.h> #endif -/* Needs to be defined before std*.h and string*.h are included */ -#define __STDC_WANT_LIB_EXT1__ 1 +/* + * Needs to be defined before std*.h and string*.h are included + * As it's also needed when Python.h is the first header we + * require a global -D__STDC_WANT_LIB_EXT1__=1 + */ +#ifndef __STDC_WANT_LIB_EXT1__ +#error -D__STDC_WANT_LIB_EXT1__=1 required +#endif #include <stdio.h> #include <stdlib.h> diff --git a/lib/replace/system/capability.h b/lib/replace/system/capability.h index a7b78f02756..44b8d5127a9 100644 --- a/lib/replace/system/capability.h +++ b/lib/replace/system/capability.h @@ -37,7 +37,9 @@ #define BROKEN_RHEL5_SYS_CAP_HEADER_WORKAROUND #endif +#ifdef HAVE_POSIX_CAPABILITIES #include <sys/capability.h> +#endif #ifdef BROKEN_RHEL5_SYS_CAP_HEADER_WORKAROUND #undef _LINUX_TYPES_H diff --git a/librpc/idl/dns.idl b/librpc/idl/dns.idl index 8e8eed5ab23..c47a40344f2 100644 --- a/librpc/idl/dns.idl +++ b/librpc/idl/dns.idl @@ -23,8 +23,7 @@ interface dns const int DNS_MAX_LABEL_LENGTH = 63; typedef [public,bitmap16bit] bitmap { - DNS_RCODE = 0x000F, - DNS_FLAG_BROADCAST = 0x0010, + DNS_RCODE = 0x001F, DNS_FLAG_RECURSION_AVAIL = 0x0080, DNS_FLAG_RECURSION_DESIRED = 0x0100, DNS_FLAG_TRUNCATION = 0x0200, diff --git a/python/samba/tests/dns_base.py b/python/samba/tests/dns_base.py index 56c02dd6e51..ddd8b4efd1a 100644 --- a/python/samba/tests/dns_base.py +++ b/python/samba/tests/dns_base.py @@ -68,13 +68,13 @@ class DNSTest(TestCaseInTempDir): def assert_dns_rcode_equals(self, packet, rcode): "Helper function to check return code" - p_errcode = packet.operation & 0x000F + p_errcode = packet.operation & dns.DNS_RCODE self.assertEquals(p_errcode, rcode, "Expected RCODE %s, got %s" % (self.errstr(rcode), self.errstr(p_errcode))) def assert_dns_opcode_equals(self, packet, opcode): "Helper function to check opcode" - p_opcode = packet.operation & 0x7800 + p_opcode = packet.operation & dns.DNS_OPCODE self.assertEquals(p_opcode, opcode, "Expected OPCODE %s, got %s" % (opcode, p_opcode)) diff --git a/python/samba/tests/dns_forwarder.py b/python/samba/tests/dns_forwarder.py index 8178678e885..65616898172 100644 --- a/python/samba/tests/dns_forwarder.py +++ b/python/samba/tests/dns_forwarder.py @@ -81,13 +81,13 @@ class DNSTest(TestCase): def assert_dns_rcode_equals(self, packet, rcode): "Helper function to check return code" - p_errcode = packet.operation & 0x000F + p_errcode = packet.operation & dns.DNS_RCODE self.assertEquals(p_errcode, rcode, "Expected RCODE %s, got %s" % (self.errcodes[rcode], self.errcodes[p_errcode])) def assert_dns_opcode_equals(self, packet, opcode): "Helper function to check opcode" - p_opcode = packet.operation & 0x7800 + p_opcode = packet.operation & dns.DNS_OPCODE self.assertEquals(p_opcode, opcode, "Expected OPCODE %s, got %s" % (opcode, p_opcode)) diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index f2635e574cd..b662776a847 100755 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -2221,6 +2221,15 @@ sub teardown_env_terminate($$) my ($self, $envvars) = @_; my $pid; + # This should cause samba to terminate gracefully + my $smbcontrol = Samba::bindir_path($self, "smbcontrol"); + my $cmd = ""; + $cmd .= "$smbcontrol samba shutdown $envvars->{CONFIGURATION}"; + my $ret = system($cmd); + if ($ret != 0) { + warn "'$cmd' failed with '$ret'\n"; + } + # This should cause samba to terminate gracefully close($envvars->{STDIN_PIPE}); diff --git a/source4/heimdal_build/wscript_configure b/source4/heimdal_build/wscript_configure index 4d4e6a0cff9..903fb5139db 100644 --- a/source4/heimdal_build/wscript_configure +++ b/source4/heimdal_build/wscript_configure @@ -164,97 +164,3 @@ conf.define('HAVE_KRB5_PRINCIPAL_GET_TYPE', 1) conf.define('HAVE_KRB5_WARNX', 1) conf.define('HAVE_KRB5_PROMPT_TYPE', 1) -heimdal_includedirs = [] -heimdal_libdirs = [] -krb5_config = conf.find_program("krb5-config.heimdal", var="HEIMDAL_KRB5_CONFIG") -if not krb5_config: - krb5_config = conf.find_program("krb5-config", var="HEIMDAL_KRB5_CONFIG") -if krb5_config: - # Not ideal, but seems like the best way to get at these paths: - f = open(krb5_config[0], 'r') - try: - for l in f: - if l.startswith("libdir="): - heimdal_libdirs.append(l.strip()[len("libdir="):]) - elif l.startswith("includedir="): - include_path = l.strip()[len("includedir="):] - heimdal_includedirs.append(include_path) - conf.define('HEIMDAL_KRB5_TYPES_PATH', - include_path + "/krb5-types.h") - finally: - f.close() - -def check_system_heimdal_lib(name, functions='', headers='', onlyif=None): - # Only use system library if the user requested the bundled one not be - # used. - if conf.LIB_MAY_BE_BUNDLED(name): - return False - setattr(conf.env, "CPPPATH_%s" % name.upper(), heimdal_includedirs) - setattr(conf.env, "LIBPATH_%s" % name.upper(), heimdal_libdirs) - if not conf.CHECK_BUNDLED_SYSTEM(name, checkfunctions=functions, headers=headers, - onlyif=onlyif): - return False - conf.define('USING_SYSTEM_%s' % name.upper(), 1) - return True - -def check_system_heimdal_binary(name): - if conf.LIB_MAY_BE_BUNDLED(name): - return False - if not conf.find_program(name, var=name.upper()): - return False - conf.define('USING_SYSTEM_%s' % name.upper(), 1) - return True - -check_system_heimdal_lib("com_err", "com_right_r com_err", "com_err.h") - -if check_system_heimdal_lib("roken", "rk_socket_set_reuseaddr", "roken.h"): - conf.env.CPPPATH_ROKEN_HOSTCC = conf.env.CPPPATH_ROKEN - conf.env.LIBPATH_ROKEN_HOSTCC = conf.env.LIBPATH_ROKEN - conf.env.LIB_ROKEN_HOSTCC = "roken" - conf.SET_TARGET_TYPE("ROKEN_HOSTCC", 'SYSLIB') - -# Make sure HAVE_CONFIG_H is unset, as the system Heimdal headers use it -# and include config.h if it is set, resulting in failure (since config.h -# doesn't yet exist) - -DEFINES = list(conf.env.DEFINES) -conf.undefine("HAVE_CONFIG_H") -while "HAVE_CONFIG_H=1" in conf.env.DEFINES: - conf.env.DEFINES.remove("HAVE_CONFIG_H=1") -try: - check_system_heimdal_lib("wind", "wind_stringprep", "wind.h", onlyif="roken") - check_system_heimdal_lib("hx509", "hx509_bitstring_print", "hx509.h", onlyif="roken wind") - check_system_heimdal_lib("asn1", "initialize_asn1_error_table", "asn1_err.h", onlyif="roken com_err") - check_system_heimdal_lib("heimbase", "heim_cmp", "heimbase.h", onlyif="roken") - check_system_heimdal_lib("hcrypto", "MD4_Init", "hcrypto/md4.h", - onlyif="asn1 roken com_err") - if check_system_heimdal_lib("krb5", "krb5_anyaddr", "krb5.h", - onlyif="roken wind asn1 hx509 hcrypto com_err heimbase"): - conf.CHECK_FUNCS_IN('krb5_free_unparsed_name', 'krb5', headers="krb5.h") - check_system_heimdal_lib("gssapi", "gss_oid_to_name", "gssapi.h", - onlyif="hcrypto asn1 roken krb5 com_err wind") - check_system_heimdal_lib("heimntlm", "heim_ntlm_ntlmv2_key", "heimntlm.h", - onlyif="roken hcrypto krb5") - if check_system_heimdal_lib("hdb", "hdb_db_dir", "krb5.h hdb.h", - onlyif="roken krb5 hcrypto com_err wind"): - conf.CHECK_CODE(''' - #include <hdb.h> - int main(void) { hdb_enctype2key(NULL, NULL, NULL, 0, NULL); } - ''', - define='HDB_ENCTYPE2KEY_TAKES_KEYSET', - addmain=False, - lib='hdb', - msg='Checking whether hdb_enctype2key takes a keyset argument', - local_include=False) - - check_system_heimdal_lib("kdc", "kdc_log", "kdc.h", - onlyif="roken krb5 hdb asn1 heimntlm hcrypto com_err wind heimbase") -finally: - conf.env.DEFINES = DEFINES - -# With the proper checks in place we should be able to build against the system libtommath. -#if conf.CHECK_BUNDLED_SYSTEM('tommath', checkfunctions='mp_init', headers='tommath.h'): -# conf.define('USING_SYSTEM_TOMMATH', 1) - -check_system_heimdal_binary("compile_et") -check_system_heimdal_binary("asn1_compile") diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 6c10289515f..6cf58539a75 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -121,6 +121,68 @@ static void ringbuf_log_msg(struct imessaging_context *msg, imessaging_send(msg, src, MSG_RINGBUF_LOG, &blob); } +/**************************************************************************** + Receive a "set debug level" message. +****************************************************************************/ + +static void debug_imessage(struct imessaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + struct server_id src, + DATA_BLOB *data) +{ + const char *params_str = (const char *)data->data; + struct server_id_buf src_buf; + struct server_id dst = imessaging_get_server_id(msg_ctx); + struct server_id_buf dst_buf; + + /* Check, it's a proper string! */ + if (params_str[(data->length)-1] != '\0') { + DBG_ERR("Invalid debug message from pid %s to pid %s\n", + server_id_str_buf(src, &src_buf), + server_id_str_buf(dst, &dst_buf)); + return; + } + + DBG_ERR("INFO: Remote set of debug to `%s' (pid %s from pid %s)\n", + params_str, + server_id_str_buf(dst, &dst_buf), + server_id_str_buf(src, &src_buf)); + + debug_parse_levels(params_str); +} + +/**************************************************************************** + Return current debug level. +****************************************************************************/ + +static void debuglevel_imessage(struct imessaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + struct server_id src, + DATA_BLOB *data) +{ + char *message = debug_list_class_names_and_levels(); + DATA_BLOB blob = data_blob_null; + struct server_id_buf src_buf; + struct server_id dst = imessaging_get_server_id(msg_ctx); + struct server_id_buf dst_buf; + + DBG_DEBUG("Received REQ_DEBUGLEVEL message (pid %s from pid %s)\n", + server_id_str_buf(dst, &dst_buf), + server_id_str_buf(src, &src_buf)); + + if (message == NULL) { + DBG_ERR("debug_list_class_names_and_levels returned NULL\n"); + return; + } + + blob = data_blob_string_const_null(message); + imessaging_send(msg_ctx, src, MSG_DEBUGLEVEL, &blob); + + TALLOC_FREE(message); +} + /* return uptime of messaging server via irpc */ @@ -460,6 +522,16 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { goto fail; } + status = imessaging_register(msg, NULL, MSG_DEBUG, + debug_imessage); + if (!NT_STATUS_IS_OK(status)) { + goto fail; + } + status = imessaging_register(msg, NULL, MSG_REQ_DEBUGLEVEL, + debuglevel_imessage); + if (!NT_STATUS_IS_OK(status)) { + goto fail; + } status = IRPC_REGISTER(msg, irpc, IRPC_UPTIME, irpc_uptime, msg); if (!NT_STATUS_IS_OK(status)) { goto fail; diff --git a/source4/smbd/server.c b/source4/smbd/server.c index 626123bc9b0..cf860491c1a 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -45,6 +45,7 @@ #include "libds/common/roles.h" #include "lib/util/tfork.h" #include "dsdb/samdb/ldb_modules/util.h" +#include "lib/util/server_id.h" #ifdef HAVE_PTHREAD #include <pthread.h> @@ -291,6 +292,31 @@ static int prime_ldb_databases(struct tevent_context *event_ctx, bool *am_backup return LDB_SUCCESS; } +/* + called from 'smbcontrol samba shutdown' + */ +static void samba_parent_shutdown(struct imessaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id src, + DATA_BLOB *data) +{ + struct server_state *state = + talloc_get_type_abort(private_data, + struct server_state); + struct server_id_buf src_buf; + struct server_id dst = imessaging_get_server_id(msg); + struct server_id_buf dst_buf; + + DBG_ERR("samba_shutdown of %s %s: from %s\n", + state->binary_name, + server_id_str_buf(dst, &dst_buf), + server_id_str_buf(src, &src_buf)); + + TALLOC_FREE(state); + exit(0); +} + /* called when a fatal condition occurs in a child task */ @@ -316,7 +342,7 @@ static NTSTATUS setup_parent_messaging(struct server_state *state, msg = imessaging_init(state->event_ctx, lp_ctx, - cluster_id(0, SAMBA_PARENT_TASKID), + cluster_id(getpid(), SAMBA_PARENT_TASKID), state->event_ctx); NT_STATUS_HAVE_NO_MEMORY(msg); @@ -325,10 +351,19 @@ static NTSTATUS setup_parent_messaging(struct server_state *state, return status; } + status = imessaging_register(msg, state, MSG_SHUTDOWN, + samba_parent_shutdown); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + status = IRPC_REGISTER(msg, irpc, SAMBA_TERMINATE, samba_terminate, state); + if (!NT_STATUS_IS_OK(status)) { + return status; + } - return status; + return NT_STATUS_OK; } diff --git a/third_party/resolv_wrapper/wscript b/third_party/resolv_wrapper/wscript index 93fec427b5d..6bd2d51db41 100644 --- a/third_party/resolv_wrapper/wscript +++ b/third_party/resolv_wrapper/wscript @@ -28,7 +28,7 @@ def configure(conf): conf.CHECK_HEADERS('resolv.h') - conf.CHECK_STRUCTURE_MEMBER('struct _res_state', + conf.CHECK_STRUCTURE_MEMBER('struct __res_state', '_u._ext.nsaddrs', headers='resolv.h', define='HAVE_RESOLV_IPV6_NSADDRS') diff --git a/wscript b/wscript index e38a8e9aecf..4a5fc421baa 100644 --- a/wscript +++ b/wscript @@ -246,14 +246,11 @@ def configure(conf): 'hx509', 'wind', 'gssapi', 'hcrypto', 'krb5', 'heimbase', 'asn1_compile', 'compile_et', 'kdc', 'hdb', 'heimntlm') + conf.PROCESS_SEPARATE_RULE('system_heimdal') + + if not conf.CONFIG_GET('KRB5_VENDOR'): + conf.PROCESS_SEPARATE_RULE('embedded_heimdal') - # Only process heimdal_build for non-MIT KRB5 builds - # When MIT KRB5 checks are done as above, conf.env.KRB5_VENDOR will be set - # to the lowcased output of 'krb5-config --vendor'. - # If it is not set or the output is 'heimdal', we are dealing with - # system-provided or embedded Heimdal build - if conf.CONFIG_GET('KRB5_VENDOR') in (None, 'heimdal'): - conf.RECURSE('source4/heimdal_build') conf.RECURSE('source4/lib/tls') conf.RECURSE('source4/dsdb/samdb/ldb_modules') conf.RECURSE('source4/ntvfs/sysdep') diff --git a/wscript_configure_embedded_heimdal b/wscript_configure_embedded_heimdal new file mode 100644 index 00000000000..8c55ae2a938 --- /dev/null +++ b/wscript_configure_embedded_heimdal @@ -0,0 +1 @@ +conf.RECURSE('source4/heimdal_build') diff --git a/wscript_configure_system_heimdal b/wscript_configure_system_heimdal new file mode 100644 index 00000000000..0ff6dad2f55 --- /dev/null +++ b/wscript_configure_system_heimdal @@ -0,0 +1,99 @@ -- Samba Shared Repository