summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/oplock.c3
-rw-r--r--source3/smbd/process.c2
-rw-r--r--source3/smbd/smb2_server.c5
-rw-r--r--source3/smbd/smb2_sesssetup.c4
-rw-r--r--source3/smbd/vfs.c22
5 files changed, 19 insertions, 17 deletions
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index f2d39b808a..ed4de13e8d 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -151,6 +151,9 @@ static void downgrade_file_oplock(files_struct *fsp)
sconn->oplocks.level_II_open++;
fsp->sent_oplock_break = NO_BREAK_SENT;
+ flush_write_cache(fsp, OPLOCK_RELEASE_FLUSH);
+ delete_write_cache(fsp);
+
TALLOC_FREE(fsp->oplock_timeout);
}
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 45bde2f085..d01bf39f08 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -201,7 +201,7 @@ out:
SMB_PERFCOUNT_END(pcd);
smbd_unlock_socket(sconn);
- return true;
+ return (ret > 0);
}
/*******************************************************************
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 58eddee54a..f7798fadd7 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -1910,11 +1910,6 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req)
if (x != NULL) {
signing_required = x->global->signing_required;
encryption_required = x->global->encryption_required;
-
- if (opcode == SMB2_OP_SESSSETUP &&
- x->global->channels[0].signing_key.length) {
- signing_required = true;
- }
}
req->do_signing = false;
diff --git a/source3/smbd/smb2_sesssetup.c b/source3/smbd/smb2_sesssetup.c
index e911945fb6..a82d696027 100644
--- a/source3/smbd/smb2_sesssetup.c
+++ b/source3/smbd/smb2_sesssetup.c
@@ -422,6 +422,10 @@ static NTSTATUS smbd_smb2_reauth_generic_return(struct smbXsrv_session *session,
conn_clear_vuid_caches(conn->sconn, session->compat->vuid);
+ if (security_session_user_level(session_info, NULL) >= SECURITY_USER) {
+ smb2req->do_signing = true;
+ }
+
*out_session_id = session->global->session_wire_id;
return NT_STATUS_OK;
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 4a0588e6f5..cdd5042d1f 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -580,6 +580,10 @@ int vfs_allocate_file_space(files_struct *fsp, uint64_t len)
return 0;
}
+ if (ret == -1 && errno == ENOSPC) {
+ return -1;
+ }
+
len -= fsp->fsp_name->st.st_ex_size;
len /= 1024; /* Len is now number of 1k blocks needed. */
space_avail = get_dfree_info(conn, fsp->fsp_name->base_name, false,
@@ -634,7 +638,7 @@ int vfs_set_filelen(files_struct *fsp, off_t len)
fails. Needs to be outside of the default version of SMB_VFS_FALLOCATE
as this is also called from the default SMB_VFS_FTRUNCATE code.
Always extends the file size.
- Returns 0 on success, errno on failure.
+ Returns 0 on success, -1 on failure.
****************************************************************************/
#define SPARSE_BUF_WRITE_SIZE (32*1024)
@@ -648,7 +652,7 @@ int vfs_slow_fallocate(files_struct *fsp, off_t offset, off_t len)
sparse_buf = SMB_CALLOC_ARRAY(char, SPARSE_BUF_WRITE_SIZE);
if (!sparse_buf) {
errno = ENOMEM;
- return ENOMEM;
+ return -1;
}
}
@@ -657,10 +661,12 @@ int vfs_slow_fallocate(files_struct *fsp, off_t offset, off_t len)
pwrite_ret = SMB_VFS_PWRITE(fsp, sparse_buf, curr_write_size, offset + total);
if (pwrite_ret == -1) {
+ int saved_errno = errno;
DEBUG(10,("vfs_slow_fallocate: SMB_VFS_PWRITE for file "
"%s failed with error %s\n",
- fsp_str_dbg(fsp), strerror(errno)));
- return errno;
+ fsp_str_dbg(fsp), strerror(saved_errno)));
+ errno = saved_errno;
+ return -1;
}
total += pwrite_ret;
}
@@ -718,9 +724,7 @@ int vfs_fill_sparse(files_struct *fsp, off_t len)
* return ENOTSUP or EINVAL in cases like that. */
ret = SMB_VFS_FALLOCATE(fsp, VFS_FALLOCATE_EXTEND_SIZE,
offset, num_to_write);
- if (ret == ENOSPC) {
- errno = ENOSPC;
- ret = -1;
+ if (ret == -1 && errno == ENOSPC) {
goto out;
}
if (ret == 0) {
@@ -731,10 +735,6 @@ int vfs_fill_sparse(files_struct *fsp, off_t len)
}
ret = vfs_slow_fallocate(fsp, offset, num_to_write);
- if (ret != 0) {
- errno = ret;
- ret = -1;
- }
out: