From 9dfdad26a67d8bee893e23b1c9dbdc4ffc690e73 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 30 Mar 2009 15:09:10 -0700 Subject: [PATCH] Ensure files starting with multiple dots are hidden if "hide dot files" is set. Thanks to Barry Kelly for pointing this one out. Jeremy. (cherry picked from commit beeb86618e3af1478708d996b118856a4f9a0c0b) --- source/smbd/dosmode.c | 12 ++++++++---- 1 file 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; } } -- 2.11.4.GIT