6
\\host.example.com\ShareName\Tail\Components
  |______________| |_______| |_____________|
        host         share        tail

I can find plenty of resources on the tail component of a UNC path, and I assume the host component follows DNS rules on case sensitivity, but what about the share name?

When you connect to just a host without specifying a share name the implementation you're connecting to can send you the correct case of the share. When you connect directly to a share how would case be handled?

I could only see a single line in the Samba manual stating "Section and parameter names are not case sensitive" which doesn't really say either way (section names are used to create shares but connection to that share could be handled differently). I can't see mention of case in Windows Shared Folders help.

Does this mean that share names are de facto case insensitive, and no one has ever thought to make it explicit, or can someone point me toward documentation?


Edit:

According to Microsoft's SMB2 specification:

The server MUST parse the Buffer field as specified in [MS-DTYP] section 2.2.49 to extract the hostname and sharename components. If the Buffer field is not in the format specified in section 2.2.9, the server MUST fail the request with STATUS_INVALID_PARAMETER. Otherwise, the server MUST provide the tuple <hostname, sharename> parsed from the request message to invoke the event specified in [MS-SRVS] section 3.1.6.8, to normalize the hostname by resolving server aliases and evaluating share scope. The server MUST use <normalized hostname, sharename> to look up the Share in ShareList. If no share with a matching share name and server name is found, the server MUST fail the request with STATUS_BAD_NETWORK_NAME.

So there is no normalisation of the share name, and I can find nothing which states a compliant implementation has to perform the matching case insensitively.

I am ideally looking for either some documentation or an answer from someone who's tested this on several implementations other than just Windows and Samba discussing their findings.

Samuel Harmer
  • 294
  • 3
  • 9
  • 1
    I happened to find http://doc.isilon.com/onefs/zzz_archive/cloudpools_staging/ifs_r_help_on_protocols_windows_sharing_smb_shares.html which says that share names are only case insensitive when configured for UTF-8, but it's unclear if this is part of the protocol or just a specific implementation. Either way, it's an example of potential case sensitivity in the wild. – LB-- Dec 23 '22 at 21:52

2 Answers2

1

The actual spec says that the server operator can choose whether or not to use case sensitivity for requests. Windows defaults to "IsCaseInsensitive=TRUE", but other implementations could choose differently.

https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/a64e55aa-1152-48e4-8206-edd96444e7f7

IsCaseInsensitive
TRUE
Windows-based SMB2 servers always handle path names as case-insensitive.

2.1.5.1 Server Requests an Open of a File

IsCaseInsensitive: A Boolean value. TRUE indicates that string comparisons performed in the context of this Open are case-insensitive; otherwise, they are case-sensitive.

mfinni
  • 36,144
  • 4
  • 53
  • 86
0

SMB share names are not case sensitive. You can confirm this by trying to create two shares with the same name and different case. The system will not allow this.

Greg Askew
  • 35,880
  • 5
  • 54
  • 82
  • On which implementations? – Samuel Harmer Sep 14 '16 at 12:25
  • 1
    On any implementation that wants to be compatible with the known universe. – Greg Askew Sep 14 '16 at 12:29
  • Your answer sounds like you're actually referring to a specific implementation; probably Windows. If you do what you've described in Samba it is actually quite legal: the configuration blocks are concatenated and the last definition wins for repeated options, but the share remains the case of the first section defined. I suppose I have posted on Server Fault rather than Stack Overflow, but I was really discussing what the protocol states. Obviously experience of an implementation is relevant and appreciated as I have witnessed what you have it seems. – Samuel Harmer Sep 14 '16 at 12:48
  • Just because some guy created his own implementation of a private protocol and made share names case sensitive has no implications for a standard, de facto or otherwise. 99.999% of all SMB implementations and consumers are Windows, and the reasonable expectation would be case-insensitive. The only reason to make it case-sensitive is to be incompatible/don't like people in general. – Greg Askew Sep 14 '16 at 13:16
  • 1
    "some guy created his own implementation of a private protocol and made share names case sensitive" -- 1) I did not say that, 2) he has not done that, 3) SMB2 protocol is clearly not private anymore, 4) there are many more implementations than just Samba. Please don't mistake what I'm saying to be argumentative, I am just stating facts as I've observed them. "the reasonable expectation would be case-insensitive" -- what is reasonable in one situation might not be in another, hence why protocols are documented. I'm searching for clarity regarding the protocol. – Samuel Harmer Sep 14 '16 at 14:14