diff options
author | Tim Prouty <tprouty@samba.org> | 2009-06-22 15:26:56 -0700 |
---|---|---|
committer | Tim Prouty <tprouty@samba.org> | 2009-06-24 21:15:25 -0700 |
commit | e129384d7c1df664e447186673dd107e190e2894 (patch) | |
tree | 166c08e9d2ee0bbb8a88fb2ad76ed226a62f83dc /source3/smbd/notify.c | |
parent | 36c10191750c845a2a7cd6cc62149b1095c0b651 (diff) | |
download | samba-e129384d7c1df664e447186673dd107e190e2894.tar.gz samba-e129384d7c1df664e447186673dd107e190e2894.tar.bz2 samba-e129384d7c1df664e447186673dd107e190e2894.zip |
s3: Plumb smb_filename through SMB_VFS_STAT and SMB_VFS_LSTAT
This patch introduces two new temporary helper functions
vfs_stat_smb_fname and vfs_lstat_smb_fname. They basically allowed me
to call the new smb_filename version of stat, while avoiding plumbing
it through callers that are still too inconvenient. As the conversion
moves along, I will be able to remove callers of this, with the goal
being to remove all callers.
There was also a bug in create_synthetic_smb_fname_split (also a
temporary utility function) that caused it to incorrectly handle
filenames with ':'s in them when in posix mode. This is now fixed.
Diffstat (limited to 'source3/smbd/notify.c')
-rw-r--r-- | source3/smbd/notify.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index 12a75cc9f6..a242fc3ac0 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -341,25 +341,35 @@ void notify_fname(connection_struct *conn, uint32 action, uint32 filter, char *fullpath; char *parent; const char *name; - SMB_STRUCT_STAT sbuf; if (path[0] == '.' && path[1] == '/') { path += 2; } - if (asprintf(&fullpath, "%s/%s", conn->connectpath, path) == -1) { - DEBUG(0, ("asprintf failed\n")); - return; + if (parent_dirname(talloc_tos(), path, &parent, &name)) { + struct smb_filename *smb_fname_parent = NULL; + NTSTATUS status; + + status = create_synthetic_smb_fname(talloc_tos(), parent, NULL, + NULL, &smb_fname_parent); + if (!NT_STATUS_IS_OK(status)) { + return; + } + if (SMB_VFS_STAT(conn, smb_fname_parent) != -1) { + notify_onelevel(conn->notify_ctx, action, filter, + SMB_VFS_FILE_ID_CREATE(conn, &smb_fname_parent->st), + name); + } + TALLOC_FREE(smb_fname_parent); } - if (parent_dirname(talloc_tos(), path, &parent, &name) - && (SMB_VFS_STAT(conn, parent, &sbuf) != -1)) { - notify_onelevel(conn->notify_ctx, action, filter, - SMB_VFS_FILE_ID_CREATE(conn, &sbuf), - name); + fullpath = talloc_asprintf(talloc_tos(), "%s/%s", conn->connectpath, + path); + if (fullpath == NULL) { + DEBUG(0, ("asprintf failed\n")); + return; } - notify_trigger(conn->notify_ctx, action, filter, fullpath); - SAFE_FREE(fullpath); + TALLOC_FREE(fullpath); } static void notify_fsp(files_struct *fsp, uint32 action, const char *name) |