summaryrefslogtreecommitdiff
path: root/python/samba
Commit message (Collapse)AuthorAgeFilesLines
* domain.py: Give some advice if the schema upgrade command failsGarming Sam2018-03-011-3/+8
| | | | | Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
* samba python tests: convert 'except X, (tuple)' to 'except X as e'Noel Power2018-02-284-6/+12
| | | | | | | | | In addition to converting the except line another line is also added for each except to extract the tuple contents. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool: convert 'except X, (tuple)' to 'except X as e'Noel Power2018-02-285-25/+50
| | | | | | | | | In addition to converting the except line another line is also added for each except to extract the tuple contents. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba python libs: convert 'except X, (tuple)' to 'except X as e'Noel Power2018-02-2810-66/+132
| | | | | | | | | In addition to converting the except line another line is also added for each except to extract the tuple contents. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* python tests: convert oct 'O1234' format to python3 compatible '0o1234'Noel Power2018-02-282-13/+13
| | | | | | Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba python libs: convert 'O1234' format to python3 compatible '0o1234'Noel Power2018-02-283-17/+17
| | | | | | Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool: convert octal 'O1234' format to python3 compatible '0o1234'Noel Power2018-02-281-3/+3
| | | | | | Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool: user setexpiry: Fix incorrect Example2Rowland Penny2018-02-271-1/+1
| | | | | | | | Signed-off-by: Rowland Penny <rpenny@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Tue Feb 27 20:31:39 CET 2018 on sn-devel-144
* tests/blackbox/smbcontrol: ping tests names ping target upon failureDouglas Bagnall2018-02-241-1/+2
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Jeremy Allison <jra@samba.org>
* text/python/blackbox: allow optional message in ProcessErrorDouglas Bagnall2018-02-241-7/+13
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Jeremy Allison <jra@samba.org>
* tests: Authenticate again so make sure we are not locked outAndreas Schneider2018-02-241-0/+10
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* tests/py_creds: Add a SamLogonEx test with an empty string domainGarming Sam2018-02-221-0/+27
| | | | | | | | | | This test passes against 4.6, but failed against 4.7.5 and master. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13206 Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tests:dcerpc/raw_protocol: reproduce call_id truncation bugStefan Metzmacher2018-02-211-1/+1
| | | | | | | | | We need to make sure the server handles call_id values > UINT16_MAX. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13289 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* provision: fix the 'dnsdomain' for the local sam of a domain memberStefan Metzmacher2018-02-211-0/+16
| | | | | | | | | | A member has a local AD database, which should not use the 'dnsdomain' as the one on domain controllers. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13285 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* traffic_packets.py: let Lookup{Sids,Names}() work against a sane serverStefan Metzmacher2018-02-211-8/+8
| | | | | | | | | | In order to resolve predefined sids or names we need to use level = LSA_LOOKUP_NAMES_ALL (1). Bug: https://bugzilla.samba.org/show_bug.cgi?id=13284 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* subnet: Avoid a segfault when renaming subnet objectsGarming Sam2018-02-191-0/+33
| | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13031 Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba python tests: convert 'except X, e' to 'except X as e'Douglas Bagnall2018-02-158-18/+18
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba python libs: convert 'except X, e' to 'except X as e'Douglas Bagnall2018-02-159-32/+32
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool: convert 'except X, e' to 'except X as e' for all XDouglas Bagnall2018-02-1515-77/+77
| | | | | | | This is needed for Python 3 and is compatible with python 2.6 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* selftest: Avoid a build started around midnight failing (again)Andrew Bartlett2018-02-151-2/+3
| | | | | | | | This case most likely relates to Daylight Saving changes creating a 23 hour day. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool drs showrepl: add --json option for JSON outputDouglas Bagnall2018-02-151-1/+16
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool drs showrepl: restructure in preparation for --jsonDouglas Bagnall2018-02-151-45/+94
| | | | | | | Basically we just separate data extraction from printing. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* python.subunit: add assertRegexpMatches for Python 2.6Douglas Bagnall2018-02-151-1/+10
| | | | | | | This is used in python/samba/tests/samba_tool/provision_password_check.py Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* python: tests: Make tests of dsdb Python module Python 3 compatibleLumir Balhar2018-02-151-11/+12
| | | | | | Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* python: Port samdb module to Python 3 compatible formLumir Balhar2018-02-152-7/+8
| | | | | | Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* python: Add `text_type` Python 2/3 compatible function name.Lumir Balhar2018-02-151-0/+2
| | | | | | | | | This compatible function name represents `str` in Python 3 and `unicode` in Python 2. Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* python: Convert base64 encoded password to utf-8Andreas Schneider2018-02-151-1/+1
| | | | | | | | | Pair-Programmed-With: Alexander Bokovoy <ab@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Alexander Bokovoy <ab@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* python: Generate random test usernamesAndreas Schneider2018-02-151-2/+4
| | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* tests/samba-tool user wdigest: fix a flapping testDouglas Bagnall2018-02-121-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | The output of something like samba-tool user getpassword $USER --attributes virtualWDigest01 contains an LDIF section with long strings folded on the 77th column. To unfold this LDIF we were using: result = re.sub(r"\n\s*", '', out) which worked fine EXCEPT when a space in the output happened to land immediately after the fold and got eaten by the \s*. Instead we remove just a single space after the line break, because that is always what fold_string() in lib/ldb/common/ldb_ldif.c inserts, and for this simple replacement we don't need the re module. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Mon Feb 12 05:21:01 CET 2018 on sn-devel-144
* tests: SambaToolCmdTest.assertMatch() indicates what was assertedDouglas Bagnall2018-02-121-1/+11
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* sambatool drs showrepl: prefer self over ctx in python classesDouglas Bagnall2018-02-091-2/+3
| | | | | | | | | | | | | and the line length too. (Now only python/samba/join.py uses ctx for self, but at least it does it consistently. This was the only ctx function in the class). Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Feb 9 12:34:06 CET 2018 on sn-devel-144
* samba-tool rodc: consistently use self.outf, not stdoutDouglas Bagnall2018-02-092-4/+7
| | | | | | | | | This increases the output of some commands from the point of view of tests which read the outf, so we also need to change those tests a bit. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* subunit.run: report failure in process return codeDouglas Bagnall2018-02-091-0/+7
| | | | | | | | The protocol requires that the TestResult object remembers when it has failed, but in subclassing unittest.TestResult we forgot to ensure this is true. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* python samdb.newuser(): use user DN not samaccountname to set passwordDouglas Bagnall2018-02-091-1/+3
| | | | | | | | | | | This is noticably faster in cases (e.g. tests) where the same user is added and deleted many times. The rreason is samaccountname is retained for deleted objects, so the search finds multiple objects that need to be filtered out internally. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* tests/samba_tool user virtualCryptSHA: remove unused py3 incompatible importDouglas Bagnall2018-02-091-2/+0
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* tests/password_hash: avoid py3-incompatible md5 moduleDouglas Bagnall2018-02-091-2/+2
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* tests/samba-tool user_wdigest: avoid py3-incompatible md5 moduleDouglas Bagnall2018-02-091-4/+2
| | | | | | | | | | In Python3, the md5 and sha modules are gone, but the functions are available via hashlib (which is also in python 2.5+). The md5.hexdigest() does what binascii.hexlify(md5.digest()) does. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool/tests: Check that dns cleanup does not spuriously remove entriesGarming Sam2018-02-081-1/+5
| | | | | | | | | | This might happen in the multi-record case. Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Thu Feb 8 10:00:13 CET 2018 on sn-devel-144
* samba-tool/dns: Clarify the cleanup subcommandGarming Sam2018-02-081-2/+3
| | | | | Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* tests/samba-tool: dns cleanup should work with a missing nameGarming Sam2018-02-081-0/+50
| | | | | Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* remove_dc: Allow remove_dns_references to ignore missing server namesGarming Sam2018-02-082-3/+14
| | | | | Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool: add dns cleanup cmdJoe Guo2018-02-082-0/+150
| | | | | | | | | | 1. Add new command to cleanup dns records for a dns host name 2. Add test to verify the command is working Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* tests/samba-tool: add tests for samba-tool group move commandBjörn Baumbach2018-02-081-0/+32
| | | | | Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool group: implement the group move commandBjörn Baumbach2018-02-081-0/+79
| | | | | | | This new command allows to move a a group into an ou or container. Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* tests/samba-tool: add tests for user move commandBjörn Baumbach2018-02-081-0/+32
| | | | | Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool user: implement the user move commandBjörn Baumbach2018-02-081-0/+80
| | | | | | | This new command allows to move an user into an ou or container. Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool user: fix some typosBjörn Baumbach2018-02-081-3/+3
| | | | | Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* tests/samba-tool: add test for samba-tool user show commandBjörn Baumbach2018-02-081-0/+22
| | | | | Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool: implement user show command to display a user AD objectBjörn Baumbach2018-02-081-0/+79
| | | | | | | | | This command displays a user account and it's attributes in the Active Directory domain. The username specified on the command is the sAMAccountName. Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* tests/samba-tool: add tests for new ou management commandsBjörn Baumbach2018-02-081-0/+274
| | | | | Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>