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

Matthew Cengia mattcen at gmail.com
Fri Sep 16 21:05:56 MDT 2011


Hi all,

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

  mattcen at 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 at adam:SambaTest$ ls /srv
  SambaTest  aquota.group  aquota.user  archive  bittorrent  cvs  lost+found  lxc  nfs  share  tftp  time_machine  tmp
  mattcen at 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 at adam:SambaTest$

This config doesn't:

  mattcen at 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 at 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 at 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 at 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 at 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 at adam:tmp$ lsb_release -idrc
  Distributor ID: Debian
  Description:    Debian GNU/Linux 6.0.2 (squeeze)
  Release:        6.0.2
  Codename:       squeeze
  mattcen at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.samba.org/pipermail/samba/attachments/20110917/08d0a375/attachment.pgp>


More information about the samba mailing list