summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-07-17 11:17:32 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:10:12 -0500
commite1248154d6c42cd6780ce5e065a5877e983a7c9d (patch)
tree0b093981992017541ba20313369505a0c734f32d
parentbdf914a39d42b5ced62f59aaa38d75fe53c32aa9 (diff)
downloadsamba-e1248154d6c42cd6780ce5e065a5877e983a7c9d.tar.gz
samba-e1248154d6c42cd6780ce5e065a5877e983a7c9d.tar.bz2
samba-e1248154d6c42cd6780ce5e065a5877e983a7c9d.zip
r17088: add ntvfs mapping function for notify
metze (This used to be commit 7daf432d58ecebd10a28acd3ddbded9cb16536d0)
-rw-r--r--source4/ntvfs/ntvfs_generic.c64
-rw-r--r--source4/ntvfs/posix/pvfs_notify.c2
2 files changed, 65 insertions, 1 deletions
diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c
index e0e69b25e1..aff05b70a8 100644
--- a/source4/ntvfs/ntvfs_generic.c
+++ b/source4/ntvfs/ntvfs_generic.c
@@ -1327,3 +1327,67 @@ _PUBLIC_ NTSTATUS ntvfs_map_close(struct ntvfs_module_context *ntvfs,
return ntvfs->ops->close(ntvfs, req, cl2);
}
+
+/*
+ NTVFS notify generic to any mapper
+*/
+static NTSTATUS ntvfs_map_notify_finish(struct ntvfs_module_context *ntvfs,
+ struct ntvfs_request *req,
+ union smb_notify *nt,
+ union smb_notify *nt2,
+ NTSTATUS status)
+{
+ NT_STATUS_NOT_OK_RETURN(status);
+
+ switch (nt->nttrans.level) {
+ case RAW_NOTIFY_SMB2:
+ if (nt2->nttrans.out.num_changes == 0) {
+ return STATUS_NOTIFY_ENUM_DIR;
+ }
+ nt->smb2.out.num_changes = nt2->nttrans.out.num_changes;
+ nt->smb2.out.changes = talloc_steal(req, nt2->nttrans.out.changes);
+ break;
+
+ default:
+ return NT_STATUS_INVALID_LEVEL;
+ }
+
+ return status;
+}
+
+
+/*
+ NTVFS notify generic to any mapper
+*/
+_PUBLIC_ NTSTATUS ntvfs_map_notify(struct ntvfs_module_context *ntvfs,
+ struct ntvfs_request *req,
+ union smb_notify *nt)
+{
+ union smb_notify *nt2;
+ NTSTATUS status;
+
+ nt2 = talloc(req, union smb_notify);
+ NT_STATUS_HAVE_NO_MEMORY(nt2);
+
+ status = ntvfs_map_async_setup(ntvfs, req, nt, nt2,
+ (second_stage_t)ntvfs_map_notify_finish);
+ NT_STATUS_NOT_OK_RETURN(status);
+
+ nt2->nttrans.level = RAW_NOTIFY_NTTRANS;
+
+ switch (nt->nttrans.level) {
+ case RAW_NOTIFY_NTTRANS:
+ status = NT_STATUS_INVALID_LEVEL;
+ break;
+
+ case RAW_NOTIFY_SMB2:
+ nt2->nttrans.in.file.ntvfs = nt->smb2.in.file.ntvfs;
+ nt2->nttrans.in.buffer_size = nt->smb2.in.buffer_size;
+ nt2->nttrans.in.completion_filter = nt->smb2.in.completion_filter;
+ nt2->nttrans.in.recursive = nt->smb2.in.recursive;
+ status = ntvfs->ops->notify(ntvfs, req, nt2);
+ break;
+ }
+
+ return ntvfs_map_async_finish(req, status);
+}
diff --git a/source4/ntvfs/posix/pvfs_notify.c b/source4/ntvfs/posix/pvfs_notify.c
index d6fec02305..460bf11f40 100644
--- a/source4/ntvfs/posix/pvfs_notify.c
+++ b/source4/ntvfs/posix/pvfs_notify.c
@@ -226,7 +226,7 @@ NTSTATUS pvfs_notify(struct ntvfs_module_context *ntvfs,
struct notify_pending *pending;
if (info->nttrans.level != RAW_NOTIFY_NTTRANS) {
- return NT_STATUS_NOT_IMPLEMENTED;
+ return ntvfs_map_notify(ntvfs, req, info);
}
f = pvfs_find_fd(pvfs, req, info->nttrans.in.file.ntvfs);