summaryrefslogtreecommitdiffstats
path: root/source3/smbd
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-04-11 00:43:46 +0200
committerJeremy Allison <jra@samba.org>2014-04-11 21:41:08 +0200
commit796874912d9935e202b8c767ca33d557dce9c43e (patch)
tree9683c499e945f70fe1d83e47e029d7b15526778b /source3/smbd
parent77b6860668437bbb3bb66f57f75ea4fc378de49b (diff)
downloadsamba-796874912d9935e202b8c767ca33d557dce9c43e.tar.gz
samba-796874912d9935e202b8c767ca33d557dce9c43e.tar.xz
samba-796874912d9935e202b8c767ca33d557dce9c43e.zip
s3:smb2_server: use the same logic to avoid recvfile() for IPC/PRINT shares
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/smb2_server.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 3c46efd7e60..13626f3cb55 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -2841,7 +2841,19 @@ static size_t get_min_receive_file_size(struct smbd_smb2_request *smb2_req)
static bool is_smb2_recvfile_write(struct smbd_smb2_request_read_state *state)
{
+ NTSTATUS status;
uint32_t flags;
+ uint64_t file_id_persistent;
+ uint64_t file_id_volatile;
+ struct smbXsrv_open *op = NULL;
+ struct files_struct *fsp = NULL;
+ const uint8_t *body = NULL;
+
+ /*
+ * This is only called with a pktbuf
+ * of at least SMBD_SMB2_SHORT_RECEIVEFILE_WRITE_LEN
+ * bytes
+ */
if (IVAL(state->pktbuf, 0) == SMB2_TF_MAGIC) {
/* Transform header. Cannot recvfile. */
@@ -2873,6 +2885,35 @@ static bool is_smb2_recvfile_write(struct smbd_smb2_request_read_state *state)
return false;
}
+ body = &state->pktbuf[SMB2_HDR_BODY];
+
+ file_id_persistent = BVAL(body, 0x10);
+ file_id_volatile = BVAL(body, 0x18);
+
+ status = smb2srv_open_lookup(state->req->sconn->conn,
+ file_id_persistent,
+ file_id_volatile,
+ 0, /* now */
+ &op);
+ if (!NT_STATUS_IS_OK(status)) {
+ return false;
+ }
+
+ fsp = op->compat;
+ if (fsp == NULL) {
+ return false;
+ }
+ if (fsp->conn == NULL) {
+ return false;
+ }
+
+ if (IS_IPC(fsp->conn)) {
+ return false;
+ }
+ if (IS_PRINT(fsp->conn)) {
+ return false;
+ }
+
DEBUG(10,("Doing recvfile write len = %u\n",
(unsigned int)(state->pktlen -
SMBD_SMB2_SHORT_RECEIVEFILE_WRITE_LEN)));