samba-users September 2011 archive
Main Archive Page > Month Archives  > samba-users archives
samba-users: [Samba] vfs_shadow_copy2 doesn't seem to work with

[Samba] vfs_shadow_copy2 doesn't seem to work with basedir of /

From: Matthew Cengia <mattcen_at_nospam>
Date: Sat Sep 17 2011 - 03:05:56 GMT
To: Samba <samba@lists.samba.org>

Hi all,

I'm using the VFS sbadow_copy2 module, and I think I've hit a bug. This
config works:

  mattcen@adam:SambaTest$ cat works3/smb.conf
  [SambaTest]
    comment = SambaTest
    writable = yes
    path = /srv/SambaTest/share
    #vfs objects = shadow_copy
    vfs objects = shadow_copy2
    shadow:snapdir = /mnt/dates
    shadow:basedir = /srv
  mattcen@adam:SambaTest$ ls /srv
  SambaTest aquota.group aquota.user archive bittorrent cvs lost+found lxc nfs share tftp time_machine tmp
  mattcen@adam:SambaTest$ ls /mnt/dates/@GMT-*
  /mnt/dates/@GMT-2011.09.16-22.44.13:
  SambaTest

  /mnt/dates/@GMT-2011.09.16-22.44.36:
  SambaTest

  /mnt/dates/@GMT-2011.09.16-22.45.24:
  SambaTest

  /mnt/dates/@GMT-2011.09.16-23.03.18:
  SambaTest

  /mnt/dates/@GMT-2011.09.16-23.03.37:
  SambaTest

  /mnt/dates/@GMT-2011.09.16-23.03.56:
  SambaTest
  mattcen@adam:SambaTest$

This config doesn't:

  mattcen@adam:SambaTest$ cat broken1/smb.conf
  [SambaTest]
    comment = SambaTest
    writable = yes
    path = /srv/SambaTest/share
    #vfs objects = shadow_copy
    vfs objects = shadow_copy2
    shadow:snapdir = /mnt/dates
    shadow:basedir = /
  mattcen@adam:SambaTest$ ls /
  bin boot cgroup dev etc home initrd.img lib lost+found media mnt opt proc root sbin selinux snapshots srv sys tmp usr var vmlinuz
  mattcen@adam:SambaTest$ ls /mnt/dates/@GMT-*
  /mnt/dates/@GMT-2011.09.16-22.44.13:
  srv

  /mnt/dates/@GMT-2011.09.16-22.44.36:
  srv

  /mnt/dates/@GMT-2011.09.16-22.45.24:
  srv

  /mnt/dates/@GMT-2011.09.16-23.03.18:
  srv

  /mnt/dates/@GMT-2011.09.16-23.03.37:
  srv

  /mnt/dates/@GMT-2011.09.16-23.03.56:
  srv
  mattcen@adam:SambaTest$

The latter config gives me the following in /var/log/samba/log.<client>:

  [2011/09/17 00:06:42.354400, 0] modules/vfs_shadow_copy2.c:380(convert_shadow2_name)
    convert_shadow2_name: basedir / is not a parent of /srv/SambaTest/share

I'm hitting this code in vfs_shadow_copy2.c, but I don't really
understand what it's doing:

  mattcen@adam:samba$ nl -ba samba-3.5.6~dfsg/source3/modules/vfs_shadow_copy2.c | sed -n 376,383p
     376 /* some sanity checks */
     377 if (strncmp(basedir, handle->conn->connectpath, baselen) != 0 ||
     378 (handle->conn->connectpath[baselen] != 0 && handle->conn->connectpath[baselen] != '/')) {
     379 DEBUG(0,("convert_shadow2_name: basedir %s is not a parent of %s\n",
     380 basedir, handle->conn->connectpath));
     381 talloc_free(tmp_ctx);
     382 return NULL;
     383 }

I'm running Samba on Debian Squeeze:

  mattcen@adam:tmp$ lsb_release -idrc
  Distributor ID: Debian
  Description: Debian GNU/Linux 6.0.2 (squeeze)
  Release: 6.0.2
  Codename: squeeze
  mattcen@adam:tmp$ dpkg -l samba | tail -1
  ii samba 2:3.5.6~dfsg-3squeeze5 SMB/CIFS file, print, and login server for Unix

Checking the Samba Git repo, it looks like the version I'm running is
from around commit 5529289e1d17d0524dc38aea11e0a3469818753c (at least
that has the same version of the vfs_shadow_copy2.c file), and I can see
that the git trunk has a complete rewrite of this module, but I don't
want to have to recompile my Samba deb after cherry-picking that module.

Can anybody see anything wrong with the way I've configured my smb.conf,
or does this actually look like a bug (which probably isn't worth
reporting since this code seems to be almost obsolete)?

-- Regards, Matthew Cengia

-- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/options/samba