samba-technical@lists.samba.org
[Top] [All Lists]

Re: BUG: vfs-cifs hangs from windows explorer: access denied: cause writ

Subject: Re: BUG: vfs-cifs hangs from windows explorer: access denied: cause write size
From: Amin Azez
Date: Thu, 29 Nov 2007 12:19:36 +0000
Well this is the patch that proves the bug; sadly the client doesn't
take the hint, and keeps sending large writes, but at least the files
get saved.

I/we still need to work out how to propagate the real limit.

I think we ought to have this patch as a safety net; and if not the
solution, at least the warning.

Sam
diff --git a/source/ntvfs/cifs/vfs_cifs.c b/source/ntvfs/cifs/vfs_cifs.c
index bd1997f..f34633c 100644
--- a/source/ntvfs/cifs/vfs_cifs.c
+++ b/source/ntvfs/cifs/vfs_cifs.c
@@ -673,6 +673,17 @@ static NTSTATUS cvfs_write(struct ntvfs_module_context 
*ntvfs,
        }
        SETUP_FILE;
 
+       /* If the write is too big, then reduce it, the response says how much
+          was written anyway... Session negotiation time should set the client 
+          limit to something matching the proxied server */
+       if (io->generic.in.count > 
+               private->tree->session->transport->negotiate.max_xmit) {
+               DEBUG(1,("Client sending too-big write sized %d, negotiated 
limit %d\n",
+                                io->generic.in.count,
+                                
private->tree->session->transport->negotiate.max_xmit));
+               
io->generic.in.count=private->tree->session->transport->negotiate.max_xmit;
+       }
+
        if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
                return smb_raw_write(private->tree, io);
        }
<Prev in Thread] Current Thread [Next in Thread>