aboutsummaryrefslogtreecommitdiff
path: root/include
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
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')
-rw-r--r--include/common.h2
-rw-r--r--include/fstree.h10
2 files changed, 10 insertions, 2 deletions
diff --git a/include/common.h b/include/common.h
index 8b2c66c..bdb3837 100644
--- a/include/common.h
+++ b/include/common.h
@@ -132,8 +132,6 @@ void sqfs_writer_cleanup(sqfs_writer_t *sqfs);
void sqfs_perror(const char *file, const char *action, int error_code);
-bool is_filename_sane(const char *name, bool check_os_specific);
-
/*
A wrapper around mkdir() that behaves like 'mkdir -p'. It tries to create
every component of the given path and skips already existing entries.
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 */