From: Volker Lendecke Date: Fri, 24 Jun 2016 14:27:34 +0000 (+0200) Subject: smbd: Store notify filters in fsp->notify X-Git-Tag: tdb-1.3.10~316 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cf7fea2312c159764402f1bcb966f97904fb2132;p=thirdparty%2Fsamba.git smbd: Store notify filters in fsp->notify When notifyd crashes, it will be restarted. We need to restore the filters with notifyd Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index c2d5d40793b..4837ca5bda4 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -32,6 +32,12 @@ struct notify_change_event { }; struct notify_change_buf { + /* + * Filters for reinitializing after notifyd has been restarted + */ + uint32_t filter; + uint32_t subdir_filter; + /* * If no requests are pending, changes are queued here. Simple array, * we only append. @@ -275,7 +281,6 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32_t filter, { size_t len = fsp_fullbasepath(fsp, NULL, 0); char fullpath[len+1]; - uint32_t subdir_filter; NTSTATUS status = NT_STATUS_NOT_IMPLEMENTED; if (fsp->notify != NULL) { @@ -288,6 +293,8 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32_t filter, DEBUG(0, ("talloc failed\n")); return NT_STATUS_NO_MEMORY; } + fsp->notify->filter = filter; + fsp->notify->subdir_filter = recursive ? filter : 0; fsp_fullbasepath(fsp, fullpath, sizeof(fullpath)); @@ -298,11 +305,11 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32_t filter, fullpath[len-2] = '\0'; } - subdir_filter = recursive ? filter : 0; - - if ((filter != 0) || (subdir_filter != 0)) { + if ((fsp->notify->filter != 0) || + (fsp->notify->subdir_filter != 0)) { status = notify_add(fsp->conn->sconn->notify_ctx, - fullpath, filter, subdir_filter, fsp); + fullpath, fsp->notify->filter, + fsp->notify->subdir_filter, fsp); } return status;