This indicates if the server is expecting a response to the oplock/lease
break sent to the clients. The need_ack argument will be further used in
the upcoming patches.
Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
struct smbXsrv_session *session,
struct smbXsrv_tcon *tcon,
struct smbXsrv_open *op,
struct smbXsrv_session *session,
struct smbXsrv_tcon *tcon,
struct smbXsrv_open *op,
+ uint8_t oplock_level, bool need_ack);
NTSTATUS smbd_smb2_send_lease_break(struct smbXsrv_connection *xconn,
uint16_t new_epoch,
NTSTATUS smbd_smb2_send_lease_break(struct smbXsrv_connection *xconn,
uint16_t new_epoch,
struct smb2_lease_key *lease_key,
uint32_t current_lease_state,
struct smb2_lease_key *lease_key,
uint32_t current_lease_state,
- uint32_t new_lease_state);
+ uint32_t new_lease_state, bool need_ack);
NTSTATUS smbd_smb2_request_pending_queue(struct smbd_smb2_request *req,
struct tevent_req *subreq,
NTSTATUS smbd_smb2_request_pending_queue(struct smbd_smb2_request *req,
struct tevent_req *subreq,
status = smbd_smb2_send_lease_break(xconn,
state->new_epoch,
status = smbd_smb2_send_lease_break(xconn,
state->new_epoch,
&state->lease_key,
state->break_from,
&state->lease_key,
state->break_from,
+ state->break_to,
+ (state->break_flags));
TALLOC_FREE(state);
if (!NT_STATUS_IS_OK(status)) {
smbd_server_connection_terminate(xconn,
TALLOC_FREE(state);
if (!NT_STATUS_IS_OK(status)) {
smbd_server_connection_terminate(xconn,
(unsigned int)break_to ));
if (fsp->oplock_type == LEASE_OPLOCK) {
(unsigned int)break_to ));
if (fsp->oplock_type == LEASE_OPLOCK) {
- uint32_t break_flags = 0;
-
- if (fsp->lease->lease.lease_state != SMB2_LEASE_NONE) {
- break_flags = SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED;
- }
+ bool need_ack = (fsp->lease->lease.lease_state != SMB2_LEASE_NONE);
if (fsp->lease->lease.lease_version > 1) {
new_epoch = fsp->lease->lease.lease_epoch;
if (fsp->lease->lease.lease_version > 1) {
new_epoch = fsp->lease->lease.lease_epoch;
- status = smbd_smb2_send_lease_break(xconn, new_epoch, break_flags,
+ status = smbd_smb2_send_lease_break(xconn,
+ new_epoch,
&fsp->lease->lease.lease_key,
&fsp->lease->lease.lease_key,
+ break_from, break_to, need_ack);
} else {
uint8_t smb2_oplock_level;
} else {
uint8_t smb2_oplock_level;
+ bool need_ack = true;
+
+ if (break_from == SMB2_OPLOCK_LEVEL_II) {
+ need_ack = false;
+ }
+
smb2_oplock_level = (break_to & SMB2_LEASE_READ) ?
SMB2_OPLOCK_LEVEL_II : SMB2_OPLOCK_LEVEL_NONE;
smb2_oplock_level = (break_to & SMB2_LEASE_READ) ?
SMB2_OPLOCK_LEVEL_II : SMB2_OPLOCK_LEVEL_NONE;
- status = smbd_smb2_send_oplock_break(xconn,
- session,
- fsp->conn->tcon,
- fsp->op,
- smb2_oplock_level);
+ status = smbd_smb2_send_oplock_break(xconn, session,
+ fsp->conn->tcon, fsp->op,
+ smb2_oplock_level, need_ack);
}
if (!NT_STATUS_IS_OK(status)) {
smbd_server_connection_terminate(xconn,
}
if (!NT_STATUS_IS_OK(status)) {
smbd_server_connection_terminate(xconn,
struct smbXsrv_session *session,
struct smbXsrv_tcon *tcon,
struct smbXsrv_open *op,
struct smbXsrv_session *session,
struct smbXsrv_tcon *tcon,
struct smbXsrv_open *op,
+ uint8_t oplock_level,
+ bool need_ack)
return smbd_smb2_send_break(xconn, NULL, NULL, body, sizeof(body),
false, /* Not lease */
return smbd_smb2_send_break(xconn, NULL, NULL, body, sizeof(body),
false, /* Not lease */
}
NTSTATUS smbd_smb2_send_lease_break(struct smbXsrv_connection *xconn,
uint16_t new_epoch,
}
NTSTATUS smbd_smb2_send_lease_break(struct smbXsrv_connection *xconn,
uint16_t new_epoch,
struct smb2_lease_key *lease_key,
uint32_t current_lease_state,
struct smb2_lease_key *lease_key,
uint32_t current_lease_state,
- uint32_t new_lease_state)
+ uint32_t new_lease_state,
+ bool need_ack)
+ uint32_t lease_flags = 0;
+
+ if (need_ack == true) {
+ lease_flags = SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED;
+ }
SSVAL(body, 0x00, sizeof(body));
SSVAL(body, 0x02, new_epoch);
SSVAL(body, 0x00, sizeof(body));
SSVAL(body, 0x02, new_epoch);
return smbd_smb2_send_break(xconn, NULL, NULL, body, sizeof(body),
true, /* Is Lease */
return smbd_smb2_send_break(xconn, NULL, NULL, body, sizeof(body),
true, /* Is Lease */
}
static bool is_smb2_recvfile_write(struct smbd_smb2_request_read_state *state)
}
static bool is_smb2_recvfile_write(struct smbd_smb2_request_read_state *state)