summaryrefslogtreecommitdiff
path: root/source3/smbd/notify.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-03-15 13:02:15 +0100
committerVolker Lendecke <vl@samba.org>2012-03-16 14:28:42 +0100
commit8503eecabb9cbd47db6167f7394dc2257714ebd9 (patch)
tree02953fadb5e83c1b5faf488209ff6670d37d3499 /source3/smbd/notify.c
parent640a7d0db71e038223a2f5afed70c5df5db509ac (diff)
downloadsamba-8503eecabb9cbd47db6167f7394dc2257714ebd9.tar.gz
samba-8503eecabb9cbd47db6167f7394dc2257714ebd9.tar.bz2
samba-8503eecabb9cbd47db6167f7394dc2257714ebd9.zip
s3-notify: Lift "/." handling up one level
This slightly simplifies the code Autobuild-User: Volker Lendecke <vl@samba.org> Autobuild-Date: Fri Mar 16 14:28:44 CET 2012 on sn-devel-104
Diffstat (limited to 'source3/smbd/notify.c')
-rw-r--r--source3/smbd/notify.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c
index 37d585b896..534ed8477b 100644
--- a/source3/smbd/notify.c
+++ b/source3/smbd/notify.c
@@ -178,6 +178,7 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter,
bool recursive)
{
char *fullpath;
+ size_t len;
struct notify_entry e;
NTSTATUS status;
@@ -202,6 +203,14 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter,
return NT_STATUS_NO_MEMORY;
}
+ /*
+ * Avoid /. at the end of the path name. notify can't deal with it.
+ */
+ len = strlen(fullpath);
+ if (len > 1 && fullpath[len-1] == '.' && fullpath[len-2] == '/') {
+ fullpath[len-2] = '\0';
+ }
+
ZERO_STRUCT(e);
e.path = fullpath;
e.dir_fd = fsp->fh->fd;