Patch: Move the handling of svhdx to vfs_default.c

Steve French smfrench at gmail.com
Fri Oct 2 01:06:44 UTC 2015


Why do we return an error when we don't recognize a create context
(rather than just ignore it as Microsoft servers do)?

MS-SMB2 says the following (and obviously Windows ignores AAPL rather
than returning an error, so unknown contexts can or should be ignored)

"<247> Section 3.3.5.9: Windows Vista SP1, Windows Server 2008,
Windows 7, Windows Server 2008 R2, Windows 8, and Windows Server 2012
ignore create contexts having a NameLength greater than 4 and ignore
create contexts with a length of 4 that are not specified "

HyperV in creating a VM (at least from Windows 10 MMC) fails on the
open/create of the image over SMB3 due to us returning
INVALID_DEVICE_REQUEST due to the unrecognized create context (for
SVHDXOpenDeviceContext).  This is not actually running the VM, just
creating an image file on a share.

Setting max protocols to 3.0 does avoid this problem (although it
breaks due to a more serious Samba bug in parsing negprot - so you
can't negotiate protocol with recent Windows to Samba when max
protocols is set.  Samba needs the patch below

diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 2ea997e..1a97b2e 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -2096,9 +2096,7 @@ NTSTATUS smbd_smb2_request_dispatch(struct
smbd_smb2_request *req)
                allowed_flags |= SMB2_HDR_FLAG_PRIORITY_MASK;
        }
        if (opcode == SMB2_OP_NEGPROT) {
-               if (lp_server_max_protocol() >= PROTOCOL_SMB3_11) {
-                       allowed_flags |= SMB2_HDR_FLAG_PRIORITY_MASK;
-               }
+               allowed_flags |= SMB2_HDR_FLAG_PRIORITY_MASK;
        }
        if (opcode == SMB2_OP_CANCEL) {
                allowed_flags |= SMB2_HDR_FLAG_ASYNC;

On Wed, Aug 26, 2015 at 10:35 AM, Richard Sharpe
<realrichardsharpe at gmail.com> wrote:
> Hi folks,
>
> I have resolved the style issue and it now does not crash when SMB
> (rather than SMB2) is in use.
>
> However, re-review is needed because things changed.
>
> --
> Regards,
> Richard Sharpe
> (何以解憂?唯有杜康。--曹操)



-- 
Thanks,

Steve



More information about the samba-technical mailing list