#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
struct auth_session_info *session_info;
+ struct {
+ bool required;
+ bool active;
+ } smb2_signing;
+
/* some statistics for the management tools */
struct {
/* the time when the session setup started */
/* the sequence number for signing */
uint64_t seq_num;
- struct request_buffer in;
- struct request_buffer out;
+ struct smb_request_buffer in;
+ 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
*/
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;
struct smbsrv_trans_partial {
struct smbsrv_trans_partial *next, *prev;
struct smbsrv_request *req;
- struct smb_trans2 *trans;
uint8_t command;
+ union {
+ struct smb_trans2 *trans;
+ struct smb_nttrans *nttrans;
+ } u;
} *trans_partial;
/* configuration parameters */
struct {
- enum security_types security;
bool nt_status_support;
} config;
struct share_context *share_context;
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;
/* 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; \
} 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; \
/* 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"