summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_snapper.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2016-02-24 14:02:45 -0800
committerMichael Adam <obnox@samba.org>2016-02-25 20:46:49 +0100
commitcd1335e67dbfce0b6894ff209aa805d0314578da (patch)
tree835ffef3668cdd93bc1805cd1fabac03d6b055b2 /source3/modules/vfs_snapper.c
parentde2bc1bc3890bcdd1b3b97ecc3d7e96f58ff50d3 (diff)
downloadsamba-cd1335e67dbfce0b6894ff209aa805d0314578da.tar.gz
VFS: Modify rmdir to take a const struct smb_filename * instead of const char *
Preparing to reduce use of lp_posix_pathnames(). Uses the same techniques as commit 616d068f0cebb8e50a855b6e30f36fccb7f5a3c8 (synthetic_smb_fname()) to cope with modules that modify the incoming pathname. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Thu Feb 25 20:46:49 CET 2016 on sn-devel-144
Diffstat (limited to 'source3/modules/vfs_snapper.c')
-rw-r--r--source3/modules/vfs_snapper.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c
index 7161b808275..80396c4e7f0 100644
--- a/source3/modules/vfs_snapper.c
+++ b/source3/modules/vfs_snapper.c
@@ -2527,14 +2527,16 @@ static int snapper_gmt_mkdir(vfs_handle_struct *handle,
return ret;
}
-static int snapper_gmt_rmdir(vfs_handle_struct *handle, const char *fname)
+static int snapper_gmt_rmdir(vfs_handle_struct *handle,
+ const struct smb_filename *fname)
{
time_t timestamp;
char *stripped;
int ret, saved_errno;
char *conv;
+ struct smb_filename *smb_fname = NULL;
- if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, fname,
+ if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, fname->base_name,
&timestamp, &stripped)) {
return -1;
}
@@ -2546,9 +2548,18 @@ static int snapper_gmt_rmdir(vfs_handle_struct *handle, const char *fname)
if (conv == NULL) {
return -1;
}
- ret = SMB_VFS_NEXT_RMDIR(handle, conv);
- saved_errno = errno;
+ smb_fname = synthetic_smb_fname(talloc_tos(),
+ conv,
+ NULL,
+ NULL);
TALLOC_FREE(conv);
+ if (smb_fname == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_RMDIR(handle, smb_fname);
+ saved_errno = errno;
+ TALLOC_FREE(smb_fname);
errno = saved_errno;
return ret;
}