1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

smbd: Add "path" to notify_remove

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2016-06-13 18:06:08 +02:00 committed by Jeremy Allison
parent ed26f4b22a
commit 229c9108d9
3 changed files with 21 additions and 7 deletions

View File

@ -518,9 +518,21 @@ void file_free(struct smb_request *req, files_struct *fsp)
uint64_t fnum = fsp->fnum;
if (fsp->notify) {
struct notify_context *notify_ctx =
fsp->conn->sconn->notify_ctx;
notify_remove(notify_ctx, fsp);
size_t len = fsp_fullbasepath(fsp, NULL, 0);
char fullpath[len+1];
fsp_fullbasepath(fsp, fullpath, sizeof(fullpath));
/*
* Avoid /. at the end of the path name. notify can't
* deal with it.
*/
if (len > 1 && fullpath[len-1] == '.' &&
fullpath[len-2] == '/') {
fullpath[len-2] = '\0';
}
notify_remove(fsp->conn->sconn->notify_ctx, fsp, fullpath);
TALLOC_FREE(fsp->notify);
}

View File

@ -176,7 +176,8 @@ NTSTATUS notify_add(struct notify_context *ctx,
return NT_STATUS_OK;
}
NTSTATUS notify_remove(struct notify_context *ctx, void *private_data)
NTSTATUS notify_remove(struct notify_context *ctx, void *private_data,
char *path)
{
struct notify_list *listel;
struct notify_rec_change_msg msg = {};
@ -203,8 +204,8 @@ NTSTATUS notify_remove(struct notify_context *ctx, void *private_data)
iov[0].iov_base = &msg;
iov[0].iov_len = offsetof(struct notify_rec_change_msg, path);
iov[1].iov_base = discard_const_p(char, listel->path);
iov[1].iov_len = strlen(listel->path)+1;
iov[1].iov_base = path;
iov[1].iov_len = strlen(path)+1;
status = messaging_send_iov(
ctx->msg_ctx, ctx->notifyd, MSG_SMB_NOTIFY_REC_CHANGE,

View File

@ -589,7 +589,8 @@ NTSTATUS notify_add(struct notify_context *notify,
void (*callback)(void *, struct timespec,
const struct notify_event *),
void *private_data);
NTSTATUS notify_remove(struct notify_context *notify, void *private_data);
NTSTATUS notify_remove(struct notify_context *ctx, void *private_data,
char *path);
void notify_trigger(struct notify_context *notify,
uint32_t action, uint32_t filter,
const char *dir, const char *path);