summaryrefslogtreecommitdiff
path: root/python
AgeCommit message (Collapse)AuthorFilesLines
2019-11-17ndrdump: Use human-readable strings for NDR decode errorsAndrew Bartlett1-2/+2
These make much more sense than the NTSTATUS values they can be forced to map to. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-11-17selftest: Test fix for ndrdump of structures by numberAndrew Bartlett1-0/+16
This requires that misc.GUID not move in the IDL, so a comment is added. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14191 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-11-14pytests/segfault: pidl inline arraysDouglas Bagnall1-1/+6
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Noel Power <npower@samba.org>
2019-11-14pytests/segfaults: dcerpc ref elements segfaultDouglas Bagnall1-1/+13
These are just a couple of examples. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Noel Power <npower@samba.org>
2019-11-14pytests: rpc echo should not segfaultDouglas Bagnall1-0/+5
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Noel Power <npower@samba.org>
2019-11-13selftest: Add expected-output tests for the ndrdump struct modeAndrew Bartlett1-1/+27
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14191 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-11-10Make sure backup temp directory gets deleted on exceptionHeiko Baumann1-42/+43
This fix ensures that the samba-tool backup temp directory is removed if an exception occurs (e.g. LDAP_INVALID_CREDENTIALS). Signed-off-by: Heiko Baumann <heibau@gmail.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-11-08dns: Extend DNS tests to check the SOA record is always returnedSamuel Cabrero1-0/+19
Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-10-31python/samba/upgradehelpers.py: typo fixesBjörn Jacke1-1/+1
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2019-10-31python/samba/netcmd/gpo.py: typo fixesBjörn Jacke1-0/+1
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2019-10-31python/samba/dbchecker.py: typo fixesBjörn Jacke1-4/+4
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2019-10-23samba-tool: py3 compatiblity in 'user syncpasswords --daemon'Heinz Hoelzl1-1/+2
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14154 Signed-off-by: Heinz Hölzl <heinz.hoelzl@gvcc.net> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Björn Baumbach <bb@sernet.de> Autobuild-User(master): Björn Baumbach <bb@sernet.de> Autobuild-Date(master): Wed Oct 23 15:54:43 UTC 2019 on sn-devel-184
2019-10-22samba-tool domain: fix an unhandled exceptionAmit Kumar1-1/+5
Uncaught exception on running 'samba-tool domain schemaupgrade' ERROR(<class 'ModuleNotFoundError'>): uncaught exception - No module named 'markdown' File "/usr/lib64/python3.7/site-packages/samba/netcmd/__init__.py", line 185, in _run return self.run(*args, **kwargs) File "/usr/lib64/python3.7/site-packages/samba/netcmd/domain.py", line 4157, in run from samba.ms_schema_markdown import read_ms_markdown File "/usr/lib64/python3.7/site-packages/samba/ms_schema_markdown.py", line 26, in <module> import markdown Signed-off-by: Amit Kumar amitkuma@redhat.com Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-10-17samba-tool: Add facility to add rfc2307 attributes to an already created ↵Rowland Penny4-7/+473
user or group Signed-off-by: Rowland Penny <rpenny@samba.org> Reviewed-by: David Mulder <dmulder@suse.com> 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): Thu Oct 17 12:21:55 UTC 2019 on sn-devel-184
2019-10-17samba-tool: Update 'samba-tool gpo list <>' descriptionAmit Kumar1-7/+7
We have a command to get gpo listing from Active Directory. samba-tool gpo list <username> This command can list GPOs for both username and machinename, But command help only shows 'username'. This PR - Updates the option presented in help. - Updates name of variable used to retrieve GPO so that it's not misleading if someone reads code later on BUG: https://bugzilla.samba.org/show_bug.cgi?id=14016 Signed-off-by: Amit Kumar <amitkuma@redhat.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Oct 17 09:21:20 UTC 2019 on sn-devel-184
2019-10-12python/tests/gensec: add spnego downgrade python testsIsaac Boukris1-1/+23
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14106 Pair-Programmed-With: Andreas Schneider <asn@samba.org> Signed-off-by: Isaac Boukris <iboukris@gmail.com> Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-10-12python/tests/gensec: make it possible to add knownfail tests for gensec.update()Stefan Metzmacher1-2/+8
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14106 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-10-09selftest: add mdfind blackbox testRalph Boehme1-0/+130
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
2019-10-09selftest: add end-to-end tests for mdssvc with a fake HTTP serverRalph Boehme1-0/+194
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
2019-10-03rpcclient: Remove unused global domain sidVolker Lendecke1-11/+11
For the auth_log tests using rpcclient this means one message less Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Oct 3 17:59:13 UTC 2019 on sn-devel-184
2019-09-24test_pam_winbind.sh: allow different pam_winbindd config options to be specifiedStefan Metzmacher3-14/+22
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14124 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2019-09-24tests/pam_winbind.py: allow upn names to be used in USERNAME with an empty ↵Stefan Metzmacher3-4/+16
DOMAIN value BUG: https://bugzilla.samba.org/show_bug.cgi?id=14124 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2019-09-24tests/pam_winbind.py: turn pypamtest.PamTestError into a failureStefan Metzmacher3-5/+20
A failure generated by the AssertionError() checks can be added to selftest/knownfail.d/*. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14124 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2019-09-24posixacl.py: avoid inefficient string concatenationsBjörn Jacke1-2/+2
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
2019-09-24auth_log_winbind.py: avoid inefficient string concatenationsBjörn Jacke1-2/+1
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-09-24schema.py: avoid inefficient string concatenationsBjörn Jacke1-5/+2
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-09-24user.py: avoid inefficient string concatenationsBjörn Jacke1-30/+28
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-09-24gpo.py: avoid inefficient string concatenationsBjörn Jacke1-6/+3
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-09-24kcc_utils.py: avoid inefficient string concatenationsBjörn Jacke1-103/+92
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-09-24traffic.py: avoid inefficient string concatenationsBjörn Jacke1-3/+1
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-09-23classicupgrade: fix a a bytes-like object is required, not 'str' errorBjörn Jacke1-1/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14136 Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Björn Baumbach <bb@samba.org> Autobuild-User(master): Björn Jacke <bjacke@samba.org> Autobuild-Date(master): Mon Sep 23 12:58:20 UTC 2019 on sn-devel-184
2019-09-21user.py: import tempfile module only where neededBjörn Jacke1-1/+1
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-09-13param: Allow rpc server dynamic port range to roundtripGarming Sam1-2/+0
Originally this parameter only set two other parameters, but never set the original string. By setting the string as well, we can make it be emitted by testparm -v correctly (instead of ''), and set it back as the value for the parameter. Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Noel Power <npower@samba.org>
2019-09-01Spelling fixes s/overriden/overridden/Mathieu Parent1-6/+6
Signed-off-by: Mathieu Parent <math.parent@gmail.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-08-30samba-tool domain provision: Remove experimental OpenLDAP supportAndrew Bartlett4-811/+9
This feature has long been obsolete, remaining only in the hope that it might be revived in the future. Specifically, in 2011 the S4 OpenLDAP backend HOWTO was removed: commit 1d46325af8541ea467c79cd86e65f93ce6a14ff4 Author: Andrew Bartlett <abartlet@samba.org> Date: Wed Apr 27 22:42:29 2011 +1000 Remove outdated S4 OpenLDAP backend HOWTO. There is a project to revive this, hosted here: https://github.com/Symas/samba and https://github.com/Symas/samba_overlays However discussions at SambaXP with Nadezhda Ivanova indicate a new approach with slapd being started by Samba and taught to read native Samba ldb files is more likely in the short term. This has the advantage that Samba's provision and offline tooling would not need to change, with the solution looking more like how BIND9_DLZ has access to the Samba DB. If any of this is required then reverting these patches will be the least of the difficulties in bringing this to production. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Nadezhda Ivanova <nivanova@symas.com>
2019-08-30rpc samr: EnumDomainUsers perf improvementAaron Haslett1-23/+1
EnumDomainUsers currently takes too long, significantly slowing down calls to winbind's getpwent which is a core unix API. The time is taken up by a GUID lookup for every record in the cached result. The advantages of this approach are: 1. It meets the specified requirement that if a record yet to be returned by a search in progress (with a resume handle) is deleted or modified, the future returned results correctly reflect the new changes. 2. Memory footprint for a search in progress is only 16 bytes per record. But, those benefits are not worth the significant performance hit of the lookups, so this patch changes the function to run the search and cache the RIDs and names of all records matching the search when the request is made. This makes the memory footprint around 200 bytes per record or up to 2MB per concurrent search for a 100k user database. The speedup achieved by this change is around 50%, and in tandem with some winbindd improvements as part of the same task has achieved around 15x speedup for getpwent. The lost specification compliance is unlikely to cause a problem for any known usage of this RPC call. Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-08-22s4-dns: Deprecate BIND9_FLATFILE and remove "rndc command"Andrew Bartlett1-8/+0
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Thu Aug 22 21:24:00 UTC 2019 on sn-devel-184
2019-08-22python: use os.urandom, which is available in python by definitionBjörn Jacke1-39/+2
os.urandom also uses CSPRNG methods like getrandom() when the underlying OS provides those. Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-08-20downgradedatabase: installing scriptAaron Haslett1-0/+2
Installing downgrade script so people don't need the source tree for it. Exception added in usage test because running the script without arguments is valid. (This avoids the need to knownfail it). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2019-08-20downgradedatabase: rename to samba_downgrade_dbTim Beale1-1/+1
Just so that it's slightly less of a mouthful for users. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2019-08-20tests: Avoid hardcoding relative filepathTim Beale1-2/+2
If we move the test file, the test will break. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2019-08-17Prevent samba-tool online backup crashDavid Mulder2-5/+33
On some GPOs, getting a files ntacl throws an NT_STATUS_ACCESS_DENIED. Catch and log the failure when this happens. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14088 Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Tim Beale <timbeale@samba.org>
2019-08-01tests/dcerpc/raw_protocol: Add more tests for DCERPC_AUTH_LEVEL_PACKETGünther Deschner1-0/+11
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Signed-off-by: Guenther Deschner <gd@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Aug 1 16:59:02 UTC 2019 on sn-devel-184
2019-08-01tests/dcerpc/raw_protocol: split test_spnego_integrity_request into 2 partsStefan Metzmacher1-2/+6
This can be a generic test that can be used for more auth_levels. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-08-01tests/dcerpc/raw_protocol: split test_spnego_connect_request() into 2 partsStefan Metzmacher1-3/+7
This can be a generic test that can be used for more auth_levels. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-07-31tests: Add samba_upgradedns to the list of possible cmdsGarming Sam1-0/+1
This will be used to test the replication scenario with no DNS partitions BUG: https://bugzilla.samba.org/show_bug.cgi?id=14051 Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-07-31netcmd: Allow drs replicate --local to create partitionsGarming Sam1-1/+3
Currently, neither the offline (--local) or online (normal replica sync) methods allow partition creation post-join. This overrides the Python default to not create the DB, which allows TDB + MDB to work. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14051 Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-07-24netcmd: Better error message for backup with no RID poolTim Beale1-5/+13
Add a better error message (and what to do about it) if the user tries to back up a DC that hasn't initialized its RID pool yet. Seems to be a fairly common problem hit by users. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14048 RN: Added more informative error message if the 'samba-tool domain backup' command fails due to no RID pool being present on the DC. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed Jul 24 07:07:01 UTC 2019 on sn-devel-184
2019-07-24join: Use a specific attribute order for the DsAddEntry nTDSDSA objectTim Beale1-7/+16
Joining a Windows domain can throw an error if the HasMasterNCs attribute occurs before msDS-HasMasterNCs. This patch changes the attribute order so that msDS-HasMasterNCs is always first. Previously on python2, the dictionary hash order was arbitrary but constant. By luck, msDS-HasMasterNCs was always before HasMasterNCs, so we never noticed any problem. With python3, the dictionary hash order now changes everytime you run the command, so the order is unpredictable. To enforce a order, we can change to use an OrderedDict, which will return the keys in the order they're added. I've asked Microsoft to clarify the protocol requirement here WRT attribute order. However, in the meantime we may as well fix the problem for users. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14046 RN: When trying to join a Windows domain (with functional level 2008R2) as an AD domain controller, the 'samba-tool domain join' command could throw a python exception: 'RuntimeError ("DsAddEntry failed")'. When this problem occurred, you would also see the message "DsAddEntry failed with status WERR_ACCESS_DENIED info (8363, 'WERR_DS_NO_CROSSREF_FOR_NC')" in the command output. This issue has now been resolved. Note that this problem would only occur on Samba v4.10 when using the Python3 packages. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed Jul 24 04:18:21 UTC 2019 on sn-devel-184
2019-07-24traffic_replay: Avoid DB full scans in LDAP searchesTim Beale2-0/+63
When generating LDAP search traffic, a full DB scan can be very costly. Avoiding full-scan LDAP searches means that we can run traffic_replay against a 100K user DB and get some sane results. Because the traffic_learner doesn't record the LDAP search filter at all, the traffic_replay LDAP searches default to being full scans. Doing full scans meant that the LDAP search was usually the first packet type to exceed the max latency and fail the test. It could also skew results for the other packet types by creating big demands on memory/CPU/ DB-lock-time. It's hard to know for sure exactly what real-world LDAP searches will look like, but let's assume full scan searches will be fairly rare. In traffic-model files we've collected previously, some of the attributes are fairly unique (e.g. pKIExtendedKeyUsage), and as there are some LDAP queries specified in MS specs (such as MS-GPOL and MS-WCCE), it allows us to infer what the search filter might be. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>