public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paulo Alcantara <pc@cjr.nz>
To: Byron Stanoszek <gandalf@winds.org>, Steve French <sfrench@samba.org>
Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: CIFS regression mounting vers=1.0 NTLMSSP when hostname is too long
Date: Tue, 03 May 2022 22:35:43 -0300	[thread overview]
Message-ID: <878rri2i6o.fsf@cjr.nz> (raw)
In-Reply-To: <e6837098-15d9-acb6-7e34-1923cf8c6fe1@winds.org>

Byron Stanoszek <gandalf@winds.org> writes:

> I would like to report a regression in the CIFS fs. Sometime between Linux 4.14
> and 5.16, mounting CIFS with option vers=1.0 (and
> CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y set appropriately) with security type
> NTLMSSP stopped working for me. The server side is a Windows 2003 Server.
>
> I found that this behavior depends on the length of the Linux client's
> host+domain name (e.g. utsname()->nodename), where the mount works as long as
> the name is 16 characters or less. Anything 17 or above returns -EIO, per the
> following example:

Looks like your server is expecting the WorkstationName field in
AUTHENTICATE_MESSAGE payload to be 16 bytes long.  That is, NetBIOS name
length as per rfc1001.

> I implemented a workaround using the following patch:
>
> Signed-off-by: Byron Stanoszek <gandalf@winds.org>
> ---
> --- a/fs/cifs/cifsglob.h
> +++ b/fs/cifs/cifsglob.h
> @@ -101,7 +101,7 @@
>   #define XATTR_DOS_ATTRIB "user.DOSATTRIB"
>   #endif
>
> -#define CIFS_MAX_WORKSTATION_LEN  (__NEW_UTS_LEN + 1)  /* reasonable max for client */
> +#define CIFS_MAX_WORKSTATION_LEN 16
>
>   /*
>    * CIFS vfs client Status information (based on what we know.)
>
> I don't know if this patch is correct or will have any real effect outside of
> the NTLMSSP session connect sequence, but it worked in my case.

Perhaps we should be use TCP_Server_Info::workstation_RFC1001_name in
fs/cifs/sess.c:build_ntlmssp_auth_blob() instead only when connecting to
old servers by using insecure dialects -- like SMB1, in your case.

  reply	other threads:[~2022-05-04  1:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03 20:36 CIFS regression mounting vers=1.0 NTLMSSP when hostname is too long Byron Stanoszek
2022-05-04  1:35 ` Paulo Alcantara [this message]
2022-05-04  5:43   ` Steven French
2022-05-04 19:15     ` Paulo Alcantara
2022-05-04 20:18       ` Tom Talpey
2022-05-04 20:58         ` Paulo Alcantara
2022-05-06  2:03           ` Steve French
2022-05-06  2:19           ` ronnie sahlberg
2022-05-06 14:05             ` Paulo Alcantara
2022-05-04  7:13 ` Thorsten Leemhuis
2022-05-17 20:37 ` Paulo Alcantara
2022-05-22  4:40   ` Steven French
2022-05-23  2:32     ` Byron Stanoszek
2022-05-25  3:17   ` Byron Stanoszek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rri2i6o.fsf@cjr.nz \
    --to=pc@cjr.nz \
    --cc=gandalf@winds.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfrench@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox