summaryrefslogtreecommitdiff
path: root/lib/util
AgeCommit message (Collapse)AuthorFilesLines
2026-03-25auth: Remove talloc_set_name_const() if talloc_keep_secret() changes the ↵Pavel Filipenský1-1/+0
talloc name Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> Autobuild-User(timing): Pavel Filipensky <pfilipensky@samba.org> Autobuild-Date(timing): Wed Mar 25 21:16:35 UTC 2026 on atb-devel-224
2026-03-25util/tests: Test that talloc_keep_secret() does not overwrite the namePavel Filipenský1-0/+20
Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
2026-03-25lib/util: Overwrite talloc name in talloc_keep_secret() only if it would ↵Pavel Filipenský1-1/+7
reveal memory content Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
2026-03-25util/tests: Extend the 'test_talloc_keep_secret' testPavel Filipenský1-0/+7
Test that talloc_strdup() puts the secret as talloc name. Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
2026-03-25Revert "lib/util: Avoid overwriting talloc chunk name in talloc_keep_secret()"Pavel Filipenský2-0/+5
This reverts commit 7e693b55730ceba2ef326286a0c68d5d91324a22. Without this commit, for memory allocated via e.g. talloc_strdup(), talloc name would reveal memory content. Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
2026-03-23lib:util: Remove is_aligned prototype from alignment.hGary Lockyer1-10/+0
is_aligned is now defined as static inline, so there's no need for the prototype Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Anoop C S <anoopcs@samba.org> Autobuild-User(master): Anoop C S <anoopcs@samba.org> Autobuild-Date(master): Mon Mar 23 08:23:50 UTC 2026 on atb-devel-224
2026-03-20lib:util add alignment utilitiesGary Lockyer1-0/+62
Add utilities to allow checking of pointer alignment. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Volker Lendecke <vl@samba.org>
2026-03-01lib: Remove the "getwd cache"Volker Lendecke2-2/+0
No longer needed Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-03-01torture: Use SINGLETON_CACHE_TALLOC in testsVolker Lendecke1-12/+12
GETWD_CACHE is on its way out. Despite not having _TALLOC in its name nor it being marked as talloc in memcache.h, memcache_is_talloc() shows it as being talloc'ed. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-20build: Move jansson detection and related options to lib/utilMartin Schwenke2-0/+33
This means that standalone builds (e.g. CTDB) can use it. The check for without JSON but with AD DC stays in the top-level wscript. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-15lib: Remove unused str_list_showVolker Lendecke2-21/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-15lib: Remove sys_fsusage()Volker Lendecke3-179/+0
"man statfs" on Linux says "Unless you need the f_type field, you should use the standard statvfs(3) interface instead.". We don't need f_type to get disk usage :-) We lose some of the older compatibility layers. Should these ever be needed again, we should add them to lib/util/statvfs.c an the single interface to retrieve file system usage info. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-15lib: Add statvfs2fsusageVolker Lendecke2-0/+32
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-15lib: Move statvfs.[ch] to lib/utilVolker Lendecke3-0/+316
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-15lib: Move conv_str_bool() to its only userVolker Lendecke2-34/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-15lib: Avoid an "else", we return in the if-branchVolker Lendecke1-4/+5
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-15lib: Remove very little used wrapper conv_str_u64()Volker Lendecke2-34/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-15lib: Clean up includes in util_strlist_v3.cVolker Lendecke1-3/+3
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-09util: Avoid signed/unsigned integer comparisonsMartin Schwenke1-3/+3
../../../lib/util/sys_rw.c: In function ‘sys_pread_full’: ../../../lib/util/sys_rw.c:219:25: warning: comparison of integer expressions of different signedness: ‘ssize_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare] 219 | if (ret > curr_count) { | ^ ../../../lib/util/sys_rw.c: In function ‘sys_pwrite_full’: ../../../lib/util/sys_rw.c:282:25: warning: comparison of integer expressions of different signedness: ‘ssize_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare] 282 | if (ret > curr_count) { | ^ ../../../lib/util/sys_rw.c: In function ‘sys_write_full’: ../../../lib/util/sys_rw.c:321:25: warning: comparison of integer expressions of different signedness: ‘ssize_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare] 321 | if (ret > curr_count) { | ^ Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Volker Lendecke <vl@samba.org>
2026-01-28lib:util:debug tests for JSON logging macrosGary Lockyer2-0/+291
Add unit tests for the new JSON debugging macros DBGJSON and DBGJSONC BUG: https://bugzilla.samba.org/show_bug.cgi?id=15898 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Volker Lendecke <vl@samba.org>
2026-01-28lib:util:debug Logging macros for JSON outputGary Lockyer2-0/+59
Add new debug macros for outputting JSON log lines BUG: https://bugzilla.samba.org/show_bug.cgi?id=15898 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Volker Lendecke <vl@samba.org>
2026-01-20lib: Delay get_iconv_handle() in strchr_m()Volker Lendecke1-1/+3
Do it the same way as in strrchr_m() Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Jan 20 12:56:27 UTC 2026 on atb-devel-224
2026-01-20lib: Remove extern const data_blob_nullVolker Lendecke2-3/+1
This actually saves some .text bytes in the code referencing this constant. The compiler should be smarter to do the right thing than to copy from a shared location. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-01-07lib: Remove unnecessary assignmentsVolker Lendecke1-2/+0
data_blob_free() already NULLs out its argument Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-01-07lib: Reduce indentationVolker Lendecke1-7/+12
Avoid a few "else" statements, review with "git show -w". Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-01-07lib: Add timespec_equal()Volker Lendecke2-0/+7
I've just gotten the !=0 vs ==0 wrong. Make comparing timespecs for equality more intuitive. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-01-07lib: Fix some whitespaceVolker Lendecke1-18/+18
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-12-08lib/util: Add tests for the new secure data_blob_..._s() functionsPavel Filipenský1-1/+56
Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-12-08lib/util: Fix trailing white spaces in tests/data_blob.cPavel Filipenský1-6/+6
Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-12-08lib/util: Avoid overwriting talloc chunk name in talloc_keep_secret()Pavel Filipenský2-5/+0
Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-12-08lib/util: Add data_blob_..._s() functions that call talloc_keep_secret()Pavel Filipenský1-0/+71
Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-12-08lib/util: Move talloc_keep_secret.c from samba-util to samba-util-corePavel Filipenský1-1/+2
Needed by future data_blob.h changes. ctdb uses data_blob and links only samba-util-core. Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-12-08lib/util: Set "PREDEFINED = DOXYGEN" in DoxyfilePavel Filipenský1-0/+1
that will set -DDOXYGEN and code inside #ifdef DOXYGEN is parsed Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-12-08lib/util: Change comments to Doxygen in data_blob.hPavel Filipenský1-9/+64
Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-12-08lib/util: Refactor data_blob.{h,c}Pavel Filipenský2-23/+15
Makes data_blob_talloc_zero() use __location__ of the real caller Signed-off-by: Pavel Filipenský <pfilipensky@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2025-11-12lib:util: Add APIs for fetch/store int64/uint64 values to/from tdbVinit Agnihotri2-0/+121
Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-11-11Replace memset_s() with memset_explicit()Andreas Schneider2-18/+17
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2025-11-10lib: Fix whitespaceVolker Lendecke1-6/+6
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-11-10lib: Add some const to bitmap functionsVolker Lendecke2-4/+4
The unusual use of const comes from bitmap_copy :-) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-11-10lib: Fix bitmap_talloc()'s parameter to unsignedVolker Lendecke2-2/+6
It does not make sense to allocate a negative number of bits Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-11-10lib: "boolean == true" looks strange :-)Volker Lendecke1-4/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-10-17Add missing include needed for cmocka.hAndreas Schneider1-0/+1
This will be required in future. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-09-28lib/util: Fix CID 1414760 - Resource leakShweta Sodani1-1/+5
If read is failed torture_assert could return without freeing the t. Fixing the leak. Signed-off-by: Shweta Sodani <ssodani@redhat.com> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Vinit Agnihotri <vagnihot@redhat.com> Reviewed-by: Anoop C S <anoopcs@samba.org> Autobuild-User(master): Anoop C S <anoopcs@samba.org> Autobuild-Date(master): Sun Sep 28 09:30:56 UTC 2025 on atb-devel-224
2025-09-10lib: Fix the build on FreeBSDVolker Lendecke1-0/+2
FreeBSD does not need crypt.h for crypt_r(). Patch from Peter Eriksson <pen@lysator.liu.se> via https://bugzilla.samba.org/show_bug.cgi?id=15897#c8 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-09-02lib: Remove unused interpret_string_addr_prefer_ipv4()Volker Lendecke2-24/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-09-02lib: Fix whitespaceVolker Lendecke1-2/+2
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-09-02lib: tevent_req_set_endtime() can failVolker Lendecke1-1/+4
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-09-01lib: Re-add dlclose(handle) when module initialization failedVolker Lendecke1-1/+3
Signed-off-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 Sep 1 17:04:27 UTC 2025 on atb-devel-224
2025-08-15lib: Make file_ploadv() staticVolker Lendecke2-6/+1
All callers want to see lines. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Fri Aug 15 11:53:56 UTC 2025 on atb-devel-224
2025-08-15lib: Move file_lines_ploadv() to lib/util/Volker Lendecke2-0/+27
Make it available to ctdb Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>