Bug 140068 - [smbfs] [patch] smbfs does not allow semicolon in filenames, but should
Summary: [smbfs] [patch] smbfs does not allow semicolon in filenames, but should
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: unspecified
Hardware: Any Any
: Normal Affects Some People
Assignee: Oleksandr Tymoshenko
URL:
Keywords: easy, needs-qa, patch
Depends on:
Blocks:
 
Reported: 2009-10-29 06:50 UTC by tom
Modified: 2019-02-11 08:53 UTC (History)
3 users (show)

See Also:
koobs: mfc-stable10?


Attachments
file.diff (455 bytes, patch)
2009-10-29 06:50 UTC, tom
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tom 2009-10-29 06:50:01 UTC
Semicolon (';') is a legal character in modern MS Windows filesystems (FAT32 & NTFS). it is allowed by Windows, Linux & Samba. But on FreeBSD using mount_smbfs, it is not possible to create a file or directory with a semicolon in the name.

Fix: delete ';' from badchars in sys/fs/smbfs/smbfs_vnops.c

Patch attached with submission follows:
How-To-Repeat: mount a windows or samba share. `% touch a\;1' or `% mkdir b\;1'
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2009-10-29 07:08:38 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2016-07-01 12:31:32 UTC
Can't be In Progress without an Assignee. Open to take
Comment 3 Andrey V. Elsukov freebsd_committer 2016-07-02 10:00:34 UTC
Looking in the Apple's smbfs sources we can find a bit more restrictions in the smbfs_pathcheck() functions. 
 https://opensource.apple.com/source/smb/smb-551/kernel/smbfs/smbfs_vnops.c

Also, it looks like our restricions doesn't have all characters according to Microsoft's documentation:
 https://msdn.microsoft.com/en-us/library/azure/dn167011.aspx
Comment 4 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2019-01-20 01:10:23 UTC
The semicolon was added to the list as part of base r159117. I don't think it's relevant to the CVE referenced in the commit log. Also judging from the Apple source code semicolon is valid for long names but not for 8.3 format. So proer fix would be to move it from badchars to badchars83 list.

Colin, do you remember why semicolon was added to the list in the first place?
Comment 5 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2019-01-20 01:11:15 UTC
Forgot to add cpercva@ to Cc. Colin, could you take a look at he question in my previous comment?

Thanks
Comment 6 Colin Percival freebsd_committer 2019-01-20 01:33:50 UTC
(In reply to Oleksandr Tymoshenko from comment #5)

Looks to me like that security patch just changed how '\' is handled.  The ';' character has been in the badchars list since smbfs was added to FreeBSD in 2001.
Comment 7 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2019-01-20 01:40:42 UTC
(In reply to Colin Percival from comment #6)

Yes, you're right, my bad. Sorry, I misread the patch.
Comment 8 commit-hook freebsd_committer 2019-01-20 05:53:08 UTC
A commit references this bug:

Author: gonzo
Date: Sun Jan 20 05:52:17 UTC 2019
New revision: 343209
URL: https://svnweb.freebsd.org/changeset/base/343209

Log:
  [smbfs] Allow semicolon in mounts that support long names

  Semicolon is a legal character in long names but not in 8.3 format.
  Move it to respective character set.

  PR:		140068
  Submitted by:	tom@uffner.com
  MFC after:	3 weeks

Changes:
  head/sys/fs/smbfs/smbfs_vnops.c
Comment 9 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2019-01-20 05:58:11 UTC
Patch has been committed. Thanks for submitting it.
Comment 10 commit-hook freebsd_committer 2019-02-11 08:53:20 UTC
A commit references this bug:

Author: gonzo
Date: Mon Feb 11 08:52:48 UTC 2019
New revision: 344000
URL: https://svnweb.freebsd.org/changeset/base/344000

Log:
  MFC r343209:

  [smbfs] Allow semicolon in mounts that support long names

  Semicolon is a legal character in long names but not in 8.3 format.
  Move it to respective character set.

  PR:		140068
  Submitted by:	tom@uffner.com

Changes:
_U  stable/12/
  stable/12/sys/fs/smbfs/smbfs_vnops.c