All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cifs: fill TRANS2_QUERY_FILE_INFO ByteCount fields
@ 2013-06-28  9:47 David Disseldorp
       [not found] ` <1372412853-25917-1-git-send-email-ddiss-l3A5Bk7waGM@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: David Disseldorp @ 2013-06-28  9:47 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA; +Cc: David Disseldorp

Currently the trans2 ByteCount field is incorrectly left zero in
TRANS2_QUERY_FILE_INFO info_level=SMB_QUERY_FILE_ALL_INFO and
info_level=SMB_QUERY_FILE_UNIX_BASIC requests. The field should properly
reflect the FID, information_level and padding bytes carried in these
requests.

Leaving this field zero causes such requests to fail against Novell CIFS
servers. Other SMB servers (e.g. Samba) use the parameter count fields
for data length calculations instead, so do not suffer the same fate.

Signed-off-by: David Disseldorp <ddiss-l3A5Bk7waGM@public.gmane.org>
---
 fs/cifs/cifssmb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index a58dc77..efe794d 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -3940,6 +3940,7 @@ QFileInfoRetry:
 	pSMB->Pad = 0;
 	pSMB->Fid = netfid;
 	inc_rfc1001_len(pSMB, byte_count);
+	pSMB->t2.ByteCount = cpu_to_le16(byte_count);
 
 	rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
 			 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
@@ -4108,6 +4109,7 @@ UnixQFileInfoRetry:
 	pSMB->Pad = 0;
 	pSMB->Fid = netfid;
 	inc_rfc1001_len(pSMB, byte_count);
+	pSMB->t2.ByteCount = cpu_to_le16(byte_count);
 
 	rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
 			 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cifs: fill TRANS2_QUERY_FILE_INFO ByteCount fields
       [not found] ` <1372412853-25917-1-git-send-email-ddiss-l3A5Bk7waGM@public.gmane.org>
@ 2013-06-28 11:33   ` Jeff Layton
  2013-06-29  5:11   ` Steve French
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2013-06-28 11:33 UTC (permalink / raw)
  To: David Disseldorp; +Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA

On Fri, 28 Jun 2013 11:47:33 +0200
David Disseldorp <ddiss-l3A5Bk7waGM@public.gmane.org> wrote:

> Currently the trans2 ByteCount field is incorrectly left zero in
> TRANS2_QUERY_FILE_INFO info_level=SMB_QUERY_FILE_ALL_INFO and
> info_level=SMB_QUERY_FILE_UNIX_BASIC requests. The field should properly
> reflect the FID, information_level and padding bytes carried in these
> requests.
> 
> Leaving this field zero causes such requests to fail against Novell CIFS
> servers. Other SMB servers (e.g. Samba) use the parameter count fields
> for data length calculations instead, so do not suffer the same fate.
> 
> Signed-off-by: David Disseldorp <ddiss-l3A5Bk7waGM@public.gmane.org>
> ---
>  fs/cifs/cifssmb.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
> index a58dc77..efe794d 100644
> --- a/fs/cifs/cifssmb.c
> +++ b/fs/cifs/cifssmb.c
> @@ -3940,6 +3940,7 @@ QFileInfoRetry:
>  	pSMB->Pad = 0;
>  	pSMB->Fid = netfid;
>  	inc_rfc1001_len(pSMB, byte_count);
> +	pSMB->t2.ByteCount = cpu_to_le16(byte_count);
>  
>  	rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
>  			 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
> @@ -4108,6 +4109,7 @@ UnixQFileInfoRetry:
>  	pSMB->Pad = 0;
>  	pSMB->Fid = netfid;
>  	inc_rfc1001_len(pSMB, byte_count);
> +	pSMB->t2.ByteCount = cpu_to_le16(byte_count);
>  
>  	rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
>  			 (struct smb_hdr *) pSMBr, &bytes_returned, 0);

Looks correct...

Acked-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cifs: fill TRANS2_QUERY_FILE_INFO ByteCount fields
       [not found] ` <1372412853-25917-1-git-send-email-ddiss-l3A5Bk7waGM@public.gmane.org>
  2013-06-28 11:33   ` Jeff Layton
@ 2013-06-29  5:11   ` Steve French
  1 sibling, 0 replies; 3+ messages in thread
From: Steve French @ 2013-06-29  5:11 UTC (permalink / raw)
  To: David Disseldorp; +Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA

merged into cifs-2.6.git

On Fri, Jun 28, 2013 at 4:47 AM, David Disseldorp <ddiss-l3A5Bk7waGM@public.gmane.org> wrote:
> Currently the trans2 ByteCount field is incorrectly left zero in
> TRANS2_QUERY_FILE_INFO info_level=SMB_QUERY_FILE_ALL_INFO and
> info_level=SMB_QUERY_FILE_UNIX_BASIC requests. The field should properly
> reflect the FID, information_level and padding bytes carried in these
> requests.
>
> Leaving this field zero causes such requests to fail against Novell CIFS
> servers. Other SMB servers (e.g. Samba) use the parameter count fields
> for data length calculations instead, so do not suffer the same fate.
>
> Signed-off-by: David Disseldorp <ddiss-l3A5Bk7waGM@public.gmane.org>
> ---
>  fs/cifs/cifssmb.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
> index a58dc77..efe794d 100644
> --- a/fs/cifs/cifssmb.c
> +++ b/fs/cifs/cifssmb.c
> @@ -3940,6 +3940,7 @@ QFileInfoRetry:
>         pSMB->Pad = 0;
>         pSMB->Fid = netfid;
>         inc_rfc1001_len(pSMB, byte_count);
> +       pSMB->t2.ByteCount = cpu_to_le16(byte_count);
>
>         rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
>                          (struct smb_hdr *) pSMBr, &bytes_returned, 0);
> @@ -4108,6 +4109,7 @@ UnixQFileInfoRetry:
>         pSMB->Pad = 0;
>         pSMB->Fid = netfid;
>         inc_rfc1001_len(pSMB, byte_count);
> +       pSMB->t2.ByteCount = cpu_to_le16(byte_count);
>
>         rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
>                          (struct smb_hdr *) pSMBr, &bytes_returned, 0);
> --
> 1.8.1.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-29  5:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-28  9:47 [PATCH] cifs: fill TRANS2_QUERY_FILE_INFO ByteCount fields David Disseldorp
     [not found] ` <1372412853-25917-1-git-send-email-ddiss-l3A5Bk7waGM@public.gmane.org>
2013-06-28 11:33   ` Jeff Layton
2013-06-29  5:11   ` Steve French

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.