summaryrefslogtreecommitdiff
path: root/source4/smb_server/smb
diff options
context:
space:
mode:
Diffstat (limited to 'source4/smb_server/smb')
-rw-r--r--source4/smb_server/smb/receive.c11
-rw-r--r--source4/smb_server/smb/service.c43
2 files changed, 33 insertions, 21 deletions
diff --git a/source4/smb_server/smb/receive.c b/source4/smb_server/smb/receive.c
index 8430871c19..4eed107d97 100644
--- a/source4/smb_server/smb/receive.c
+++ b/source4/smb_server/smb/receive.c
@@ -30,17 +30,16 @@
/*
send an oplock break request to a client
*/
-BOOL req_send_oplock_break(struct smbsrv_tcon *tcon, uint16_t fnum, uint8_t level)
+NTSTATUS smbsrv_send_oplock_break(void *p, uint16_t fnum, uint8_t level)
{
+ struct smbsrv_tcon *tcon = talloc_get_type(p, struct smbsrv_tcon);
struct smbsrv_request *req;
req = smbsrv_init_request(tcon->smb_conn);
- if (!req) {
- return False;
- }
+ NT_STATUS_HAVE_NO_MEMORY(req);
smbsrv_setup_reply(req, 8, 0);
-
+
SCVAL(req->out.hdr,HDR_COM,SMBlockingX);
SSVAL(req->out.hdr,HDR_TID,tcon->tid);
SSVAL(req->out.hdr,HDR_PID,0xFFFF);
@@ -59,7 +58,7 @@ BOOL req_send_oplock_break(struct smbsrv_tcon *tcon, uint16_t fnum, uint8_t leve
SSVAL(req->out.vwv, VWV(7), 0);
smbsrv_send_reply(req);
- return True;
+ return NT_STATUS_OK;
}
static void switch_message(int type, struct smbsrv_request *req);
diff --git a/source4/smb_server/smb/service.c b/source4/smb_server/smb/service.c
index 49c2384e98..c805d081df 100644
--- a/source4/smb_server/smb/service.c
+++ b/source4/smb_server/smb/service.c
@@ -67,35 +67,45 @@ static NTSTATUS make_connection_snum(struct smbsrv_request *req,
return NT_STATUS_ACCESS_DENIED;
}
- tcon = smbsrv_smb_tcon_new(req->smb_conn);
+ tcon = smbsrv_smb_tcon_new(req->smb_conn, lp_servicename(snum));
if (!tcon) {
DEBUG(0,("Couldn't find free connection.\n"));
return NT_STATUS_INSUFFICIENT_RESOURCES;
}
req->tcon = tcon;
- tcon->service = snum;
-
/* init ntvfs function pointers */
- status = ntvfs_init_connection(req, type);
+ status = ntvfs_init_connection(tcon, snum, type,
+ req->smb_conn->negotiate.protocol,
+ req->smb_conn->connection->event.ctx,
+ req->smb_conn->connection->msg_ctx,
+ req->smb_conn->connection->server_id,
+ &tcon->ntvfs);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("ntvfs_init_connection failed for service %s\n",
- lp_servicename(tcon->service)));
- req->tcon = NULL;
- talloc_free(tcon);
- return status;
+ lp_servicename(snum)));
+ goto failed;
+ }
+
+ status = ntvfs_set_oplock_handler(tcon->ntvfs, smbsrv_send_oplock_break, tcon);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0,("make_connection: NTVFS failed to set the oplock handler!\n"));
+ goto failed;
}
/* Invoke NTVFS connection hook */
status = ntvfs_connect(req, lp_servicename(snum));
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("make_connection: NTVFS make connection failed!\n"));
- req->tcon = NULL;
- talloc_free(tcon);
- return status;
+ goto failed;
}
return NT_STATUS_OK;
+
+failed:
+ req->tcon = NULL;
+ talloc_free(tcon);
+ return status;
}
/****************************************************************************
@@ -155,6 +165,7 @@ static NTSTATUS make_connection(struct smbsrv_request *req,
NTSTATUS smbsrv_tcon_backend(struct smbsrv_request *req, union smb_tcon *con)
{
NTSTATUS status;
+ int snum;
/* can only do bare tcon in share level security */
if (!req->session && lp_security() != SEC_SHARE) {
@@ -183,11 +194,13 @@ NTSTATUS smbsrv_tcon_backend(struct smbsrv_request *req, union smb_tcon *con)
return status;
}
+ snum = req->tcon->ntvfs->config.snum;
+
con->tconx.out.tid = req->tcon->tid;
- con->tconx.out.dev_type = talloc_strdup(req, req->tcon->dev_type);
- con->tconx.out.fs_type = talloc_strdup(req, req->tcon->fs_type);
- con->tconx.out.options = SMB_SUPPORT_SEARCH_BITS | (lp_csc_policy(req->tcon->service) << 2);
- if (lp_msdfs_root(req->tcon->service) && lp_host_msdfs()) {
+ con->tconx.out.dev_type = talloc_strdup(req, req->tcon->ntvfs->dev_type);
+ con->tconx.out.fs_type = talloc_strdup(req, req->tcon->ntvfs->fs_type);
+ con->tconx.out.options = SMB_SUPPORT_SEARCH_BITS | (lp_csc_policy(snum) << 2);
+ if (lp_msdfs_root(snum) && lp_host_msdfs()) {
con->tconx.out.options |= SMB_SHARE_IN_DFS;
}