summaryrefslogtreecommitdiff
path: root/python/samba/netcmd/user.py
AgeCommit message (Collapse)AuthorFilesLines
2018-08-24PEP8: fix E128: continuation line under-indented for visual indentJoe Guo1-7/+7
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E127: continuation line over-indented for visual indentJoe Guo1-25/+25
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E123: closing bracket does not match indentation of opening ↵Joe Guo1-27/+27
bracket's line Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E121: continuation line under-indented for hanging indentJoe Guo1-1/+1
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-07-13python/samba/netcmd: fix py2/py3 bytes usage for replaceNoel Power1-1/+1
base64.b64encode returns bytes in py3 make sure associated replace uses 'b' for strings passed to replace Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-05-17python/samba/netcmd: net.change_password should be passed stringNoel Power1-2/+4
password param which in python2 (is str) is incorrectly encoded before passing to net.change_password. python2 - password is either unicode or str, if str we should decode to get unicode (and then pass to net.change_password). python3 - password is either str or bytes, if bytes then decode (and pass as 'str' to net.change_password). Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-05-12python/samba: py2/py3 compatability always decode result of b64encodeNoel Power1-6/+6
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-05-12samba_tool: replace xrange -> rangeNoel Power1-1/+1
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-05-12python/samba: Bulk replace of '.next()' method with function 'next()'Noel Power1-1/+1
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-05-12Fix spelling s/succesfully/successfully/Mathieu Parent1-1/+1
Signed-off-by: Mathieu Parent <math.parent@gmail.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2018-04-06samba-tool: Escape username and computername in ldb search filterAndrew Bartlett1-1/+1
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-02-28samba-tool: convert 'except X, (tuple)' to 'except X as e'Noel Power1-8/+16
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>
2018-02-28samba-tool: convert octal 'O1234' format to python3 compatible '0o1234'Noel Power1-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>
2018-02-27samba-tool: user setexpiry: Fix incorrect Example2Rowland Penny1-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
2018-02-15samba-tool: convert 'except X, e' to 'except X as e' for all XDouglas Bagnall1-10/+10
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>
2018-02-08samba-tool user: implement the user move commandBjörn Baumbach1-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>
2018-02-08samba-tool user: fix some typosBjörn Baumbach1-3/+3
Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-02-08samba-tool: implement user show command to display a user AD objectBjörn Baumbach1-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>
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-05-25samba-tool add support for userPasswordGary Lockyer1-22/+88
Changes to virtualCryptSHA256 and virtualCryptSHA512 attributes. The values are now calculated as follows: 1) If a value exists in 'Primary:userPassword' with the specified number of rounds it is returned. 2) If 'Primary:CLEARTEXT, or 'Primary:SambaGPG' with '--decrypt-samba-gpg'. Calculate a hash with the specified number of rounds 3) Return the first {CRYPT} value in 'Primary:userPassword' with a matching algorithm 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-05-25samba-tool user: add rounds option to virtualCryptSHAxxxGary Lockyer1-7/+78
Allow the number of rounds to be specified when calculating the virtualCryptSHA256 and virtualCryptSHA512 attributes. i.e. --attributes="virtualCryptSHA256;rounds=3000" will calculate the hash using 3,000 rounds. 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-05-25samba-tool user: Support for virtualWDigest attributesGary Lockyer1-0/+152
Add new virtualWDigest attributes, these return the hashes stored in supplementalCredentials Primary:WDigest, in a form suitable for htdigest authentication 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-05-05samba-tool: fix log message of 'samba-tool user syncpasswords'Stefan Metzmacher1-1/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12768 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Fri May 5 01:37:45 CEST 2017 on sn-devel-144
2017-05-04samba-tool: let 'samba-tool user syncpasswords' report deletions immediatelyStefan Metzmacher1-1/+1
We need to use the show-recycled control in addition to the notification control in order to get notifications about deletions. There's no real problem as the next modification will report the deletion. But it might be delayed a few minutes. Note that show-recycled is a superset of show-deleted, so we only need one. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12767 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2017-02-22Correct "specifiy" typos.Chris Lamb1-5/+5
Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-02-21python/samba: use an explicit .encode('utf-8') where we expect utf8 passwordsStefan Metzmacher1-1/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12262 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2016-09-30bug 12292: stop user.py throwing errors if user is unknownRowland Penny1-3/+16
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12292 Signed-off-by: Rowland Penny <rpenny@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2016-07-22samba-tool: add --decrypt-samba-gpg support to 'user getpasswords' and 'user ↵Stefan Metzmacher1-11/+152
syncpasswords' This get's the cleartext passwords by decrypting the 'Primary:SambaGPG' value in order to provide the virtual attributes: virtualClearTextUTF16, virtualClearTextUTF8, virtualCryptSHA256, virtualCryptSHA512, virtualSSHA The virtual attribute virtualSambaGPG provides the raw (encrypted) value of the 'Primary:SambaGPG' value. See the "password hash gpg key ids" option for the encryption part of this feature. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2016-07-22samba-tool: add 'user syncpasswords' commandStefan Metzmacher1-0/+760
This provides an easy way to keep passwords in sync with another account database, e.g. an OpenLDAP server. It provides a functionality like the "passwd program" for the "unix password sync" feature of a standalone, member and classic (NT4) server, but for an active directory domain controller. The provided script is called for each account/password related change. Like the 'user getpassword' command it allows virtual attributes like: virtualClearTextUTF16, virtualClearTextUTF8, virtualCryptSHA256, virtualCryptSHA512, virtualSSHA Note that this command should just run on a single domain controller (typically the PDC-emulator). Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2016-07-22samba-tool: add 'user getpassword' commandStefan Metzmacher1-0/+408
This provides an easy way to get the passwords of a user including the cleartext passwords (if stored) and derived hashes. This is done by providing virtual attributes like: virtualClearTextUTF16, virtualClearTextUTF8, virtualCryptSHA256, virtualCryptSHA512, virtualSSHA This is much easier than using ldbsearch and manually parsing the supplementalCredentials attribute. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2016-06-30samba-tool: add 'samba-tool user setpassword ↵Stefan Metzmacher1-10/+52
--smartcard-required/--clear-smartcard-required' BUG: https://bugzilla.samba.org/show_bug.cgi?id=11441 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-06-30samba-tool: do a password retype validation check for 'samba-tool user ↵Stefan Metzmacher1-3/+7
setpassword' This matches the behavior of 'samba-tool user create' and 'samba-tool user password'. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11441 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-06-30samba-tool: add --smartcard-required option to 'samba-tool user create'Stefan Metzmacher1-3/+20
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11441 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-06-27samba-tool: really deprecate 'samba-tool user add'Stefan Metzmacher1-3/+3
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-12-07samba-tool: user create examples show 'add' instead of 'create'Rowland Penny1-4/+4
Signed-off-by: Rowland Penny <repenny241155@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2015-11-06Fix various spelling errorsMathieu Parent1-1/+1
Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Nov 6 13:43:45 CET 2015 on sn-devel-104
2015-02-03samba-tool: Create NIS enabled users and unixHomeDirectory attributeMarc Muehlfeld1-2/+23
Allow to create NIS enabled user accounts via 'samba-tool user add'. To create NIS enabled accounts, the parameters --uid-number=, --login-shell=, --unix-home=, --gid-number= are mandatory. Because we didn't had a parameter to set unixHomeDirectory yet, this patch also adds this feature. 'unixUserPassword: ABCD!efgh12345$67890' is added by default, when you enable NIS on an account in ADUC. The same we do in samba-tool. See: https://bugzilla.samba.org/show_bug.cgi?id=10909 Signed-off-by: Marc Muehlfeld <mmuehlfeld@samba.org> Reviewed-By: Jelmer Vernooij <jelmer@samba.org> Autobuild-User(master): Marc Muehlfeld <mmuehlfeld@samba.org> Autobuild-Date(master): Tue Feb 3 17:18:32 CET 2015 on sn-devel-104
2014-09-08samba-tool: fix reply when zero day pwd expiry is setBjörn Jacke1-4/+4
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10318 Signed-off-by: Bjoern Jacke <bj@sernet.de> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Björn Jacke <bj@sernet.de> Autobuild-Date(master): Mon Sep 8 14:15:51 CEST 2014 on sn-devel-104
2014-08-06Redescribe --userou usageMarc Muehlfeld1-2/+2
Signed-off-by: Marc Muehlfeld <mmuehlfeld@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-03-02Move python modules from source4/scripting/python/ to python/.Jelmer Vernooij1-0/+605
Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Sat Mar 2 03:57:34 CET 2013 on sn-devel-104