diff mbox

[2/2] cifs: Correct comment about domainname length

Message ID 1374777285-25639-2-git-send-email-scott.lovenberg@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Scott Lovenberg July 25, 2013, 6:34 p.m. UTC
From: Scott Lovenberg <scott.lovenberg@gmail.com>

CIFS_MAX_DOMAINNAME_LEN is the max length for a domain name, not a fully qualified domain name.

Signed-off-by: Scott Lovenberg <scott.lovenberg@gmail.com>
---
 include/uapi/linux/cifs/cifs_mount.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chen Gang July 26, 2013, 12:40 a.m. UTC | #1
On 07/26/2013 02:34 AM, scott.lovenberg@gmail.com wrote:
> From: Scott Lovenberg <scott.lovenberg@gmail.com>
> 
> CIFS_MAX_DOMAINNAME_LEN is the max length for a domain name, not a fully qualified domain name.
> 
> Signed-off-by: Scott Lovenberg <scott.lovenberg@gmail.com>
> ---
>  include/uapi/linux/cifs/cifs_mount.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/cifs/cifs_mount.h b/include/uapi/linux/cifs/cifs_mount.h
> index a58fc6e..d2408ec 100644
> --- a/include/uapi/linux/cifs/cifs_mount.h
> +++ b/include/uapi/linux/cifs/cifs_mount.h
> @@ -17,7 +17,7 @@
>  #define _CIFS_MOUNT_H
>  
>  /* Max string lengths for cifs mounting options. */
> -#define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */
> +#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
>  #define CIFS_MAX_USERNAME_LEN   256 /* reasonable max for current servers */
>  #define CIFS_MAX_PASSWORD_LEN   512 /* Windows max seems to be 256 wide chars */
>  #define CIFS_MAX_SHARE_LEN      256 /* reasonable max share name length */
> 

For our kernel implementation:

  for 'CIFS_MAX_DOMAINNAME_LEN', it counts 255 + '\0',
  for 'CIFS_MAX_USERNAME_LEN', it counts 256 (may add additional '\0'),

And original mail said about 'CIFS_MAX_DOMAINNAME_LEN':

  "The maximum length of ... the fully qualified domain name (FQDN) is
  63 octets per label and 255 bytes per FQDN. This maximum includes 254
  bytes for the FQDN and one byte for the ending dot."

And excuse me, I do not know what 'CIFS_MAX_USERNAME_LEN' should be.

Do we also need consider about it in our definition comments ?


Thanks.
Scott Lovenberg July 26, 2013, 6:12 p.m. UTC | #2
On Thu, Jul 25, 2013 at 8:40 PM, Chen Gang <gang.chen@asianux.com> wrote:
> On 07/26/2013 02:34 AM, scott.lovenberg@gmail.com wrote:
>> From: Scott Lovenberg <scott.lovenberg@gmail.com>
>>
>> CIFS_MAX_DOMAINNAME_LEN is the max length for a domain name, not a fully qualified domain name.
>>
>> Signed-off-by: Scott Lovenberg <scott.lovenberg@gmail.com>
>> ---
>>  include/uapi/linux/cifs/cifs_mount.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/uapi/linux/cifs/cifs_mount.h b/include/uapi/linux/cifs/cifs_mount.h
>> index a58fc6e..d2408ec 100644
>> --- a/include/uapi/linux/cifs/cifs_mount.h
>> +++ b/include/uapi/linux/cifs/cifs_mount.h
>> @@ -17,7 +17,7 @@
>>  #define _CIFS_MOUNT_H
>>
>>  /* Max string lengths for cifs mounting options. */
>> -#define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */
>> +#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
>>  #define CIFS_MAX_USERNAME_LEN   256 /* reasonable max for current servers */
>>  #define CIFS_MAX_PASSWORD_LEN   512 /* Windows max seems to be 256 wide chars */
>>  #define CIFS_MAX_SHARE_LEN      256 /* reasonable max share name length */
>>
>
> For our kernel implementation:
>
>   for 'CIFS_MAX_DOMAINNAME_LEN', it counts 255 + '\0',
>   for 'CIFS_MAX_USERNAME_LEN', it counts 256 (may add additional '\0'),
>
> And original mail said about 'CIFS_MAX_DOMAINNAME_LEN':
>
>   "The maximum length of ... the fully qualified domain name (FQDN) is
>   63 octets per label and 255 bytes per FQDN. This maximum includes 254
>   bytes for the FQDN and one byte for the ending dot."
>
> And excuse me, I do not know what 'CIFS_MAX_USERNAME_LEN' should be.
>
> Do we also need consider about it in our definition comments ?
>
>
> Thanks.
> --
> Chen Gang

Sorry, I misunderstood; I figured that it had to be the domain name
without the host since we were allowing a host name that's 1024
characters long.  That documentation should probably be added to the
cifs_mount.h as well then.

Still, how can we have a FQDN that's 256 characters long when the host
name length can be 1024 characters long?
Chen Gang July 29, 2013, 12:27 a.m. UTC | #3
On 07/27/2013 02:12 AM, Scott Lovenberg wrote:
> On Thu, Jul 25, 2013 at 8:40 PM, Chen Gang <gang.chen@asianux.com> wrote:
>> On 07/26/2013 02:34 AM, scott.lovenberg@gmail.com wrote:
>>> From: Scott Lovenberg <scott.lovenberg@gmail.com>
>>>
>>> CIFS_MAX_DOMAINNAME_LEN is the max length for a domain name, not a fully qualified domain name.
>>>
>>> Signed-off-by: Scott Lovenberg <scott.lovenberg@gmail.com>
>>> ---
>>>  include/uapi/linux/cifs/cifs_mount.h | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/include/uapi/linux/cifs/cifs_mount.h b/include/uapi/linux/cifs/cifs_mount.h
>>> index a58fc6e..d2408ec 100644
>>> --- a/include/uapi/linux/cifs/cifs_mount.h
>>> +++ b/include/uapi/linux/cifs/cifs_mount.h
>>> @@ -17,7 +17,7 @@
>>>  #define _CIFS_MOUNT_H
>>>
>>>  /* Max string lengths for cifs mounting options. */
>>> -#define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */
>>> +#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
>>>  #define CIFS_MAX_USERNAME_LEN   256 /* reasonable max for current servers */
>>>  #define CIFS_MAX_PASSWORD_LEN   512 /* Windows max seems to be 256 wide chars */
>>>  #define CIFS_MAX_SHARE_LEN      256 /* reasonable max share name length */
>>>
>>
>> For our kernel implementation:
>>
>>   for 'CIFS_MAX_DOMAINNAME_LEN', it counts 255 + '\0',
>>   for 'CIFS_MAX_USERNAME_LEN', it counts 256 (may add additional '\0'),
>>
>> And original mail said about 'CIFS_MAX_DOMAINNAME_LEN':
>>
>>   "The maximum length of ... the fully qualified domain name (FQDN) is
>>   63 octets per label and 255 bytes per FQDN. This maximum includes 254
>>   bytes for the FQDN and one byte for the ending dot."
>>
>> And excuse me, I do not know what 'CIFS_MAX_USERNAME_LEN' should be.
>>
>> Do we also need consider about it in our definition comments ?
>>
>>
>> Thanks.
>> --
>> Chen Gang
> 
> Sorry, I misunderstood; I figured that it had to be the domain name
> without the host since we were allowing a host name that's 1024
> characters long.  That documentation should probably be added to the
> cifs_mount.h as well then.
> 
> Still, how can we have a FQDN that's 256 characters long when the host
> name length can be 1024 characters long?
> 

Excuse me, I am not quite familiar about cifs, so can not provide
additional more information (I found it only by reading code).

But I feel, it really need additional discussion and check by the
related experts (related members who are familiar with cifs).

Welcome any members' suggestions and completions.

Thanks.
Richard Sharpe July 29, 2013, 12:36 a.m. UTC | #4
On Sun, Jul 28, 2013 at 5:27 PM, Chen Gang <gang.chen@asianux.com> wrote:
> On 07/27/2013 02:12 AM, Scott Lovenberg wrote:
>> On Thu, Jul 25, 2013 at 8:40 PM, Chen Gang <gang.chen@asianux.com> wrote:
>>> On 07/26/2013 02:34 AM, scott.lovenberg@gmail.com wrote:
>>>> From: Scott Lovenberg <scott.lovenberg@gmail.com>
>>>>
>>>> CIFS_MAX_DOMAINNAME_LEN is the max length for a domain name, not a fully qualified domain name.
>>>>
>>>> Signed-off-by: Scott Lovenberg <scott.lovenberg@gmail.com>
>>>> ---
>>>>  include/uapi/linux/cifs/cifs_mount.h | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/include/uapi/linux/cifs/cifs_mount.h b/include/uapi/linux/cifs/cifs_mount.h
>>>> index a58fc6e..d2408ec 100644
>>>> --- a/include/uapi/linux/cifs/cifs_mount.h
>>>> +++ b/include/uapi/linux/cifs/cifs_mount.h
>>>> @@ -17,7 +17,7 @@
>>>>  #define _CIFS_MOUNT_H
>>>>
>>>>  /* Max string lengths for cifs mounting options. */
>>>> -#define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */
>>>> +#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
>>>>  #define CIFS_MAX_USERNAME_LEN   256 /* reasonable max for current servers */
>>>>  #define CIFS_MAX_PASSWORD_LEN   512 /* Windows max seems to be 256 wide chars */
>>>>  #define CIFS_MAX_SHARE_LEN      256 /* reasonable max share name length */
>>>>
>>>
>>> For our kernel implementation:
>>>
>>>   for 'CIFS_MAX_DOMAINNAME_LEN', it counts 255 + '\0',
>>>   for 'CIFS_MAX_USERNAME_LEN', it counts 256 (may add additional '\0'),
>>>
>>> And original mail said about 'CIFS_MAX_DOMAINNAME_LEN':
>>>
>>>   "The maximum length of ... the fully qualified domain name (FQDN) is
>>>   63 octets per label and 255 bytes per FQDN. This maximum includes 254
>>>   bytes for the FQDN and one byte for the ending dot."
>>>
>>> And excuse me, I do not know what 'CIFS_MAX_USERNAME_LEN' should be.
>>>
>>> Do we also need consider about it in our definition comments ?
>>>
>>>
>>> Thanks.
>>> --
>>> Chen Gang
>>
>> Sorry, I misunderstood; I figured that it had to be the domain name
>> without the host since we were allowing a host name that's 1024
>> characters long.  That documentation should probably be added to the
>> cifs_mount.h as well then.
>>
>> Still, how can we have a FQDN that's 256 characters long when the host
>> name length can be 1024 characters long?
>>
>
> Excuse me, I am not quite familiar about cifs, so can not provide
> additional more information (I found it only by reading code).
>
> But I feel, it really need additional discussion and check by the
> related experts (related members who are familiar with cifs).
>
> Welcome any members' suggestions and completions.
>
> Thanks.

Come on guys, enough already. As per here:
https://en.wikipedia.org/wiki/Domain_Name_System

and a comment above the max len of the fully qualified domain name (FQDN) is
63 octets per label and 255 bytes per FQDN. This maximum includes 254
bytes for the FQDN and one byte for the ending dot.
Scott Lovenberg July 29, 2013, 6:05 p.m. UTC | #5
On Sun, Jul 28, 2013 at 8:36 PM, Richard Sharpe
<realrichardsharpe@gmail.com> wrote:
> On Sun, Jul 28, 2013 at 5:27 PM, Chen Gang <gang.chen@asianux.com> wrote:
>> On 07/27/2013 02:12 AM, Scott Lovenberg wrote:
>>> On Thu, Jul 25, 2013 at 8:40 PM, Chen Gang <gang.chen@asianux.com> wrote:
>>>> On 07/26/2013 02:34 AM, scott.lovenberg@gmail.com wrote:
>>>>> From: Scott Lovenberg <scott.lovenberg@gmail.com>
>>>>>
>>>>> CIFS_MAX_DOMAINNAME_LEN is the max length for a domain name, not a fully qualified domain name.
>>>>>
>>>>> Signed-off-by: Scott Lovenberg <scott.lovenberg@gmail.com>
>>>>> ---
>>>>>  include/uapi/linux/cifs/cifs_mount.h | 2 +-
>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/include/uapi/linux/cifs/cifs_mount.h b/include/uapi/linux/cifs/cifs_mount.h
>>>>> index a58fc6e..d2408ec 100644
>>>>> --- a/include/uapi/linux/cifs/cifs_mount.h
>>>>> +++ b/include/uapi/linux/cifs/cifs_mount.h
>>>>> @@ -17,7 +17,7 @@
>>>>>  #define _CIFS_MOUNT_H
>>>>>
>>>>>  /* Max string lengths for cifs mounting options. */
>>>>> -#define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */
>>>>> +#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
>>>>>  #define CIFS_MAX_USERNAME_LEN   256 /* reasonable max for current servers */
>>>>>  #define CIFS_MAX_PASSWORD_LEN   512 /* Windows max seems to be 256 wide chars */
>>>>>  #define CIFS_MAX_SHARE_LEN      256 /* reasonable max share name length */
>>>>>
>>>>
>>>> For our kernel implementation:
>>>>
>>>>   for 'CIFS_MAX_DOMAINNAME_LEN', it counts 255 + '\0',
>>>>   for 'CIFS_MAX_USERNAME_LEN', it counts 256 (may add additional '\0'),
>>>>
>>>> And original mail said about 'CIFS_MAX_DOMAINNAME_LEN':
>>>>
>>>>   "The maximum length of ... the fully qualified domain name (FQDN) is
>>>>   63 octets per label and 255 bytes per FQDN. This maximum includes 254
>>>>   bytes for the FQDN and one byte for the ending dot."
>>>>
>>>> And excuse me, I do not know what 'CIFS_MAX_USERNAME_LEN' should be.
>>>>
>>>> Do we also need consider about it in our definition comments ?
>>>>
>>>>
>>>> Thanks.
>>>> --
>>>> Chen Gang
>>>
>>> Sorry, I misunderstood; I figured that it had to be the domain name
>>> without the host since we were allowing a host name that's 1024
>>> characters long.  That documentation should probably be added to the
>>> cifs_mount.h as well then.
>>>
>>> Still, how can we have a FQDN that's 256 characters long when the host
>>> name length can be 1024 characters long?
>>>
>>
>> Excuse me, I am not quite familiar about cifs, so can not provide
>> additional more information (I found it only by reading code).
>>
>> But I feel, it really need additional discussion and check by the
>> related experts (related members who are familiar with cifs).
>>
>> Welcome any members' suggestions and completions.
>>
>> Thanks.
>
> Come on guys, enough already. As per here:
> https://en.wikipedia.org/wiki/Domain_Name_System
>
> and a comment above the max len of the fully qualified domain name (FQDN) is
> 63 octets per label and 255 bytes per FQDN. This maximum includes 254
> bytes for the FQDN and one byte for the ending dot.
>
> --
> Regards,
> Richard Sharpe
> (??????????--??)

OK, I'll respin this and resubmit.
Jeff Layton July 29, 2013, 8:17 p.m. UTC | #6
On Sun, 28 Jul 2013 17:36:56 -0700
Richard Sharpe <realrichardsharpe@gmail.com> wrote:

> On Sun, Jul 28, 2013 at 5:27 PM, Chen Gang <gang.chen@asianux.com> wrote:
> > On 07/27/2013 02:12 AM, Scott Lovenberg wrote:
> >> On Thu, Jul 25, 2013 at 8:40 PM, Chen Gang <gang.chen@asianux.com> wrote:
> >>> On 07/26/2013 02:34 AM, scott.lovenberg@gmail.com wrote:
> >>>> From: Scott Lovenberg <scott.lovenberg@gmail.com>
> >>>>
> >>>> CIFS_MAX_DOMAINNAME_LEN is the max length for a domain name, not a fully qualified domain name.
> >>>>
> >>>> Signed-off-by: Scott Lovenberg <scott.lovenberg@gmail.com>
> >>>> ---
> >>>>  include/uapi/linux/cifs/cifs_mount.h | 2 +-
> >>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/include/uapi/linux/cifs/cifs_mount.h b/include/uapi/linux/cifs/cifs_mount.h
> >>>> index a58fc6e..d2408ec 100644
> >>>> --- a/include/uapi/linux/cifs/cifs_mount.h
> >>>> +++ b/include/uapi/linux/cifs/cifs_mount.h
> >>>> @@ -17,7 +17,7 @@
> >>>>  #define _CIFS_MOUNT_H
> >>>>
> >>>>  /* Max string lengths for cifs mounting options. */
> >>>> -#define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */
> >>>> +#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
> >>>>  #define CIFS_MAX_USERNAME_LEN   256 /* reasonable max for current servers */
> >>>>  #define CIFS_MAX_PASSWORD_LEN   512 /* Windows max seems to be 256 wide chars */
> >>>>  #define CIFS_MAX_SHARE_LEN      256 /* reasonable max share name length */
> >>>>
> >>>
> >>> For our kernel implementation:
> >>>
> >>>   for 'CIFS_MAX_DOMAINNAME_LEN', it counts 255 + '\0',
> >>>   for 'CIFS_MAX_USERNAME_LEN', it counts 256 (may add additional '\0'),
> >>>
> >>> And original mail said about 'CIFS_MAX_DOMAINNAME_LEN':
> >>>
> >>>   "The maximum length of ... the fully qualified domain name (FQDN) is
> >>>   63 octets per label and 255 bytes per FQDN. This maximum includes 254
> >>>   bytes for the FQDN and one byte for the ending dot."
> >>>
> >>> And excuse me, I do not know what 'CIFS_MAX_USERNAME_LEN' should be.
> >>>
> >>> Do we also need consider about it in our definition comments ?
> >>>
> >>>
> >>> Thanks.
> >>> --
> >>> Chen Gang
> >>
> >> Sorry, I misunderstood; I figured that it had to be the domain name
> >> without the host since we were allowing a host name that's 1024
> >> characters long.  That documentation should probably be added to the
> >> cifs_mount.h as well then.
> >>
> >> Still, how can we have a FQDN that's 256 characters long when the host
> >> name length can be 1024 characters long?
> >>
> >
> > Excuse me, I am not quite familiar about cifs, so can not provide
> > additional more information (I found it only by reading code).
> >
> > But I feel, it really need additional discussion and check by the
> > related experts (related members who are familiar with cifs).
> >
> > Welcome any members' suggestions and completions.
> >
> > Thanks.
> 
> Come on guys, enough already. As per here:
> https://en.wikipedia.org/wiki/Domain_Name_System
> 
> and a comment above the max len of the fully qualified domain name (FQDN) is
> 63 octets per label and 255 bytes per FQDN. This maximum includes 254
> bytes for the FQDN and one byte for the ending dot.
> 

Ok, I think I knew that at one point and paged it out. It does make one
wonder why NI_MAXHOST is so big though -- is that for some
internationalization scheme?
Scott Lovenberg July 29, 2013, 9:10 p.m. UTC | #7
On Mon, Jul 29, 2013 at 4:17 PM, Jeff Layton <jlayton@redhat.com> wrote:
>> >> Still, how can we have a FQDN that's 256 characters long when the host
>> >> name length can be 1024 characters long?
>> >>
>> >
>> > Excuse me, I am not quite familiar about cifs, so can not provide
>> > additional more information (I found it only by reading code).
>> >
>> > But I feel, it really need additional discussion and check by the
>> > related experts (related members who are familiar with cifs).
>> >
>> > Welcome any members' suggestions and completions.
>> >
>> > Thanks.
>>
>> Come on guys, enough already. As per here:
>> https://en.wikipedia.org/wiki/Domain_Name_System
>>
>> and a comment above the max len of the fully qualified domain name (FQDN) is
>> 63 octets per label and 255 bytes per FQDN. This maximum includes 254
>> bytes for the FQDN and one byte for the ending dot.
>>
>
> Ok, I think I knew that at one point and paged it out. It does make one
> wonder why NI_MAXHOST is so big though -- is that for some
> internationalization scheme?
>
> --
> Jeff Layton <jlayton@redhat.com>

I guess it works if you're storing as UTF-32 or wchar_t at 4 bytes per
character. 256 characters * 4 bytes/char + 1 byte for NULL.  Microsoft
seems to use the same value for NI_MAXHOST ref:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms738532(v=vs.85).aspx
.
Chen Gang July 30, 2013, 12:09 a.m. UTC | #8
On 07/30/2013 05:10 AM, Scott Lovenberg wrote:
> On Mon, Jul 29, 2013 at 4:17 PM, Jeff Layton <jlayton@redhat.com> wrote:
>>>>> Still, how can we have a FQDN that's 256 characters long when the host
>>>>> name length can be 1024 characters long?
>>>>>
>>>>
>>>> Excuse me, I am not quite familiar about cifs, so can not provide
>>>> additional more information (I found it only by reading code).
>>>>
>>>> But I feel, it really need additional discussion and check by the
>>>> related experts (related members who are familiar with cifs).
>>>>
>>>> Welcome any members' suggestions and completions.
>>>>
>>>> Thanks.
>>>
>>> Come on guys, enough already. As per here:
>>> https://en.wikipedia.org/wiki/Domain_Name_System
>>>
>>> and a comment above the max len of the fully qualified domain name (FQDN) is
>>> 63 octets per label and 255 bytes per FQDN. This maximum includes 254
>>> bytes for the FQDN and one byte for the ending dot.
>>>
>>
>> Ok, I think I knew that at one point and paged it out. It does make one
>> wonder why NI_MAXHOST is so big though -- is that for some
>> internationalization scheme?
>>
>> --
>> Jeff Layton <jlayton@redhat.com>
> 
> I guess it works if you're storing as UTF-32 or wchar_t at 4 bytes per
> character. 256 characters * 4 bytes/char + 1 byte for NULL.  Microsoft
> seems to use the same value for NI_MAXHOST ref:
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms738532(v=vs.85).aspx
> .
> 

As far as I know, the kernel implementation wants to use 255 + 1 as
character count, not bytes count for FQDN (256 bytes for 8-bit, 512
bytes for 16-bit, ...), it can be translated into uni-code or other
format within 255 + 1 character count.

May it be useful for our discussion ?

(BTW: if kernel really wants to do, I also suggest to check the kernel
implementation for it whether correct or not).


Thanks.
Chen Gang July 30, 2013, 12:31 a.m. UTC | #9
On 07/30/2013 08:09 AM, Chen Gang wrote:
> On 07/30/2013 05:10 AM, Scott Lovenberg wrote:
>> On Mon, Jul 29, 2013 at 4:17 PM, Jeff Layton <jlayton@redhat.com> wrote:
>>>>>> Still, how can we have a FQDN that's 256 characters long when the host
>>>>>> name length can be 1024 characters long?
>>>>>>
>>>>>
>>>>> Excuse me, I am not quite familiar about cifs, so can not provide
>>>>> additional more information (I found it only by reading code).
>>>>>
>>>>> But I feel, it really need additional discussion and check by the
>>>>> related experts (related members who are familiar with cifs).
>>>>>
>>>>> Welcome any members' suggestions and completions.
>>>>>
>>>>> Thanks.
>>>>
>>>> Come on guys, enough already. As per here:
>>>> https://en.wikipedia.org/wiki/Domain_Name_System
>>>>
>>>> and a comment above the max len of the fully qualified domain name (FQDN) is
>>>> 63 octets per label and 255 bytes per FQDN. This maximum includes 254
>>>> bytes for the FQDN and one byte for the ending dot.
>>>>
>>>
>>> Ok, I think I knew that at one point and paged it out. It does make one
>>> wonder why NI_MAXHOST is so big though -- is that for some
>>> internationalization scheme?
>>>
>>> --
>>> Jeff Layton <jlayton@redhat.com>
>>
>> I guess it works if you're storing as UTF-32 or wchar_t at 4 bytes per
>> character. 256 characters * 4 bytes/char + 1 byte for NULL.  Microsoft
>> seems to use the same value for NI_MAXHOST ref:
>> http://msdn.microsoft.com/en-us/library/windows/desktop/ms738532(v=vs.85).aspx
>> .
>>
> 
> As far as I know, the kernel implementation wants to use 255 + 1 as
> character count, not bytes count for FQDN (256 bytes for 8-bit, 512
> bytes for 16-bit, ...), it can be translated into uni-code or other
> format within 255 + 1 character count.
> 
> May it be useful for our discussion ?
> 
> (BTW: if kernel really wants to do, I also suggest to check the kernel
> implementation for it whether correct or not).
> 
> 
> Thanks.
> 

OH, sorry, what I said above is incorrect. The kernel implementation use
255 + 1 as bytes, it can be translated into uni-code within 255 + 1
character count.

For NI_MAXHOST, I think we do not mind it: WIKI is more common than
Microsoft. and Microsoft also says: "To simplify determining buffer
requirements ..." (I guess, the "simplify determining" is
"sizeof(UTF-32) * 256 + '\0'").


:-)

Thanks.
diff mbox

Patch

diff --git a/include/uapi/linux/cifs/cifs_mount.h b/include/uapi/linux/cifs/cifs_mount.h
index a58fc6e..d2408ec 100644
--- a/include/uapi/linux/cifs/cifs_mount.h
+++ b/include/uapi/linux/cifs/cifs_mount.h
@@ -17,7 +17,7 @@ 
 #define _CIFS_MOUNT_H
 
 /* Max string lengths for cifs mounting options. */
-#define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */
+#define CIFS_MAX_DOMAINNAME_LEN 256 /* max domain name length */
 #define CIFS_MAX_USERNAME_LEN   256 /* reasonable max for current servers */
 #define CIFS_MAX_PASSWORD_LEN   512 /* Windows max seems to be 256 wide chars */
 #define CIFS_MAX_SHARE_LEN      256 /* reasonable max share name length */