void smb2srv_lock_recv(struct smb2srv_request *req) { union smb_lock *io; int i; SMB2SRV_CHECK_BODY_SIZE(req, 0x30, false); SMB2SRV_TALLOC_IO_PTR(io, union smb_lock); SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_lock_send, NTVFS_ASYNC_STATE_MAY_ASYNC); io->smb2.level = RAW_LOCK_SMB2; io->smb2.in.lock_count = SVAL(req->in.body, 0x02); io->smb2.in.reserved = IVAL(req->in.body, 0x04); io->smb2.in.file.ntvfs = smb2srv_pull_handle(req, req->in.body, 0x08); if (req->in.body_size < 24 + 24*(uint64_t)io->smb2.in.lock_count) { DEBUG(0,("%s: lock buffer too small\n", __location__)); smb2srv_send_error(req, NT_STATUS_FOOBAR); return; } io->smb2.in.locks = talloc_array(io, struct smb2_lock_element, io->smb2.in.lock_count); if (io->smb2.in.locks == NULL) { smb2srv_send_error(req, NT_STATUS_NO_MEMORY); return; } for (i=0;i<io->smb2.in.lock_count;i++) { io->smb2.in.locks[i].offset = BVAL(req->in.body, 24 + i*24); io->smb2.in.locks[i].length = BVAL(req->in.body, 32 + i*24); io->smb2.in.locks[i].flags = IVAL(req->in.body, 40 + i*24); io->smb2.in.locks[i].reserved = IVAL(req->in.body, 44 + i*24); } SMB2SRV_CHECK_FILE_HANDLE(io->smb2.in.file.ntvfs); SMB2SRV_CALL_NTVFS_BACKEND(ntvfs_lock(req->ntvfs, io)); }
void smb2srv_break_recv(struct smb2srv_request *req) { union smb_lock *io; SMB2SRV_CHECK_BODY_SIZE(req, 0x18, false); SMB2SRV_TALLOC_IO_PTR(io, union smb_lock); SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_break_send, NTVFS_ASYNC_STATE_MAY_ASYNC); io->smb2_break.level = RAW_LOCK_SMB2_BREAK; io->smb2_break.in.oplock_level = CVAL(req->in.body, 0x02); io->smb2_break.in.reserved = CVAL(req->in.body, 0x03); io->smb2_break.in.reserved2 = IVAL(req->in.body, 0x04); io->smb2_break.in.file.ntvfs = smb2srv_pull_handle(req, req->in.body, 0x08); SMB2SRV_CHECK_FILE_HANDLE(io->smb2_break.in.file.ntvfs); SMB2SRV_CALL_NTVFS_BACKEND(ntvfs_lock(req->ntvfs, io)); }
void smb2srv_lock_recv(struct smb2srv_request *req) { union smb_lock *io; SMB2SRV_CHECK_BODY_SIZE(req, 0x30, False); SMB2SRV_TALLOC_IO_PTR(io, union smb_lock); SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_lock_send, NTVFS_ASYNC_STATE_MAY_ASYNC); io->smb2.level = RAW_LOCK_SMB2; io->smb2.in.unknown1 = SVAL(req->in.body, 0x02); io->smb2.in.unknown2 = IVAL(req->in.body, 0x04); io->smb2.in.file.ntvfs = smb2srv_pull_handle(req, req->in.body, 0x08); io->smb2.in.offset = BVAL(req->in.body, 0x18); io->smb2.in.count = BVAL(req->in.body, 0x20); io->smb2.in.unknown5 = IVAL(req->in.body, 0x24); io->smb2.in.flags = IVAL(req->in.body, 0x28); SMB2SRV_CHECK_FILE_HANDLE(io->smb2.in.file.ntvfs); SMB2SRV_CALL_NTVFS_BACKEND(ntvfs_lock(req->ntvfs, io)); }