Ensure files starting with multiple dots are hidden
authorJeremy Allison <jra@samba.org>
Mon, 30 Mar 2009 22:09:10 +0000 (15:09 -0700)
committerJeremy Allison <jra@samba.org>
Mon, 30 Mar 2009 22:10:22 +0000 (15:10 -0700)
if "hide dot files" is set. Thanks to Barry Kelly <bkelly.ie@gmail.com>
for pointing this one out.
Jeremy.

source/smbd/dosmode.c

index 69100bf25ffe10cd4f330b94965733bc68cf8b42..8a5a7b0d0e2cafca943cb0d3992f6b40ef8c5e49 100644 (file)
@@ -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;
                }
        }