The branch, master has been updated via 712ffbffc03 s3:libsmb: allow store_cldap_reply() to work with a ipv6 response via 05807488fd3 Combine ICU libraries icu-i18n and icu-uc into a single dependency via 0c983bd0095 Improve CHECK_LIB interaction with CHECK_PKG via 363c3318577 Augment library_flags() to return libraries via 5aafd2fb404 selftest: add test for User.get_primary_group method via 8fe7f0a6d50 python: models: add get_primary_group method to User model via 1f47c0f6093 python: models: rename argument ldb to samdb via 237d9d0228c tests/ntacls: unblock failing gitlab pipelines because test_setntacl_forcenative via 380d9c5a739 .gitlab-ci-main.yml: debug kernel details of the current runner from 9844ac289be ldb-samba: ldif_read_objectSid avoids VLA
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 712ffbffc03c7dcd551c1e22815ebe7c0b9b45d2 Author: Stefan Metzmacher <me...@samba.org> Date: Tue May 7 14:53:24 2024 +0000 s3:libsmb: allow store_cldap_reply() to work with a ipv6 response BUG: https://bugzilla.samba.org/show_bug.cgi?id=15642 Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> Autobuild-User(master): Andrew Bartlett <abart...@samba.org> Autobuild-Date(master): Fri May 10 01:35:18 UTC 2024 on atb-devel-224 commit 05807488fd340751ee976c5f8a367013ff94843e Author: Earl Chew <earl_c...@yahoo.com> Date: Sat Dec 16 08:48:36 2023 -0800 Combine ICU libraries icu-i18n and icu-uc into a single dependency Rather than probing for icu-i18n, icu-uc, and icudata libraries separately, only probe for icu-i18n, and icu-uc, as direct dependencies This avoids overlinking with icudata, and allows the package to build even when ICU is not installed as a system library. RN: Only use icu-i18n and icu-uc to express ICU dependency BUG: https://bugzilla.samba.org/show_bug.cgi?id=15623 Signed-off-by: Earl Chew <earl_c...@yahoo.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 0c983bd0095d4fb20ef8b42f5efb740393073862 Author: Earl Chew <earl_c...@yahoo.com> Date: Sat Dec 16 17:47:09 2023 -0800 Improve CHECK_LIB interaction with CHECK_PKG When checking for shared libraries, only name the target library if it was not previously discoverd by pkg-config --libs and now available from uselib_store. This avoids using both sources of information which results in the library being named twice on the command line. Once the library is confirmed by CHECK_LIB, append the library if not already present, to avoid dropping libraries that were previously discovered by CHECK_PKG. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15623 Signed-off-by: Earl Chew <earl_c...@yahoo.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 363c33185779141fdfbda695997d548939a0251f Author: Earl Chew <earl_c...@yahoo.com> Date: Sun Dec 17 08:37:33 2023 -0800 Augment library_flags() to return libraries Extend library_flags() to return the libraries provided by pkg-config --libs. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15623 Signed-off-by: Earl Chew <earl_c...@yahoo.com> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 5aafd2fb4042a2f787dd6a7bc9584494d29c405f Author: Rob van der Linde <r...@catalyst.net.nz> Date: Tue Apr 30 23:54:13 2024 +1200 selftest: add test for User.get_primary_group method Signed-off-by: Rob van der Linde <r...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 8fe7f0a6d507c4711c9edbc8eab86cf0a46facaf Author: Rob van der Linde <r...@catalyst.net.nz> Date: Tue Apr 30 23:43:30 2024 +1200 python: models: add get_primary_group method to User model Signed-off-by: Rob van der Linde <r...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 1f47c0f609355aa469c04dafe6c4505f5823a6e3 Author: Rob van der Linde <r...@catalyst.net.nz> Date: Tue Apr 30 23:42:05 2024 +1200 python: models: rename argument ldb to samdb This argument is actually an instance of SamDB (which inherits from Ldb). This should have been called samdb. Signed-off-by: Rob van der Linde <r...@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abart...@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> commit 237d9d0228cfed6d2e08b41b888d30aac5ab89e3 Author: Stefan Metzmacher <me...@samba.org> Date: Wed May 8 18:03:54 2024 +0200 tests/ntacls: unblock failing gitlab pipelines because test_setntacl_forcenative This expects PermissionError: [Errno 1] Operation not permitted, but it seems that setxattr() for security.NTACL works on gitlab runners without being root. Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 380d9c5a7392741ff2134ef1e83df45a29293db3 Author: Stefan Metzmacher <me...@samba.org> Date: Wed May 8 16:12:06 2024 +0200 .gitlab-ci-main.yml: debug kernel details of the current runner Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> ----------------------------------------------------------------------- Summary of changes: .gitlab-ci-main.yml | 6 ++ buildtools/wafsamba/samba3.py | 8 +- buildtools/wafsamba/samba_autoconf.py | 34 +++++--- buildtools/wafsamba/samba_deps.py | 5 +- lib/util/charset/iconv.c | 8 +- lib/util/charset/wscript_build | 3 +- lib/util/charset/wscript_configure | 19 ++--- python/samba/domain/models/auth_policy.py | 16 ++-- python/samba/domain/models/auth_silo.py | 22 ++--- python/samba/domain/models/claim_type.py | 12 +-- python/samba/domain/models/computer.py | 14 +-- python/samba/domain/models/fields.py | 74 ++++++++-------- python/samba/domain/models/gmsa.py | 8 +- python/samba/domain/models/model.py | 114 ++++++++++++------------- python/samba/domain/models/query.py | 6 +- python/samba/domain/models/schema.py | 24 +++--- python/samba/domain/models/site.py | 6 +- python/samba/domain/models/subnet.py | 6 +- python/samba/domain/models/user.py | 30 ++++--- python/samba/domain/models/value_type.py | 12 +-- python/samba/tests/ntacls.py | 2 +- python/samba/tests/samba_tool/domain_models.py | 15 ++++ selftest/flapping.d/gitlab-setxattr-security | 18 ++++ source3/libsmb/dsgetdcname.c | 24 +++++- 24 files changed, 281 insertions(+), 205 deletions(-) create mode 100644 selftest/flapping.d/gitlab-setxattr-security Changeset truncated at 500 lines: diff --git a/.gitlab-ci-main.yml b/.gitlab-ci-main.yml index 71b3c3f861a..1e4bdf82e74 100644 --- a/.gitlab-ci-main.yml +++ b/.gitlab-ci-main.yml @@ -112,8 +112,14 @@ include: before_script: - uname -a + - ls -l /sys/module/ + - ls -l /sys/kernel/security/ + - if [ -e /sys/kernel/security/lsm ]; then cat /sys/kernel/security/lsm ; echo; fi + - if [ -e /proc/config.gz ]; then sudo zcat /proc/config.gz; echo; fi - lsb_release -a - cat /etc/os-release + - id + - cat /proc/self/status - lscpu - cat /proc/cpuinfo - mount diff --git a/buildtools/wafsamba/samba3.py b/buildtools/wafsamba/samba3.py index 227ee27705d..ba0783f0d22 100644 --- a/buildtools/wafsamba/samba3.py +++ b/buildtools/wafsamba/samba3.py @@ -45,25 +45,25 @@ def s3_fix_kwargs(bld, kwargs): '../bin/default/third_party/heimdal/lib/asn1' ] if bld.CONFIG_SET('USING_SYSTEM_TDB'): - (tdb_includes, tdb_ldflags, tdb_cpppath) = library_flags(bld, 'tdb') + (tdb_includes, tdb_ldflags, tdb_cpppath, tdb_libs) = library_flags(bld, 'tdb') extra_includes += tdb_cpppath else: extra_includes += [ '../lib/tdb/include' ] if bld.CONFIG_SET('USING_SYSTEM_TEVENT'): - (tevent_includes, tevent_ldflags, tevent_cpppath) = library_flags(bld, 'tevent') + (tevent_includes, tevent_ldflags, tevent_cpppath, tevent_libs) = library_flags(bld, 'tevent') extra_includes += tevent_cpppath else: extra_includes += [ '../lib/tevent' ] if bld.CONFIG_SET('USING_SYSTEM_TALLOC'): - (talloc_includes, talloc_ldflags, talloc_cpppath) = library_flags(bld, 'talloc') + (talloc_includes, talloc_ldflags, talloc_cpppath, talloc_libs) = library_flags(bld, 'talloc') extra_includes += talloc_cpppath else: extra_includes += [ '../lib/talloc' ] if bld.CONFIG_SET('USING_SYSTEM_POPT'): - (popt_includes, popt_ldflags, popt_cpppath) = library_flags(bld, 'popt') + (popt_includes, popt_ldflags, popt_cpppath, popt_libs) = library_flags(bld, 'popt') extra_includes += popt_cpppath else: extra_includes += [ '../lib/popt' ] diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index 7b383ea0b71..802cbaced52 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -91,7 +91,7 @@ def CHECK_HEADER(conf, h, add_headers=False, lib=None): conf.env.hlist.append(h) return True - (ccflags, ldflags, cpppath) = library_flags(conf, lib) + (ccflags, ldflags, cpppath, libs) = library_flags(conf, lib) hdrs = hlist_to_string(conf, headers=h) if lib is None: @@ -435,7 +435,7 @@ def CHECK_CODE(conf, code, define, uselib = TO_LIST(lib) - (ccflags, ldflags, cpppath) = library_flags(conf, uselib) + (ccflags, ldflags, cpppath, libs) = library_flags(conf, uselib) includes = TO_LIST(includes) includes.extend(cpppath) @@ -569,21 +569,24 @@ Build.BuildContext.CONFIG_SET = CONFIG_SET Build.BuildContext.CONFIG_GET = CONFIG_GET -def library_flags(self, libs): +def library_flags(self, library): '''work out flags from pkg_config''' ccflags = [] ldflags = [] cpppath = [] - for lib in TO_LIST(libs): + libs = [] + for lib in TO_LIST(library): # note that we do not add the -I and -L in here, as that is added by the waf # core. Adding it here would just change the order that it is put on the link line # which can cause system paths to be added before internal libraries extra_ccflags = TO_LIST(getattr(self.env, 'CFLAGS_%s' % lib.upper(), [])) extra_ldflags = TO_LIST(getattr(self.env, 'LDFLAGS_%s' % lib.upper(), [])) extra_cpppath = TO_LIST(getattr(self.env, 'CPPPATH_%s' % lib.upper(), [])) + extra_libs = TO_LIST(getattr(self.env, 'LIB_%s' % lib.upper(), [])) ccflags.extend(extra_ccflags) ldflags.extend(extra_ldflags) cpppath.extend(extra_cpppath) + libs.extend(extra_libs) extra_cpppath = TO_LIST(getattr(self.env, 'INCLUDES_%s' % lib.upper(), [])) cpppath.extend(extra_cpppath) @@ -593,11 +596,12 @@ def library_flags(self, libs): ccflags = unique_list(ccflags) ldflags = unique_list(ldflags) cpppath = unique_list(cpppath) - return (ccflags, ldflags, cpppath) + libs = unique_list(libs) + return (ccflags, ldflags, cpppath, libs) @conf -def CHECK_LIB(conf, libs, mandatory=False, empty_decl=True, set_target=True, shlib=False): +def CHECK_LIB(conf, library, mandatory=False, empty_decl=True, set_target=True, shlib=False): '''check if a set of libraries exist as system libraries returns the sublist of libs that do exist as a syslib or [] @@ -611,15 +615,20 @@ int foo() } ''' ret = [] - liblist = TO_LIST(libs) - for lib in liblist[:]: + liblist = TO_LIST(library) + for lib in liblist: if GET_TARGET_TYPE(conf, lib) == 'SYSLIB': ret.append(lib) continue - (ccflags, ldflags, cpppath) = library_flags(conf, lib) + (ccflags, ldflags, cpppath, libs) = library_flags(conf, lib) if shlib: - res = conf.check(features='c cshlib', fragment=fragment, lib=lib, uselib_store=lib, cflags=ccflags, ldflags=ldflags, uselib=lib.upper(), mandatory=False) + # Avoid repeating the library if it is already named by + # pkg-config --libs. + kw = {} + if lib not in libs: + kw['lib'] = lib + res = conf.check(features='c cshlib', fragment=fragment, uselib_store=lib, cflags=ccflags, ldflags=ldflags, uselib=lib.upper(), mandatory=False, **kw) else: res = conf.check(lib=lib, uselib_store=lib, cflags=ccflags, ldflags=ldflags, uselib=lib.upper(), mandatory=False) @@ -633,7 +642,10 @@ int foo() SET_TARGET_TYPE(conf, lib, 'EMPTY') else: conf.define('HAVE_LIB%s' % lib.upper().replace('-','_').replace('.','_'), 1) - conf.env['LIB_' + lib.upper()] = lib + # To avoid losing information from pkg-config, append the library + # only it is not already present. + if lib not in libs: + conf.env.append_value('LIB_' + lib.upper(), lib) if set_target: conf.SET_TARGET_TYPE(lib, 'SYSLIB') ret.append(lib) diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py index 80379d37a9c..6db44cc3a61 100644 --- a/buildtools/wafsamba/samba_deps.py +++ b/buildtools/wafsamba/samba_deps.py @@ -83,9 +83,8 @@ def build_dependencies(self): self.add_objects = list(self.final_objects) # extra link flags from pkg_config - libs = self.final_syslibs.copy() - - (cflags, ldflags, cpppath) = library_flags(self, list(libs)) + (cflags, ldflags, cpppath, libs) = library_flags( + self, list(self.final_syslibs.copy())) new_ldflags = getattr(self, 'samba_ldflags', [])[:] new_ldflags.extend(ldflags) self.ldflags = new_ldflags diff --git a/lib/util/charset/iconv.c b/lib/util/charset/iconv.c index 131df640986..074794a26e3 100644 --- a/lib/util/charset/iconv.c +++ b/lib/util/charset/iconv.c @@ -26,7 +26,7 @@ #include "lib/util/charset/charset.h" #include "lib/util/charset/charset_proto.h" -#ifdef HAVE_ICU_I18N +#ifdef HAVE_ICUI18N #include <unicode/ustring.h> #include <unicode/utrans.h> #endif @@ -168,7 +168,7 @@ static size_t sys_iconv(void *cd, } #endif -#ifdef HAVE_ICU_I18N +#ifdef HAVE_ICUI18N static size_t sys_uconv(void *cd, const char **inbuf, size_t *inbytesleft, @@ -334,7 +334,7 @@ static bool is_utf16(const char *name) static int smb_iconv_t_destructor(smb_iconv_t hwd) { -#ifdef HAVE_ICU_I18N +#ifdef HAVE_ICUI18N /* * This has to come first, as the cd_direct member won't be an iconv * handle and must not be passed to iconv_close(). @@ -418,7 +418,7 @@ _PUBLIC_ smb_iconv_t smb_iconv_open_ex(TALLOC_CTX *mem_ctx, const char *tocode, } #endif -#ifdef HAVE_ICU_I18N +#ifdef HAVE_ICUI18N if (strcasecmp(fromcode, "UTF8-NFD") == 0 && strcasecmp(tocode, "UTF8-NFC") == 0) { diff --git a/lib/util/charset/wscript_build b/lib/util/charset/wscript_build index c69a17170ad..3af90a0ad57 100644 --- a/lib/util/charset/wscript_build +++ b/lib/util/charset/wscript_build @@ -6,7 +6,8 @@ bld.SAMBA_SUBSYSTEM('ICONV_WRAPPER', weird.c charset_macosxfs.c ''', - public_deps='iconv replace talloc ' + bld.env['icu-libs']) + deps=bld.env['icu-libs'], + public_deps='iconv replace talloc') bld.SAMBA_SUBSYSTEM('charset', public_headers='charset.h', diff --git a/lib/util/charset/wscript_configure b/lib/util/charset/wscript_configure index 9c27fc664f0..c49b55a4fd4 100644 --- a/lib/util/charset/wscript_configure +++ b/lib/util/charset/wscript_configure @@ -8,7 +8,7 @@ # managed to link when specifying -liconv a executable even if there is no # libiconv.so or libiconv.a -conf.CHECK_LIB(libs="iconv", shlib=True) +conf.CHECK_LIB("iconv", shlib=True) #HP-UX can use libiconv as an add-on package, which has #define iconv_open libiconv_open if (conf.CHECK_FUNCS_IN('iconv_open', 'iconv', checklibc=False, headers='iconv.h') or @@ -37,15 +37,12 @@ conf.CHECK_CODE(''' lib='iconv', headers='errno.h iconv.h') -if conf.CHECK_CFG(package='icu-i18n', +if conf.CHECK_CFG(package='icu-i18n icu-uc', args='--cflags --libs', - msg='Checking for icu-i18n', - uselib_store='ICU_I18N'): - for lib in conf.env['LIB_ICU_I18N']: - conf.CHECK_LIB(lib, shlib=True, mandatory=True) - conf.env['icu-libs'] = ' '.join(conf.env['LIB_ICU_I18N']) - if not conf.CHECK_HEADERS('unicode/ustring.h'): - conf.fatal('Found libicu, but unicode/ustring.h is missing') + msg='Checking for icu-i18n icu-uc', + uselib_store='ICUI18N'): + conf.env['icu-libs'] = 'icui18n' + conf.CHECK_LIB(conf.env['icu-libs'], shlib=True, mandatory=True) + if not conf.CHECK_HEADERS('unicode/ustring.h', lib='icui18n'): + conf.fatal('Found icui18n, but unicode/ustring.h is missing') conf.DEFINE('HAVE_UTF8_NORMALISATION', 1) -else: - conf.env['icu-libs'] = '' diff --git a/python/samba/domain/models/auth_policy.py b/python/samba/domain/models/auth_policy.py index 3ee6231568c..fb4947a93d2 100644 --- a/python/samba/domain/models/auth_policy.py +++ b/python/samba/domain/models/auth_policy.py @@ -69,13 +69,13 @@ class AuthenticationPolicy(Model): "msDS-ComputerAllowedToAuthenticateTo") @staticmethod - def get_base_dn(ldb): + def get_base_dn(samdb): """Return the base DN for the AuthenticationPolicy model. - :param ldb: Ldb connection + :param samdb: SamDB connection :return: Dn object of container """ - base_dn = ldb.get_config_basedn() + base_dn = samdb.get_config_basedn() base_dn.add_child( "CN=AuthN Policies,CN=AuthN Policy Configuration,CN=Services") return base_dn @@ -85,10 +85,10 @@ class AuthenticationPolicy(Model): return "msDS-AuthNPolicy" @staticmethod - def find(ldb, name): + def find(samdb, name): """Helper function to return auth policy or raise NotFound. - :param ldb: Ldb connection + :param samdb: SamDB connection :param name: Either DN or name of Authentication Policy :raises: NotFound if not found :raises: ValueError if name is not set @@ -98,10 +98,10 @@ class AuthenticationPolicy(Model): try: # It's possible name is already a Dn. - dn = name if isinstance(name, Dn) else Dn(ldb, name) - policy = AuthenticationPolicy.get(ldb, dn=dn) + dn = name if isinstance(name, Dn) else Dn(samdb, name) + policy = AuthenticationPolicy.get(samdb, dn=dn) except ValueError: - policy = AuthenticationPolicy.get(ldb, cn=name) + policy = AuthenticationPolicy.get(samdb, cn=name) if policy is None: raise LookupError(f"Authentication policy {name} not found.") diff --git a/python/samba/domain/models/auth_silo.py b/python/samba/domain/models/auth_silo.py index 9747671e4c5..962101fe07d 100644 --- a/python/samba/domain/models/auth_silo.py +++ b/python/samba/domain/models/auth_silo.py @@ -38,13 +38,13 @@ class AuthenticationSilo(Model): members = DnField("msDS-AuthNPolicySiloMembers", many=True) @staticmethod - def get_base_dn(ldb): + def get_base_dn(samdb): """Return the base DN for the AuthenticationSilo model. - :param ldb: Ldb connection + :param samdb: SamDB connection :return: Dn object of container """ - base_dn = ldb.get_config_basedn() + base_dn = samdb.get_config_basedn() base_dn.add_child( "CN=AuthN Silos,CN=AuthN Policy Configuration,CN=Services") return base_dn @@ -53,13 +53,13 @@ class AuthenticationSilo(Model): def get_object_class(): return "msDS-AuthNPolicySilo" - def grant(self, ldb, member): + def grant(self, samdb, member): """Grant a member access to the Authentication Silo. Rather than saving the silo object and writing the entire member list out again, just add one member only. - :param ldb: Ldb connection + :param samdb: SamDB connection :param member: Member to grant access to silo """ # Create a message with only an add member operation. @@ -69,20 +69,20 @@ class AuthenticationSilo(Model): # Update authentication silo. try: - ldb.modify(message) + samdb.modify(message) except LdbError as e: raise GrantMemberError(f"Failed to grant access to silo member: {e}") # If the modify operation was successful refresh members field. - self.refresh(ldb, fields=["members"]) + self.refresh(samdb, fields=["members"]) - def revoke(self, ldb, member): + def revoke(self, samdb, member): """Revoke a member from the Authentication Silo. Rather than saving the silo object and writing the entire member list out again, just remove one member only. - :param ldb: Ldb connection + :param samdb: SamDB connection :param member: Member to revoke from silo """ # Create a message with only a remove member operation. @@ -92,12 +92,12 @@ class AuthenticationSilo(Model): # Update authentication silo. try: - ldb.modify(message) + samdb.modify(message) except LdbError as e: raise RevokeMemberError(f"Failed to revoke silo member: {e}") # If the modify operation was successful refresh members field. - self.refresh(ldb, fields=["members"]) + self.refresh(samdb, fields=["members"]) def get_authentication_sddl(self): return ('O:SYG:SYD:(XA;OICI;CR;;;WD;(@USER.ad://ext/' diff --git a/python/samba/domain/models/claim_type.py b/python/samba/domain/models/claim_type.py index 3e92c8e1969..6f498511c55 100644 --- a/python/samba/domain/models/claim_type.py +++ b/python/samba/domain/models/claim_type.py @@ -47,13 +47,13 @@ class ClaimType(Model): return str(self.display_name) @staticmethod - def get_base_dn(ldb): + def get_base_dn(samdb): """Return the base DN for the ClaimType model. - :param ldb: Ldb connection + :param samdb: SamDB connection :return: Dn object of container """ - base_dn = ldb.get_config_basedn() + base_dn = samdb.get_config_basedn() base_dn.add_child("CN=Claim Types,CN=Claims Configuration,CN=Services") return base_dn @@ -62,11 +62,11 @@ class ClaimType(Model): return "msDS-ClaimType" @staticmethod - def new_claim_type(ldb, attribute, applies_to, display_name=None, + def new_claim_type(samdb, attribute, applies_to, display_name=None, description=None, enabled=True): """Creates a ClaimType but does not save the instance. - :param ldb: SamDB database connection + :param samdb: SamDB database connection :param attribute: AttributeSchema object to use for creating ClaimType :param applies_to: List of ClassSchema objects ClaimType applies to :param display_name: Optional display name to use or use attribute name @@ -74,7 +74,7 @@ class ClaimType(Model): :param enabled: Create an enabled or disabled claim type (default True) :raises NotFound: if the ValueType for this attribute doesn't exist """ - value_type = ValueType.find(ldb, attribute) + value_type = ValueType.find(samdb, attribute) # Generate the new Claim Type cn. # Windows creates a random number here containing 16 hex digits. diff --git a/python/samba/domain/models/computer.py b/python/samba/domain/models/computer.py index 84dddb16a9b..f78785300b4 100644 --- a/python/samba/domain/models/computer.py +++ b/python/samba/domain/models/computer.py @@ -69,31 +69,31 @@ class Computer(User): super().__init__(**kwargs) @staticmethod - def get_base_dn(ldb): + def get_base_dn(samdb): """Return base Dn for Computers. - :param ldb: Ldb connection + :param samdb: SamDB connection :return: Dn to use for searching """ - return ldb.get_wellknown_dn(ldb.get_default_basedn(), - DS_GUID_COMPUTERS_CONTAINER) + return samdb.get_wellknown_dn(samdb.get_default_basedn(), + DS_GUID_COMPUTERS_CONTAINER) @staticmethod def get_object_class(): return "computer" @classmethod - def find(cls, ldb, name): + def find(cls, samdb, name): """Helper function to find a computer, first by Dn then sAMAccountName. If the Dn can't be parsed use sAMAccountName, automatically add the $. """ try: - query = {"dn": Dn(ldb, name)} + query = {"dn": Dn(samdb, name)} except ValueError: if name.endswith("$"): query = {"account_name": name} else: query = {"account_name": name + "$"} - return cls.get(ldb, **query) + return cls.get(samdb, **query) diff --git a/python/samba/domain/models/fields.py b/python/samba/domain/models/fields.py index d2a3b5e9d9e..e902b727aec 100644 --- a/python/samba/domain/models/fields.py +++ b/python/samba/domain/models/fields.py @@ -49,7 +49,7 @@ class Field(metaclass=ABCMeta): readonly=False): """Creates a new field, should be subclassed. - :param name: Ldb field name. + :param name: SamDB field name. :param many: If true always convert field to a list when loaded. :param default: Default value or callback method (obj is first argument) :param hidden: If this is True, exclude the field when calling as_dict() @@ -68,23 +68,23 @@ class Field(metaclass=ABCMeta): self.default = default @abstractmethod - def from_db_value(self, ldb, value): + def from_db_value(self, samdb, value): """Converts value read from the database to Python value. - :param ldb: Ldb connection + :param samdb: SamDB connection :param value: MessageElement value from the database :returns: Parsed value as Python type """ pass -- Samba Shared Repository