summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* s4-dns: Deprecate BIND9_FLATFILE and remove "rndc command"Andrew Bartlett2019-08-221-1/+0
| | | | | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Thu Aug 22 21:24:00 UTC 2019 on sn-devel-184
* lib: free popt context in texpectSwen Schillig2019-08-221-5/+9
| | | | | | | | | | | If done with popt context it should be free'd. Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Thu Aug 22 01:41:37 UTC 2019 on sn-devel-184
* lib:crypto: Do not build AES-CMAC if we use GnuTLS that supports itAndreas Schneider2019-08-211-2/+4
| | | | | | | | | | This requires GnuTLS >= 3.6.5. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Wed Aug 21 11:14:11 UTC 2019 on sn-devel-184
* lib/crypto: Remove unused RC4 code from SambaAndrew Bartlett2019-08-213-119/+0
| | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* lib:crypto: Prepare not to build AES or AES-CMAC if we use GnuTLS support itAndreas Schneider2019-08-211-10/+42
| | | | | | | | | | | Samba will soon require GnuTLS >= 3.4.7. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Adjusted by Andrew Bartlett from an earlier more comprehensive patch by Andreas Signed-off-by: Andrew Bartlett <abartlet@samba.org>
* crypto: Update REQUIREMENTS file with new minimum versionAndrew Bartlett2019-08-211-2/+1
| | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* talloc: ASAN fix for test_magic_protectionSwen Schillig2019-08-211-0/+2
| | | | | | | | | | | | | | | | Direct leak of 1152 byte(s) in 1 object(s) allocated from: #0 0x7f06393dfc08 in __interceptor_malloc (/lib64/libasan.so.5+0xefc08) #1 0x7f06392cfd59 in __talloc_with_prefix ../../talloc.c:782 #2 0x7f06392cfd59 in _talloc_pool ../../talloc.c:837 #3 0x7f06392cfd59 in talloc_pool ../../talloc.c:859 #4 0x40b83c in test_magic_protection ../../testsuite.c:1960 #5 0x40b83c in torture_local_talloc ../../testsuite.c:2164 #6 0x402603 in main ../../testsuite_main.c:32 #7 0x7f063908a412 in __libc_start_main (/lib64/libc.so.6+0x24412) Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
* talloc: ASAN fix for test_rustySwen Schillig2019-08-211-1/+3
| | | | | | | | | | | | | | | | | Direct leak of 100 byte(s) in 1 object(s) allocated from: #0 0x7f06393dfc08 in __interceptor_malloc (/lib64/libasan.so.5+0xefc08) #1 0x7f06392d1af3 in __talloc_with_prefix ../../talloc.c:782 #2 0x7f06392d1af3 in __talloc ../../talloc.c:824 #3 0x7f06392d1af3 in __talloc_strlendup ../../talloc.c:2455 #4 0x7f06392d1af3 in talloc_strdup ../../talloc.c:2471 #5 0x40b4f0 in test_rusty ../../testsuite.c:1543 #6 0x40b4f0 in torture_local_talloc ../../testsuite.c:2146 #7 0x402603 in main ../../testsuite_main.c:32 #8 0x7f063908a412 in __libc_start_main (/lib64/libc.so.6+0x24412) Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
* talloc: ASAN fix for test_pool_nestSwen Schillig2019-08-211-0/+2
| | | | | | | | | | | | | | | | | Direct leak of 96 byte(s) in 1 object(s) allocated from: #0 0x7f06393dfc08 in __interceptor_malloc (/lib64/libasan.so.5+0xefc08) #1 0x7f06392d0c45 in __talloc_with_prefix ../../talloc.c:782 #2 0x7f06392d0c45 in __talloc ../../talloc.c:824 #3 0x7f06392d0c45 in _talloc_named_const ../../talloc.c:981 #4 0x7f06392d0c45 in talloc_named_const ../../talloc.c:1748 #5 0x40901e in test_pool_nest ../../testsuite.c:1451 #6 0x40901e in torture_local_talloc ../../testsuite.c:2096 #7 0x402603 in main ../../testsuite_main.c:32 #8 0x7f063908a412 in __libc_start_main (/lib64/libc.so.6+0x24412) Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
* talloc: ASAN fix for test_talloc_free_in_destructorSwen Schillig2019-08-211-0/+2
| | | | | | | | | | | | | | | | | Indirect leak of 104 byte(s) in 1 object(s) allocated from: #0 0x7f06393dfc08 in __interceptor_malloc (/lib64/libasan.so.5+0xefc08) #1 0x7f06392d0c45 in __talloc_with_prefix ../../talloc.c:782 #2 0x7f06392d0c45 in __talloc ../../talloc.c:824 #3 0x7f06392d0c45 in _talloc_named_const ../../talloc.c:981 #4 0x7f06392d0c45 in talloc_named_const ../../talloc.c:1748 #5 0x409edd in test_talloc_free_in_destructor ../../testsuite.c:1256 #6 0x409edd in torture_local_talloc ../../testsuite.c:2138 #7 0x402603 in main ../../testsuite_main.c:32 #8 0x7f063908a412 in __libc_start_main (/lib64/libc.so.6+0x24412) Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
* talloc: ASAN fix for test_realloc_on_destructor_parentSwen Schillig2019-08-211-0/+2
| | | | | | | | | | | | | | | | | Direct leak of 96 byte(s) in 1 object(s) allocated from: #0 0x7fd52c00dc08 in __interceptor_malloc (/lib64/libasan.so.5+0xefc08) #1 0x7fd52befec45 in __talloc_with_prefix ../../talloc.c:782 #2 0x7fd52befec45 in __talloc ../../talloc.c:824 #3 0x7fd52befec45 in _talloc_named_const ../../talloc.c:981 #4 0x7fd52befec45 in talloc_named_const ../../talloc.c:1748 #5 0x4099bd in test_realloc_on_destructor_parent ../../testsuite.c:1000 #6 0x4099bd in torture_local_talloc ../../testsuite.c:2129 #7 0x402603 in main ../../testsuite_main.c:32 #8 0x7fd52bcb8412 in __libc_start_main (/lib64/libc.so.6+0x24412) Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
* tdb: Release tdb 1.4.2tdb-1.4.2Stefan Metzmacher2019-08-202-1/+74
| | | | | | | | | | | * Build fixes * Improve the performance by inlining the tdb_oob() checks Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Tue Aug 20 14:45:41 UTC 2019 on sn-devel-184
* ldb: Free memory when repacking databaseTim Beale2019-08-201-0/+1
| | | | | | | | | | | | | | | | | The msg for each database record is allocated on the module context, but never freed. The module seems like it could be a long-running context (as the database would normally get repacked by the samba executable). Even if it's not a proper leak, it shouldn't hurt to cleanup the memory. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-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 Aug 20 04:57:10 UTC 2019 on sn-devel-184
* ldb: Log the partition we're repackingTim Beale2019-08-201-2/+4
| | | | | | | | | | | | | | | | | | | | | | | Firstly, with Samba AD this looks a little weird because we log the same message 5 times (once for every partition). If we log that we're doing this to records in different partitions, hopefully someone with a little Samba knowledge can figure out what's going on. Secondly, the info about what partitions are actually changing might be useful. E.g. if we hit a fatal error repacking the 3rd partition, and the transaction doesn't abort properly, then it would be useful to know what partitions were repacked and which ones weren't. There doesn't appear to be a useful name for the partition (ldb_kv->kv_ops->name() doesn't seem any more intelligible to a user), so just log the first record that we update. We can use that to infer the partition database). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* ldb: Log pack format in user-friendly wayTim Beale2019-08-201-2/+15
| | | | | | | | | | | | The "format 0x26011968" log confused me (and I'm a developer). We can subtract the base offset from the pack format to get a more user-friendly number, e.g. v0 (not actually used), v1, v2, etc. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* ldb: Change pack format defines to enumTim Beale2019-08-201-5/+8
| | | | | | | | | | | The main reason is so that any future pack formats will continue incrementing this number in a sequential fashion. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* ldb: Move where we update the pack format versionTim Beale2019-08-203-2/+4
| | | | | | | | | | | | | | | | Store it on the repack context so that we can log a more informative message "Repacking from format x to format y". While this is not really a big deal currently, it could be worth recording for potential future scenarios (i.e. supporting three or more pack versions), where upgrades could potentially skip an intermediary pack format version. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* ldb: Always log when the database pack format changesTim Beale2019-08-202-1/+4
| | | | | | | | | | | | | | | LDB_DEBUG_WARNING gets logged by Samba as level 2, whereas the default log level for Samba is 0. It's not really fair to the user to change the format of their database on disk and potentially not tell them. This patch adds a log with level zero (using a alias define, as this technically isn't a fatal problem). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* lib: Remove a duplicate function prototypeVolker Lendecke2019-08-191-5/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
* lib: Micro-optimization for db_tdb_do_locked()Volker Lendecke2019-08-191-2/+2
| | | | | | | We don't need the tdb lock for the talloc_free(buf) anymore Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
* lib:util: Use generate_secret_buffer() for long term passwordsAndreas Schneider2019-08-141-3/+3
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
* lib:util: Fix documentation for random number functionsAndreas Schneider2019-08-142-4/+13
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
* lib: CID 1452289: API usage errors (USE_AFTER_FREE)Volker Lendecke2019-08-141-1/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib:util: Add better documentation for generate_secret_buffer()Andreas Schneider2019-08-122-6/+17
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib:util: Add generate_nonce_buffer()Andreas Schneider2019-08-122-2/+21
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* ldb: Fix mem-leak if talloc_realloc failsSwen Schillig2019-08-101-5/+10
| | | | | | | | | | | In case of a failing talloc_realloc(), the only reference to the originally allocated memory is overwritten. Instead use a temp var until success is verified. Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Christof Schmitt <cs@samba.org> Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib:torture: add torture_assert_u32_[not_]equal[_goto] macrosRalph Boehme2019-08-081-0/+48
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:mdssvc: add noindex backendRalph Boehme2019-08-083-1/+3
| | | | | | | | | | | | | | Add a new default backend that, while allowing mdsvc RPC and search queries from clients, always returns no results. Shares using this backend will behave the same way as shares on a macOS SMB server where indexing is disabled. This change will later also allow us to compile the Spotlight RPC service by default which is a big step in the direction of adding tests to CI. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:mdssvc: new option "spotlight backend"Ralph Boehme2019-08-083-0/+12
| | | | | | | | Currently there's only the tracker backend, but subsequent commits will add other backends. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tfork: Free memory in torture test to satisfy sanitizerSwen Schillig2019-08-081-0/+3
| | | | | | | | | Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Thu Aug 8 11:33:32 UTC 2019 on sn-devel-184
* util: Free memory in charset torture test to satisfy sanitizerSwen Schillig2019-08-081-0/+10
| | | | | | Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
* util: Free memory in genrand torture test to satisfy sanitizerSwen Schillig2019-08-081-0/+2
| | | | | | Signed-off-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
* charset: add tests for Unicode NFC <-> NFD conversionRalph Boehme2019-08-071-0/+228
| | | | | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed Aug 7 07:25:39 UTC 2019 on sn-devel-184
* charset: add support for Unicode normalisation with libicuRalph Boehme2019-08-073-1/+178
| | | | | | | | | | | | | | This adds a direct conversion hook using libicu to perform NFC <-> NFD conversion on UTF8 strings. The defined charset strings are "UTF8-NFC" and "UTF8-NFD", to convert from one to the other the caller calls smb_iconv_open() with the desired source and target charsets, eg smb_iconv_open("UTF8-NFD", "UTF8-NFC"); for converting from NFC to NFD. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* torture: add torture_assert_errno_equal_goto()Ralph Boehme2019-08-071-0/+12
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* Add fuzzing binary for oLschema2ldifMichael Hanselmann2019-08-072-0/+59
| | | | | | | | | Use the oLschema2ldif library functions introduced in commit 0c7c44a284a26790081c000f5b8f4ed32f9f21d7 to implement a fuzzing utility. Signed-off-by: Michael Hanselmann <public@hansmi.ch> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* Add fuzzing binary for tiniparserMichael Hanselmann2019-08-074-7/+63
| | | | | | | | | | | The "tiniparser_load" function is made into a wrapper for the newly added "tiniparser_load_stream" function which accepts a FILE pointer. This way no actual files have to be opened for fuzzing (memfd_create(2) isn't readily available on all systems yet). Signed-off-by: Michael Hanselmann <public@hansmi.ch> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* Add fuzzing support to build systemMichael Hanselmann2019-08-074-0/+93
| | | | | | | | | | | | | LibFuzzer, Honggfuzz and other programs implement simple interfaces for fuzzing appropriately prepared code. Samba contains quite a lot of parsing code, often a good target for fuzzing. With this change the build system is amended to support building fuzzing binaries (added in later changes). Signed-off-by: Michael Hanselmann <public@hansmi.ch> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* tdb: Inline the common part of tdb_oobVolker Lendecke2019-08-062-9/+15
| | | | | | | | | | | | | | When you set in tdbtorture.c to make it more similar to locking.tdb use, bin/tdbtorture -m -n 1 -l 100000 -s becomes twice as fast. This is a pretty extreme case, but all other tests that I did improve significantly as well. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tdb: Speed up tdb_oob()Volker Lendecke2019-08-062-1/+17
| | | | | | | | This is common between both implementations of tdb_oob(). It's faster if we don't have to dereference function pointers. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tdb: Introduce tdb_oob()Volker Lendecke2019-08-068-20/+26
| | | | | | | Initially just encapsulate the pointer dereferences Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* tdb: Rename tdb_oob() to tdb_notrans_oob()Volker Lendecke2019-08-062-4/+4
| | | | | | | | tdb_oob() will become a public function encapsulating the pointer dereferences. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* ldb_dn: free dn components on explode failureDouglas Bagnall2019-08-061-1/+1
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Noel Power <npower@samba.org>
* ldb: skip indexes on full_searchAaron Haslett2019-08-021-1/+28
| | | | | | | | | | | | | | Use iterate_range kv op to skip the index section of the database when running a full search. Quick local testing showed 18% improved throughput on a full search with no results on a 50k database. With more results, improvement is smaller but still noticeable. Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Reviewed-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 Aug 2 02:29:42 UTC 2019 on sn-devel-184
* lib:crypto: Don't build RC4 if we have GnuTLS >= 3.4.7Andreas Schneider2019-07-261-5/+20
| | | | | | | | | | | We have a GnuTLS DCEPRC backupkey implementation for the server and the test. However this is only working with GnuTLS >= 3.4.7. So we need to keep this around till we can require at least GnuTLS in a newer version. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14031 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib:crypto: Remove arcfour.h from crypto.hAndreas Schneider2019-07-261-1/+0
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14031 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib:crypto: Use GnuTLS RC4 in py_cryptoAndreas Schneider2019-07-262-9/+32
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14031 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* 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>