From 2114768a8e64647e4f429e0b4e464e0cfc056feb Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Fri, 20 Jul 2018 12:31:20 +0300 Subject: [PATCH 1/3] s4-dns_server: Only build dns server Python code for AD DC BUG: https://bugzilla.samba.org/show_bug.cgi?id=13542 Signed-off-by: Alexander Bokovoy Reviewed-by: Jeremy Allison Reviewed-by: Guenther Deschner --- source4/dns_server/wscript_build | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source4/dns_server/wscript_build b/source4/dns_server/wscript_build index c24f45584a4..c01e618b561 100644 --- a/source4/dns_server/wscript_build +++ b/source4/dns_server/wscript_build @@ -71,6 +71,8 @@ for env in bld.gen_python_environments(): pytalloc_util = bld.pyembed_libname('pytalloc-util') bld.SAMBA_PYTHON('python_dsdb_dns', - source='pydns.c', - deps='samdb %s %s dnsserver_common %s' % (pyldb_util, pyrpc_util, pytalloc_util), - realname='samba/dsdb_dns.so') + source='pydns.c', + deps='samdb %s %s dnsserver_common %s' % ( + pyldb_util, pyrpc_util, pytalloc_util), + realname='samba/dsdb_dns.so', + enabled=bld.AD_DC_BUILD_IS_ENABLED()) -- 2.17.1 From 1faaeb00b5b8217c7a2cb145673ceba847b94cf2 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Fri, 20 Jul 2018 12:32:20 +0300 Subject: [PATCH 2/3] s4-dsdb: only build dsdb Python modules for AD DC BUG: https://bugzilla.samba.org/show_bug.cgi?id=13542 Signed-off-by: Alexander Bokovoy Reviewed-by: Jeremy Allison Reviewed-by: Guenther Deschner --- source4/dsdb/wscript_build | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source4/dsdb/wscript_build b/source4/dsdb/wscript_build index be99e9950ef..34ba8edb44a 100644 --- a/source4/dsdb/wscript_build +++ b/source4/dsdb/wscript_build @@ -40,12 +40,14 @@ bld.SAMBA_MODULE('service_drepl', bld.SAMBA_LIBRARY('dsdb_garbage_collect_tombstones', source='kcc/garbage_collect_tombstones.c', deps='samdb RPC_NDR_DRSUAPI', - private_library=True) + private_library=True, + enabled=bld.AD_DC_BUILD_IS_ENABLED()) bld.SAMBA_LIBRARY('scavenge_dns_records', source='kcc/scavenge_dns_records.c', deps='samdb RPC_NDR_DRSUAPI dnsserver_common', - private_library=True) + private_library=True, + enabled=bld.AD_DC_BUILD_IS_ENABLED()) bld.SAMBA_MODULE('service_kcc', source='kcc/kcc_service.c kcc/kcc_connection.c kcc/kcc_periodic.c kcc/kcc_drs_replica_info.c', @@ -78,5 +80,6 @@ for env in bld.gen_python_environments(): # removes it so we end up with unresolved symbols. deps='samdb %s dcerpc com_err %s %s dsdb_garbage_collect_tombstones scavenge_dns_records' %\ (pyldb_util, pyrpc_util, pyparam_util), - realname='samba/dsdb.so' - ) + realname='samba/dsdb.so', + enabled=bld.AD_DC_BUILD_IS_ENABLED() + ) -- 2.17.1 From f0812896ed864340338bd9a4bade2e1581116434 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Sat, 21 Jul 2018 12:05:15 +0300 Subject: [PATCH 4/4] python/samba/tests: make sure samba.tests can be imported without SamDB We are using samba.tests Python module __init__.py file as a catch-all for all types of helpers. Some of these helpers are only usable with Samba AD DC targets. When SamDB is not available in a non-Samba AD DC target, provide a dummy replacement that simply returns None. This allows to complete initialization for non-Samba AD DC target tests which do not use connect_samdb() helper. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13542 Signed-off-by: Alexander Bokovoy Reviewed-by: Guenther Deschner --- python/samba/tests/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py index 7061f8b3d14..f04b42be826 100644 --- a/python/samba/tests/__init__.py +++ b/python/samba/tests/__init__.py @@ -39,7 +39,10 @@ from samba.compat import PY3, text_type from random import randint if not PY3: # Py2 only - from samba.samdb import SamDB + try: + from samba.samdb import SamDB + except ImportError: + SamDB = lambda *x: None import samba.ndr import samba.dcerpc.dcerpc import samba.dcerpc.epmapper -- 2.17.1