summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-03-30 15:09:10 -0700
committerKarolin Seeger <kseeger@samba.org>2009-03-31 10:46:30 +0200
commit1f832dcc9c1ef6b89b2580d85f32b7bd53413218 (patch)
tree8b3f5f56df550a849f47b36de1cfe806a0de650a
parentaa817cec0648130920daf082626eefb3a14f7440 (diff)
downloadsamba-1f832dcc9c1ef6b89b2580d85f32b7bd53413218.tar.gz
samba-1f832dcc9c1ef6b89b2580d85f32b7bd53413218.tar.xz
samba-1f832dcc9c1ef6b89b2580d85f32b7bd53413218.zip
Ensure files starting with multiple dots are hidden
if "hide dot files" is set. Thanks to Barry Kelly <bkelly.ie@gmail.com> for pointing this one out. Jeremy. (cherry picked from commit 5bdc16a867b9c14682b327c79f79834edcd6842d)
-rw-r--r--source/smbd/dosmode.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/smbd/dosmode.c b/source/smbd/dosmode.c
index 69100bf25ff..8a5a7b0d0e2 100644
--- a/source/smbd/dosmode.c
+++ b/source/smbd/dosmode.c
@@ -319,8 +319,10 @@ uint32 dos_mode_msdfs(connection_struct *conn, const char *path,SMB_STRUCT_STAT
} else {
p = path;
}
-
- if (p[0] == '.' && p[1] != '.' && p[1] != 0) {
+
+ /* Only . and .. are not hidden. */
+ if (p[0] == '.' && !((p[1] == '\0') ||
+ (p[1] == '.' && p[2] == '\0'))) {
result |= aHIDDEN;
}
}
@@ -371,8 +373,10 @@ uint32 dos_mode(connection_struct *conn, const char *path,SMB_STRUCT_STAT *sbuf)
} else {
p = path;
}
-
- if (p[0] == '.' && p[1] != '.' && p[1] != 0) {
+
+ /* Only . and .. are not hidden. */
+ if (p[0] == '.' && !((p[1] == '\0') ||
+ (p[1] == '.' && p[2] == '\0'))) {
result |= aHIDDEN;
}
}