[v3,5/7] CIFS: set signing flag in SMB2+ TreeConnect if needed
diff mbox

Message ID 20170228184034.18771-6-aaptel@suse.com
State New
Headers show

Commit Message

Aurelien Aptel Feb. 28, 2017, 6:40 p.m. UTC
cifs_enable_signing() already sets server->sign according to what the
server requires/offers and what mount options allows/forbids, so use
that.

this is required for IPC tcon that connects to signing-required servers.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
---
 fs/cifs/smb2pdu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Pavel Shilovsky March 1, 2017, 2:37 a.m. UTC | #1
2017-02-28 10:40 GMT-08:00 Aurelien Aptel <aaptel@suse.com>:
> cifs_enable_signing() already sets server->sign according to what the
> server requires/offers and what mount options allows/forbids, so use
> that.
>
> this is required for IPC tcon that connects to signing-required servers.
>
> Signed-off-by: Aurelien Aptel <aaptel@suse.com>
> ---
>  fs/cifs/smb2pdu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> index 8c4532d..2fd93ee 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -1168,8 +1168,8 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
>
>                 /* since no tcon, smb2_init can not do this, so do here */
>                 req->hdr.sync_hdr.SessionId = ses->Suid;
> -               /* if (ses->server->sec_mode & SECMODE_SIGN_REQUIRED)
> -                       req->hdr.Flags |= SMB2_FLAGS_SIGNED; */
> +               if (ses->server->sign)
> +                       req->hdr.sync_hdr.Flags |= SMB2_FLAGS_SIGNED;
>         } else if (encryption_required(tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
> --
> 2.10.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>

Patch
diff mbox

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 8c4532d..2fd93ee 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1168,8 +1168,8 @@  SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
 
 		/* since no tcon, smb2_init can not do this, so do here */
 		req->hdr.sync_hdr.SessionId = ses->Suid;
-		/* if (ses->server->sec_mode & SECMODE_SIGN_REQUIRED)
-			req->hdr.Flags |= SMB2_FLAGS_SIGNED; */
+		if (ses->server->sign)
+			req->hdr.sync_hdr.Flags |= SMB2_FLAGS_SIGNED;
 	} else if (encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;