Barry Kelly
2009-Mar-25 13:45 UTC
[Samba] Dotfiles with multiple dots not marked as hidden
I have "hide dot files" on, but I have noticed that while files with a single dot are hidden, files with multiple dots are not: ".foo" - hidden "...foo" - not hidden Is this by design? *nix certainly hide such files by default... -- Barry -- http://barrkel.blogspot.com/
Jeremy Allison
2009-Mar-25 16:57 UTC
[Samba] Dotfiles with multiple dots not marked as hidden
On Wed, Mar 25, 2009 at 01:45:44PM +0000, Barry Kelly wrote:> I have "hide dot files" on, but I have noticed that while files with a > single dot are hidden, files with multiple dots are not: > > ".foo" - hidden > "...foo" - not hidden > > Is this by design? *nix certainly hide such files by default...No, it's a bug. The ..foo files are getting matched by the logic to avoid making .. directories hidden. Should be a quick fix... Jeremy.
Jeremy Allison
2009-Mar-30 22:05 UTC
[Samba] Dotfiles with multiple dots not marked as hidden
On Wed, Mar 25, 2009 at 01:45:44PM +0000, Barry Kelly wrote:> I have "hide dot files" on, but I have noticed that while files with a > single dot are hidden, files with multiple dots are not: > > ".foo" - hidden > "...foo" - not hidden > > Is this by design? *nix certainly hide such files by default... >Here's the fix ! Thanks, Jeremy. -------------- next part -------------- diff --git a/source/smbd/dosmode.c b/source/smbd/dosmode.c index 69100bf..8a5a7b0 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; } }