From b2efff8fe5cdfd031a7b6f814993a9c234a66ee8 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 7 Jan 2007 18:08:50 +0000 Subject: r20597: Survive some of the notify mask tests. (This used to be commit e4a2e63272dc5b20413597179d06b0185c4a6817) --- source3/smbd/dosmode.c | 10 +++++++++- source3/smbd/notify.c | 14 ++++++++++++++ source3/smbd/reply.c | 10 +--------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 1172fe3e6b..a3c46b3275 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -499,8 +499,11 @@ int file_set_dosmode(connection_struct *conn, const char *fname, unixmode |= (st->st_mode & (S_IWUSR|S_IWGRP|S_IWOTH)); } - if ((ret = SMB_VFS_CHMOD(conn,fname,unixmode)) == 0) + if ((ret = SMB_VFS_CHMOD(conn,fname,unixmode)) == 0) { + notify_fname(conn, fname, FILE_NOTIFY_CHANGE_ATTRIBUTES, + NOTIFY_ACTION_MODIFIED); return 0; + } if((errno != EPERM) && (errno != EACCES)) return -1; @@ -529,6 +532,8 @@ int file_set_dosmode(connection_struct *conn, const char *fname, ret = SMB_VFS_FCHMOD(fsp, fsp->fh->fd, unixmode); unbecome_root(); close_file_fchmod(fsp); + notify_fname(conn, fname, FILE_NOTIFY_CHANGE_ATTRIBUTES, + NOTIFY_ACTION_MODIFIED); } return( ret ); @@ -601,6 +606,9 @@ BOOL set_filetime(connection_struct *conn, const char *fname, time_t mtime) DEBUG(4,("set_filetime(%s) failed: %s\n",fname,strerror(errno))); return False; } + + notify_fname(conn, fname, FILE_NOTIFY_CHANGE_LAST_WRITE, + NOTIFY_ACTION_MODIFIED); return(True); } diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index f94ff76e7b..bcd8fcb0ab 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -541,6 +541,20 @@ void notify_action(connection_struct *conn, const char *parent, TALLOC_FREE(lck); } +void notify_fname(connection_struct *conn, const char *path, + uint32 filter, uint32 action) +{ + char *parent; + const char *name; + + if (!parent_dirname_talloc(tmp_talloc_ctx(), path, &parent, &name)) { + return; + } + + notify_action(conn, parent, name, filter, action); + TALLOC_FREE(parent); +} + static void notify_fsp(files_struct *fsp, struct notify_message *msg) { struct notify_change *change, *changes; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index d33940aa64..62fd0ea686 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -2026,9 +2026,6 @@ NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype, mangle_check_cache( mask, sizeof(pstring)-1, conn->params ); if (!has_wild) { - char *dir; - const char *fname; - pstrcat(directory,"/"); pstrcat(directory,mask); error = can_delete(conn,directory,dirtype,bad_path); @@ -2039,12 +2036,7 @@ NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype, count++; } - if (parent_dirname_talloc(tmp_talloc_ctx(), orig_name, - &dir, &fname)) { - notify_action(conn, dir, fname, -1, - NOTIFY_ACTION_REMOVED); - TALLOC_FREE(dir); /* not strictly necessary */ - } + notify_fname(conn, orig_name, -1, NOTIFY_ACTION_REMOVED); } else { struct smb_Dir *dir_hnd = NULL; -- cgit