summaryrefslogtreecommitdiff
path: root/python/pyglue.c
AgeCommit message (Collapse)AuthorFilesLines
2022-10-03python: whitespace fixesVolker Lendecke1-5/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-08-26pyglue:generate_random_[machine]_password: ValueError for bad valuesDouglas Bagnall1-0/+10
The actual range is 14 to 255 for machine passwords, and there is a min <= max check for both. Signed-off-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): Fri Aug 26 08:59:28 UTC 2022 on sn-devel-184
2022-08-26pyglue: generate_random_[machine]_password: reject negative numbersDouglas Bagnall1-2/+27
Other range errors (e.g. min > max) are caught in the wrapped functions which returns EINVAL, so we don't recapitulate that logic (see next commit though). Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2022-08-26pyglue: generate_random_bytes/str accept positive numbers onlyDouglas Bagnall1-4/+16
We aren't yet able to generate negative numbers of random bytes. Instead a request for -n bytes is implicitly converted into one for SIZE_MAX - n bytes, which is typically very large. Memory exhaustion seems a likely outcome. With this patch callers will see a ValueError. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2022-08-26pyglue: check talloc buffer for random bytesDouglas Bagnall1-0/+4
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2021-06-02selftest: Add test of NDR marshalling from python, starting with wbintAndrew Bartlett1-0/+9
These patches are to address an issue unpacking a very large winbind.wbint_Principals array (100,000). We need the NDR_TOKEN_MAX_LIST_SIZE value exposed as otherwise a well-meaning incrase of this value would invalidate the test. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14710 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2021-04-21python: glue function for detecting if selftest is enabledDavid Mulder1-0/+12
Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-03-01pyglue: add float2nttime() and nttime2float()Stefan Metzmacher1-0/+47
The float value is what the native python time.time() returns, it's basically a struct timespec converted to double/float. Pair-Programmed-With: Björn Baumbach <bb@sernet.de> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-10-23py3: Add is_ad_dc_built option to python glueDavid Mulder1-0/+12
Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-05-08Fix clang 9 missing-field-initializer warningsGary Lockyer1-1/+1
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2020-03-23py3: Remove #define PyInt_FromLong PyLong_FromLongAndrew Bartlett1-3/+3
This allows us to end the use of Python 2/3 compatability macros. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power
2019-06-24py3: Remove PyStr_FromString() compatability macroAndrew Bartlett1-6/+6
We no longer need Samba to be py2/py3 compatible so we choose to return to the standard function names. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
2019-05-16squash 'cast between incompatible function types' warningNoel Power1-4/+8
To avoid warning above produced by using -Wcast-function-type we; + ensure PyCFunctions of type METH_NOARGS defined dummy arg + ensure PyCFunctions of type METH_KEYWORDS use PY_DISCARD_FUNC_SIG macro Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-01-13python: use 'et' as format for ParseTuple with python2Noel Power1-2/+6
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-13python: Fix memory leak with ParseTuple (using 'es' format)Noel Power1-7/+15
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-11-08debug: Use debuglevel_(get|set) functionAndreas Schneider1-2/+3
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Nov 8 11:03:11 CET 2018 on sn-devel-144
2018-10-23python: py_strcasecmp_m & py_strstr_m don't handle unicode properlyNoel Power1-5/+9
py_strcasecmp_m & py_strstr_m use PyArg_ParseTuple() with 's' which in Py2 tries to decode string with the default (e.g. ascii) encoding Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-06-12python: export fault_setup() to python bindingsStefan Metzmacher1-0/+12
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>
2017-12-18pyglue: Add function to generate a random byte stringGary Lockyer1-0/+21
Adds a function to generate a random byte string using the samba random routines. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-12-10samba-tool: validate password early in `domain provision`Jamie McClymont1-0/+17
Checks password against default quality and length standards when it is entered, allowing a second chance to enter one (if interactive), rather than running through the provisioning process and bailing on an exception Includes unit tests for the newly-added python wrapper of check_password_quality plus black-box tests for the checks in samba-tool. Breaks an openldap test which uses an invalid password. BUG: https://bugzilla.samba.org/show_bug.cgi?id=9710 BUG: https://bugzilla.samba.org/show_bug.cgi?id=12235 Signed-off-by: Jamie McClymont <jamiemcclymont@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2017-04-29python: Add py_is_heimdal_built() to pyglueAndreas Schneider1-0/+11
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlet <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2017-03-10python: samba._glue: Port samba._glue module to Python 3.Lumir Balhar1-11/+20
Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2017-02-21pyglue: add generate_random_machine_password() wrapperStefan Metzmacher1-1/+25
We use PyUnicode_FromString() (which is available from 2.6) because we really have non-ascii strings. 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-11-04python: Add DsExtendedError ExceptionAndrew Bartlett1-0/+8
This will be used for checking errors during a GetNCChanges EXOP like RID Set allocation. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> BUG: https://bugzilla.samba.org/show_bug.cgi?id=12398
2016-11-04python: create NTSTATUSError, HRESULTError and WERRORErrorAndrew Bartlett1-0/+20
The advantage of these over the previous use of just RuntimeError is that we can catch just the errors we want, without having to catch all possible RuntimeError cases and assume they decode to a tuple Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> BUG: https://bugzilla.samba.org/show_bug.cgi?id=12398
2015-10-23build: Enable NTVFS file server to be omittedAndrew Bartlett1-0/+11
We now only build it by default with --enable-sefltest, or otherwise if requested. The NTVFS file server still has features not present in the smbd file server, such as a CIFS/SMB proxy, and a radically different design, but it is also not undergoing any ongoing development so this keeps it in a safe state for care and maintaince, with less of a security risk if such an issue were to come up. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2014-01-09samba:python - Py_RETURN_NONE remove compatibility code for releases < 2.4Matthias Dieter Wallnöfer1-4/+0
http://www.python.org/doc//current/c-api/none.html Reviewed-By: Jelmer Vernooij <jelmer@samba.org> Autobuild-User(master): Matthias Dieter Wallnöfer <mdw@samba.org> Autobuild-Date(master): Thu Jan 9 16:27:47 CET 2014 on sn-devel-104
2013-08-30python/pyglue: filter out loopback and linklocal addresses unless ↵Stefan Metzmacher1-2/+43
all_interfaces is given Bug: https://bugzilla.samba.org/show_bug.cgi?id=10030 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Bjoern Jacke <bj@sernet.de>
2013-03-02Move python modules from source4/scripting/python/ to python/.Jelmer Vernooij1-0/+250
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