summaryrefslogtreecommitdiff
path: root/python/samba/getopt.py
Commit message (Collapse)AuthorAgeFilesLines
* samba-tool: Use authentication file to pass credentialsNikola Radovanovic2022-10-041-0/+10
| | | | | | | | | | In order not to pass credentials in clear-text directly over command line, this is a patch to store username/password/domain in a file and use it during domain join for example. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15031 Signed-off-by: Nikola Radovanovic <radovanovic.extern@univention.de> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
* py/getopt: allow --option arguments to contain '='Douglas Bagnall2022-09-061-1/+1
| | | | | | | | | | | | | smb.conf lines can have = on the right hand side. For example, in st/ad_dc/etc/smb.conf we have 3 examples, including: gpo update command = python3 source4/scripting/bin/samba-gpupdate [...] --target=Computer If we tried to provide the same line via --option, it would split on both '=', and the set value would end at '--target'. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* py/getopt: improve messages for bad --realmDouglas Bagnall2022-09-061-1/+4
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* py/getopt: improve messages for bad --debug argDouglas Bagnall2022-09-061-1/+4
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool: avoid traceback for options errorsDouglas Bagnall2022-09-061-0/+3
| | | | | | | | | | What option? None yet, but see the next two commits. We use a local reference to optparse.OptionValueError, to save typing and make the eventual switch to argparse easier. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* gpo: samba-gpupdate use s3 param for registry confDavid Mulder2022-07-221-0/+9
| | | | | | | | | | | Cause samba-gpupdate to use an s3 param so that it can load settings from registry configuration. Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Jul 22 20:40:51 UTC 2022 on sn-devel-184
* python: Streamline option parser of python toolsAndreas Schneider2021-06-201-6/+36
| | | | | | | | The python tools, especially samba-tool should have the same option set as the rest of the client utils. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* Remove password from samba-tool proctitleHeiko Baumann2020-11-261-0/+48
| | | | | | | | | | | | | This fix makes sure the password is removed from the proctitle of samba-tool so it cannot be exposed by e.g. ps(1). - Moved code to python/samba/getopt.py as suggested by David Mulder - Except ModuleNotFoundError when trying to load setproctitle module - Improved code to keep option separator (space or equal sign) while removing password from proctitle. Signed-off-by: Heiko Baumann <heibau@gmail.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: David Mulder <dmulder@suse.com>
* python getopt: Add bytes option typeGary Lockyer2019-07-021-0/+45
| | | | | | | | | | Add a new option type to the python command line options. Option("--size", type="bytes", metavar="SIZE") To allow the input of file and memory sizes using unit suffixes i.e. 2Gb, 4KiB ... Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* python/samba: PY3 fix can't compare string with intNoel Power2018-11-141-3/+0
| | | | | | | | | Testing a string against an int value is illegal and is not necessary in this case, this patch removes the problematic test. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* PEP8: fix E128: continuation line under-indented for visual indentJoe Guo2018-08-241-19/+19
| | | | | | 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>
* PEP8: fix E123: closing bracket does not match indentation of opening ↵Joe Guo2018-08-241-1/+1
| | | | | | | | 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>
* python: call fault_setup() if samba.getopt is usedStefan Metzmacher2018-06-121-0/+2
| | | | | | | | | | | | | | | | This means we have a samba command line tool written in python, e.g. samba-tool We should get the samba typicall backtraces instead of just "Segmentation fault (core dumped)". BUG: https://bugzilla.samba.org/show_bug.cgi?id=13469 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): Tue Jun 12 11:04:55 CEST 2018 on sn-devel-144
* python: Allow debug classes to be specified on the command line for python toolsAndrew Bartlett2017-09-071-3/+3
| | | | | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Thu Sep 7 10:43:33 CEST 2017 on sn-devel-144
* python/getopt: Add --krb5-ccache (for samba-tool etc) to match the C binariesAndrew Bartlett2017-07-281-0/+7
| | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* python/getopt: -d/--debuglevel saves value in options for scriptsDouglas Bagnall2017-06-231-0/+1
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* python: samba.getopt: Port module to Python 3 compatible formLumir Balhar2017-03-101-6/+2
| | | | | | | | | | | | | | Port samba.getopt module to Python 3 compatible form. Remove unused and untested `get_hostconfig()` function. Andrew Bartlett suggested this removal because it is the simpliest way how to break a long dependency line of Python modules which have to be ported at once. More info: https://lists.samba.org/archive/samba-technical/2017-January/118150.html Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* python/samba: add on optional 'special_name' argument to CredentialsOptions()Stefan Metzmacher2015-07-081-10/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This way we have have two sets or credentials on the command line, while at least one uses some prefix (special_name) for the arguments. The default options without special_name are: Credentials Options: --simple-bind-dn=DN DN to use for a simple bind --password=PASSWORD Password -U USERNAME, --username=USERNAME Username -W WORKGROUP, --workgroup=WORKGROUP Workgroup -N, --no-pass Don't ask for a password -k KERBEROS, --kerberos=KERBEROS Use Kerberos --ipaddress=IPADDRESS IP address of server -P, --machine-pass Use stored machine account password With special_name='local-dc' it's: Credentials Options (local-dc): --local-dc-simple-bind-dn=DN DN to use for a simple bind --local-dc-password=PASSWORD Password --local-dc-username=USERNAME Username --local-dc-workgroup=WORKGROUP Workgroup --local-dc-no-pass Don't ask for a password --local-dc-kerberos=KERBEROS Use Kerberos --local-dc-ipaddress=IPADDRESS IP address of server --local-dc-machine-pass Use stored machine account password Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* samba-tool: Add -P to options.CredentialsOptionsAndrew Bartlett2015-03-061-5/+21
| | | | | | | This matches our other binaries, and allows samba-tool commands to run with the machine account. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* Move python modules from source4/scripting/python/ to python/.Jelmer Vernooij2013-03-021-0/+251
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