From: Björn Baumbach Date: Tue, 19 Jan 2021 09:53:48 +0000 (+0100) Subject: samba-tool user: use remote domain information X-Git-Tag: tevent-0.11.0~1697 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fdc44a14e470df785a39bbf15691b443284a7c4d;p=thirdparty%2Fsamba.git samba-tool user: use remote domain information Required, when running get_account_attributes() against a remote samdb. avoid: ERROR(): uncaught exception - 'NoneType' object has no attribute 'get' File "bin/python/samba/netcmd/__init__.py", line 186, in _run return self.run(*args, **kwargs) File "bin/python/samba/netcmd/user.py", line 2769, in run obj = self.get_account_attributes(samdb, username, File "bin/python/samba/netcmd/user.py", line 1250, in get_account_attributes realm = self.lp.get("realm") Signed-off-by: Björn Baumbach Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py index 8ffff09a35e..8ba5168c049 100644 --- a/python/samba/netcmd/user.py +++ b/python/samba/netcmd/user.py @@ -1232,7 +1232,7 @@ class GetPasswordCommand(Command): if "userPrincipalName" in obj: account_upn = str(obj["userPrincipalName"][0]) else: - realm = self.lp.get("realm") + realm = samdb.domain_dns_name() account_upn = "%s@%s" % (account_name, realm.lower()) if add_userPrincipalName: del obj["userPrincipalName"] @@ -1544,7 +1544,7 @@ class GetPasswordCommand(Command): i = int(x) except ValueError: continue - domain = self.lp.get("workgroup") + domain = samdb.domain_netbios_name() dns_domain = samdb.domain_dns_name() v = get_wDigest(i, primary_wdigest, account_name, account_upn, domain, dns_domain) if v is None: