summaryrefslogtreecommitdiff
path: root/source4/smb_server
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-03-16 18:54:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:57:32 -0500
commitd3087451c4ec25171ba956fe2cd4e1d0f64f7edc (patch)
tree9fc7f4b924a84789db962720ba989d881a4a277f /source4/smb_server
parenta949db7c6d4bd35df59ba066111e6566172d4814 (diff)
downloadsamba-d3087451c4ec25171ba956fe2cd4e1d0f64f7edc.tar.gz
samba-d3087451c4ec25171ba956fe2cd4e1d0f64f7edc.tar.bz2
samba-d3087451c4ec25171ba956fe2cd4e1d0f64f7edc.zip
r14487: split smbsrv_request into two parts, one will be moved to ntvfs_request
but I don't to get the commit to large, to I'll do this tomorrow... metze (This used to be commit 10e627032d7d04f1ebf6efed248c426614f5aa6f)
Diffstat (limited to 'source4/smb_server')
-rw-r--r--source4/smb_server/smb/receive.c10
-rw-r--r--source4/smb_server/smb/reply.c2
-rw-r--r--source4/smb_server/smb/request.c4
-rw-r--r--source4/smb_server/smb/service.c23
-rw-r--r--source4/smb_server/smb_server.h32
5 files changed, 59 insertions, 12 deletions
diff --git a/source4/smb_server/smb/receive.c b/source4/smb_server/smb/receive.c
index 2abfda7e36..44e385dc73 100644
--- a/source4/smb_server/smb/receive.c
+++ b/source4/smb_server/smb/receive.c
@@ -143,9 +143,7 @@ NTSTATUS smbsrv_recv_smb_request(void *private, DATA_BLOB blob)
return NT_STATUS_OK;
}
- req->flags = CVAL(req->in.hdr, HDR_FLG);
req->flags2 = SVAL(req->in.hdr, HDR_FLG2);
- req->smbpid = SVAL(req->in.hdr, HDR_PID);
if (!smbsrv_signing_check_incoming(req)) {
smbsrv_send_error(req, NT_STATUS_ACCESS_DENIED);
@@ -554,6 +552,14 @@ static void switch_message(int type, struct smbsrv_request *req)
return;
}
+/* TODO: remove this stuff */
+req->smbpid = SVAL(req->in.hdr, HDR_PID);
+req->smbmid = SVAL(req->in.hdr, HDR_MID);
+req->statistics.request_time = req->request_time;
+if (req->session) req->session_info = req->session->session_info;
+if (req->tcon) req->ctx = req->tcon->ntvfs;
+/* TODO: end */
+
smb_messages[type].fn(req);
}
diff --git a/source4/smb_server/smb/reply.c b/source4/smb_server/smb/reply.c
index cc625b6d03..7171618f8c 100644
--- a/source4/smb_server/smb/reply.c
+++ b/source4/smb_server/smb/reply.c
@@ -1208,8 +1208,10 @@ void smbsrv_reply_exit(struct smbsrv_request *req)
for (tcon=req->smb_conn->smb_tcons.list;tcon;tcon=tcon->next) {
req->tcon = tcon;
+req->ctx = req->tcon->ntvfs;
status = ntvfs_exit(req);
req->tcon = NULL;
+req->ctx = NULL;
if (!NT_STATUS_IS_OK(status)) {
smbsrv_send_error(req, status);
return;
diff --git a/source4/smb_server/smb/request.c b/source4/smb_server/smb/request.c
index cc72b412e7..1a3ff23b93 100644
--- a/source4/smb_server/smb/request.c
+++ b/source4/smb_server/smb/request.c
@@ -40,13 +40,11 @@ struct smbsrv_request *smbsrv_init_request(struct smbsrv_connection *smb_conn)
{
struct smbsrv_request *req;
- req = talloc(smb_conn, struct smbsrv_request);
+ req = talloc_zero(smb_conn, struct smbsrv_request);
if (!req) {
return NULL;
}
- ZERO_STRUCTP(req);
-
/* setup the request context */
req->smb_conn = smb_conn;
diff --git a/source4/smb_server/smb/service.c b/source4/smb_server/smb/service.c
index dcd91f1917..76607a0e0f 100644
--- a/source4/smb_server/smb/service.c
+++ b/source4/smb_server/smb/service.c
@@ -47,6 +47,21 @@ static int find_service(const char *service)
return iService;
}
+static struct socket_address *smbsrv_get_my_addr(void *p, TALLOC_CTX *mem_ctx)
+{
+ struct smbsrv_connection *smb_conn = talloc_get_type(p,
+ struct smbsrv_connection);
+
+ return socket_get_my_addr(smb_conn->connection->socket, mem_ctx);
+}
+
+static struct socket_address *smbsrv_get_peer_addr(void *p, TALLOC_CTX *mem_ctx)
+{
+ struct smbsrv_connection *smb_conn = talloc_get_type(p,
+ struct smbsrv_connection);
+
+ return socket_get_peer_addr(smb_conn->connection->socket, mem_ctx);
+}
/****************************************************************************
Make a connection, given the snum to connect to, and the vuser of the
@@ -93,6 +108,14 @@ static NTSTATUS make_connection_snum(struct smbsrv_request *req,
goto failed;
}
+ status = ntvfs_set_addr_callbacks(tcon->ntvfs, smbsrv_get_my_addr, smbsrv_get_peer_addr, req->smb_conn);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0,("make_connection: NTVFS failed to set the oplock handler!\n"));
+ goto failed;
+ }
+
+ req->ctx = tcon->ntvfs;
+
/* Invoke NTVFS connection hook */
status = ntvfs_connect(req, lp_servicename(snum));
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/smb_server/smb_server.h b/source4/smb_server/smb_server.h
index 2b06eb9d5b..ab110890d0 100644
--- a/source4/smb_server/smb_server.h
+++ b/source4/smb_server/smb_server.h
@@ -134,7 +134,7 @@ struct smbsrv_tcon {
functions */
struct smbsrv_request {
/* the smbsrv_connection needs a list of requests queued for send */
- struct smbsrv_request_foo *next, *prev;
+ struct smbsrv_request *next, *prev;
/* the server_context contains all context specific to this SMB socket */
struct smbsrv_connection *smb_conn;
@@ -148,11 +148,8 @@ struct smbsrv_request {
/* a set of flags to control usage of the request. See REQ_CONTROL_* */
unsigned control_flags;
- /* the smb pid is needed for locking contexts */
- uint16_t smbpid;
-
/* the flags from the SMB request, in raw form (host byte order) */
- uint16_t flags, flags2;
+ uint16_t flags2;
/* the system time when the request arrived */
struct timeval request_time;
@@ -167,11 +164,32 @@ struct smbsrv_request {
/* the sequence number for signing */
uint64_t seq_num;
+ struct request_buffer in;
+ struct request_buffer out;
+
+ /*
+ * the following elemets will be part of a future ntvfs_request struct
+ */
+
+ /* the ntvfs_context this requests belongs to */
+ struct ntvfs_context *ctx;
+
/* ntvfs per request async states */
struct ntvfs_async_state *async_states;
- struct request_buffer in;
- struct request_buffer out;
+ /* the session_info, with security_token and maybe delegated credentials */
+ struct auth_session_info *session_info;
+
+ /* the smb pid is needed for locking contexts */
+ uint16_t smbpid;
+
+uint16_t smbmid;
+
+ /* some statictics for the management tools */
+ struct {
+ /* the system time when the request arrived */
+ struct timeval request_time;
+ } statistics;
};
/* this contains variables that should be used in % substitutions for