summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-03-30 15:05:39 -0700
committerJeremy Allison <jra@samba.org>2009-03-30 15:05:39 -0700
commit9be2e2fdce9f0823f428afd492c066eb5e097f59 (patch)
tree0cc61eedd3d8905678ce4a4ad8cad21dcdefd6b7
parent5b33918947914f6d6805e6ac43436cac58388a59 (diff)
downloadsamba-9be2e2fdce9f0823f428afd492c066eb5e097f59.tar.gz
samba-9be2e2fdce9f0823f428afd492c066eb5e097f59.tar.bz2
samba-9be2e2fdce9f0823f428afd492c066eb5e097f59.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.
-rw-r--r--source3/smbd/dosmode.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index 555718bd83..5ae7151303 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -325,8 +325,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;
}
}
@@ -484,8 +486,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;
}
}