[Samba] vfs_shadow_copy2 delimiter not working
Michael Miller
sambaorg at e.mjmm.org
Sun Apr 2 21:42:29 UTC 2017
Hi
I could not get a custom "shadow:delimiter" for the vfs shadow_copy2
module to work successfully for me with Samba 4.6.2. I did not try
previous versions. Based on my testing it seems that an additional line
of code is needed in vfs_shadow_copy2.c as shown in the patch below
(some comment updates are included too for code readability).
Without the below patch, previous versions were not being returned by
Samba when using a shadow:delimiter. I was using a sample config of
shadow:snapprefix = ^Snap
shadow:delimiter = _._
shadow:format = %Y.%m.%d-%H.%M.%S
with sample snapshots named:
Snap_testing1_._2016.11.01-01.00.01
Snap_prerelease_._2016.12.01-01.00.02
Snap_postrelease_._2017.01.01-01.00.01
Is anyone able to use a custom shadow:delimiter successfully without any
modifications to the Samba code? If not, how do I go about getting this
patch applied?
diff -up vfs_shadow_copy2.c.orig vfs_shadow_copy2.c
--- vfs_shadow_copy2.c.orig 2017-03-31 14:53:38.722560396 +0100
+++ vfs_shadow_copy2.c 2017-04-02 22:13:41.943038415 +0100
@@ -1866,16 +1866,19 @@ static bool shadow_copy2_snapshot_to_gmt
*/
if (priv->snaps->regex != NULL) {
tmpstr = talloc_strdup(talloc_tos(), name);
- /* point "name" to the time format */
+ /* Point "name" at <delimiter><time_format> */
name = strstr(name, priv->config->delimiter);
if (name == NULL) {
goto done;
}
- /* Extract the prefix */
+ /* Now point name at <time_format> */
+ name = name + strlen(priv->config->delimiter);
+ /* Locate the the prefix */
tmp = strstr(tmpstr, priv->config->delimiter);
if (tmp == NULL) {
goto done;
}
+ /* Trim <delimiter><time_format> from tmpstr leaving
prefix */
*tmp = '\0';
/* Parse regex */
More information about the samba
mailing list