Hi,
I was trying out "git daemon" with the rc script provided...
# rcctl enable gitdaemon
# rcctl set gitdaemon flags /tmp/git/test.git
# rcctl start gitdaemon
and then...
$ pgrep -u root -fl git
74576 git-daemon --detach /tmp/git/test.git
it started to run as root. I believe the daemon_flags are overwritten
when a user sets them. If we set "--user=_gitdaemon" just like
"--detach" in ${daemon} instead of ${daemon_flags}, we could make it
drop privileges even if a user misses it while setting flags.
Comments?
Index: gitdaemon.rc
===================================================================
RCS file: /cvs/ports/devel/git/pkg/gitdaemon.rc,v
retrieving revision 1.1
diff -u -p -r1.1 gitdaemon.rc
--- gitdaemon.rc 2 Jun 2016 18:33:27 -0000 1.1
+++ gitdaemon.rc 9 Jan 2017 08:06:31 -0000
@@ -2,12 +2,11 @@
#
# $OpenBSD: gitdaemon.rc,v 1.1 2016/06/02 18:33:27 jung Exp $
-daemon="${TRUEPREFIX}/bin/git daemon --detach"
-daemon_flags="--user=_gitdaemon"
+daemon="/usr/local/bin/git daemon --detach --user=_gitdaemon"
. /etc/rc.d/rc.subr
-pexp="git-daemon --detach${daemon_flags:+ ${daemon_flags}}"
+pexp="git-daemon --detach --user=_gitdaemon${daemon_flags:+ ${daemon_flags}}"
rc_reload=NO
rc_cmd $1