summaryrefslogtreecommitdiff
path: root/source4/smb_server/smb
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/smb
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/smb')
-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
4 files changed, 34 insertions, 5 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)) {