mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
smbd: Simplify sending oplock_break_message
This is fixed length of 33 bytes, no need to talloc Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
4fe0808ebe
commit
8f1cc217a8
@ -1995,7 +1995,8 @@ NTSTATUS send_break_message(struct messaging_context *msg_ctx,
|
|||||||
.break_to = break_to,
|
.break_to = break_to,
|
||||||
};
|
};
|
||||||
enum ndr_err_code ndr_err;
|
enum ndr_err_code ndr_err;
|
||||||
DATA_BLOB blob;
|
uint8_t msgbuf[33];
|
||||||
|
DATA_BLOB blob = {.data = msgbuf, .length = sizeof(msgbuf)};
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
if (DEBUGLVL(10)) {
|
if (DEBUGLVL(10)) {
|
||||||
@ -2005,9 +2006,8 @@ NTSTATUS send_break_message(struct messaging_context *msg_ctx,
|
|||||||
NDR_PRINT_DEBUG(oplock_break_message, &msg);
|
NDR_PRINT_DEBUG(oplock_break_message, &msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
ndr_err = ndr_push_struct_blob(
|
ndr_err = ndr_push_struct_into_fixed_blob(
|
||||||
&blob,
|
&blob,
|
||||||
talloc_tos(),
|
|
||||||
&msg,
|
&msg,
|
||||||
(ndr_push_flags_fn_t)ndr_push_oplock_break_message);
|
(ndr_push_flags_fn_t)ndr_push_oplock_break_message);
|
||||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||||
@ -2016,9 +2016,10 @@ NTSTATUS send_break_message(struct messaging_context *msg_ctx,
|
|||||||
return ndr_map_error2ntstatus(ndr_err);
|
return ndr_map_error2ntstatus(ndr_err);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = messaging_send(
|
status = messaging_send(msg_ctx,
|
||||||
msg_ctx, exclusive->pid, MSG_SMB_BREAK_REQUEST, &blob);
|
exclusive->pid,
|
||||||
TALLOC_FREE(blob.data);
|
MSG_SMB_BREAK_REQUEST,
|
||||||
|
&blob);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
DEBUG(3, ("Could not send oplock break message: %s\n",
|
DEBUG(3, ("Could not send oplock break message: %s\n",
|
||||||
nt_errstr(status)));
|
nt_errstr(status)));
|
||||||
|
@ -829,7 +829,7 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
|
|||||||
struct server_id src,
|
struct server_id src,
|
||||||
DATA_BLOB *data)
|
DATA_BLOB *data)
|
||||||
{
|
{
|
||||||
struct oplock_break_message *msg = NULL;
|
struct oplock_break_message msg;
|
||||||
enum ndr_err_code ndr_err;
|
enum ndr_err_code ndr_err;
|
||||||
files_struct *fsp;
|
files_struct *fsp;
|
||||||
bool use_kernel;
|
bool use_kernel;
|
||||||
@ -844,34 +844,22 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
|
|||||||
|
|
||||||
smb_vfs_assert_allowed();
|
smb_vfs_assert_allowed();
|
||||||
|
|
||||||
msg = talloc(talloc_tos(), struct oplock_break_message);
|
ndr_err = ndr_pull_struct_blob_all_noalloc(
|
||||||
if (msg == NULL) {
|
data, &msg, (ndr_pull_flags_fn_t)ndr_pull_oplock_break_message);
|
||||||
DBG_WARNING("talloc failed\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ndr_err = ndr_pull_struct_blob_all(
|
|
||||||
data,
|
|
||||||
msg,
|
|
||||||
msg,
|
|
||||||
(ndr_pull_flags_fn_t)ndr_pull_oplock_break_message);
|
|
||||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||||
DBG_DEBUG("ndr_pull_oplock_break_message failed: %s\n",
|
DBG_DEBUG("ndr_pull_oplock_break_message failed: %s\n",
|
||||||
ndr_errstr(ndr_err));
|
ndr_errstr(ndr_err));
|
||||||
TALLOC_FREE(msg);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (DEBUGLEVEL >= 10) {
|
if (DEBUGLEVEL >= 10) {
|
||||||
struct server_id_buf buf;
|
struct server_id_buf buf;
|
||||||
DBG_DEBUG("Got break message from %s\n",
|
DBG_DEBUG("Got break message from %s\n",
|
||||||
server_id_str_buf(src, &buf));
|
server_id_str_buf(src, &buf));
|
||||||
NDR_PRINT_DEBUG(oplock_break_message, msg);
|
NDR_PRINT_DEBUG(oplock_break_message, &msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
break_to = msg->break_to;
|
break_to = msg.break_to;
|
||||||
fsp = initial_break_processing(sconn, msg->id, msg->share_file_id);
|
fsp = initial_break_processing(sconn, msg.id, msg.share_file_id);
|
||||||
|
|
||||||
TALLOC_FREE(msg);
|
|
||||||
|
|
||||||
if (fsp == NULL) {
|
if (fsp == NULL) {
|
||||||
/* We hit a race here. Break messages are sent, and before we
|
/* We hit a race here. Break messages are sent, and before we
|
||||||
|
Loading…
Reference in New Issue
Block a user