summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2025-02-06talloc: version 2.4.3talloc-2.4.3Jule Anger3-1/+83
* Testsuite and documenation fixes * Add LGPLv3 LICENSE file Signed-off-by: Jule Anger <janger@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
2025-02-06tdb: version 1.4.13tdb-1.4.13Jule Anger2-1/+74
* Add LGPLv3 LICENSE file Signed-off-by: Jule Anger <janger@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
2025-02-06gpfswrap: Remove unused gpfs_set_winattrs_pathChristof Schmitt2-19/+0
Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-06gpfswrap: Remove unused gpfs_fstat_xChristof Schmitt2-16/+0
Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-06gpfswrap: Remove unused gpfs_stat_x wrapperChristof Schmitt2-16/+0
Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-02-05talloc: Add a comment explaining talloc_asprintf_addbuf()Volker Lendecke1-0/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2025-01-29lib/util: add dns_cmp() as it's own fileStefan Metzmacher3-0/+252
This is a copy of the function in source4/dsdb/common/util_trusts.c, which will be removed soon. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2025-01-23lib: factor out generate_random_str_list_buf()Volker Lendecke2-10/+30
No talloc required Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2025-01-21lib:replace: Don't use deprecated readline CPPFunction castAndreas Schneider1-1/+3
HAVE_RL_COMPLETION_FUNC_T was unused and not checking for the right function. libcli/smbreadline/smbreadline.c: In function ‘smb_readline’: libcli/smbreadline/smbreadline.c:139:17: warning: ‘CPPFunction’ is deprecated [-Wdeprecated-declarations] 139 | rl_attempted_completion_function = RL_COMPLETION_CAST completion_fn; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ libcli/smbreadline/smbreadline.c:139:50: error: assignment to ‘char ** (*)(const char *, int, int)’ from incompatible pointer type ‘char ** (*)(void)’ [-Wincompatible-pointer-types] 139 | rl_attempted_completion_function = RL_COMPLETION_CAST completion_fn; | ^ BUG: https://bugzilla.samba.org/show_bug.cgi?id=15788 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Tue Jan 21 19:38:37 UTC 2025 on atb-devel-224
2025-01-21lib:replace: Remove trailing spaces from readline.hAndreas Schneider1-3/+3
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15788 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2025-01-17lib:util: Fix stack-use-after-return in crypt_as_best_we_can()Andreas Schneider1-4/+12
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15784 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Pavel Filipenský <pfilipensky@samba.org> Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org> Autobuild-Date(master): Fri Jan 17 23:21:13 UTC 2025 on atb-devel-224
2025-01-13docs-xml/smbdotconf: add "client use krb5 netlogon" optionStefan Metzmacher3-0/+26
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
2025-01-07lib: add sys_write_full()Ralph Boehme2-0/+39
Basically a copy of sys_pwrite_full(), calling write() instead of pwrite(). Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2025-01-02include <grp.h> for setgroups in a few placesMichael Tokarev1-0/+3
setgroups(), unlike getgroups(), is not in <unistd.h> but in <grp.h>. Recent compilers require function declaration before using a function (or more and more distributions treat lack of declaration as error), so all configure-time tests fails with source3/lib/util_sec.c: source3/../lib/util/setid.c: In function 'samba_setgroups': source3/../lib/util/setid.c:244:16: error: implicit declaration of function \ 'setgroups'; did you mean 'getgroups'? [-Wimplicit-function-declaration] 244 | return setgroups(setlen, gidset); Add the missing include so configuration finds the existing system functions instead of failing. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Pavel Filipenský <pfilipensky@samba.org> Autobuild-User(master): Pavel Filipensky <pfilipensky@samba.org> Autobuild-Date(master): Thu Jan 2 17:58:50 UTC 2025 on atb-devel-224
2025-01-02remove usage of bzeroMichael Tokarev4-14/+1
bzero() function has been deprecated for a long time. In samba it is replaced with memset(). But samba also provides common memory-zeroing macros, like ZERO_STRUCT(). In all places where bzero() is used, it actually meant to zero a structure or an array. So replace these bzero() calls with ZERO_STRUCT() or ZERO_ARRAY() as appropriate, and remove bzero() replacement and testing entirely. While at it, also stop checking for presence of memset() - this function is standard for a very long time, and the only conditional where HAVE_MEMSET were used, was to provide replacement for bzero() - in all other places memset() is used unconditionally. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2025-01-02replace direct calls to memset_s() with commonly used macrosMichael Tokarev5-18/+5
samba provides macros for zeroing various structures in memory, and all code uses them instead of relying on memset_s(). However, a few places use memset_s() directly. Replace these usages with macros for consistency and to be able to replace memset_s() easier. A few notes. Commit 03a50d8f7d872b6ef701d12 "lib:util: Check memset_s() error code in talloc_keep_secret_destructor()" (Aug-2022) added a check for error return from memset_s(). This is the only place in whole codebase which bothers about doing this. But I've difficult time figuring out the intention. Was there a real case when this code path is actually executed? Commit 7658c9bf0a9c99e3f200571 "lib:crypto: Remove redundant array zeroing" (Nov-2023) removed the OTHER line from the two lines used to zero memory in here. Initially the code used both memset_s() *and* ZERO_ARRAY_LEN(), the former has been removed. This change removes the other - memset_s(), reintroducing ZERO_ARRAY_LEN(). Here however, it's probably better to use BURN_PTR instead of ZERO_ARRAY - in this place and a few lines above. Commit 8dddea2ceda40f2365bd6b1 "lib:talloc: Use memset_s() to avoid the call gets optimized out" (Feb-2024) is a recent commit which introduces memset_s(). However, it does not seem like it makes any difference whatsoever for a testsuite, or that it actually needs to clean up the memory to begin with. We've quite an assortment of all this memory zeroing stuff. Also it is repeated in replace.h and memory.h (two sets in these files are different but has big intersection). I'd say, to fix this mess, things from replace.h should be removed in favour of memory.h, and necessary includes added, but this is for the next time. We also have lots of direct usages of memset_s() in heimdal code. Cc: Joseph Sutton <josephsutton@catalyst.net.nz> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2025-01-02specify some deps on private libs actually used directlyMichael Tokarev2-3/+3
Lots of samba libraries has incomplete dependencies listed in wscript files. This usually is not a problem since the link line includes dependencies of their dependencies of their dependencies, and somewhere down that line all immediate dependencies which are missing are actually present. But sometimes this becomes a problem when a library does not declare direct dependency on at least one private library which it actually uses: in case no private library is listed as direct dependency, private library directory is not put into RUNPATH of the resulting binary, so the binary can not find its own dependencies. Fix a few such places, including some libraries which are a part of public abi (libsmbldap, libndr). Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2024-12-30ldb: fix Coverity 1636883Douglas Bagnall1-1/+1
oops. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Mon Dec 30 04:17:46 UTC 2024 on atb-devel-224
2024-12-20util:datablob: data_blob_pad checks its alignment assumptionDouglas Bagnall1-1/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15756 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 Dec 20 07:59:51 UTC 2024 on atb-devel-224
2024-12-20util: add a crypt strerror helperDouglas Bagnall2-0/+26
This will be used by Python also. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15756 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-20util: add a crypt wrapper, derived from dsdb:password_hashDouglas Bagnall3-0/+101
This is going to be used by the dsdb password_hash module, and exposed to Python via pyglue. We're doing this because Python 3.13 has dropped crypt from the Python standard library. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15756 Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-19ldb:dn_compare_base: avoid unlikely int overflowDouglas Bagnall1-5/+7
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-19ldb:dn_compare: be a bit more transitiveDouglas Bagnall1-5/+11
If neither dn can casefold, they should be considered equal. Otherwise cmp(dn1, dn2) will be inconsistent with cmp(dn2, dn1). These will still sort to the end of the list, relative to any valid DNs. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-19ldb:kv_cache: s/ltdb/ldb_kv/ in comments and messagesDouglas Bagnall1-4/+6
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-19ldb:kv: s/ltdb/ldb_kv/ in comments and messagesDouglas Bagnall1-7/+10
with some subsequent tidy-ups for style. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-19ldb:ldb_pack: filter avoids looping over msg when attrs contain "*"Douglas Bagnall1-9/+13
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-19ldb:dn_casefold_internal: TALLOC_FREE only what we tallocedDouglas Bagnall1-7/+13
If the failure is not on the last component, we would have TALLOC_FREE()ed some components that we hadn't set. I think in all pathways we initialise the unset components to zero, but we should be careful just in case. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-19ldb:tests: add tests ensuring indexes don't change search resultsDouglas Bagnall1-0/+478
The index code (lib/ldb_key_value/ldb_kv_index.c) recapitulates LDB expression logic, and it seemed less than completely obvious that it would never make a mistake and return a different result than an unindexed search. Here we run the same search on an unindexed database and on some that have been indexed with a variety of options. We assert that the results are identical over a number of searches. By default, when run from the command line, that number is 495161, which takes a couple of minutes. But if the SKIP_SLOW_TESTS environment variable is set, the number is 33569, which takes 20 seconds or so. In selftest we set the variable and run the smaller number. The tests will print the cumulative search time for each database for each testsuite, like this: $ python3 lib/ldb/tests/python/index_transparency.py ..........................................................[...] <class '__main__.SearchTest'> 25.78186821937561 <ldb connection tdb:///tmp/tmpf1x72x7l/tdb-indexed-dn.ldb> 17.73349642753601 <ldb connection tdb:///tmp/tmpf1x72x7l/tdb-half-indexed.ldb> 15.14864206314087 <ldb connection tdb:///tmp/tmpf1x72x7l/tdb-indexed-guid.ldb> 13.107165575027466 <ldb connection mdb:///tmp/tmpf1x72x7l/mdb-indexed.ldb> Like all benchmarks it is interesting but misleading. One caveat here is that you have (probably) compiled tdb in developer mode without optimisation, while lmdb is probably a system package compiled with -O2, though perhaps not tuned to your exact architecture. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-19lib:ldb-samba: use 'ldb' debug class more widelyDouglas Bagnall2-0/+6
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-12-12ldb: Add LGPLv3 LICENSE fileAndreas Schneider1-0/+165
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15729 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-12-12tdb: Add LGPLv3 LICENSE fileAndreas Schneider1-0/+165
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15729 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-12-12tevent: Add LGPLv3 LICENSE fileAndreas Schneider1-0/+165
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15729 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-12-12talloc: Add LGPLv3 LICENSE fileAndreas Schneider1-0/+165
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15729 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-12-02lib: Simplify smbconf_txt_load_file()Volker Lendecke1-4/+4
file_modtime() returns errno, so we can skip the racy file_exist() call. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-12-02lib: Move some R/W "data" segment to R/O "text"Volker Lendecke1-18/+18
Doesn't really matter for tests, but I just came across it. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-11-12lib: Simplify nybble_to_hex_*Volker Lendecke1-44/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-11-12ldb: User hexchars_upper from replace.hVolker Lendecke1-3/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-11-12libreplace: Introduce hexchars_{upper|lower}Volker Lendecke4-11/+14
We use that in quite a few places in our code. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-11-11lib/replace: memset_explicit() only takes three argumentsThomas Klausner1-1/+1
Signed-off-by: Thomas Klausner <wiz@gatalith.at> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Nov 11 16:47:46 UTC 2024 on atb-devel-224
2024-11-11param: Add "client netlogon ping protocol"Volker Lendecke2-0/+16
Allow "net ads join" in environments where UDP/389 is blocked. Code will follow. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-11-11param: Remove parameter "cldap port"Volker Lendecke1-1/+0
This was not used consistently across all of our code base, and I don't see a reason why this should ever not be port 389. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2024-11-11lib/util: Include grp.h for setgroups during autoconfSamuel Thibault1-0/+3
Otherwise setresuid and friends don't get detected on GNU/Hurd because the inclusion of <grp.h> is missing for the declaration of setgroups. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Nov 11 12:51:17 UTC 2024 on atb-devel-224
2024-11-08Describe implication of upstream ICU-22610Earl Chew1-0/+4
Add commentary to link commit 86c7688 (MR !3447) to the upstream fix for ICU-22610 in case there is subsequent breakage. Signed-off-by: Earl Chew <earl_chew@yahoo.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Nov 8 00:20:38 UTC 2024 on atb-devel-224
2024-11-06ldb:test:lmdb_free_list: s/the the/to the/ in commentDouglas Bagnall1-1/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-06util:charset: s/the the\b/the/ in commentsDouglas Bagnall1-1/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-06tevent docs: s/the the\b/the/Douglas Bagnall1-1/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-06pyldb: s/the the\b/the/ in commentsDouglas Bagnall1-1/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-06ldb:pack: s/the the/in the/ in commentsDouglas Bagnall1-2/+2
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-06lib/afs: s/the the\b/the/ in commentsDouglas Bagnall1-1/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-11-05smbd: add option "smb3 directory leases"Ralph Boehme1-0/+2
By default enabled on non-clustered Samba, disabled on clustered Samba, the reason being the expected additional load caused by forcing strict rename to be enabled. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>