change_notify_create seems to want to ignore the status from SMB_VFS_NOTIFY_WATCH but it can leak through

Volker Lendecke Volker.Lendecke at SerNet.DE
Tue Jan 14 14:50:18 MST 2014


On Thu, Dec 05, 2013 at 09:27:03AM -0800, Richard Sharpe wrote:
> Hi folks,
> 
> In source3/smbd/notify.c:change_notify_create we see this:
> 
>         if (fsp->conn->sconn->sys_notify_ctx != NULL) {
>                 void *sys_notify_handle = NULL;
> 
>                 status = SMB_VFS_NOTIFY_WATCH(
>                         fsp->conn, fsp->conn->sconn->sys_notify_ctx,
>                         fullpath, &filter, &subdir_filter,
>                         sys_notify_callback, fsp, &sys_notify_handle);
> 
>                 if (NT_STATUS_IS_OK(status)) {
>                         talloc_steal(fsp->notify, sys_notify_handle);
>                 }
>         }
> 
>         if ((filter != 0) || (subdir_filter != 0)) {
>                 status = notify_add(fsp->conn->sconn->notify_ctx,
>                                     fullpath, filter, subdir_filter,
>                                     notify_callback, fsp);
>         }
>         TALLOC_FREE(fullpath);
>         return status;
> 
> In earlier versions there was an explicit comment about ignoring the
> return from SMB_VFS_NOTIFY_WATCH (or sys_notify_watch), however, if
> filter == 0 and subdir_filter == 0 the status from
> SMB_VFS_NOTIFY_WATCH can leak through.

This is by design I think. SMB_VFS_NOTIFY_WATCH is optional
from a cifs perspective. It can pick whatever it can handle
itself from the filters, notify_add will take care of the
rest. So a proper failure mode for SMB_VFS_NOTIFY_WATCH is
to leave the filters untouched.

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de


More information about the samba-technical mailing list