mirror of
https://github.com/samba-team/samba.git
synced 2025-08-04 08:22:08 +03:00
selftest: Make as_canonicalization_tests.py easier to run outside "make test"
This takes the realm from the LDAP base DN and so avoids one easy mistake to make. So far the NT4 domain name is not auto-detected, so much be read from the smb.conf. By using .guess() the smb.conf is read for the unspecified parts (eg workstation for an NTLM login to the LDAP server if the target server is an IP address). Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
This commit is contained in:
committed by
Gary Lockyer
parent
579a3c641c
commit
d85e71f449
@ -185,14 +185,20 @@ class KerberosASCanonicalizationTests(RawKerberosTest):
|
||||
cls.username = os.environ["USERNAME"]
|
||||
cls.password = os.environ["PASSWORD"]
|
||||
cls.domain = os.environ["DOMAIN"]
|
||||
cls.realm = os.environ["REALM"]
|
||||
cls.host = os.environ["SERVER"]
|
||||
|
||||
c = Credentials()
|
||||
c.set_username(cls.username)
|
||||
c.set_password(cls.password)
|
||||
c.set_domain(cls.domain)
|
||||
c.set_realm(cls.realm)
|
||||
try:
|
||||
realm = os.environ["REALM"]
|
||||
c.set_realm(realm)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
c.guess()
|
||||
|
||||
cls.credentials = c
|
||||
|
||||
cls.session = system_session()
|
||||
@ -236,6 +242,7 @@ class KerberosASCanonicalizationTests(RawKerberosTest):
|
||||
|
||||
cls.user_creds = Credentials()
|
||||
cls.user_creds.guess(cls.lp)
|
||||
cls.user_creds.set_realm(cls.ldb.domain_dns_name().upper())
|
||||
cls.user_creds.set_password(cls.user_pass)
|
||||
cls.user_creds.set_username(cls.user_name)
|
||||
cls.user_creds.set_workstation(cls.machine_name)
|
||||
@ -263,6 +270,7 @@ class KerberosASCanonicalizationTests(RawKerberosTest):
|
||||
|
||||
cls.machine_creds = Credentials()
|
||||
cls.machine_creds.guess(cls.lp)
|
||||
cls.machine_creds.set_realm(cls.ldb.domain_dns_name().upper())
|
||||
cls.machine_creds.set_secure_channel_type(SEC_CHAN_WKSTA)
|
||||
cls.machine_creds.set_kerberos_state(DONT_USE_KERBEROS)
|
||||
cls.machine_creds.set_password(cls.machine_pass)
|
||||
|
Reference in New Issue
Block a user