aboutsummaryrefslogtreecommitdiff
path: root/include/fstree.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-12-18 16:35:19 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-12-18 16:48:03 +0100
commit6f96c4d2651ed59975354433267319d527490537 (patch)
tree8ba1e1d90146ab943725c42d1e24c708a1f93328 /include/fstree.h
parent2262af9f82d8a07751acea042844906649053a9f (diff)
Move is_filename_sane to libfstree, add test cases
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/fstree.h')
-rw-r--r--include/fstree.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/fstree.h b/include/fstree.h
index 7bc92fd..4ff8c5f 100644
--- a/include/fstree.h
+++ b/include/fstree.h
@@ -181,4 +181,14 @@ char *fstree_get_path(tree_node_t *node);
*/
int canonicalize_name(char *filename);
+/*
+ Returns true if a given filename is sane, false if it is not (e.g. contains
+ slashes or it is equal to '.' or '..').
+
+ If check_os_specific is true, this also checks if the filename contains
+ a character, or is equal to a name, that is black listed on the current OS.
+ E.g. on Windows, a file named "COM0" or "AUX" is a no-no.
+ */
+bool is_filename_sane(const char *name, bool check_os_specific);
+
#endif /* FSTREE_H */