The max_buffer value is only evaluated on the first notify
request on a directory handle.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13864
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Mar 29 00:35:39 UTC 2019 on sn-devel-144
^samba3.smb2.create.gentest
^samba3.smb2.create.blob
^samba3.smb2.create.open
^samba3.smb2.create.gentest
^samba3.smb2.create.blob
^samba3.smb2.create.open
-^samba3.smb2.notify.valid-req
^samba3.smb2.notify.rec
^samba3.smb2.durable-open.delete_on_close2
^samba3.smb2.durable-v2-open.app-instance
^samba3.smb2.notify.rec
^samba3.smb2.durable-open.delete_on_close2
^samba3.smb2.durable-v2-open.app-instance
+ uint32_t max_buffer_size;
+
/*
* num_changes == -1 means that we have got a catch-all change, when
* asked we just return NT_STATUS_OK without specific changes.
/*
* num_changes == -1 means that we have got a catch-all change, when
* asked we just return NT_STATUS_OK without specific changes.
- if (max_param == 0 || notify_buf == NULL) {
+ if (notify_buf == NULL) {
reply_fn(req, NT_STATUS_OK, NULL, 0);
return;
}
reply_fn(req, NT_STATUS_OK, NULL, 0);
return;
}
+ max_param = MIN(max_param, notify_buf->max_buffer_size);
+
if (!notify_marshall_changes(notify_buf->num_changes, max_param,
notify_buf->changes, &blob)) {
/*
if (!notify_marshall_changes(notify_buf->num_changes, max_param,
notify_buf->changes, &blob)) {
/*
files_forall(sconn, notify_fsp_cb, &state);
}
files_forall(sconn, notify_fsp_cb, &state);
}
-NTSTATUS change_notify_create(struct files_struct *fsp, uint32_t filter,
+NTSTATUS change_notify_create(struct files_struct *fsp,
+ uint32_t max_buffer_size,
+ uint32_t filter,
bool recursive)
{
size_t len = fsp_fullbasepath(fsp, NULL, 0);
bool recursive)
{
size_t len = fsp_fullbasepath(fsp, NULL, 0);
}
fsp->notify->filter = filter;
fsp->notify->subdir_filter = recursive ? filter : 0;
}
fsp->notify->filter = filter;
fsp->notify->subdir_filter = recursive ? filter : 0;
+ fsp->notify->max_buffer_size = max_buffer_size;
fsp_fullbasepath(fsp, fullpath, sizeof(fullpath));
fsp_fullbasepath(fsp, fullpath, sizeof(fullpath));
if (fsp->notify == NULL) {
if (fsp->notify == NULL) {
- status = change_notify_create(fsp, filter, recursive);
-
+ status = change_notify_create(fsp,
+ max_param_count,
+ filter,
+ recursive);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("change_notify_create returned %s\n",
nt_errstr(status)));
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("change_notify_create returned %s\n",
nt_errstr(status)));
void notify_callback(struct smbd_server_connection *sconn,
void *private_data, struct timespec when,
const struct notify_event *e);
void notify_callback(struct smbd_server_connection *sconn,
void *private_data, struct timespec when,
const struct notify_event *e);
-NTSTATUS change_notify_create(struct files_struct *fsp, uint32_t filter,
+NTSTATUS change_notify_create(struct files_struct *fsp,
+ uint32_t max_buffer_size,
+ uint32_t filter,
bool recursive);
NTSTATUS change_notify_add_request(struct smb_request *req,
uint32_t max_param,
bool recursive);
NTSTATUS change_notify_add_request(struct smb_request *req,
uint32_t max_param,
if (fsp->notify == NULL) {
status = change_notify_create(fsp,
if (fsp->notify == NULL) {
status = change_notify_create(fsp,
+ in_output_buffer_length,
in_completion_filter,
recursive);
if (!NT_STATUS_IS_OK(status)) {
in_completion_filter,
recursive);
if (!NT_STATUS_IS_OK(status)) {