diff options
author | Volker Lendecke <vl@samba.org> | 2012-10-18 15:24:39 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2014-06-27 09:03:53 +0200 |
commit | 9c195321345846195e465158f88dad5fd7699389 (patch) | |
tree | bc111cd74c9a8991d9acebd9c8e1e522336e67ee /source3/modules/vfs_shadow_copy2.c | |
parent | 1d488270a116b3140de1355c1492aa2652a57e08 (diff) | |
download | samba-9c195321345846195e465158f88dad5fd7699389.tar.gz samba-9c195321345846195e465158f88dad5fd7699389.tar.xz samba-9c195321345846195e465158f88dad5fd7699389.zip |
s3-shadow-copy2: Protect against already converted names
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jun 27 09:03:53 CEST 2014 on sn-devel-104
Diffstat (limited to 'source3/modules/vfs_shadow_copy2.c')
-rw-r--r-- | source3/modules/vfs_shadow_copy2.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index 30f67e2782..439df5ddf4 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -235,6 +235,9 @@ static bool shadow_copy2_strip_snapshot(TALLOC_CTX *mem_ctx, char *stripped; size_t rest_len, dst_len; struct shadow_copy2_config *config; + const char *snapdir; + ssize_t snapdirlen; + ptrdiff_t len_before_gmt; SMB_VFS_HANDLE_GET_DATA(handle, config, struct shadow_copy2_config, return false); @@ -252,6 +255,31 @@ static bool shadow_copy2_strip_snapshot(TALLOC_CTX *mem_ctx, p, name, (int)p[-1])); goto no_snapshot; } + + /* + * Figure out whether we got an already converted string. One + * case where this happens is in a smb2 create call with the + * mxac create blob set. We do the get_acl call on + * fsp->fsp_name, which is already converted. We are converted + * if we got a file name of the form ".snapshots/@GMT-", + * i.e. ".snapshots/" precedes "p". + */ + + snapdir = lp_parm_const_string(SNUM(handle->conn), "shadow", "snapdir", + ".snapshots"); + snapdirlen = strlen(snapdir); + len_before_gmt = p - name; + + if ((len_before_gmt >= (snapdirlen + 1)) && (p[-1] == '/')) { + const char *parent_snapdir = p - (snapdirlen+1); + + DEBUG(10, ("parent_snapdir = %s\n", parent_snapdir)); + + if (strncmp(parent_snapdir, snapdir, snapdirlen) == 0) { + DEBUG(10, ("name=%s is already converted\n", name)); + goto no_snapshot; + } + } q = strptime(p, GMT_FORMAT, &tm); if (q == NULL) { DEBUG(10, ("strptime failed\n")); |