summaryrefslogtreecommitdiff
path: root/python/samba
Commit message (Collapse)AuthorAgeFilesLines
* cli_credentials_parse_string: fix parsing of principalsAlexander Bokovoy2020-11-041-2/+2
| | | | | | | | | | | | | | | | | | | When parsing a principal-like name, user name was left with full principal instead of taking only the left part before '@' sign. >>> from samba import credentials >>> t = credentials.Credentials() >>> t.parse_string('admin@realm.test', credentials.SPECIFIED) >>> t.get_username() 'admin@realm.test' The issue is that cli_credentials_set_username() does a talloc_strdup() of the argument, so we need to change order of assignment to allow talloc_strdup() to copy the right part of the string. Signed-off-by: Alexander Bokovoy <ab@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* selftest: add test for new "samba-tool user unlock" commandBjörn Baumbach2020-11-041-0/+41
| | | | | | | | Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org> Autobuild-Date(master): Wed Nov 4 00:19:25 UTC 2020 on sn-devel-184
* samba-tool: add new "user unlock" commandBjörn Baumbach2020-11-032-1/+103
| | | | | | | | | | | | Can be used to unlock a user when the badPwdCount has been reached. Introduces SamDB error classes, as suggested by Douglas Bagnall <douglas.bagnall@catalyst.net.nz> - thanks! This helps to handle expected failures. Tracebacks of really unexpected failures will not be hidden. Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* tests: avoid returning an already used ID in randomXid()Jule Anger2020-10-291-3/+17
| | | | | | | | | | | | | | | | The error 'uidNumber xxx is already being used.' in the samba tool tests occurs when the random.randint functions returns the same value twice and therefore a user or group with an already used gid or uid should be created. Avoid this error by adding a list that stores the used IDs, so that the randomXid function can check wheter a value is already used before returning it. Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Oct 29 18:54:24 UTC 2020 on sn-devel-184
* python:tests: Add SAMR password change tests for fipsAndreas Schneider2020-10-291-0/+188
| | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
* DNS Resolver: support both dnspython before and after 2.0.0Alexander Bokovoy2020-10-261-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | `dnspython` 2.0.0 has many changes and several deprecations like: ``` > dns.resolver.resolve() has been added, allowing control of whether search lists are used. dns.resolver.query() is retained for backwards compatibility, but deprecated. The default for search list behavior can be set at in the resolver object with the use_search_by_default parameter. The default is False. > dns.resolver.resolve_address() has been added, allowing easy address-to-name lookups. ``` The new class `DNSResolver`: - provides the compatibility layer - defaults the previous behavior (the search list configured in the system's resolver configuration is used for relative names) - defaults lifetime to 15sec (determines the number of seconds to spend trying to get an answer to the question) The compatibility shim was developed by Stanislav Levin for FreeIPA and adopted for Samba by Alexander Bokovoy. Signed-off-by: Stanislav Levin <slev@altlinux.org> Signed-off-by: Alexander Bokovoy <ab@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* py3: Add is_ad_dc_built option to python glueDavid Mulder2020-10-231-0/+1
| | | | | Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* python: Create targetdir recursivelyAndreas Schneider2020-10-221-1/+1
| | | | | | | | This fixes `make test` in a release tarball. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14542 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
* python/tests: add DynamicTestCase setUpDynamicTestCases() infrastructureStefan Metzmacher2020-10-211-0/+27
| | | | | | | | | | | | This can be used in order to run a sepcific test (coded just once) with an autogenerated set of arguments. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14531 Pair-Programmed-With: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* python2 reduction: Merge remaining compat code into commonDavid Mulder2020-10-0232-123/+79
| | | | | | | | | | | | | The remaining compat code (get_string, get_bytes, cmp) are useful helper routines which we should simply merge into common (especially since there is some duplication here). Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): David Mulder <dmulder@samba.org> Autobuild-Date(master): Fri Oct 2 14:49:36 UTC 2020 on sn-devel-184
* python: Move dsdb_Dn to samdbDavid Mulder2020-10-026-86/+80
| | | | | | | | | The import dsdb needed for dsdb_Dn causes import errors when trying to import get_bytes/get_string in some places. Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool tests: rename 'contact create' to 'contact add'Jule Anger2020-10-011-5/+5
| | | | | | | | | Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org> Autobuild-Date(master): Thu Oct 1 02:44:09 UTC 2020 on sn-devel-184
* samba-tool contact: rename 'contact create' to 'contact add'Jule Anger2020-10-011-10/+11
| | | | | | | | Keep 'contact create' for compatibility reasons. Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool tests: rename 'group create' to 'group add'Jule Anger2020-10-011-1/+1
| | | | | | Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool group: add 'group create' as synonym for 'group add'Jule Anger2020-10-011-3/+4
| | | | | | | | | Add 'group create' command for a symmetric set of samba-tool subcommands Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool tests: rename 'computer create' to 'computer add'Jule Anger2020-10-011-7/+7
| | | | | | Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool computer: rename 'computer create' to 'computer add'Jule Anger2020-10-011-13/+14
| | | | | | | | Keep 'computer create' for compatibility reasons. Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool tests: rename 'user create' to 'user add'Jule Anger2020-10-011-5/+5
| | | | | | Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool user: rename 'user create' to 'user add'Jule Anger2020-10-011-29/+15
| | | | | | | | Keep 'user create' for compatibility reasons. Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool tests: rename 'ou create' to 'ou add'Jule Anger2020-10-014-14/+14
| | | | | | Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool ou: rename 'ou create' to 'ou add'Jule Anger2020-10-011-8/+9
| | | | | | | | Keep 'ou create' for compatibility reasons. Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool tests: add test-cases for 'contact rename'Jule Anger2020-10-011-0/+126
| | | | | | | | | | | | | | | Tests the following options: --surname --given-name --initials --force-new-cn --reset-cn --display-name --mail-address Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool contact: add new contact 'rename' commandJule Anger2020-10-011-0/+178
| | | | | | | | | | | | | | | | | | | | | | | Usage: samba-tool contact rename <contactname> [options] Rename a contact and related attributes. This command allows to set the contact's name related attributes. Use an empty attribute value to remove the specified attribute. The contactname specified on the command is the CN. Example1: samba-tool contact rename "John Doe" --surname=Bloggs \\ --force-new-cn=John Example1 shows how to change the surname ('sn' attribute) of a contact 'John Doe' to 'Bloggs' and change the CN to 'John' on the local server. Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool tests: add test-cases for 'group rename'Jule Anger2020-10-011-0/+75
| | | | | | | | | | | | Tests the following options: --samaccountname --force-new-cn --reset-cn --mail-address Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool group: add new group 'rename' commandJule Anger2020-10-011-0/+155
| | | | | | | | | | | | | | | | | | | | | | Usage: samba-tool group rename <groupname> [options] Rename a group and related attributes. This command allows to set the group's name related attributes. Use an empty attribute value to remove the specified attribute. The groupname specified on the command is the sAMAccountName. Example1: samba-tool group rename employees --samaccountname=staff Example1 shows how to change the sAMAaccountName of a group 'employees' to 'staff' on the local server. Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool tests: add test-cases for 'user rename'Jule Anger2020-10-011-0/+234
| | | | | | | | | | | | | | | | | Tests the following options: --surname --given-name --initials --force-new-cn --reset-cn --display-name --mail-address --samaccountname --upn Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool user: add new user 'rename' commandBjörn Baumbach2020-10-011-0/+225
| | | | | | | | | | | | | | | | | | | | | | | | | | | Usage: samba-tool user rename <username> [options] Rename a user and related attributes. This command allows to set the user's name related attributes. The user's CN will be renamed automatically. The user's new CN will be made up by combining the given-name, initials and surname. A dot ('.') will be appended to the initials automatically. Use the --force-new-cn option to specify the new CN manually. The username specified on the command is the sAMAccountName. Example1: samba-tool user rename johndoe --surname='Bloggs' Example1 shows how to change the surname of a user 'johndoe' to 'Bloggs' on the local server. The user's CN will be renamed automatically, based on the given name, initials and surname. Pair-Programmed-With: Jule Anger <ja@sernet.de> Signed-off-by: Björn Baumbach <bb@sernet.de> Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samdb: add fullname_from_names() methodJule Anger2020-10-011-19/+37
| | | | | | | | | | | | | | | | Add a method to construct the fullname, using the given name, the initials and the surname. If one of this values is empty, try to use the old one, given by an attributs set. If the combination is empty, the method will return the fallback-default parameter. Use this method to construct the CN or the displayName of users or contacts. Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samdb: add prepare_attr_replace() methodJule Anger2020-10-011-0/+23
| | | | | | | | | | | | | | | Add a method to prepare a given Message to replace the given attribute. If the given new value is None or the old value and the new value are the same, do nothing. If the new value is empty, prepare to replace the given attribute with []. Else prepare to replace the given attribute with the new value. Use this for samdb.modify(msg). Signed-off-by: Jule Anger <ja@sernet.de> Reviewed-by: Björn Baumbach <bb@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* provision: BIND 9.17.x is not supportedAmitay Isaacs2020-09-241-0/+2
| | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14487 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Rowland Penny <rpenny@samba.org> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Thu Sep 24 05:55:43 UTC 2020 on sn-devel-184
* provision: Add support for BIND 9.16.xAmitay Isaacs2020-09-241-1/+5
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14487 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Rowland Penny <rpenny@samba.org>
* provision: BIND 9.15.x is not supportedAmitay Isaacs2020-09-241-0/+2
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14487 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Rowland Penny <rpenny@samba.org>
* provision: Add support for BIND 9.14.xAmitay Isaacs2020-09-241-2/+5
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14487 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Rowland Penny <rpenny@samba.org>
* provision: BIND 9.13.x is not supportedAmitay Isaacs2020-09-241-0/+2
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14487 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Rowland Penny <rpenny@samba.org>
* python/tests/gpo: this should fix a Popen deadlockStefan Metzmacher2020-09-071-11/+10
| | | | | | | | | | | | | | | | | | | | | | | It is inspired by commit 5dc773a5b00834c7a53130a73a48f49048bd55e8 Author: Joe Guo <joeg@catalyst.net.nz> Date: Fri Sep 15 16:13:26 2017 +1200 python: use communicate to fix Popen deadlock `Popen.wait()` will deadlock when using stdout=PIPE and/or stderr=PIPE and the child process generates large output to a pipe such that it blocks waiting for the OS pipe buffer to accept more data. Use communicate() to avoid that. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-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): Thu Oct 19 09:27:16 CEST 2017 on sn-devel-144 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
* Fixed arrow keys typo to the computer move command utilityHezekiah2020-09-041-1/+1
| | | | | | | | | Signed-off-by: Hezekiah <hezekiahmaina3@gmail.com> Reviewed-by: Alexander Bokovoy <ab@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org> Autobuild-User(master): Alexander Bokovoy <ab@samba.org> Autobuild-Date(master): Fri Sep 4 16:57:30 UTC 2020 on sn-devel-184
* gpo: Pass necessary parameters to rsopDavid Mulder2020-09-021-1/+1
| | | | | | | | | | | | | | | | | These parameters were missed by mistake when exts were modified to be initialized within the rsop command. Fixes an exception thrown when executing samba-gpupdate --rsop: Traceback (most recent call last): File "/usr/sbin/samba-gpupdate", line 99, in <module> rsop(lp, creds, gp_extensions, opts.target) File "/usr/lib64/python3.8/site-packages/samba/gpclass.py", line 512, in rsop ext = ext(logger, lp, creds, store) NameError: name 'logger' is not defined Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* gpo: Test rsop function for successDavid Mulder2020-09-022-2/+12
| | | | | Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-tool: Create unix user with modified template homedirDavid Mulder2020-09-021-2/+3
| | | | | Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org>
* samba-tool: Test creating unix user with modified template homedirDavid Mulder2020-09-021-0/+8
| | | | | Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org>
* python/samba/tests/blackbox: Tests with nested DFS containerNoel Power2020-08-311-0/+96
| | | | | | | | Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Mon Aug 31 19:09:24 UTC 2020 on sn-devel-184
* python/samba/tests/blackbox: python smbcacls '--propagate-inherit' testNoel Power2020-08-311-0/+1291
| | | | | Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org>
* python/samba/tests/blackbox: Preparatory change to support custom shareNoel Power2020-08-311-5/+5
| | | | | | | | tearDown method doesn't handle local file deletion fallback if a share other than 'tmp' is used Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org>
* python/samba/tests:blackbox: Fix local file delete test tree fallbackNoel Power2020-08-311-5/+5
| | | | | | | | Wrong indentation ensures the fallback where we use file system removal of test files if the test's tearDown method fails. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org>
* python/samba/tests/blackbox: Fix undetected deltree failNoel Power2020-08-311-1/+3
| | | | | | | | | With msdfs root share smbclient deltree command can fail without setting the errorcode (e.g. when do_list encounters an error it will log a warning message and continue rather than error out fatally) Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org>
* GPO: Add rsop output for Messages policyDavid Mulder2020-08-271-0/+15
| | | | | | | | Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): David Mulder <dmulder@samba.org> Autobuild-Date(master): Thu Aug 27 17:19:48 UTC 2020 on sn-devel-184
* GPO: Test rsop output for Messages policyDavid Mulder2020-08-271-2/+14
| | | | | Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* gpo: Apply Group Policy Login Prompt MessageDavid Mulder2020-08-271-0/+4
| | | | | Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* gpo: Test Group Policy Login Prompt MessageDavid Mulder2020-08-271-8/+20
| | | | | Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* gpo: Apply Group Policy Message of the dayDavid Mulder2020-08-271-1/+43
| | | | | Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>