summaryrefslogtreecommitdiff
path: root/source3/lib/util_path.c
AgeCommit message (Collapse)AuthorFilesLines
2024-07-26s3/lib: move path_to_strv() to util_path.cRalph Boehme1-0/+11
More callers are coming. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2023-09-27s3:lib: Initialize ‘tm’ structureJoseph Sutton1-1/+1
‘tm’ must be initialized prior to calling strptime(). Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-12-16libsmb: Simplify clistr_is_previous_version_path()Volker Lendecke1-18/+2
Nobody looks at the out params anymore Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Fri Dec 16 08:42:18 UTC 2022 on sn-devel-184
2022-12-16s3: lib: Add new clistr_smb2_extract_snapshot_token() function.Jeremy Allison1-0/+5
Strips @GMT from client pathnames for SMB2 (uses '\\' separator). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2022-12-16s3: smbd: Make extract_snapshot_token() a wrapper for ↵Jeremy Allison1-2/+7
extract_snapshot_token_internal(). Allows us to pass in path separator from a new function without changing existing calling code. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2022-10-25CVE-2022-3592 lib: Move subdir_of() to source3/lib/util_path.cVolker Lendecke1-0/+50
Make it available for other components Bug: https://bugzilla.samba.org/show_bug.cgi?id=15207 Signed-off-by: Volker Lendecke <vl@samba.org>
2022-10-25CVE-2022-3592 lib: lib/util/fault.h requires _SAMBA_DEBUG_H for SMB_ASSERT()Volker Lendecke1-1/+1
fault.h has: which leads to SMB_ASSERT not being defined when you include samba_util.h (and thus fault.h) before debug.h. Bug: https://bugzilla.samba.org/show_bug.cgi?id=15207 Signed-off-by: Volker Lendecke <vl@samba.org>
2022-09-19libsmb: Use find_snapshot_token() for clistr_is_previous_version_path()Volker Lendecke1-0/+27
Dedup that string parsing logic 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): Mon Sep 19 18:21:56 UTC 2022 on sn-devel-184
2022-09-19lib: Add separator argument to find_snapshot_token()Volker Lendecke1-4/+5
We'll use the logic for \ based strings next Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-09-19lib: Move extract_snapshot_token() to util_path.cVolker Lendecke1-0/+72
Make it available to replace clistr_is_previous_version_path() in libsmb/ Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-07-25lib: Simplify canonicalize_absolute_path()Volker Lendecke1-12/+6
We don't need the separate "wrote_slash" boolean variable, we can just look at what we wrote into p[-1] Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-22s3: lib: Remove the old canonicalize_absolute_path().Jeremy Allison1-154/+0
This code was really hard to understand. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-22s3: util: Replace the old (hard to understand) canonicalize_absolute_path() ↵Jeremy Allison1-0/+113
with a version created from resolve_realpath_name() in vfs_widelinks.c This code is *much* more comprehensible and passes the stricter test set than the original (unfixed) canonicalize_absolute_path() out of the gate. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-22s3: lib: Fix canonicalize_absolute_path() to pass the tests from ↵Jeremy Allison1-1/+13
resolve_realpath_name() Remove the knownfail. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2019-11-27param: add FN_{GLOBAL,LOCAL}_SUBSTITUTED_STRING supportStefan Metzmacher1-0/+1
Pair-Programmed-With: Ralph Boehme <slow@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Ralph Boehme <slow@samba.org>
2018-08-17lib: Pass mem_ctx to cache_path()Volker Lendecke1-2/+2
Fix a confusing API: Many places TALLOC_FREE the path where it's not clear you have to do it. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Fri Aug 17 14:28:51 CEST 2018 on sn-devel-144
2018-08-17lib: Pass mem_ctx to state_path()Volker Lendecke1-2/+2
Fix a confusing API: Many places TALLOC_FREE the path where it's not clear you have to do it. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2018-08-17lib: Pass mem_ctx to lock_path()Volker Lendecke1-2/+2
Fix a confusing API: Many places TALLOC_FREE the path where it's not clear you have to do it. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2018-08-17lib: Pass "mem_ctx" down to xx_pathVolker Lendecke1-5/+7
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2018-03-01s3:lib: Add FALL_THROUGH statements in util_path.cAndreas Schneider1-4/+8
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-01-30s3: lib: Fix two old, old bugs in set_conn_connectpath(), now in ↵Jeremy Allison1-6/+12
canonicalize_absolute_path(). Canonicalizing a path of /foo/bar/../baz would return /foo/barbaz as moving forward 3 characters would delete the / character. Canonicalizing /foo/.. would end up as '\0'. Test to follow. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12531 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org>
2017-01-30s3: lib: Add canonicalize_absolute_path().Jeremy Allison1-0/+133
Resolves any invalid path components (.) (..) in an absolute POSIX path. We will be re-using this in several places. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12531 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org>
2015-12-14lib: Separate out xx_path() & callersVolker Lendecke1-0/+95
We should not have to #include proto.h just for cache_path() or so Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>