s4-smb_server No longer follow the security=share smb.conf directive
[kai/samba.git] / source4 / smb_server / smb_server.h
index 4676fc3e9cfb1f8ffe80a4f60c70be735340223b..ab555445a3371276ae5834c66a87609c1fe77450 100644 (file)
 
 #include "libcli/raw/request.h"
 #include "libcli/raw/interfaces.h"
-#include "lib/events/events.h"
 #include "lib/socket/socket.h"
-#include "lib/util/dlinklist.h"
+#include "libds/common/roles.h"
+#include "../lib/util/dlinklist.h"
+#include "../librpc/gen_ndr/nbt.h"
+
+struct tevent_context;
 
 /*
   this header declares the core context structures associated with smb
@@ -263,8 +266,6 @@ struct smbsrv_request {
        struct smb_request_buffer out;
 };
 
-enum security_types {SEC_SHARE,SEC_USER};
-
 /* smb server context structure. This should contain all the state
  * information associated with a SMB server connection 
  */
@@ -298,7 +299,7 @@ struct smbsrv_connection {
                enum protocol_types protocol;
 
                /* authentication context for multi-part negprot */
-               struct auth_context *auth_context;
+               struct auth4_context *auth_context;
        
                /* reference to the kerberos keytab, or machine trust account */
                struct cli_credentials *server_credentials;
@@ -369,7 +370,6 @@ struct smbsrv_connection {
 
        /* configuration parameters */
        struct {
-               enum security_types security;
                bool nt_status_support;
        } config;
 
@@ -386,15 +386,18 @@ struct smbsrv_connection {
        struct loadparm_context *lp_ctx;
 
        bool smb2_signing_required;
+
+       uint64_t highest_smb2_seqnum;
 };
 
 struct model_ops;
 struct loadparm_context;
 
-NTSTATUS smbsrv_add_socket(struct event_context *event_context,
+NTSTATUS smbsrv_add_socket(TALLOC_CTX *mem_ctx,
+                          struct tevent_context *event_context,
                           struct loadparm_context *lp_ctx,
-                              const struct model_ops *model_ops,
-                              const char *address);
+                          const struct model_ops *model_ops,
+                          const char *address);
 
 struct loadparm_context;
 
@@ -481,6 +484,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; \
@@ -492,6 +500,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; \
@@ -504,3 +517,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"