[Box Backup] Symlink error in bbackupd?

Hans-Joachim Baader boxbackup@fluffy.co.uk
Mon, 5 Nov 2007 23:10:43 +0100

Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable


> >You are right, I just verified this bug. I'll write a test for it and=20
> >fix it in trunk.
> Sorry, my mistake, I wasn't able to verify the bug (I wrote the test and=
> it works for me). Please could you provide some more information about=20
> exactly what's going wrong for you? For example, when you say "according=
> to my log, it attempts to overwrite /root/a/dir/file", could you provide=
> the exact log message? And which version of Box Backup are you using?

I have 0.10 on both client and server, and also on a third machine where
I extract the backup.

The user visible message is:
Exception: Common OSFileError (Error accessing a file. Check permissions.) =

I can reproduce it if on the host where I extract the backup exists
a directory in the root directory tree with the same name as the
directory to be extracted and the permissions of this directory don't
allow access. I know it sounds bizarre but it was a real problem for me
while verifying the backup. In order to do this, I had to copy the
config files of the client and make them accessible to the user that
verifies the backups (not root). Here's how to reproduce it:

On the client:

mkdir -p /root/a/dir
chmod 0700 /root/a
echo 1234 > /root/a/dir/1234
mkdir /root/b
ln -s /root/a/dir /root/b/dir
bbackupctl sync

On the extraction host the directory /root/a must also exist. If it
doesn't, all goes well!

mkdir -p /root/a/dir
chmod 0700 /root/a

Then extract the backup as unprivileged user:

strace shows:

25062 unlink("root/b/dir")              =3D 0
25062 symlink("/root/a/dir", "root/b/dir") =3D 0
25062 geteuid32()                       =3D 1000
25062 close(4)                          =3D 0
25062 write(1, ".", 1)                  =3D 1
25062 stat64("root/b/dir", 0xbfe58830)  =3D -1 EACCES (Permission denied)
25062 close(3)                          =3D 0
25062 write(1, "Exception: Common OSFileError (Error accessing a file. Chec=
k permissions.) (1/9)\n", 81) =3D 81

The second line is correct, it restores the symlink. But it has no
business to execute line 6: It follows a link it shouldn't.

hjb :-)
Pro-Linux - Germany's largest volunteer Linux support site
http://www.pro-linux.de/          Public Key ID 0x3DDBDDEA

Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

Version: GnuPG v1.4.6 (GNU/Linux)