diff mbox

[19/20] cifs: rename encryption_required to smb3_encryption_required

Message ID 20180508235537.31416-20-lsahlber@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ronnie Sahlberg May 8, 2018, 11:55 p.m. UTC
and make it public.

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/smb2pdu.c   | 42 +++++++++++++++++++++---------------------
 fs/cifs/smb2proto.h |  1 +
 2 files changed, 22 insertions(+), 21 deletions(-)

Comments

Steve French May 9, 2018, 10:46 p.m. UTC | #1
I fixed this trivial function rename patch up (to resolve merge
conflicts) and merged into cifs-2.6.git for-next (I did not make it
public yet to avoid build warnings etc.).

Hopefully merging the easy/obvious stuff  can shrink the list of
complex function patches/lines to review somewhat.  Ronnie's
compounding patches are important.

On Tue, May 8, 2018 at 6:55 PM, Ronnie Sahlberg <lsahlber@redhat.com> wrote:
> and make it public.
>
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/smb2pdu.c   | 42 +++++++++++++++++++++---------------------
>  fs/cifs/smb2proto.h |  1 +
>  2 files changed, 22 insertions(+), 21 deletions(-)
>
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> index e04632ea751e..ae6dbbccae2e 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -79,7 +79,7 @@ static const int smb2_req_struct_sizes[NUMBER_OF_SMB2_COMMANDS] = {
>         /* SMB2_OPLOCK_BREAK */ 24 /* BB this is 36 for LEASE_BREAK variant */
>  };
>
> -static int encryption_required(const struct cifs_tcon *tcon)
> +int smb3_encryption_required(const struct cifs_tcon *tcon)
>  {
>         if (!tcon)
>                 return 0;
> @@ -145,7 +145,7 @@ smb2_hdr_assemble(struct smb2_sync_hdr *shdr, __le16 smb2_cmd,
>                 shdr->Flags |= SMB2_FLAGS_DFS_OPERATIONS; */
>
>         if (tcon->ses && tcon->ses->server && tcon->ses->server->sign &&
> -           !encryption_required(tcon))
> +           !smb3_encryption_required(tcon))
>                 shdr->Flags |= SMB2_FLAGS_SIGNED;
>  out:
>         return;
> @@ -1417,7 +1417,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
>                 return rc;
>         }
>
> -       if (encryption_required(tcon))
> +       if (smb3_encryption_required(tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         iov[0].iov_base = (char *)req;
> @@ -1433,7 +1433,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
>
>         /* 3.11 tcon req must be signed if not encrypted. See MS-SMB2 3.2.4.1.1 */
>         if ((ses->server->dialect == SMB311_PROT_ID) &&
> -           !encryption_required(tcon))
> +           !smb3_encryption_required(tcon))
>                 req->sync_hdr.Flags |= SMB2_FLAGS_SIGNED;
>
>         memset(&rqst, 0, sizeof(struct smb_rqst));
> @@ -1527,7 +1527,7 @@ SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon)
>         if (rc)
>                 return rc;
>
> -       if (encryption_required(tcon))
> +       if (smb3_encryption_required(tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         flags |= CIFS_NO_RESP;
> @@ -1971,7 +1971,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
>         else
>                 return -EIO;
>
> -       if (encryption_required(tcon))
> +       if (smb3_encryption_required(tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         memset(&rqst, 0, sizeof(struct smb_rqst));
> @@ -2062,7 +2062,7 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
>         if (rc)
>                 return rc;
>
> -       if (encryption_required(tcon))
> +       if (smb3_encryption_required(tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         req->CtlCode = cpu_to_le32(opcode);
> @@ -2246,7 +2246,7 @@ SMB2_close(const unsigned int xid, struct cifs_tcon *tcon,
>         if (!ses || !(ses->server))
>                 return -EIO;
>
> -       if (encryption_required(tcon))
> +       if (smb3_encryption_required(tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         memset(&rqst, 0, sizeof(struct smb_rqst));
> @@ -2390,7 +2390,7 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon,
>         if (!ses || !(ses->server))
>                 return -EIO;
>
> -       if (encryption_required(tcon))
> +       if (smb3_encryption_required(tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         memset(&rqst, 0, sizeof(struct smb_rqst));
> @@ -2624,7 +2624,7 @@ SMB2_flush(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
>         if (rc)
>                 return rc;
>
> -       if (encryption_required(tcon))
> +       if (smb3_encryption_required(tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         req->PersistentFileId = persistent_fid;
> @@ -2851,7 +2851,7 @@ smb2_async_readv(struct cifs_readdata *rdata)
>                 return rc;
>         }
>
> -       if (encryption_required(io_parms.tcon))
> +       if (smb3_encryption_required(io_parms.tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         rdata->iov[0].iov_base = buf;
> @@ -2903,7 +2903,7 @@ SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,
>         if (rc)
>                 return rc;
>
> -       if (encryption_required(io_parms->tcon))
> +       if (smb3_encryption_required(io_parms->tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         iov[0].iov_base = (char *)req;
> @@ -3040,7 +3040,7 @@ smb2_async_writev(struct cifs_writedata *wdata,
>                 goto async_writev_out;
>         }
>
> -       if (encryption_required(tcon))
> +       if (smb3_encryption_required(tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         shdr = (struct smb2_sync_hdr *)req;
> @@ -3175,7 +3175,7 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
>         if (io_parms->tcon->ses->server == NULL)
>                 return -ECONNABORTED;
>
> -       if (encryption_required(io_parms->tcon))
> +       if (smb3_encryption_required(io_parms->tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         req->sync_hdr.ProcessId = cpu_to_le32(io_parms->pid);
> @@ -3290,7 +3290,7 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon,
>         if (rc)
>                 return rc;
>
> -       if (encryption_required(tcon))
> +       if (smb3_encryption_required(tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         switch (srch_inf->info_level) {
> @@ -3426,7 +3426,7 @@ send_set_info(const unsigned int xid, struct cifs_tcon *tcon,
>                 return rc;
>         }
>
> -       if (encryption_required(tcon))
> +       if (smb3_encryption_required(tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         req->sync_hdr.ProcessId = cpu_to_le32(pid);
> @@ -3626,7 +3626,7 @@ SMB2_oplock_break(const unsigned int xid, struct cifs_tcon *tcon,
>         if (rc)
>                 return rc;
>
> -       if (encryption_required(tcon))
> +       if (smb3_encryption_required(tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         req->VolatileFid = volatile_fid;
> @@ -3722,7 +3722,7 @@ SMB2_QFS_info(const unsigned int xid, struct cifs_tcon *tcon,
>         if (rc)
>                 return rc;
>
> -       if (encryption_required(tcon))
> +       if (smb3_encryption_required(tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         memset(&rqst, 0, sizeof(struct smb_rqst));
> @@ -3783,7 +3783,7 @@ SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon,
>         if (rc)
>                 return rc;
>
> -       if (encryption_required(tcon))
> +       if (smb3_encryption_required(tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         memset(&rqst, 0, sizeof(struct smb_rqst));
> @@ -3845,7 +3845,7 @@ smb2_lockv(const unsigned int xid, struct cifs_tcon *tcon,
>         if (rc)
>                 return rc;
>
> -       if (encryption_required(tcon))
> +       if (smb3_encryption_required(tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         req->sync_hdr.ProcessId = cpu_to_le32(pid);
> @@ -3915,7 +3915,7 @@ SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon,
>         if (rc)
>                 return rc;
>
> -       if (encryption_required(tcon))
> +       if (smb3_encryption_required(tcon))
>                 flags |= CIFS_TRANSFORM_REQ;
>
>         req->sync_hdr.CreditRequest = cpu_to_le16(1);
> diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h
> index 1d119cdef62e..17818c7d7083 100644
> --- a/fs/cifs/smb2proto.h
> +++ b/fs/cifs/smb2proto.h
> @@ -217,6 +217,7 @@ extern int smb3_validate_negotiate(const unsigned int, struct cifs_tcon *);
>
>  extern enum securityEnum smb2_select_sectype(struct TCP_Server_Info *,
>                                         enum securityEnum);
> +extern int smb3_encryption_required(const struct cifs_tcon *tcon);
>  #ifdef CONFIG_CIFS_SMB311
>  extern int smb311_crypto_shash_allocate(struct TCP_Server_Info *server);
>  extern int smb311_update_preauth_hash(struct cifs_ses *ses,
> --
> 2.13.3
>
diff mbox

Patch

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index e04632ea751e..ae6dbbccae2e 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -79,7 +79,7 @@  static const int smb2_req_struct_sizes[NUMBER_OF_SMB2_COMMANDS] = {
 	/* SMB2_OPLOCK_BREAK */ 24 /* BB this is 36 for LEASE_BREAK variant */
 };
 
-static int encryption_required(const struct cifs_tcon *tcon)
+int smb3_encryption_required(const struct cifs_tcon *tcon)
 {
 	if (!tcon)
 		return 0;
@@ -145,7 +145,7 @@  smb2_hdr_assemble(struct smb2_sync_hdr *shdr, __le16 smb2_cmd,
 		shdr->Flags |= SMB2_FLAGS_DFS_OPERATIONS; */
 
 	if (tcon->ses && tcon->ses->server && tcon->ses->server->sign &&
-	    !encryption_required(tcon))
+	    !smb3_encryption_required(tcon))
 		shdr->Flags |= SMB2_FLAGS_SIGNED;
 out:
 	return;
@@ -1417,7 +1417,7 @@  SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
 		return rc;
 	}
 
-	if (encryption_required(tcon))
+	if (smb3_encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	iov[0].iov_base = (char *)req;
@@ -1433,7 +1433,7 @@  SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
 
 	/* 3.11 tcon req must be signed if not encrypted. See MS-SMB2 3.2.4.1.1 */
 	if ((ses->server->dialect == SMB311_PROT_ID) &&
-	    !encryption_required(tcon))
+	    !smb3_encryption_required(tcon))
 		req->sync_hdr.Flags |= SMB2_FLAGS_SIGNED;
 
 	memset(&rqst, 0, sizeof(struct smb_rqst));
@@ -1527,7 +1527,7 @@  SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon)
 	if (rc)
 		return rc;
 
-	if (encryption_required(tcon))
+	if (smb3_encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	flags |= CIFS_NO_RESP;
@@ -1971,7 +1971,7 @@  SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
 	else
 		return -EIO;
 
-	if (encryption_required(tcon))
+	if (smb3_encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	memset(&rqst, 0, sizeof(struct smb_rqst));
@@ -2062,7 +2062,7 @@  SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
 	if (rc)
 		return rc;
 
-	if (encryption_required(tcon))
+	if (smb3_encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	req->CtlCode = cpu_to_le32(opcode);
@@ -2246,7 +2246,7 @@  SMB2_close(const unsigned int xid, struct cifs_tcon *tcon,
 	if (!ses || !(ses->server))
 		return -EIO;
 
-	if (encryption_required(tcon))
+	if (smb3_encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	memset(&rqst, 0, sizeof(struct smb_rqst));
@@ -2390,7 +2390,7 @@  query_info(const unsigned int xid, struct cifs_tcon *tcon,
 	if (!ses || !(ses->server))
 		return -EIO;
 
-	if (encryption_required(tcon))
+	if (smb3_encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	memset(&rqst, 0, sizeof(struct smb_rqst));
@@ -2624,7 +2624,7 @@  SMB2_flush(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
 	if (rc)
 		return rc;
 
-	if (encryption_required(tcon))
+	if (smb3_encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	req->PersistentFileId = persistent_fid;
@@ -2851,7 +2851,7 @@  smb2_async_readv(struct cifs_readdata *rdata)
 		return rc;
 	}
 
-	if (encryption_required(io_parms.tcon))
+	if (smb3_encryption_required(io_parms.tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	rdata->iov[0].iov_base = buf;
@@ -2903,7 +2903,7 @@  SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,
 	if (rc)
 		return rc;
 
-	if (encryption_required(io_parms->tcon))
+	if (smb3_encryption_required(io_parms->tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	iov[0].iov_base = (char *)req;
@@ -3040,7 +3040,7 @@  smb2_async_writev(struct cifs_writedata *wdata,
 		goto async_writev_out;
 	}
 
-	if (encryption_required(tcon))
+	if (smb3_encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	shdr = (struct smb2_sync_hdr *)req;
@@ -3175,7 +3175,7 @@  SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
 	if (io_parms->tcon->ses->server == NULL)
 		return -ECONNABORTED;
 
-	if (encryption_required(io_parms->tcon))
+	if (smb3_encryption_required(io_parms->tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	req->sync_hdr.ProcessId = cpu_to_le32(io_parms->pid);
@@ -3290,7 +3290,7 @@  SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon,
 	if (rc)
 		return rc;
 
-	if (encryption_required(tcon))
+	if (smb3_encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	switch (srch_inf->info_level) {
@@ -3426,7 +3426,7 @@  send_set_info(const unsigned int xid, struct cifs_tcon *tcon,
 		return rc;
 	}
 
-	if (encryption_required(tcon))
+	if (smb3_encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	req->sync_hdr.ProcessId = cpu_to_le32(pid);
@@ -3626,7 +3626,7 @@  SMB2_oplock_break(const unsigned int xid, struct cifs_tcon *tcon,
 	if (rc)
 		return rc;
 
-	if (encryption_required(tcon))
+	if (smb3_encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	req->VolatileFid = volatile_fid;
@@ -3722,7 +3722,7 @@  SMB2_QFS_info(const unsigned int xid, struct cifs_tcon *tcon,
 	if (rc)
 		return rc;
 
-	if (encryption_required(tcon))
+	if (smb3_encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	memset(&rqst, 0, sizeof(struct smb_rqst));
@@ -3783,7 +3783,7 @@  SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon,
 	if (rc)
 		return rc;
 
-	if (encryption_required(tcon))
+	if (smb3_encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	memset(&rqst, 0, sizeof(struct smb_rqst));
@@ -3845,7 +3845,7 @@  smb2_lockv(const unsigned int xid, struct cifs_tcon *tcon,
 	if (rc)
 		return rc;
 
-	if (encryption_required(tcon))
+	if (smb3_encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	req->sync_hdr.ProcessId = cpu_to_le32(pid);
@@ -3915,7 +3915,7 @@  SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon,
 	if (rc)
 		return rc;
 
-	if (encryption_required(tcon))
+	if (smb3_encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	req->sync_hdr.CreditRequest = cpu_to_le16(1);
diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h
index 1d119cdef62e..17818c7d7083 100644
--- a/fs/cifs/smb2proto.h
+++ b/fs/cifs/smb2proto.h
@@ -217,6 +217,7 @@  extern int smb3_validate_negotiate(const unsigned int, struct cifs_tcon *);
 
 extern enum securityEnum smb2_select_sectype(struct TCP_Server_Info *,
 					enum securityEnum);
+extern int smb3_encryption_required(const struct cifs_tcon *tcon);
 #ifdef CONFIG_CIFS_SMB311
 extern int smb311_crypto_shash_allocate(struct TCP_Server_Info *server);
 extern int smb311_update_preauth_hash(struct cifs_ses *ses,