The branch, master has been updated
       via  39e468f55859c01f7bdaab4086df371d3375099f (commit)
       via  7d8f3cdbfc741aa680f23018a434ae9409b69ef0 (commit)
      from  0e723d8f7d918d2d1a1e9e26d976f016d5d97c94 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 39e468f55859c01f7bdaab4086df371d3375099f
Author: Sam Liddicott <[EMAIL PROTECTED]>
Date:   Fri Dec 5 09:05:47 2008 +0000

    vfs_cifs - Use ntvfs request transport close to close downstream session
    
    When upstream session closes, close the downstream session
    
    Signed-off-by: Sam Liddicott <[EMAIL PROTECTED]>
    Signed-off-by: Stefan Metzmacher <[EMAIL PROTECTED]>

commit 7d8f3cdbfc741aa680f23018a434ae9409b69ef0
Author: Sam Liddicott <[EMAIL PROTECTED]>
Date:   Fri Dec 5 09:04:55 2008 +0000

    Let ntvfs request transport close via ntvfs_request state
    
    [I can't swear that this covers all the smb2 cases, there are some reply
    functions that I can't trace properly]
    
    Add NTVFS_ASYNC_STATE_CLOSE bit to ntvfs_request->async_states->state
    so that the ntvfs layer can signify that the client transport should
    be closed, most useful for proxy servies, and most likely due to a
    forwarding transport having been closed.
    
    Signed-off-by: Sam Liddicott <[EMAIL PROTECTED]>
    Signed-off-by: Stefan Metzmacher <[EMAIL PROTECTED]>

-----------------------------------------------------------------------

Summary of changes:
 source4/ntvfs/cifs/vfs_cifs.c         |   12 +++++++++++-
 source4/ntvfs/ntvfs.h                 |    1 +
 source4/smb_server/smb2/smb2_server.h |   10 ++++++++++
 source4/smb_server/smb_server.h       |   12 ++++++++++++
 4 files changed, 34 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c
index d133bbc..e615401 100644
--- a/source4/ntvfs/cifs/vfs_cifs.c
+++ b/source4/ntvfs/cifs/vfs_cifs.c
@@ -63,7 +63,17 @@ struct async_info {
        void *parms;
 };
 
-#define SETUP_PID private->tree->session->pid = req->smbpid
+#define CHECK_UPSTREAM_OPEN do { \
+       if (! private->transport->socket->sock) { \
+               req->async_states->state|=NTVFS_ASYNC_STATE_CLOSE; \
+               return NT_STATUS_CONNECTION_DISCONNECTED; \
+       } \
+} while(0)
+
+#define SETUP_PID do { \
+       private->tree->session->pid = req->smbpid; \
+       CHECK_UPSTREAM_OPEN; \
+} while(0)
 
 #define SETUP_FILE_HERE(f) do { \
        f = ntvfs_handle_get_backend_data(io->generic.in.file.ntvfs, ntvfs); \
diff --git a/source4/ntvfs/ntvfs.h b/source4/ntvfs/ntvfs.h
index 0d5738d..fc04d97 100644
--- a/source4/ntvfs/ntvfs.h
+++ b/source4/ntvfs/ntvfs.h
@@ -226,6 +226,7 @@ struct ntvfs_context {
 /* a set of flags to control handling of request structures */
 #define NTVFS_ASYNC_STATE_ASYNC     (1<<1) /* the backend will answer this one 
later */
 #define NTVFS_ASYNC_STATE_MAY_ASYNC (1<<2) /* the backend is allowed to answer 
async */
+#define NTVFS_ASYNC_STATE_CLOSE     (1<<3) /* the backend session should be 
closed */
 
 /* the ntvfs_async_state structure allows backend functions to 
    delay replying to requests. To use this, the front end must
diff --git a/source4/smb_server/smb2/smb2_server.h 
b/source4/smb_server/smb2/smb2_server.h
index 431add4..ba3021a 100644
--- a/source4/smb_server/smb2/smb2_server.h
+++ b/source4/smb_server/smb2/smb2_server.h
@@ -153,6 +153,11 @@ struct smbsrv_request;
 /* check req->ntvfs->async_states->status and if not OK then send an error 
reply */
 #define SMB2SRV_CHECK_ASYNC_STATUS_ERR_SIMPLE do { \
        req = talloc_get_type(ntvfs->async_states->private_data, struct 
smb2srv_request); \
+       if (ntvfs->async_states->state & NTVFS_ASYNC_STATE_CLOSE || 
NT_STATUS_EQUAL(ntvfs->async_states->status, NT_STATUS_NET_WRITE_FAULT)) { \
+               smbsrv_terminate_connection(req->smb_conn, 
get_friendly_nt_error_msg (ntvfs->async_states->status)); \
+               talloc_free(req); \
+               return; \
+       } \
        req->status = ntvfs->async_states->status; \
        if (NT_STATUS_IS_ERR(ntvfs->async_states->status)) { \
                smb2srv_send_error(req, ntvfs->async_states->status); \
@@ -165,6 +170,11 @@ struct smbsrv_request;
 } while (0)
 #define SMB2SRV_CHECK_ASYNC_STATUS_SIMPLE do { \
        req = talloc_get_type(ntvfs->async_states->private_data, struct 
smb2srv_request); \
+       if (ntvfs->async_states->state & NTVFS_ASYNC_STATE_CLOSE || 
NT_STATUS_EQUAL(ntvfs->async_states->status, NT_STATUS_NET_WRITE_FAULT)) { \
+               smbsrv_terminate_connection(req->smb_conn, 
get_friendly_nt_error_msg (ntvfs->async_states->status)); \
+               talloc_free(req); \
+               return; \
+       } \
        req->status = ntvfs->async_states->status; \
        if (!NT_STATUS_IS_OK(ntvfs->async_states->status)) { \
                smb2srv_send_error(req, ntvfs->async_states->status); \
diff --git a/source4/smb_server/smb_server.h b/source4/smb_server/smb_server.h
index e3e55ae..227c298 100644
--- a/source4/smb_server/smb_server.h
+++ b/source4/smb_server/smb_server.h
@@ -483,6 +483,11 @@ struct loadparm_context;
 /* check req->ntvfs->async_states->status and if not OK then send an error 
reply */
 #define SMBSRV_CHECK_ASYNC_STATUS_ERR_SIMPLE do { \
        req = talloc_get_type(ntvfs->async_states->private_data, struct 
smbsrv_request); \
+       if (ntvfs->async_states->state & NTVFS_ASYNC_STATE_CLOSE || 
NT_STATUS_EQUAL(ntvfs->async_states->status, NT_STATUS_NET_WRITE_FAULT)) { \
+               smbsrv_terminate_connection(req->smb_conn, 
get_friendly_nt_error_msg (ntvfs->async_states->status)); \
+               talloc_free(req); \
+               return; \
+       } \
        if (NT_STATUS_IS_ERR(ntvfs->async_states->status)) { \
                smbsrv_send_error(req, ntvfs->async_states->status); \
                return; \
@@ -494,6 +499,11 @@ struct loadparm_context;
 } while (0)
 #define SMBSRV_CHECK_ASYNC_STATUS_SIMPLE do { \
        req = talloc_get_type(ntvfs->async_states->private_data, struct 
smbsrv_request); \
+       if (ntvfs->async_states->state & NTVFS_ASYNC_STATE_CLOSE || 
NT_STATUS_EQUAL(ntvfs->async_states->status, NT_STATUS_NET_WRITE_FAULT)) { \
+               smbsrv_terminate_connection(req->smb_conn, 
get_friendly_nt_error_msg (ntvfs->async_states->status)); \
+               talloc_free(req); \
+               return; \
+       } \
        if (!NT_STATUS_IS_OK(ntvfs->async_states->status)) { \
                smbsrv_send_error(req, ntvfs->async_states->status); \
                return; \
@@ -506,3 +516,5 @@ struct loadparm_context;
 
 /* zero out some reserved fields in a reply */
 #define SMBSRV_VWV_RESERVED(start, count) memset(req->out.vwv + VWV(start), 0, 
(count)*2)
+
+#include "smb_server/service_smb_proto.h"


-- 
Samba Shared Repository

Reply via email to