[Rsync-patches] [PATCH] Conditionalize the test daemon's "uid" and "gid" parameters.

Matt McCutchen <matt at mattmccutchen.net>
Thu Nov 12 21:27:12 PST 2009


This makes the daemon tests work once again when run as root.  See:

http://lists.samba.org/archive/rsync/2009-November/024216.html
---
 testsuite/rsync.fns |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/testsuite/rsync.fns b/testsuite/rsync.fns
index 1983877..bff54e5 100644
--- a/testsuite/rsync.fns
+++ b/testsuite/rsync.fns
@@ -268,8 +268,18 @@ log format = %i %h [%a] %m (%u) %l %f%L
 transfer logging = yes
 exclude = ? foobar.baz
 max verbosity = 4
-#uid = 0
-#gid = 0
+EOF
+
+    # Root needs to avoid dropping to nobody so that it can write to root-owned
+    # dirs, while unprivileged users would fail to setuid/setgid.
+    case `id -u` in
+    0)
+	echo "uid = 0" >>"$conf"
+	echo "gid = 0" >>"$conf"
+	;;
+    esac
+
+    cat >>"$conf" <<EOF
 
 [test-from]
 	path = $fromdir
-- 
1.6.2.18.gdd77




More information about the rsync-patches mailing list