def setUp(self):
# This is some intentional trickery to ensure we skip
# InheritanceSmbCaclsTests.setUp so we can create a new
- # test directory & file hierachy (including a nested dfs link)
+ # test directory & file hierarchy (including a nested dfs link)
SmbCaclsBlockboxTestBase.setUp(self)
smbclient_args = self.build_test_cmd("smbclient", ["//%s/%s" % (self.server, self.share), "-c", "mkdir %s" % os.getenv("TESTDIR", "smbcacls")])
self.check_output(smbclient_args)
try:
# add flags on oi_dir
- # This is somwhat artificial, we need to add a new acl to the directory
+ # This is somewhat artificial, we need to add a new acl to the directory
# so that the following modify operation doesn't fail. Previously
# '--modify' was used in place of '--add' but that resulted in failure
# to access the directory ( or even modify the acl ).
delete_ace_str = "ACL:%s:ALLOWED/0x0/RWD" % self.user
try:
- # This is somwhat artificial, we need to add a new acl to the
+ # This is somewhat artificial, we need to add a new acl to the
# directory so that the following modify operation doesn't fail.
# Previously '--modify' was used in place of '--add' but that
# resulted in failure to access the directory ( or even modify
try:
# add flags on oi_dir
- # This is somwhat artificial, we need to add a new acl to the
+ # This is somewhat artificial, we need to add a new acl to the
# directory so that the following modify operation doesn't fail.
# Previously '--modify' was used in place of '--add' but that
# resulted in failure to access the directory ( or even modify
"""Compress, decompress, assert equality with original.
If size_delta is None, no size is given to decompress. This
- should fail with the Huffman varient and succeed with plain.
+ should fail with the Huffman variant and succeed with plain.
Otherwise size_delta is added to the gven size; if negative,
we'd expect a failure, with plain compression a positive delta
will succeed.
def test_round_trip_aaa_long(self):
s = b'a' * 150000
- # this *wont* fail because although the data will run out
+ # this *won't* fail because although the data will run out
# before the buffer is full, LZXpress plain does not care
# about that.
try:
# For the Huffman algorithm, the length is really an essential
# part of the compression data, and the bindings will reject a
- # call with out it. This happens at the arument parsing stage,
+ # call with out it. This happens at the argument parsing stage,
# so is a TypeError (i.e. wrong type of function), not a
# CompressionError.
self.assertRaises(TypeError,
def test_check_all_substituted(self):
samba.check_all_substituted("nothing to see here")
self.assertRaises(Exception, samba.check_all_substituted,
- "Not subsituted: ${FOOBAR}")
+ "Not substituted: ${FOOBAR}")
class ArcfourTestCase(TestCase):
# there should be no A record, and one TOMBSTONE record.
self.assert_num_records(self.custom_zone, "testrecord", 'A', 0)
# we can't make assertions about the tombstone count based on
- # RPC calls, as ther are no tombstones in RPCs (there is
+ # RPC calls, as there are no tombstones in RPCs (there is
# "DNS_TYPE_ZERO" instead). Nor do tombstones show up if we
# use DNS_TYPE_ALL.
self.assert_num_records(self.custom_zone, "testrecord", 'ALL', 0)
parm_error = 0x00000000
self.conn.NetShareAdd(self.server_unc, 502, share, parm_error)
name = share.name
- share.comment = "now sucessfully modified "
+ share.comment = "now successfully modified "
parm_error = self.pipe.NetShareSetInfo(self.server_unc, name,
502, share, parm_error)
class StringTestsWithoutLeakCheck(samba.tests.TestCase):
"""We know that the ndr unpacking test leaves stuff in the
autofree_context, and we don't want to worry about that. So for
- this test we don't make meory leak assertions."""
+ this test we don't make memory leak assertions."""
def test_string_from_ndr(self):
info = drsblobs.repsFromTo2OtherInfo()
self.assertEqual(rec.dwTimeStamp, 0) # timestamp stays zero
if failures:
- self.fail(f"failed {failures}/{total} defered assertions")
+ self.fail(f"failed {failures}/{total} deferred assertions")
def test_static_record_dynamic_update(self):
"""Add a static record, then a dynamic record.
bkp_pd = get_prim_dom(paths.secrets, bkp_lp)
self.assertEqual(len(bkp_pd), 1)
- acn = bkp_pd[0].get('samAccountName')
- self.assertIsNotNone(acn)
- self.assertEqual(str(acn[0]), self.new_server + '$')
+ account = bkp_pd[0].get('samAccountName')
+ self.assertIsNotNone(account)
+ self.assertEqual(str(account[0]), self.new_server + '$')
self.assertIsNotNone(bkp_pd[0].get('secret'))
samdb = SamDB(url=paths.samdb, session_info=system_session(),
def test_ridalloc_next_free_rid(self):
# Test RID allocation. We assume that RID
- # pools allocated to us are continguous.
+ # pools allocated to us are contiguous.
self.samdb.transaction_start()
try:
orig_rid_set = self.get_rid_set(self.rid_set_dn)
self.realm.lower())
def test_get_dc_winbind_need_2012r2(self):
- """Test requring that we have a FL2012R2 DC as answer
+ """Test requiring that we have a FL2012R2 DC as answer
"""
self.assertIsNotNone(self.trust_realm)
self.assertTrue(cldap_netlogon_reply.server_type & nbt.NBT_SERVER_DS_9)
def test_get_dc_direct_need_2012r2_but_not_found(self):
- """Test requring that we have a FL2012R2 DC as answer, aginst the FL2008R2 domain
+ """Test requiring that we have a FL2012R2 DC as answer, against the FL2008R2 domain
This test requires that the DC in the FL2008R2 does not claim
to be 2012R2 capable (off by default in Samba)
self.fail(f"Incorrect error {estr} from GetDcNameEx looking for 2012R2 DC that was not available")
def test_get_dc_direct_need_web_but_not_found(self):
- """Test requring that we (do not) have a AD Web Services on the DC
+ """Test requiring that we (do not) have a AD Web Services on the DC
This test requires that the DC does not advertise AD Web Services
self.assertFalse(cldap_netlogon_reply.server_type & nbt.NBT_SERVER_ADS_WEB_SERVICE)
def test_get_dc_winbind_need_web_but_not_found(self):
- """Test requring that we (do not) have a AD Web Services on the trusted DC
+ """Test requiring that we (do not) have a AD Web Services on the trusted DC
This test requires that the DC does not advertise AD Web Services
self.assertFalse(cldap_netlogon_reply.server_type & nbt.NBT_SERVER_ADS_WEB_SERVICE)
def test_get_dc_direct_need_2012r2(self):
- """Test requring that we have a FL2012R2 DC as answer
+ """Test requiring that we have a FL2012R2 DC as answer
"""
self.assertIsNotNone(self.trust_realm)
self.assertTrue(cldap_netlogon_reply.server_type & nbt.NBT_SERVER_DS_9)
def test_get_dc_winbind_need_2012r2_but_not_found(self):
- """Test requring that we have a FL2012R2 DC as answer, aginst the FL2008R2 domain
+ """Test requiring that we have a FL2012R2 DC as answer, against the FL2008R2 domain
This test requires that the DC in the FL2008R2 does not claim
to be 2012R2 capable (off by default in Samba)
self.assertFalse(cldap_netlogon_reply.server_type & nbt.NBT_SERVER_DS_9)
def test_get_dc_winbind_need_2012r2_but_not_found_fallback(self):
- """Test requring that we have a FL2012R2 DC as answer, aginst the
+ """Test requiring that we have a FL2012R2 DC as answer, against the
FL2008R2 domain, then trying for just FL2008R2 (to show caching bugs)
This test requires that the DC in the FL2008R2 does not claim
self.assertTrue(cldap_netlogon_reply.server_type & nbt.NBT_SERVER_FULL_SECRET_DOMAIN_6)
def test_get_dc_direct_need_2012r2_but_not_found_fallback(self):
- """Test requring that we have a FL2012R2 DC as answer, aginst the
+ """Test requiring that we have a FL2012R2 DC as answer, against the
FL2008R2 domain, then trying for just FL2008R2 (to show caching bugs)
This test requires that the DC in the FL2008R2 does not claim
client_claims_bytes1 = ndr_pack(client_claims)
client_claims2 = ndr_unpack(claims.CLAIMS_SET_METADATA_NDR, client_claims_bytes1)
- # Confirm that despite no lenghts being set, the data is compressed correctly
+ # Confirm that despite no lengths being set, the data is compressed correctly
self.assertEqual(client_claims2.claims.metadata.uncompressed_claims_set_size,
8232)
self.assertEqual(client_claims2.claims.metadata.claims_set_size,
expected_client_claims=(expected_claims
if not remove_claims else None))
- # Perform a test similar to that preceeding. This time, create both a user
+ # Perform a test similar to that preceding. This time, create both a user
# and a computer account, each having an applicable claim. After obtaining
# tickets, from which the claims are optionally removed, change the claim
# attribute of each account to a different value. Then perform constrained
checksum_keys = self.get_krbtgt_checksum_key()
- # Use our modifed TGT to replace the one in the request.
+ # Use our modified TGT to replace the one in the request.
return self.modified_ticket(user_tgt,
modify_fn=modify_fn,
checksum_keys=checksum_keys)
target_realm=creds.get_realm())
# Test setting a password, specifying both principal and realm of the
- # target user, whem the user has control access on their account.
+ # target user, when the user has control access on their account.
def test_kpasswd_set_target_princ_and_realm_access(self):
# Create an account for testing.
creds = self._get_creds()
class MS_Kile_Client_Principal_Lookup_Tests(KDCBaseTest):
''' Tests for MS-KILE client principal look-up
See [MS-KILE]: Kerberos Protocol Extensions
- secion 3.3.5.6.1 Client Principal Lookup
+ section 3.3.5.6.1 Client Principal Lookup
'''
def setUp(self):
"""KRB5 Integration tests for pycredentials.
-Seperated from py_credentials so as to allow running against just one
+Separated from py_credentials so as to allow running against just one
environment so we know the server that we add the user on will be our
KDC
scope=ldb.SCOPE_SUBTREE,
attrs=["objectGUID", "samAccountName"])
- referals = res.referals
- for referal in referals:
+ referrals = res.referals
+ for referral in referrals:
self.assertTrue(
- referal.startswith("ldap://"),
- "{0} does not start with ldap://".format(referal))
+ referral.startswith("ldap://"),
+ "{0} does not start with ldap://".format(referral))
# The referral entries for an ldaps request should have the ldaps scheme
# i.e. then should all start with "ldaps://"
scope=ldb.SCOPE_SUBTREE,
attrs=["objectGUID", "samAccountName"])
- referals = res.referals
- for referal in referals:
+ referrals = res.referals
+ for referral in referrals:
self.assertTrue(
- referal.startswith("ldaps://"),
- "{0} does not start with ldaps://".format(referal))
+ referral.startswith("ldaps://"),
+ "{0} does not start with ldaps://".format(referral))
#
# * If a dictionary, it is a mapping of some of ['sam', 'upn']
# to strings (in this way, you can add two attributes in one
- # mesage, or attempt a samaccountname with '@').
+ # message, or attempt a samaccountname with '@').
#
# expected can be «ok», «bad» (mapped to True and False,
# respectively), or a specific LDB error code, if that exact
return
else:
raise
- self.fail("Shoud have rejected NTLMv2 without SPNEGO")
+ self.fail("Should have rejected NTLMv2 without SPNEGO")
def test_net_join_no_spnego_ntlmv1(self):
self.lp.set("client ipc max protocol", "NT1")
def test_dump(self):
samba_lp = param.LoadParm()
- # Just test successfull method execution (outputs to stdout)
+ # Just test successful method execution (outputs to stdout)
self.assertEqual(None, samba_lp.dump())
def test_dump_to_file(self):
def test_dump_a_parameter(self):
samba_lp = param.LoadParm()
samba_lp.load_default()
- # Just test successfull method execution
+ # Just test successful method execution
self.assertEqual(None, samba_lp.dump_a_parameter('interfaces'))
def test_dump_a_parameter_to_file(self):
self.assertEqual("%s" % found.get("cn"), expected_cn)
# remove given name, initials and surname
- # (must forece new cn, because en empty new CN throws an error)
+ # (must force new cn, because en empty new CN throws an error)
(result, out, err) = self.runsubcmd("contact", "rename", expected_cn,
"--force-new-cn=%s" % expected_cn,
"--surname=",
(
# snizle has 2 A, 2 AAAA, 10 fancy, and 2 TXT records, in
# that order.
- # the A, AAAA, and TXT recrods should be dynamic
+ # the A, AAAA, and TXT records should be dynamic
['--mark-records-dynamic-regex=sniz'],
{'snizle': [('R', 'nowish'),
('R', 'nowish'),
(
# This regex should catch snizle, frobitz, and
# ts-multi. Note that the 1e7 ts-multi record is
- # alreay dynamic and doesn't change.
+ # already dynamic and doesn't change.
['--mark-records-dynamic-regex=[i]'],
{'ts-multi': [('R', 'nowish'),
('R', 'nowish'),
# Get the lmdb map size for the specified command
#
# While there is a python lmdb package available we use the lmdb command
- # line utilities to avoid introducing a dependancy.
+ # line utilities to avoid introducing a dependency.
#
def get_lmdb_environment_size(self, path):
(result, out, err) = self.run_command("mdb_stat -ne %s" % path)
"pso", "delete"), pso_name,
"-H", self.server,
self.user_auth)
- self.assertCmdFail(result, "Deleteing a non-existent PSO should fail")
+ self.assertCmdFail(result, "Deleting a non-existent PSO should fail")
self.assertIn("Unable to find PSO", err)
def check_pso_applied(self, user, pso):
# Get the lmdb map size for the specified command
#
# While there is a python lmdb package available we use the lmdb command
- # line utilities to avoid introducing a dependancy.
+ # line utilities to avoid introducing a dependency.
#
def get_lmdb_environment_size(self, path):
(result, out, err) = self.run_command("mdb_stat -ne %s" % path)
# Get the lmdb map size for the specified command
#
# While there is a python lmdb package available we use the lmdb command
- # line utilities to avoid introducing a dependancy.
+ # line utilities to avoid introducing a dependency.
#
def get_lmdb_environment_size(self, path):
(result, out, err) = self.run_command("mdb_stat -ne %s" % path)
expires = nttime2unix(int("%s" % found.get("accountExpires")))
self.assertWithin(expires, twodays, 5, "Ensure account expires is within 5 seconds of the expected time")
- # TODO: renable this after the filter case is sorted out
+ # TODO: re-enable this after the filter case is sorted out
if "filters are broken, bail now":
return
self.assertEqual(sha512, _get_attribute(out, "virtualCryptSHA512"))
# As the number of rounds did not match, should have returned the
- # first hash of the coresponding scheme
+ # first hash of the corresponding scheme
out = self._get_password("virtualCryptSHA256," +
"virtualCryptSHA512")
self.assertEqual(sha256, _get_attribute(out, "virtualCryptSHA256"))
self.assertEquals(sha512, _get_attribute(out, "virtualCryptSHA512"))
# As the number of rounds did not match, should have returned the
- # first hash of the coresponding scheme
+ # first hash of the corresponding scheme
out = self._get_password("virtualCryptSHA256," +
"virtualCryptSHA512")
self.assertEquals(sha256, _get_attribute(out, "virtualCryptSHA256"))
# trigger notification for both
self.smb_conn.rmdir(private_path)
- # check that both get thte notification
+ # check that both get the notification
changes = notify_unpriv.get_changes(wait=True)
self.assertIsNotNone(changes)
self.assertEqual(changes[0]['name'], private_rel)
self.assertEqual(self.get_umask(), TEST_UMASK,
"umask unexpectedly overridden by test")
- # restore the original umask value (before we interferred with it)
+ # restore the original umask value (before we interfered with it)
os.umask(self.orig_umask)
super(SmbdBaseTests, self).tearDown()
samba.xattr_native.wrap_setxattr(tempf, "user.unittests",
ndr_pack(ntacl))
except IOError:
- raise SkipTest("the filesystem where the tests are runned do not support XATTR")
+ raise SkipTest("the filesystem where the tests are run does not "
+ "support XATTR")
os.unlink(tempf)
def test_set_and_get_native(self):
text = samba.xattr_native.wrap_getxattr(tempf, "user.unittests")
self.assertEqual(text, reftxt)
except IOError:
- raise SkipTest("the filesystem where the tests are runned do not support XATTR")
+ raise SkipTest("the filesystem where the tests are run does not "
+ "support XATTR")
os.unlink(tempf)
def test_set_xattr_tdb(self):