summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* lib:crypto: Document samba_gnutls_arcfour_confounded_md5()Andreas Schneider2019-07-261-0/+18
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib:crypto: Document gnutls_error_to_werror()Andreas Schneider2019-07-261-0/+16
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib:crypto: Document gnutls_error_to_ntstatus()Andreas Schneider2019-07-261-0/+16
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib/addns: clang: Fix 'Assigned value is garbage or undefined'Noel Power2019-07-241-2/+4
| | | | | | | | | | | | | | Fixes: lib/addns/dnsquery.c:222:10: warning: Assigned value is garbage or undefined <--[clang] *numdcs = num_srvs; /* size_t->int */ ^ 1 warning generated. Also fixes the out param being modified even on failure Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* lib/addns: clang: Fix 'Value stored to 'err' is never read'Noel Power2019-07-241-4/+6
| | | | | | | | | | | | | | | Fixes: /home/samba/samba/lib/addns/dnsmarshall.c:406:2: warning: Value stored to 'err' is never read <--[clang] err = ERROR_DNS_NO_MEMORY; ^ ~~~~~~~~~~~~~~~~~~~ /home/samba/samba/lib/addns/dnsmarshall.c:447:3: warning: Value stored to 'err' is never read <--[clang] err = buf->error; ^ ~~~~~~~~~~ 2 warnings generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* lib/adnss: clang: Fix The left operand of '!=' is a garbage valueNoel Power2019-07-241-1/+1
| | | | | | | | | | | | Fixes: lib/addns/dnssock.c:143:3: warning: The left operand of '!=' is a garbage value <--[clang] TALLOC_FREE(conn); ^ 1 warning generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* talloc: Release talloc 2.3.0talloc-2.3.0Andrew Bartlett2019-07-224-2/+83
| | | | | | | | * add pytalloc_get_name() to safely access te talloc name in Python bindings * Use a new minor version to allow talloc updates in the 4.11 release stream Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz
* talloc/py_util: remove tautologically dead codeDouglas Bagnall2019-07-221-12/+0
| | | | | | | | | | | | Being careful is good and all, but if we don't trust the static PyTypeObject *type = NULL; two lines up, we need to reconsider our entire software universe. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* talloc: pytalloc_get_checked_type: survive non-talloc objectsDouglas Bagnall2019-07-221-1/+1
| | | | | | | | | If the python object is not a talloc object, we will end up with a NULL pointer. We weren't checking for that properly Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* talloc: add pytalloc_get_name() helperDouglas Bagnall2019-07-222-0/+13
| | | | | | | | | | | | | | | In several places we go talloc_get_name(pytalloc_get_ptr(py_obj)) which is a certain NULL derefernce if py_obj is not a talloc object. This is a helper function that chooses to say "non-talloc object" rather than crash. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib:tsocket: New function to build a tsocket_context from samba_addressSamuel Cabrero2019-07-222-0/+39
| | | | | Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:utils: New struct to fix strict aliasing issues with sockets APISamuel Cabrero2019-07-222-59/+60
| | | | | Signed-off-by: Samuel Cabrero <scabrero@suse.de> Reviewed-by: Andreas Schneider <asn@samba.org>
* lib:util: Use GnuTLS random number generator in genrand.cAndreas Schneider2019-07-183-32/+12
| | | | | | | | | | | FIPS requires that a random number generator from a certified crypto library is used. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Jul 18 01:30:20 UTC 2019 on sn-devel-184
* lib: Optimize file_compareVolker Lendecke2019-07-171-14/+41
| | | | | | | | | | | | | | | Triggered by two coverity false positives. Loading both files into talloc'ed memory seems inefficient to me. Rely on stdio to do proper buffering. This removes the restriction from ae95d611: "It is meant for small files". This is more lines, but to me it has less implicit complexity. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org> Autobuild-User(master): Uri Simchoni <uri@samba.org> Autobuild-Date(master): Wed Jul 17 12:45:51 UTC 2019 on sn-devel-184
* ldb ABI bump for pyldb_Ldb_AsLdbContext changeDouglas Bagnall2019-07-103-1/+287
| | | | | | | | Signed-off-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): Wed Jul 10 05:48:52 UTC 2019 on sn-devel-184
* pyldb: ldb.register_module() checks arguments a little bitDouglas Bagnall2019-07-101-3/+11
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* pyldb: remove ldb.open, which was never survivableDouglas Bagnall2019-07-101-4/+0
| | | | | | | | There was no way to call ldb.open without evoking signal 11, so it is unlikely anyone was using it. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* pyldb: rename pyldb_Dn_AsDn() to pyldb_Dn_AS_DN()Douglas Bagnall2019-07-103-19/+19
| | | | | | | | Following the python/C convention for checking vs non-checking convertors. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* pyldb: check for errors in PyLdb_GetPyType()Douglas Bagnall2019-07-101-3/+21
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* pyldb: fork pyldb_Ldb_AsLdbContext macro to reflect unsafenessDouglas Bagnall2019-07-103-46/+51
| | | | | | | | | | | | | | | | | | | In the Python/C API, conversion functions which check the types of their arguments have names like: double PyFloat_AsDouble(PyObject *pyfloat); while conversion macros that don't check have names like: PyFloat_AS_DOUBLE(pyfloat) The pyldb_Ldb_AsLdbContext() macro looks like one of the checking functions but it actually isn't. This has fooled us more than once. Here we fork the macro into two -- one which performs checks and keeps the camel case, and one with a shouty name that keeps the check-free behaviour. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* pyldb: add pyldb_check_type()Douglas Bagnall2019-07-102-0/+13
| | | | | | | This will be used by pyldb_Ldb_AsLdbContext(). Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* ldb: do not allow adding a DN as a base to itselfDouglas Bagnall2019-07-101-0/+4
| | | | | | | | | | | | | If you try to add a dn to itself, it expands as it goes. The resulting loop cannot end well. It looks like this in Python: dn = ldb.Dn(ldb.Ldb(), 'CN=y,DC=x') dn.add_base(dn) Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* lib:crypto: Add GNUTLS_FIPS140_SET_(LAX|STRICT)_MODE to helpersAndreas Schneider2019-07-091-0/+11
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14031 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib:crypto: Fix path to header file in gnutls_helpers.hAndreas Schneider2019-07-091-2/+2
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14031 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* docs/xml: change default for "mangled names" to "illegal"Ralph Boehme2019-07-081-1/+1
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* docs-xml: change "client min protocol" to SMB2_02Stefan Metzmacher2019-07-081-1/+1
| | | | | | | It's time to disable SMB1 by default... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* docs-xml: change "server min protocol" to SMB2_02Stefan Metzmacher2019-07-081-1/+1
| | | | | | | | SMB2_02 was available with Windows Vista. It's time to turn SMB1 off by default. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib/param: clang: Fix Value stored is never readNoel Power2019-07-081-5/+5
| | | | | | | | | | | Fixes: lib/param/loadparm.c:2164:2: warning: Value stored to 'bRetval' is never read <--[clang] bRetval = false; ^ ~~~~~ 1 warning generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* lib/util: clang: Fix 'Null pointer passed as an argument'Noel Power2019-07-081-1/+1
| | | | | | | | | | Fixes lib/util/iov_buf.c:50:4: warning: Null pointer passed as an argument to a 'nonnull' parameter <--[clang] memcpy(p, iov[i].iov_base, thislen); ^ 1 warning generated. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* param: change default of "allocation roundup size" to 0Björn Jacke2019-07-071-2/+0
| | | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
* util: Fix off-by-one error in message about overflowMartin Schwenke2019-07-051-8/+10
| | | | | | | | | | | | | | len includes space for the NUL character, so the calculation needs to take the NUL character into account. While touching this, drop unnecessary casts by updating format string and update to modern debug macro. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Jul 5 02:24:52 UTC 2019 on sn-devel-184
* util: Avoid localised underflowMartin Schwenke2019-07-051-6/+6
| | | | | | | | | | | | | | Avoid parenthesising an unsigned subtraction that can be negative and, therefore, underflow. There is no need for the parentheses and removing them results in an expression that is evaluated left-to-right and can not underflow. It isn't clear that the underflow matters. lp <= ls, so if (li - lp) underflows then ls + (li - lp) will always overflow. This should produce the correct answer. However, depending on this seems wrong. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* ldb: Release ldb 2.0.5ldb-2.0.5Gary Lockyer2019-07-043-1/+286
| | | | | | | | | | | | | | * add ldb_options_get add a function to get the options passed in ldb connect. * add "batch_mode" option. This options stops sub transactions being started for key value operations. It is intended to improve the performance in batch operations. As it bypasses the protections on operations if an operation fails, the entire transaction will be aborted by a commit. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* ldb: Rework index_transaction_cache_size to allow caller to specify a larger ↵Gary Lockyer2019-07-041-5/+11
| | | | | | | | | | size The previous code would override the caller with the DB size estimate rather than allowing the caller to force the bigger size. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* ldb ldb_key_value: test ldb batchGary Lockyer2019-07-041-0/+57
| | | | | | | Test the the ldb "batch_mode" option sets batch mode operation. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* ldb key_value: Add batch_mode optionGary Lockyer2019-07-042-0/+76
| | | | | | | | | | | | | | | | When performing a join the overhead of the sub transactions protecting key value operations becomes significant. This commit adds a new "batch_mode" option that disables the sub transactions around key value operations. The operation level index cache is also disabled, which means the overall transaction level index cache can become inconsistent if an operation fails. To protect against this and other possible on disk inconsistencies, if any operation fails during a batch_mode transaction the commit will fail and transaction will be rolled back. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* ldb: Add new internal helper function ldb_options_get()Gary Lockyer2019-07-042-0/+12
| | | | | | | This is needed for modules to access the ldb->options array, as this in in ldb_private.h Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* ldb: Fix dependency on ldb_key_value_sub_txn_{mdb_}testAndrew Bartlett2019-07-041-2/+2
| | | | | | | | ldb_tdb can be a module, but the test is actually looking for ltdb_err_map() in ldb_tdb_err_map. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* ldb: Try to explain the confusing overload of the LDB_FLG_MOD_* enumeration ↵Andrew Bartlett2019-07-041-7/+11
| | | | | | | | | | and other flags 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 Jul 4 03:51:58 UTC 2019 on sn-devel-184
* ldb: Add tests for Ldb.write_ldif() including the FLG_SHOW_BINARY and ↵Andrew Bartlett2019-07-041-0/+51
| | | | | | | FLAG_FORCE_NO_BASE64_LDIF Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* pyldb: Apply flags specified by ldb.Ldb(flags=...) even if the URL is not setAndrew Bartlett2019-07-041-0/+2
| | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* ldb/ldb_ldif: add LDB_FLAG_FORCE_NO_BASE64_LDIF flagBjörn Baumbach2019-07-043-0/+11
| | | | | | | Flag is used to enforce binary encoded attribute values per attribute. Signed-off-by: Björn Baumbach <bb@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* ldb/ldb_ldif: add copy_raw_bytes helper variable to ldb_ldif_write_trace()Björn Baumbach2019-07-041-1/+3
| | | | | Signed-off-by: Björn Baumbach <bb@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib: Fix return of server_id_db_prune_name()Volker Lendecke2019-07-031-1/+6
| | | | | | | | | | | | The tdb routines return 0/-1 and return the specific error via tdb_error(). server_id_db_prune_name() is expected to return an errno, not 0/-1. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Noel Power <npower@samba.org> Autobuild-User(master): Noel Power <npower@samba.org> Autobuild-Date(master): Wed Jul 3 10:51:32 UTC 2019 on sn-devel-184
* tdb: Adapt _tdb_transaction_cancel() to README.CodingVolker Lendecke2019-07-031-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Noel Power <npower@samba.org>
* tdb: Adapt tdb_rescue() to README.CodingVolker Lendecke2019-07-031-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Noel Power <npower@samba.org>
* lib/krb5_wrap: Fix leaking using mkstempNoel Power2019-07-031-2/+5
| | | | | | | | commit: 8b92539997a9df8e0d217790fd82fc8f59ea50cc introduced a leak by replacing mktemp with mkstemp (mkstemp returns an open fd) Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
* lib ldb ldb_mdb: Pass the lmdb map size as an ldb optionGary Lockyer2019-07-021-17/+39
| | | | | | | | Allow the lmdb map size to be specified in the ldb option "lmdb_env_size". Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* ldb: Release ldb 2.0.4Gary Lockyer2019-07-023-1/+285
| | | | | | | | | | | | | | | | | | | * copy the ldb_options passed to ldb_connect onto the ldb_context, making them more generally available. * fix index buffering. As a performance enhancement the indexes are cached in memory during a transaction, and written to disk as part of the prepare commit. The indexes could become corrupt in the event of a failed operation. * fix read beyond buffer Calling the "ldb_parse_tree" function with a filter consisting of exactly a single space (" ") would trigger a read beyond the input buffer. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13900 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib ldb: save a copy of the options on the contextGary Lockyer2019-07-023-0/+46
| | | | | | | | | Copy the options supplied to to ldb_connect, and place them on the ldb_context. This allows backend options i.e. lmbd map size to be passed cleanly from the callers. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>