[cifs-protocol] rules for valid filenames in SMB and SMB2?

Hongwei Sun hongweis at microsoft.com
Sat Jul 12 03:11:08 GMT 2008


George,

   Thanks for the follow up questions to our response.   I have the following information for your questions.


1.        The MaximumComponentNameLength is for number of characters, not bytes.

2.        Windows file systems  always use 255 for  MaximumComponentNameLength.   But for  some other  file systems, MaximumComponentNameLength could  be  different values.

3.        Not for existing windows file systems.

4.        Yes,  we use MaximumComponentNameLength to determine if each element in the file path is too long.   Since it is always 255 for windows file systems,   we just used 255 directly in the statement  "Each element in the path must be no more than 255 characters"  to make it clearer to readers in my previous posting.


       I also want  to add to my previous posting regarding error behavior for invalid file name.

"If paths contain any elements larger than MaximumComponentNameLength, it fails with STATUS_INVALID_ OBJECT_NAME. "

      The update of the document using the information I posted  is in progress and we will post  the related section when it is finalized.

     Please let us know if you have further questions.

Hongwei Sun -MSFT









-----Original Message-----
From: George Colley [mailto:gcolley at apple.com]
Sent: Tuesday, July 01, 2008 11:10 AM
To: Hongwei Sun
Cc: tridge at samba.org; cifs-protocol at samba.org
Subject: Re: [cifs-protocol] rules for valid filenames in SMB and SMB2?





On Jul 1, 2008, at 8:34 AM, Hongwei Sun wrote:



> 2.       An SMB2 file name MUST conform to the following guidance:

>

> *         If the path beings with a separator character ('\'), the

> request MUST be failed with STATUS_INVALID_OBJECT_NAME.

> *         If the path contains multiple separator characters between

> elements, the request MUST be failed with STATUS_INVALID_OBJECT_NAME.

> *         Ending separator characters  are allowed.

> *         Each element in the path must be no more than 255

> characters.

>

>          The rules and error behaviors described above will be added

> to [MS-SMB] and [MS-SMB2].    We are finalizing the changes to the

> documents and will post them when  they are available.   Please

> don't hesitate to let us know if you think that more information is

> needed.

>

>

>





So I would like to clarify some things here. So when we make a

SMB2_Query_Info Request with a SMB2_0_INFO_FILESYSTEM infotype and

request a FileFsAttributeInformation Vista returns a

MaximumComponentNameLength value of 255.



The [MS-FSCC] doc says the following:

"MaximumComponentNameLength:  A 32-bit signed integer that contains

the maximum file

name component length, in bytes, supported by the specified file

system. The value of this

field MUST be greater than 0. "



So now for my questions:



1. Is the MaximumComponentNameLength bytes or characters (Looks like

characters)?

2. So if each element in the path must be no more than 255 characters,

then why do we need MaximumComponentNameLength?

3. Will MaximumComponentNameLength every be bigger than 255?

4. Seems to me MaximumComponentNameLength should determine the  max element in the

path not 255?





George




-------------- next part --------------
HTML attachment scrubbed and removed


More information about the cifs-protocol mailing list