Serious Bug in rdiff-backup

Ben Escoto bescoto@stanford.edu
Fri, 09 Aug 2002 13:46:08 -0700


--==_Exmh_1950320482P
Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
Content-Id: <4819.1028925958.0@folly.Stanford.EDU>

------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <4819.1028925958.1@folly.Stanford.EDU>

>>>>> "RW" == Robert Weber <Robert.Weber@colorado.edu>
>>>>> wrote the following on Fri, 09 Aug 2002 13:20:43 -0600

  RW> Rdiffbackup, when the --change-source-perms breaks high mode
  RW> permissions.  (sticky, suid, sgid) bits.  The problem is bad on
  RW> suns where

  >> ls -l /usr/lib/pt_chmod
  RW> ---s--x--x 1 root bin 4104 Jan 5 2000 /usr/lib/pt_chmod*

  RW> after a backup

  >> ls -l /usr/lib/pt_chmod
  RW> ---x--x--x 1 root bin 4104 Jan 5 2000 /usr/lib/pt_chmod*

  RW> this prevents anyone from logging into the console.  :( I am
  RW> unfamiliar with this part of the code, if anyone out there knows
  RW> how to get this fixed cleanly, go for it, if not I'll try to get
  RW> the patch myself.

Ack, that is a serious bug... :(  BTW, you apparently you are running
--changed-source-perms as root, which you generally shouldn't do since
root can read everything anyway (in fact I should probably have it
abort when it sees this case).

    About the bug, it appears only to affect 0.9.x, and it is slightly
worse than you say because it turns out that all the high permission
bits also discarded on the backup side.  Patch attached, I will try to
get 0.9.5 out later today...


-- 
Ben Escoto


------- =_aaaaaaaaaa0
Content-Type: text/patch; charset="us-ascii"
Content-ID: <4819.1028925958.2@folly.Stanford.EDU>
Content-Description: rdiff-backup-highperms.patch

--- cmodule.c.old	Fri Aug  9 13:38:50 2002
+++ cmodule.c	Fri Aug  9 13:39:54 2002
@@ -53,7 +53,7 @@
   inode = PyInt_FromLong((long)sbuf.st_ino);
 #endif
   mode = (long)sbuf.st_mode;
-  perms = mode & (S_IRWXU | S_IRWXG | S_IRWXO);
+  perms = mode & 07777;
 #if defined(HAVE_LONG_LONG) && !defined(MS_WINDOWS)
   devloc = PyLong_FromLongLong((LONG_LONG)sbuf.st_dev);
 #else

------- =_aaaaaaaaaa0--

--==_Exmh_1950320482P
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Exmh version 2.5 01/15/2001

iD8DBQE9VCoO+owuOvknOnURAsrYAJ9cOaVb/RIjpfkFwRsuCxEGawq+mACfaCp6
Un+MictrqUzc75wTxfr0rCw=
=U+qo
-----END PGP SIGNATURE-----

--==_Exmh_1950320482P--