summaryrefslogtreecommitdiff
path: root/lib/util/util_paths.c
Commit message (Collapse)AuthorAgeFilesLines
* lib: Remove a few #include "includes.h"Volker Lendecke2022-07-251-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: On FreeBSD util_paths.c does not find struct statVolker Lendecke2022-07-241-0/+1
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sun Jul 24 00:25:49 UTC 2022 on sn-devel-184
* s3: lib: Fix missing TALLOC_FREE in error code path.Jeremy Allison2020-07-141-1/+1
| | | | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14441 Reported by Alexander Pyhalov <apyhalov@gmail.com> Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Tue Jul 14 07:42:54 UTC 2020 on sn-devel-184
* util: Reallocate larger buffer if getpwuid_r() returns ERANGEMartin Schwenke2020-06-091-0/+13
| | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Tue Jun 9 21:07:24 UTC 2020 on sn-devel-184
* util: Fix build on FreeBSD by avoiding NSS_BUFLEN_PASSWDMartin Schwenke2020-06-091-5/+22
| | | | | | | | | | | NSS_BUFLEN_PASSWD is not defined on FreeBSD. Use sysconf(_SC_GETPW_R_SIZE_MAX) instead, as per POSIX. Use a dynamically allocated buffer instead of trying to cram all of the logic into the declarations. This will come in useful later anyway. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
* util: Simplify input validationMartin Schwenke2020-06-091-5/+4
| | | | | | | | | | | | It appears that snprintf(3) is being used for input validation. However, this seems like overkill because it causes szPath to be copied an extra time. The mostly likely protections being sought here, according to https://cwe.mitre.org/data/definitions/20.html, look to be DoS attacks involving CPU and memory usage. A simpler check that uses strnlen(3) can mitigate against both of these and is simpler. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3: lib: Paranoia around use of snprintf copying into a fixed-size buffer ↵Jeremy Allison2020-05-181-2/+6
| | | | | | | | | | | | from a getenv() pointer. Post checks for overflow/error. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Mon May 18 23:42:57 UTC 2020 on sn-devel-184
* lib:util: Add path_expand_tilde()Andreas Schneider2020-05-151-0/+72
| | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14370 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@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>
* lib/util use modules_path(), data_path() and shlib_ext() from source3Andrew Bartlett2011-06-061-0/+63
This brings these helpful utility functions in common, as they are not based on either loadparm system. (The 'modules dir' parameter from Samba4 will shortly be removed, so there is no loss in functionality) Andrew Bartlett