summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-05-19 19:28:26 -0700
committerJeremy Allison <jra@samba.org>2010-05-19 19:28:26 -0700
commitaf445935555dc3fab3cefc52b375dd18b8d9bb4c (patch)
treee800d21f0a757a30836c337bd17e1027089b796d /source3
parentae02691200a2fd20b0c227a875a0997b50fc6612 (diff)
downloadsamba-af445935555dc3fab3cefc52b375dd18b8d9bb4c.tar.gz
samba-af445935555dc3fab3cefc52b375dd18b8d9bb4c.tar.bz2
samba-af445935555dc3fab3cefc52b375dd18b8d9bb4c.zip
(Finally) fix bug #7158 - SMB2 connection resets during IOZone tests from 64-bit Vista client
It turns out that the persistent handles are used by the Microsoft redirector to index files on oplock break requests. So even if we don't do durable handles (yet) we must set the persistent handle on create. For now just use the same handle value as we use for volatile. Jeremy.
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/globals.h1
-rw-r--r--source3/smbd/smb2_break.c3
-rw-r--r--source3/smbd/smb2_close.c2
-rw-r--r--source3/smbd/smb2_create.c10
-rw-r--r--source3/smbd/smb2_find.c2
-rw-r--r--source3/smbd/smb2_flush.c2
-rw-r--r--source3/smbd/smb2_getinfo.c2
-rw-r--r--source3/smbd/smb2_ioctl.c2
-rw-r--r--source3/smbd/smb2_lock.c2
-rw-r--r--source3/smbd/smb2_notify.c2
-rw-r--r--source3/smbd/smb2_read.c2
-rw-r--r--source3/smbd/smb2_server.c3
-rw-r--r--source3/smbd/smb2_setinfo.c2
-rw-r--r--source3/smbd/smb2_write.c2
14 files changed, 24 insertions, 13 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index f6dd36ea72..bb4f695010 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -269,6 +269,7 @@ NTSTATUS smbd_smb2_request_done_ex(struct smbd_smb2_request *req,
smbd_smb2_request_done_ex(req, NT_STATUS_OK, body, dyn, __location__)
NTSTATUS smbd_smb2_send_oplock_break(struct smbd_server_connection *sconn,
+ uint64_t file_id_persistent,
uint64_t file_id_volatile,
uint8_t oplock_level);
diff --git a/source3/smbd/smb2_break.c b/source3/smbd/smb2_break.c
index a214da0f26..79b06b1876 100644
--- a/source3/smbd/smb2_break.c
+++ b/source3/smbd/smb2_break.c
@@ -70,7 +70,7 @@ NTSTATUS smbd_smb2_request_process_break(struct smbd_smb2_request *req)
if (req->compat_chain_fsp) {
/* skip check */
- } else if (in_file_id_persistent != 0) {
+ } else if (in_file_id_persistent != in_file_id_volatile) {
return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
}
@@ -271,6 +271,7 @@ void send_break_message_smb2(files_struct *fsp, int level)
status = smbd_smb2_send_oplock_break(fsp->conn->sconn,
(uint64_t)fsp->fnum,
+ (uint64_t)fsp->fnum,
smb2_oplock_level);
if (!NT_STATUS_IS_OK(status)) {
smbd_server_connection_terminate(fsp->conn->sconn,
diff --git a/source3/smbd/smb2_close.c b/source3/smbd/smb2_close.c
index b28fb72979..56e3167e24 100644
--- a/source3/smbd/smb2_close.c
+++ b/source3/smbd/smb2_close.c
@@ -58,7 +58,7 @@ NTSTATUS smbd_smb2_request_process_close(struct smbd_smb2_request *req)
if (req->compat_chain_fsp) {
/* skip check */
- } else if (in_file_id_persistent != 0) {
+ } else if (in_file_id_persistent != in_file_id_volatile) {
return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
}
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
index 02f83cbbe0..65022d5c84 100644
--- a/source3/smbd/smb2_create.c
+++ b/source3/smbd/smb2_create.c
@@ -87,6 +87,7 @@ static NTSTATUS smbd_smb2_create_recv(struct tevent_req *req,
uint64_t *out_allocation_size,
uint64_t *out_end_of_file,
uint32_t *out_file_attributes,
+ uint64_t *out_file_id_persistent,
uint64_t *out_file_id_volatile,
struct smb2_create_blobs *out_context_blobs);
@@ -264,6 +265,7 @@ static void smbd_smb2_request_create_done(struct tevent_req *tsubreq)
uint64_t out_allocation_size = 0;
uint64_t out_end_of_file = 0;
uint32_t out_file_attributes = 0;
+ uint64_t out_file_id_persistent = 0;
uint64_t out_file_id_volatile = 0;
struct smb2_create_blobs out_context_blobs;
DATA_BLOB out_context_buffer;
@@ -295,6 +297,7 @@ static void smbd_smb2_request_create_done(struct tevent_req *tsubreq)
&out_allocation_size,
&out_end_of_file,
&out_file_attributes,
+ &out_file_id_persistent,
&out_file_id_volatile,
&out_context_blobs);
if (!NT_STATUS_IS_OK(status)) {
@@ -356,7 +359,8 @@ static void smbd_smb2_request_create_done(struct tevent_req *tsubreq)
SIVAL(outbody.data, 0x38,
out_file_attributes); /* file attributes */
SIVAL(outbody.data, 0x3C, 0); /* reserved */
- SBVAL(outbody.data, 0x40, 0); /* file id (persistent) */
+ SBVAL(outbody.data, 0x40,
+ out_file_id_persistent); /* file id (persistent) */
SBVAL(outbody.data, 0x48,
out_file_id_volatile); /* file id (volatile) */
SIVAL(outbody.data, 0x50,
@@ -391,6 +395,7 @@ struct smbd_smb2_create_state {
uint64_t out_allocation_size;
uint64_t out_end_of_file;
uint32_t out_file_attributes;
+ uint64_t out_file_id_persistent;
uint64_t out_file_id_volatile;
struct smb2_create_blobs out_context_blobs;
};
@@ -791,6 +796,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
if (state->out_file_attributes == 0) {
state->out_file_attributes = FILE_ATTRIBUTE_NORMAL;
}
+ state->out_file_id_persistent = result->fnum;
state->out_file_id_volatile = result->fnum;
state->out_context_blobs = out_context_blobs;
@@ -809,6 +815,7 @@ static NTSTATUS smbd_smb2_create_recv(struct tevent_req *req,
uint64_t *out_allocation_size,
uint64_t *out_end_of_file,
uint32_t *out_file_attributes,
+ uint64_t *out_file_id_persistent,
uint64_t *out_file_id_volatile,
struct smb2_create_blobs *out_context_blobs)
{
@@ -830,6 +837,7 @@ static NTSTATUS smbd_smb2_create_recv(struct tevent_req *req,
*out_allocation_size = state->out_allocation_size;
*out_end_of_file = state->out_end_of_file;
*out_file_attributes = state->out_file_attributes;
+ *out_file_id_persistent = state->out_file_id_persistent;
*out_file_id_volatile = state->out_file_id_volatile;
*out_context_blobs = state->out_context_blobs;
diff --git a/source3/smbd/smb2_find.c b/source3/smbd/smb2_find.c
index 6690adcb93..9a7738ab76 100644
--- a/source3/smbd/smb2_find.c
+++ b/source3/smbd/smb2_find.c
@@ -114,7 +114,7 @@ NTSTATUS smbd_smb2_request_process_find(struct smbd_smb2_request *req)
if (req->compat_chain_fsp) {
/* skip check */
- } else if (in_file_id_persistent != 0) {
+ } else if (in_file_id_persistent != in_file_id_volatile) {
return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
}
diff --git a/source3/smbd/smb2_flush.c b/source3/smbd/smb2_flush.c
index 561e690582..108f3bd488 100644
--- a/source3/smbd/smb2_flush.c
+++ b/source3/smbd/smb2_flush.c
@@ -57,7 +57,7 @@ NTSTATUS smbd_smb2_request_process_flush(struct smbd_smb2_request *req)
if (req->compat_chain_fsp) {
/* skip check */
- } else if (in_file_id_persistent != 0) {
+ } else if (in_file_id_persistent != in_file_id_volatile) {
return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
}
diff --git a/source3/smbd/smb2_getinfo.c b/source3/smbd/smb2_getinfo.c
index d8963f4e9f..547d9dba16 100644
--- a/source3/smbd/smb2_getinfo.c
+++ b/source3/smbd/smb2_getinfo.c
@@ -97,7 +97,7 @@ NTSTATUS smbd_smb2_request_process_getinfo(struct smbd_smb2_request *req)
if (req->compat_chain_fsp) {
/* skip check */
- } else if (in_file_id_persistent != 0) {
+ } else if (in_file_id_persistent != in_file_id_volatile) {
return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
}
diff --git a/source3/smbd/smb2_ioctl.c b/source3/smbd/smb2_ioctl.c
index c7775b4e4d..672965f470 100644
--- a/source3/smbd/smb2_ioctl.c
+++ b/source3/smbd/smb2_ioctl.c
@@ -88,7 +88,7 @@ NTSTATUS smbd_smb2_request_process_ioctl(struct smbd_smb2_request *req)
} else if (in_file_id_persistent == UINT64_MAX &&
in_file_id_volatile == UINT64_MAX) {
/* without a handle */
- } else if (in_file_id_persistent != 0) {
+ } else if (in_file_id_persistent != in_file_id_volatile) {
return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
}
diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c
index 8e66248790..df5971566d 100644
--- a/source3/smbd/smb2_lock.c
+++ b/source3/smbd/smb2_lock.c
@@ -96,7 +96,7 @@ NTSTATUS smbd_smb2_request_process_lock(struct smbd_smb2_request *req)
if (req->compat_chain_fsp) {
/* skip check */
- } else if (in_file_id_persistent != 0) {
+ } else if (in_file_id_persistent != in_file_id_volatile) {
return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
}
diff --git a/source3/smbd/smb2_notify.c b/source3/smbd/smb2_notify.c
index f3d8077eee..bffa651b1e 100644
--- a/source3/smbd/smb2_notify.c
+++ b/source3/smbd/smb2_notify.c
@@ -85,7 +85,7 @@ NTSTATUS smbd_smb2_request_process_notify(struct smbd_smb2_request *req)
if (req->compat_chain_fsp) {
/* skip check */
- } else if (in_file_id_persistent != 0) {
+ } else if (in_file_id_persistent != in_file_id_volatile) {
return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
}
diff --git a/source3/smbd/smb2_read.c b/source3/smbd/smb2_read.c
index 7a92cdf920..d4c38d65df 100644
--- a/source3/smbd/smb2_read.c
+++ b/source3/smbd/smb2_read.c
@@ -83,7 +83,7 @@ NTSTATUS smbd_smb2_request_process_read(struct smbd_smb2_request *req)
if (req->compat_chain_fsp) {
/* skip check */
- } else if (in_file_id_persistent != 0) {
+ } else if (in_file_id_persistent != in_file_id_volatile) {
return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
}
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 75c818bcda..b081b6a257 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -1448,6 +1448,7 @@ struct smbd_smb2_send_oplock_break_state {
static void smbd_smb2_oplock_break_writev_done(struct tevent_req *subreq);
NTSTATUS smbd_smb2_send_oplock_break(struct smbd_server_connection *sconn,
+ uint64_t file_id_persistent,
uint64_t file_id_volatile,
uint8_t oplock_level)
{
@@ -1488,7 +1489,7 @@ NTSTATUS smbd_smb2_send_oplock_break(struct smbd_server_connection *sconn,
SCVAL(body, 0x02, oplock_level);
SCVAL(body, 0x03, 0); /* reserved */
SIVAL(body, 0x04, 0); /* reserved */
- SBVAL(body, 0x08, 0); /* file_id_persistent */
+ SBVAL(body, 0x08, file_id_persistent);
SBVAL(body, 0x10, file_id_volatile);
subreq = tstream_writev_queue_send(state,
diff --git a/source3/smbd/smb2_setinfo.c b/source3/smbd/smb2_setinfo.c
index 6a40714b1d..3e1bdd2771 100644
--- a/source3/smbd/smb2_setinfo.c
+++ b/source3/smbd/smb2_setinfo.c
@@ -88,7 +88,7 @@ NTSTATUS smbd_smb2_request_process_setinfo(struct smbd_smb2_request *req)
if (req->compat_chain_fsp) {
/* skip check */
- } else if (in_file_id_persistent != 0) {
+ } else if (in_file_id_persistent != in_file_id_volatile) {
return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
}
diff --git a/source3/smbd/smb2_write.c b/source3/smbd/smb2_write.c
index 7813836e65..ae98c812e9 100644
--- a/source3/smbd/smb2_write.c
+++ b/source3/smbd/smb2_write.c
@@ -96,7 +96,7 @@ NTSTATUS smbd_smb2_request_process_write(struct smbd_smb2_request *req)
if (req->compat_chain_fsp) {
/* skip check */
- } else if (in_file_id_persistent != 0) {
+ } else if (in_file_id_persistent != in_file_id_volatile) {
return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
}