summaryrefslogtreecommitdiff
path: root/python
AgeCommit message (Collapse)AuthorFilesLines
2017-07-21selftest: Add test for password change when NTLM is disabledTim Beale1-13/+33
When NTLM is disabled, the server should reject NTLM-based password changes. Changing the password is a bit complicated from python, but because the server should reject the password change outright with NTLM_BLOCKED, the test doesn't actually need to provide valid credentials. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11923 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Jul 21 13:54:35 CEST 2017 on sn-devel-144
2017-07-05Add test for 'samba-tool user edit'Rowland Penny1-0/+72
Signed-off-by: Rowland Penny <rpenny@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2017-07-05Easily edit a users object in AD, as if using ldbedit.Rowland Penny1-1/+138
Signed-off-by: Rowland Penny <rpenny@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2017-07-05python: tests: Add test for tdb_copy function from tdb_util module.Lumir Balhar1-0/+53
Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Reviewed-by: Alexander Bokovoy <ab@samba.org> Reviewed-by: Andrew Bartlet <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Wed Jul 5 02:00:25 CEST 2017 on sn-devel-144
2017-07-04selftest: Add test to confirm NTLM authentication is enabledTim Beale1-0/+68
(or later, that it is disabled) Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> BUG: https://bugzilla.samba.org/show_bug.cgi?id=11923
2017-07-04selftest: Add test for support for MSCHAPv2 and NTLMv1 on a serverAndrew Bartlett1-4/+98
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-07-04tests: Add simple check whether netlogon server is runningTim Beale1-0/+69
Netlogon only needs to run in DC environment. This is a simple test to check whether the netlogon service is running. This will allow us to disable the netlogon service on setups that don't require it. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-07-02dsdb: Add tests showing that the CN=CONFIGURATION partition is also lockedAndrew Bartlett1-7/+31
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-07-02dsdb: Add new test adding a record to the top level sam.ldb fileAndrew Bartlett1-0/+71
This shows that locks are made on this file as well Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-07-02dsdb: Add more locking more tests, confirming blocking locks in both directionsStefan Metzmacher1-7/+162
These extended tests allow us to show that a search (read) blocks a transaction commit (write), and that a transaction commit blocks a search. Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2017-07-02dsdb: Add test showing a search can't start while a transaction is already ↵Andrew Bartlett1-0/+54
repared in a backend partition Pair-programmed-with: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-07-02dsdb: Add test showing a search can't start while a transaction is already ↵Andrew Bartlett1-1/+53
repared Pair-programmed-with: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-06-30dsdb: Add a dummy module to replace show_deletedAndrew Bartlett1-1/+1
This helps when we improve show_deleted in a way that the fake database in samba3sam can not cover Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-29tests py_credentials: Fix encrypt_netr_crypt_password testGary Lockyer1-16/+10
The test uses NetrServerPasswordSet2 to change a password, this tests the end to end encryption. The original call to NetrServerPasswordSet2 was not utf-16 encoding the new password. However the call to netr_DsrEnumerateDomainTrusts was using cached credentials and not using the new password, so this was not detected. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Garming Sam <garming@samba.org> Autobuild-Date(master): Thu Jun 29 06:50:32 CEST 2017 on sn-devel-144
2017-06-23samba_kcc: debugging: say intrasite when we mean intrasiteGarming Sam1-1/+1
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org> Autobuild-Date(master): Fri Jun 23 06:45:47 CEST 2017 on sn-devel-144
2017-06-23samba_kcc: drop all connections from non-existent DSAsDouglas Bagnall1-2/+3
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-23samba_kcc: comment typoDouglas Bagnall1-1/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-23samba_kcc: avoid crash on odd networks with --dot-file-dirDouglas Bagnall1-0/+4
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-23python/getopt: -d/--debuglevel saves value in options for scriptsDouglas Bagnall1-0/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-22python/tests: test SMB1 and SMB2/3 in auth_log.pyStefan Metzmacher1-2/+47
We should do this explicitly in order to make the tests independent of 'client max protocol'. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2017-06-22pycredentials: Add support for netr_crypt_passwordGary Lockyer1-1/+45
Add code to encrypt a netr_CryptPassword structure with the current session key. This allows the making of Netr_ServerPasswordSet2 calls from python. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-06-22pycredentials: add function to return the netr_AuthenticatorGary Lockyer1-0/+241
Add method new_client_authenticator that returns data to allow a netr_Authenticator to be constructed. Allows python to make netr_LogonSamLogonWithFlags, netr_LogonGetDomainInfo and similar calls Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-06-22Tests lsa.String: add String constructor, str and reprGary Lockyer1-0/+79
Tests for the String constructor, str and repr methods added to the samba.dcerpc.lsa.String python object Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-06-16selftest: confirm that two attributes are also correctly set in the @ recordsAndrew Bartlett1-2/+39
This shows that the current behaviour in dsdb_schema_set_indices_and_attributes(), while not ideal, is not actually buggy. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-06-15python/test: delete_force() passes on command line argsDouglas Bagnall1-2/+2
This allows you to use e.g.: delete_force(self.ldb, ou, controls=['tree_delete:1']) Only in tests of course. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-06-15repl: Set GET_ALL_GROUP_MEMBERSHIP flag in the drepl serverGarming Sam1-1/+0
Although we do not currently support this in the server, this will cause data loss against a Windows DC unless we set this flag as per the docs. This flag is required for the RODC. Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Garming Sam <garming@samba.org> Autobuild-Date(master): Thu Jun 15 05:31:59 CEST 2017 on sn-devel-144
2017-06-15selftest: Pass the dcerpc binding object to self.waitForMessages in auth_logAndrew Bartlett2-8/+8
This ensures that object is not cleaned up, triggering a disconnect before we get back the audit messages. Otherwise they can be lost when the server task calls exit() while the message thread is still trying to send them. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-15selftest: Add test for gss_krb5/ntlmssp -> SPNEGOAndrew Bartlett1-2/+11
These bare mechs are permitted to go direct to SPNEGO, which must cope with them Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-15selftest: Add pygensec tests for GSS-SPNEGO and Win2000 emulated SPNEGOAndrew Bartlett1-6/+55
This is to provide some unit testing coverage for these different modes of operation Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-15selftest: Add a test for @ATTRIBUTES and @INDEXLIST generationAndrew Bartlett1-0/+138
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-13python/samba/tests: don't use hardcoded names in *pam_winbind* testsStefan Metzmacher2-4/+19
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2017-06-13python: Port simple libpython module to Python 3 compatible formLumir Balhar2-9/+11
Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2017-06-11join.py Add DNS records at domain join timeAndrew Bartlett1-3/+197
This avoids issues getting replication going after the DC first starts as the rest of the domain does not have to wait for samba_dnsupdate to run successfully We do not just run samba_dnsupdate as we want to strictly operate against the DC we just joined: - We do not want to query another DNS server - We do not want to obtain a Kerberos ticket for the new DC (as the KDC we select may not be the DC we just joined, and so may not be in sync with the password we just set) - We do not wish to set the _ldap records until we have started - We do not wish to use NTLM (the --use-samba-tool mode forces NTLM) The downside to using DCE/RPC rather than DNS is that these will be regarded as static entries, and (against windows) have a the ACL assigned for static entries. However this is still better than no DNS at all. Because some tests want a DNS record matching their own name this fixes some tests and removes entires from knownfail Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Sun Jun 11 02:04:52 CEST 2017 on sn-devel-144
2017-06-10selftest: Add test confirming join-created DNS entries can be modified as the DCAndrew Bartlett1-6/+68
This ensures that samba_dnsupdate can run in the long term against the new DNS entries Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10selftest: Test join.py and confirm that the DNS record is createdAndrew Bartlett1-0/+113
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10provision: Allow removing an existing account when force=True is setAndrew Bartlett1-22/+23
This allows a practical override for use in test scripts Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10provision: Move default handler for site=None down into dc_join object creationAndrew Bartlett2-3/+3
This makes this code easier to call from a test script Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10selftest: Use TestCaseInTempDir as base class in dns testsAndrew Bartlett1-2/+2
This will help when we add a new join test based on this code Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10selftest: Create new common base class for dns.py and dns_tkey.pyAndrew Bartlett3-580/+435
This will allow more DNS tests to be written in the future with less code duplication.
2017-06-10selftest: merge DNSTest boilerplateAndrew Bartlett2-88/+196
This will help unifying dns.py and dns_tkey.py to use common subclasses The code was originally copied, but has since divereged. This handles that divergence. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10selftest: move make_txt_record() onto self in samba.tests.dnsAndrew Bartlett1-14/+14
This will help unifying dns.py and dns_tkey.py to use common subclasses Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10dns_server: clobber MNAME in the SOAAndrew Bartlett1-1/+1
Otherwise, we always report the first server we created/provisioned the AD domain on which does not match AD behaviour. AD is multi-master so all RW servers are a master. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10selftest: run dns tests in multiple envsAndrew Bartlett1-52/+102
This will let us check the negative behaviour: that updates against RODCs fail and un-authenticated updates fail. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10selftest: confirm we clobber the MNAME in the SOA query in the DNS serverAndrew Bartlett1-0/+18
All RW DCs should be their own master DNS server. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10join.py: Do not expose the old machine password over NTLM if -k yes was setAndrew Bartlett1-0/+1
This makes the test for a valid machine account stricter (as a kerberos error could cause this to fail and so skip the validation), but we never wish to use NTLM if the administrator disabled it on the command line Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10pydsdb_dns: Allow the partition DN to be specified into py_dsdb_dns_lookupAndrew Bartlett1-2/+6
This allows lookups to be confined to one partition, which in turn avoids issues when running this against MS Windows, which does not match Samba behaviour for dns_common_zones() Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10python: Allow sd_utils to take a Dn object, not just a string DNAndrew Bartlett1-1/+5
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-10pydns: Also return the DN of the LDB object when finding a DNS recordAndrew Bartlett1-2/+2
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-06-09samba-tool: You cannot add members to a group if the member exists as a ↵Rowland Penny2-3/+8
sAMAccountName and a CN. Signed-off-by: Rowland Penny <rpenny@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> Autobuild-User(master): Alexander Bokovoy <ab@samba.org> Autobuild-Date(master): Fri Jun 9 23:24:47 CEST 2017 on sn-devel-144
2017-06-09samba tool - tests: Fix shell metacharacters in generated passwordGary Lockyer2-4/+16
Restrict the random password to [A-Za-z0-9] to ensure there are no shell metacharacters in the generated password. The tests use "samba-tool user create" to create the test user. Occasionally the generated password contained shell metachatacters and the command failed. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Jun 9 09:50:28 CEST 2017 on sn-devel-144