summaryrefslogtreecommitdiff
path: root/lib/ldb-samba
Commit message (Collapse)AuthorAgeFilesLines
* lib: Update all consumers of strtoul_err(), strtoull_err() to new APISwen Schillig2019-06-302-7/+13
| | | | | | Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
* lib/ldb-samba: squash 'cast between incompatible function types' warningNoel Power2019-05-161-2/+4
| | | | | | | | | | To avoid warning above produced by using -Wcast-function-type we; + ensure PyCFunctions of type METH_NOARGS defined dummy arg Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
* common-lib: Update error check for new string conversion wrapperSwen Schillig2019-04-111-12/+2
| | | | | | | | | | | The new string conversion wrappers detect and flag errors which occured during the string to integer conversion. Those modifications required an update of the callees error checks. Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
* ldb: tests for <= and >= integer indexing with duplicatesGarming Sam2019-04-081-0/+43
| | | | | | | | | We need to make sure that duplicates are correctly returned (uSNChanged for instance is UNIQUE but, we should be able to index on attributes which are not unique). Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* ldb: tests for <= and >= integer indexingAaron Haslett2019-04-082-0/+180
| | | | | | | | | | | | | | | | Testing max, min and negative values for indexed 32 and 64 bit types. This has to be done in two different files because the 64 bit type is LDB_SYNTAX_INTEGER which is implemented at the ldb level, while the 32 bit is added in the ldb-samba module. Schema syntax binding added for ldb-samba. We also need to make sure that full scans are not invoked for LMDB. Pair-programmed-with: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* schema_syntax: Add comments for our index format functionsGarming Sam2019-04-081-1/+20
| | | | | | | | | | | We had to devise our own scheme for writing integers in a human readable format which also sorted correctly numerically. This might look a bit confusing to outsiders, so here's a large comment as a peace offering. Pair-programmed-with: Tim Beale <timbeale@catalyst.net.nz> Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* ldb: activating <= and >= indexing for integersAaron Haslett2019-04-081-0/+45
| | | | | | | | | | | | | | | Activating <= and >= mdb indexing in samba for int32 and int64 attributes by: 1. Adding index_format_fn to LDB_SYNTAX_SAMBA_INT32 in ldb_samba 2. Cloning the 64bit LDB_SYNTAX_INTEGER type as LDB_SYNTAX_ORDERED_INTEGER 3. Adding index_format_fn to the new type 4. Modifying LargeInteger use the new type in samba schema 5. Bumping the index version to trigger reindexing Pair-programmed-with: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* build: Remove bld.gen_python_environments()Andrew Bartlett2019-03-211-7/+6
| | | | | | | This was part of --extra-python support. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* build: Remove --extra-pythonAndrew Bartlett2019-03-211-2/+0
| | | | | | | | | | | This option is quite invasive in waf and was mainly for the python3 transition. Testing with multiple python versions can be done by testing a full compile against multiple versions, likewise multiple different binding versions can be created the same way. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* samba-o3: fix -Werror=strict-overflow error in lib/ldb-samba/ldb_ildap moduleJoe Guo2019-03-081-4/+4
| | | | | | | | | | | | | | | | | | | | samba-o3 test failed in ubuntu:16.04 docker container: ==> /home/samba/samba/samba-o3.stderr <== ../../lib/ldb-samba/ldb_ildap.c: In function ‘ildb_handle_request’: ../../lib/ldb-samba/ldb_ildap.c:535:2: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow] for (i = 0; i < n; i++) { ^ ../../lib/ldb-samba/ldb_ildap.c:579:2: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow] for (i = 0; i < n; i++) { ^ cc1: all warnings being treated as errors Change type to mute errors. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* common-lib: Use wrapper for string to integer conversionSwen Schillig2019-03-012-7/+23
| | | | | | | | | | | | In order to detect an value overflow error during the string to integer conversion with strtoul/strtoull, the errno variable must be set to zero before the execution and checked after the conversion is performed. This is achieved by using the wrapper function strtoul_err and strtoull_err. Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Ralph Böhme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Cleanup references to module objects returned from PyImport_ImportModuleNoel Power2019-02-071-2/+8
| | | | | Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* PY3: change shebang to python3 in lib dirJoe Guo2018-12-141-1/+1
| | | | | Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Noel Power <npower@samba.org>
* lib/ldb-samba/tests: PY3 port samba4.ldap.match_rulesNoel Power2018-12-101-11/+11
| | | | | | | | | | | Various fixes a) schema_format_value can return bytes (esp. for objectSid, objectGUID b) embedded NULL now cause ValueError in py3 (was TypeError in py2) Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* ldb-samba/tests/match-rules: remove unused importsDouglas Bagnall2018-10-251-4/+0
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Noel Power <npower@samba.org>
* ldb tests: remove unused code from match_rules.pyDouglas Bagnall2018-08-241-3/+0
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* PEP8: fix E713: test for membership should be 'not in'Joe Guo2018-08-241-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>
* PEP8: fix E305: expected 2 blank lines after class or function definition, ↵Joe Guo2018-08-241-0/+1
| | | | | | | | found 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>
* PEP8: fix E303: too many blank lines (2)Joe Guo2018-08-241-1/+0
| | | | | | 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 E302: expected 2 blank lines, found 1Joe Guo2018-08-241-0/+3
| | | | | | 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 E226: missing whitespace around arithmetic operatorJoe Guo2018-08-241-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>
* PEP8: fix E202: whitespace before ')'Joe Guo2018-08-241-8/+8
| | | | | | 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 E128: continuation line under-indented for visual indentJoe Guo2018-08-241-154/+163
| | | | | | 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 E127: continuation line over-indented for visual indentJoe Guo2018-08-241-255/+255
| | | | | | 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 E101: indentation contains mixed spaces and tabsJoe Guo2018-08-241-37/+37
| | | | | | 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>
* dns: custom match rule for DNS records to be tombstonedAaron Haslett2018-07-122-1/+136
| | | | | | | | | | | | | A custom match rule for records to be tombstoned by the scavenging process. Needed because DNS records are a multi-valued attribute on name records, so without a custom match rule we'd have entire zones into memory to search for expired records. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10812 Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org>
* dns: Reformat DNS with clang-formatGary Lockyer2018-07-121-1/+1
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=10812 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* dsdb: add defines for sessionInfo and networkSessionInfoGary Lockyer2018-06-095-5/+15
| | | | | | | | | Replace uses of the string "sessionInfo" with the constant DSDB_SESSION_INFO, and "networkSessionInfo" with the constant DSDB_NETWORK_SESSION_INFO. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* ldb-samba: Handle generic mdb:// url scheme in ldb_relative_path()Gary Lockyer2018-05-231-0/+2
| | | | | | | Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* ldb: removing prior secret from logsAaron Haslett2018-05-121-1/+2
| | | | | | | | | | | | priorSecret, like secret, can contain a machine account password (for secrets.ldb) and so should not be printed in a debug trace. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13353 Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* ldb-samba: Handle generic ldb:// url scheme in ldb_relative_path()Gary Lockyer2018-05-031-0/+2
| | | | | | Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* ldb_wrap.c missing headerWilliam Brown2018-04-201-0/+1
| | | | | | | | | ldb_wrap.c was missing unistd.h causing implicit symbol declaration and error during compilation. Signed-off-by: William Brown <william@blackhats.net.au> Reviewed-by: Alexander Bokovoy <ab@samba.org> Reviewed-by: Simo Sorce <idra@samba.org>
* wscript_build: make sure we link extra-python versions of librariesNoel Power2018-04-131-1/+4
| | | | | | Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* ldb-samba: require pid match for cached ldbGary Lockyer2018-04-121-1/+6
| | | | | | Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* ldb_wrap: Remove the magic cache of database handles except for sam.ldbAndrew Bartlett2018-04-121-8/+7
| | | | | | | | | | sam.ldb is handled in samdb_connect_url(), not this function. This cache caused issues when "private dir" was changed in a testing script, but also just generates many-owner shared mutable state that is frowned upon these days. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* ldb_wrap: Remove ldb_transaction_cancel_noerr from ldb_wrap_fork_hook()Andrew Bartlett2018-04-121-12/+3
| | | | | | | | Writing to a TDB, without locks (these are per-process) in a forked child is never going to end well, if a transaction is open at this point we have bigger problems. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* ldb-samba: use ldap enum instead of ldb enumUri Simchoni2017-11-221-1/+1
| | | | | | | This silences a picky compiler warning. Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib: Give util_paths.c its own headerVolker Lendecke2017-06-241-0/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* ldb-samba: Fix a possible NULL pointer dereferenceAndreas Schneider2017-05-161-1/+3
| | | | | | | | | | | CID: #1402566 CID: #1402567 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue May 16 16:45:43 CEST 2017 on sn-devel-144
* s4: popt: Global replace of cmdline_credentials -> ↵Jeremy Allison2017-05-111-1/+2
| | | | | | | | | | | popt_get_cmdline_credentials(). Add one use of popt_set_cmdline_credentials(). Fix 80 column limits when cmdline_credentials changes to popt_get_cmdline_credentials(). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* python: samba._ldb: Port of samba._ldb to Python 3 compatible formLumir Balhar2017-03-102-11/+23
| | | | | | | | Port of samba._ldb Python module to Python 3 compatible form. Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* ldb-samba: remember the error string of a failing bind in ildb_connect()Stefan Metzmacher2017-03-031-0/+1
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=9048 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* ldb-samba: Add new extended match rule DSDB_MATCH_FOR_EXPUNGEAndrew Bartlett2016-09-012-1/+133
| | | | | | | | | | | This allows us to find links that need to be expunged without passing the whole DB up in the search response. While each message still needs to be examined, this code only has to do memory allocation for entries with links Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* lib/ldb-samba: Avoid talloc() in ldif_read_objectSid() by parsing the SID ↵Andrew Bartlett2016-07-281-15/+23
| | | | | | | string on the stack Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* lib/ldb-samba: Use ndr_push_struct_into_fixed_blob() in ldif_handlers.cAndrew Bartlett2016-07-281-2/+9
| | | | | | | | This avoids a number of pointless and pointlessly-large allocations in inner loops. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* match_rules: Make cleanup faster and more efficientGarming Sam2016-07-151-37/+2
| | | | | Signed-off-by: Garming Sam <garming@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* match_rules: Fix a duplicated checkGarming Sam2016-07-151-2/+2
| | | | | Signed-off-by: Garming Sam <garming@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib/ldb-samba: We can confirm a GUID is a GUID by lengthAndrew Bartlett2016-06-171-5/+3
| | | | | | | | | | The GUID_from_ndr_blob() is pointless and costly Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Jun 17 18:13:56 CEST 2016 on sn-devel-144
* ldb-samba: Add "secret" as a value to hide in LDIF filesAndrew Bartlett2016-05-111-1/+1
| | | | | | | | | | This is not secret or encrypted in LDAP, but is sensitive in secrets.ldb Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Autobuild-User(master): Garming Sam <garming@samba.org> Autobuild-Date(master): Wed May 11 07:17:38 CEST 2016 on sn-devel-144
* ldb-samba: Use ndr_pull_struct_blob_all_noallocAndrew Bartlett2016-05-031-10/+4
| | | | | | | | | | This avoids pointless talloc() calls in a hot code path. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Autobuild-User(master): Garming Sam <garming@samba.org> Autobuild-Date(master): Tue May 3 11:43:15 CEST 2016 on sn-devel-144