summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-03-30 03:51:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:59:20 -0500
commited3fc628713e1f9552b523c9aec9bd8993e0b771 (patch)
tree47aeb7113ad1f89e3b1432ecb3acdb915c744991 /source4
parent8260854a18fe784be01fa88be1678bf0e267720c (diff)
downloadsamba-ed3fc628713e1f9552b523c9aec9bd8993e0b771.tar.gz
samba-ed3fc628713e1f9552b523c9aec9bd8993e0b771.tar.bz2
samba-ed3fc628713e1f9552b523c9aec9bd8993e0b771.zip
r14797: added checking of the filter in notify requests
(This used to be commit 1db0a5a7f4c1ff915d91bc15d8e40cc90a78961d)
Diffstat (limited to 'source4')
-rw-r--r--source4/ntvfs/common/notify.c14
-rw-r--r--source4/ntvfs/posix/pvfs_mkdir.c15
-rw-r--r--source4/ntvfs/posix/pvfs_open.c15
-rw-r--r--source4/ntvfs/posix/pvfs_read.c5
-rw-r--r--source4/ntvfs/posix/pvfs_unlink.c4
-rw-r--r--source4/ntvfs/posix/pvfs_write.c5
6 files changed, 48 insertions, 10 deletions
diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c
index bc04c830f1..c5acf9decb 100644
--- a/source4/ntvfs/common/notify.c
+++ b/source4/ntvfs/common/notify.c
@@ -322,11 +322,15 @@ static NTSTATUS notify_remove_all(struct notify_context *notify)
see if a notify event matches
*/
static BOOL notify_match(struct notify_context *notify, struct notify_entry *e,
- const char *path, uint32_t action)
+ const char *path, uint32_t filter)
{
- size_t len = strlen(e->path);
+ size_t len;
- /* TODO: check action */
+ if (!(filter & e->filter)) {
+ return False;
+ }
+
+ len = strlen(e->path);
if (strncmp(path, e->path, len) != 0) {
return False;
@@ -379,7 +383,7 @@ static void notify_send(struct notify_context *notify, struct notify_entry *e,
trigger a notify message for anyone waiting on a matching event
*/
void notify_trigger(struct notify_context *notify,
- uint32_t action, const char *path)
+ uint32_t action, uint32_t filter, const char *path)
{
NTSTATUS status;
int i;
@@ -391,7 +395,7 @@ void notify_trigger(struct notify_context *notify,
/* this needs to be changed to a log(n) search */
for (i=0;i<notify->array->num_entries;i++) {
- if (notify_match(notify, &notify->array->entries[i], path, action)) {
+ if (notify_match(notify, &notify->array->entries[i], path, filter)) {
notify_send(notify, &notify->array->entries[i],
path + strlen(notify->array->entries[i].path) + 1,
action);
diff --git a/source4/ntvfs/posix/pvfs_mkdir.c b/source4/ntvfs/posix/pvfs_mkdir.c
index 5ec7df3b9d..cd83c9de43 100644
--- a/source4/ntvfs/posix/pvfs_mkdir.c
+++ b/source4/ntvfs/posix/pvfs_mkdir.c
@@ -83,7 +83,10 @@ static NTSTATUS pvfs_t2mkdir(struct pvfs_state *pvfs,
return status;
}
- notify_trigger(pvfs->notify_context, NOTIFY_ACTION_ADDED, name->full_name);
+ notify_trigger(pvfs->notify_context,
+ NOTIFY_ACTION_ADDED,
+ FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_DIR_NAME,
+ name->full_name);
return NT_STATUS_OK;
}
@@ -137,7 +140,10 @@ NTSTATUS pvfs_mkdir(struct ntvfs_module_context *ntvfs,
return status;
}
- notify_trigger(pvfs->notify_context, NOTIFY_ACTION_ADDED, name->full_name);
+ notify_trigger(pvfs->notify_context,
+ NOTIFY_ACTION_ADDED,
+ FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_DIR_NAME,
+ name->full_name);
return NT_STATUS_OK;
}
@@ -176,7 +182,10 @@ NTSTATUS pvfs_rmdir(struct ntvfs_module_context *ntvfs,
return pvfs_map_errno(pvfs, errno);
}
- notify_trigger(pvfs->notify_context, NOTIFY_ACTION_REMOVED, name->full_name);
+ notify_trigger(pvfs->notify_context,
+ NOTIFY_ACTION_REMOVED,
+ FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_DIR_NAME,
+ name->full_name);
return NT_STATUS_OK;
}
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index 38123c3a9e..264234a09b 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -378,6 +378,11 @@ static NTSTATUS pvfs_open_directory(struct pvfs_state *pvfs,
f->handle->have_opendb_entry = True;
create_action = NTCREATEX_ACTION_CREATED;
+
+ notify_trigger(pvfs->notify_context,
+ NOTIFY_ACTION_REMOVED,
+ FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_DIR_NAME,
+ name->full_name);
} else {
create_action = NTCREATEX_ACTION_EXISTED;
}
@@ -461,6 +466,11 @@ static int pvfs_handle_destructor(void *p)
if (unlink(path) != 0) {
DEBUG(0,("pvfs_close: failed to delete '%s' - %s\n",
path, strerror(errno)));
+ } else {
+ notify_trigger(h->pvfs->notify_context,
+ NOTIFY_ACTION_REMOVED,
+ FILE_NOTIFY_CHANGE_FILE_NAME,
+ path);
}
}
@@ -730,7 +740,10 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
/* success - keep the file handle */
talloc_steal(pvfs, f);
- notify_trigger(pvfs->notify_context, NOTIFY_ACTION_ADDED, name->full_name);
+ notify_trigger(pvfs->notify_context,
+ NOTIFY_ACTION_ADDED,
+ FILE_NOTIFY_CHANGE_FILE_NAME,
+ name->full_name);
return NT_STATUS_OK;
diff --git a/source4/ntvfs/posix/pvfs_read.c b/source4/ntvfs/posix/pvfs_read.c
index 411fbd9c27..f30c4d6e38 100644
--- a/source4/ntvfs/posix/pvfs_read.c
+++ b/source4/ntvfs/posix/pvfs_read.c
@@ -90,5 +90,10 @@ NTSTATUS pvfs_read(struct ntvfs_module_context *ntvfs,
rd->readx.out.remaining = 0xFFFF;
rd->readx.out.compaction_mode = 0;
+ notify_trigger(pvfs->notify_context,
+ NOTIFY_ACTION_MODIFIED,
+ FILE_NOTIFY_CHANGE_LAST_ACCESS,
+ f->handle->name->full_name);
+
return NT_STATUS_OK;
}
diff --git a/source4/ntvfs/posix/pvfs_unlink.c b/source4/ntvfs/posix/pvfs_unlink.c
index 3a6e4bba2f..4477360deb 100644
--- a/source4/ntvfs/posix/pvfs_unlink.c
+++ b/source4/ntvfs/posix/pvfs_unlink.c
@@ -104,7 +104,9 @@ static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs,
}
if (NT_STATUS_IS_OK(status)) {
- notify_trigger(pvfs->notify_context, NOTIFY_ACTION_REMOVED,
+ notify_trigger(pvfs->notify_context,
+ NOTIFY_ACTION_REMOVED,
+ FILE_NOTIFY_CHANGE_FILE_NAME,
name->full_name);
}
diff --git a/source4/ntvfs/posix/pvfs_write.c b/source4/ntvfs/posix/pvfs_write.c
index 9c23b3e4fd..15e3526176 100644
--- a/source4/ntvfs/posix/pvfs_write.c
+++ b/source4/ntvfs/posix/pvfs_write.c
@@ -84,6 +84,11 @@ NTSTATUS pvfs_write(struct ntvfs_module_context *ntvfs,
wr->writex.out.nwritten = ret;
wr->writex.out.remaining = 0; /* should fill this in? */
+
+ notify_trigger(pvfs->notify_context,
+ NOTIFY_ACTION_MODIFIED,
+ FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_LAST_WRITE,
+ f->handle->name->full_name);
return NT_STATUS_OK;
}