summaryrefslogtreecommitdiff
path: root/src/path.h
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2014-12-16 18:53:55 -0600
committerEdward Thomson <ethomson@microsoft.com>2014-12-17 15:00:20 -0600
commit91fa31fb6f44919d5dcbaa157cfac9fb49dc44df (patch)
treec4e45bd3bb838e9aad31a12121d315faf8d90bd2 /src/path.h
parent0183c4d2590163f1ac2d813d84c33bdf1bb01f68 (diff)
downloadlibgit2-hf/libgit2sharp_020_patch.tar.gz
Introduce core.protectHFS and core.protectNTFShf/libgit2sharp_020_patch
Validate HFS ignored char ".git" paths when `core.protectHFS` is specified. Validate NTFS invalid ".git" paths when `core.protectNTFS` is specified.
Diffstat (limited to 'src/path.h')
-rw-r--r--src/path.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/path.h b/src/path.h
index 752f59bd3..c32f2173c 100644
--- a/src/path.h
+++ b/src/path.h
@@ -465,15 +465,20 @@ extern int git_path_from_url_or_path(git_buf *local_path_out, const char *url_or
/* Flags to determine path validity in `git_path_isvalid` */
#define GIT_PATH_REJECT_TRAVERSAL (1 << 0)
#define GIT_PATH_REJECT_DOT_GIT (1 << 1)
-#define GIT_PATH_REJECT_BACKSLASH (1 << 2)
-#define GIT_PATH_REJECT_TRAILING_DOT (1 << 3)
-#define GIT_PATH_REJECT_TRAILING_SPACE (1 << 4)
-#define GIT_PATH_REJECT_TRAILING_COLON (1 << 5)
-#define GIT_PATH_REJECT_DOS_GIT_SHORTNAME (1 << 6)
+#define GIT_PATH_REJECT_SLASH (1 << 2)
+#define GIT_PATH_REJECT_BACKSLASH (1 << 3)
+#define GIT_PATH_REJECT_TRAILING_DOT (1 << 4)
+#define GIT_PATH_REJECT_TRAILING_SPACE (1 << 5)
+#define GIT_PATH_REJECT_TRAILING_COLON (1 << 6)
#define GIT_PATH_REJECT_DOS_PATHS (1 << 7)
#define GIT_PATH_REJECT_NT_CHARS (1 << 8)
#define GIT_PATH_REJECT_DOT_GIT_HFS (1 << 9)
+#define GIT_PATH_REJECT_DOT_GIT_NTFS (1 << 10)
+/* Default path safety for writing files to disk: since we use the
+ * Win32 "File Namespace" APIs ("\\?\") we need to protect from
+ * paths that the normal Win32 APIs would not write.
+ */
#ifdef GIT_WIN32
# define GIT_PATH_REJECT_DEFAULTS \
GIT_PATH_REJECT_TRAVERSAL | \
@@ -481,13 +486,8 @@ extern int git_path_from_url_or_path(git_buf *local_path_out, const char *url_or
GIT_PATH_REJECT_TRAILING_DOT | \
GIT_PATH_REJECT_TRAILING_SPACE | \
GIT_PATH_REJECT_TRAILING_COLON | \
- GIT_PATH_REJECT_DOS_GIT_SHORTNAME | \
GIT_PATH_REJECT_DOS_PATHS | \
GIT_PATH_REJECT_NT_CHARS
-#elif __APPLE__
-# define GIT_PATH_REJECT_DEFAULTS \
- GIT_PATH_REJECT_TRAVERSAL | \
- GIT_PATH_REJECT_DOT_GIT_HFS
#else
# define GIT_PATH_REJECT_DEFAULTS GIT_PATH_REJECT_TRAVERSAL
#endif