From c6f8856e3ce8301dfe3bf621ac0ab44c0a9abd39 Mon Sep 17 00:00:00 2001 From: plunky Date: Sun, 18 Mar 2007 15:53:54 +0000 Subject: [PATCH] For sdpd(8), change default user/group from nobody/nobody to _sdpd/_sdpd --- etc/defaults/rc.conf | 4 ++-- etc/group | 1 + etc/master.passwd | 1 + etc/rc.d/sdpd | 7 +------ share/man/man5/rc.conf.5 | 22 +++------------------- usr.sbin/postinstall/postinstall | 9 ++++++--- usr.sbin/sdpd/main.c | 8 ++++---- usr.sbin/sdpd/sdpd.8 | 8 ++++---- 8 files changed, 22 insertions(+), 38 deletions(-) diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf index 07fea1041fc8..bda06bbdafb5 100644 --- a/etc/defaults/rc.conf +++ b/etc/defaults/rc.conf @@ -1,4 +1,4 @@ -# $NetBSD: rc.conf,v 1.84 2007/02/20 16:56:10 kiyohara Exp $ +# $NetBSD: rc.conf,v 1.85 2007/03/18 15:53:54 plunky Exp $ # # /etc/defaults/rc.conf -- # default configuration of /etc/rc.conf @@ -275,7 +275,7 @@ btconfig=NO # Bluetooth controller configuration btdevctl=NO # Bluetooth device configuration bthcid=NO bthcid_flags="" # Bluetooth HCI daemon btuartd=NO # Bluetooth HCI UART daemon -sdpd=NO # Service Discovery daemon +sdpd=NO sdpd_flags="" # Service Discovery daemon # Other daemons. # diff --git a/etc/group b/etc/group index cb71d21dbf8b..2a05c7864460 100644 --- a/etc/group +++ b/etc/group @@ -18,6 +18,7 @@ _rwhod:*:19: staff:*:20:root _proxy:*:21: _timedc:*:22: +_sdpd:*:23: guest:*:31:root nobody:*:39: utmp:*:45: diff --git a/etc/master.passwd b/etc/master.passwd index 655bf74a5cd3..8e317468db75 100644 --- a/etc/master.passwd +++ b/etc/master.passwd @@ -12,5 +12,6 @@ _pflogd:*:18:18::0:0:& pseudo-user:/var/chroot/pflogd:/sbin/nologin _rwhod:*:19:19::0:0:& pseudo-user:/var/rwho:/sbin/nologin _proxy:*:21:21::0:0:Proxy Services:/nonexistent:/sbin/nologin _timedc:*:22:22::0:0:& pseudo-user:/nonexistent:/sbin/nologin +_sdpd:*:23:23::0:0:& pseudo-user:/nonexistent:/sbin/nologin uucp:*:66:1::0:0:UNIX-to-UNIX Copy:/nonexistent:/sbin/nologin nobody:*:32767:39::0:0:Unprivileged user:/nonexistent:/sbin/nologin diff --git a/etc/rc.d/sdpd b/etc/rc.d/sdpd index b05830cb0d4a..7a252bba2b5b 100644 --- a/etc/rc.d/sdpd +++ b/etc/rc.d/sdpd @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: sdpd,v 1.1 2006/06/19 15:44:36 gdamore Exp $ +# $NetBSD: sdpd,v 1.2 2007/03/18 15:53:54 plunky Exp $ # # PROVIDE: sdpd @@ -14,9 +14,4 @@ rcvar=$name command="/usr/sbin/${name}" load_rc_config $name -control="${sdpd_control:-/var/run/sdp}" -group="${sdpd_groupname:-nobody}" -user="${sdpd_username:-nobody}" -command_args="-c ${control} -g ${group} -u ${user}" - run_rc_command "$1" diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 81a326e3c328..6456ca806c3f 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -1,4 +1,4 @@ -.\" $NetBSD: rc.conf.5,v 1.112 2007/02/04 08:19:26 elad Exp $ +.\" $NetBSD: rc.conf.5,v 1.113 2007/03/18 15:53:54 plunky Exp $ .\" .\" Copyright (c) 1996 Matthew R. Green .\" Copyright (c) 1997 Curt J. Sampson @@ -1210,24 +1210,8 @@ or .Sq NO . Runs the Service Discovery Profile daemon, .Xr sdpd 8 . -.It Sy sdpd_control -Optional string specifying the path to the -.Xr sdpd 8 -control socket. -Defaults to -.Pa /var/run/sdp . -.It Sy sdpd_username -Optional string specifying the username that -.Xr sdpd 8 -will run as after initialisation. -Defaults to -.Sq nobody . -.It Sy sdpd_groupname -Optional string specifying the groupname that -.Xr sdpd 8 -will run as after initialisation. -Defaults to -.Sq nobody . +Passes +.Sy sdpd_flags . .El .Ss Other daemons .Bl -tag -width net_interfaces diff --git a/usr.sbin/postinstall/postinstall b/usr.sbin/postinstall/postinstall index 6a9019c4c543..736330f6cf2f 100755 --- a/usr.sbin/postinstall/postinstall +++ b/usr.sbin/postinstall/postinstall @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall,v 1.37 2007/03/03 06:43:46 apb Exp $ +# $NetBSD: postinstall,v 1.38 2007/03/18 15:53:55 plunky Exp $ # # Copyright (c) 2002-2006 The NetBSD Foundation, Inc. # All rights reserved. @@ -615,7 +615,7 @@ do_gid() [ -n "$1" ] || err 2 "USAGE: do_gid fix|check" check_ids $1 groups "${DEST_DIR}/etc/group" \ - named ntpd postfix sshd authpf _pflogd _rwhod _timedc + named ntpd postfix sshd authpf _pflogd _rwhod _timedc _sdpd } # @@ -872,6 +872,9 @@ do_rc() ip6forwarding \ mountcritlocal mountcritremote \ network nfsiod_flags \ + sdpd sdpd_control \ + sdpd sdpd_groupname \ + sdpd sdpd_username \ sysctl while [ $# -gt 1 ]; do if rcconf_is_set ${op} $1 $2 1; then @@ -1091,7 +1094,7 @@ do_uid() [ -n "$1" ] || err 2 "USAGE: do_uid fix|check" check_ids $1 users "${DEST_DIR}/etc/master.passwd" \ - named ntpd postfix sshd _pflogd _rwhod _timedc + named ntpd postfix sshd _pflogd _rwhod _timedc _sdpd } diff --git a/usr.sbin/sdpd/main.c b/usr.sbin/sdpd/main.c index 8252e523c0f9..625b0a29343e 100644 --- a/usr.sbin/sdpd/main.c +++ b/usr.sbin/sdpd/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.2 2007/03/18 10:00:42 plunky Exp $ */ +/* $NetBSD: main.c,v 1.3 2007/03/18 15:53:55 plunky Exp $ */ /* * main.c @@ -27,7 +27,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: main.c,v 1.2 2007/03/18 10:00:42 plunky Exp $ + * $Id: main.c,v 1.3 2007/03/18 15:53:55 plunky Exp $ * $FreeBSD: src/usr.sbin/bluetooth/sdpd/main.c,v 1.1 2004/01/20 20:48:26 emax Exp $ */ @@ -35,7 +35,7 @@ __COPYRIGHT("@(#) Copyright (c) 2006 Itronix, Inc.\n" "@(#) Copyright (c) 2004 Maksim Yevmenkin \n" "All rights reserved.\n"); -__RCSID("$NetBSD: main.c,v 1.2 2007/03/18 10:00:42 plunky Exp $"); +__RCSID("$NetBSD: main.c,v 1.3 2007/03/18 15:53:55 plunky Exp $"); #include #include @@ -74,7 +74,7 @@ main(int argc, char *argv[]) { server_t server; char const *control = SDP_LOCAL_PATH; - char const *user = "nobody", *group = "nobody"; + char const *user = "_sdpd", *group = "_sdpd"; char const *sgroup = NULL; int32_t detach = 1, opt; struct sigaction sa; diff --git a/usr.sbin/sdpd/sdpd.8 b/usr.sbin/sdpd/sdpd.8 index f0e3a18313b6..77a418d40f43 100644 --- a/usr.sbin/sdpd/sdpd.8 +++ b/usr.sbin/sdpd/sdpd.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: sdpd.8,v 1.2 2007/03/18 10:00:42 plunky Exp $ +.\" $NetBSD: sdpd.8,v 1.3 2007/03/18 15:53:55 plunky Exp $ .\" .\" Copyright (c) 2004 Maksim Yevmenkin .\" All rights reserved. @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: sdpd.8,v 1.2 2007/03/18 10:00:42 plunky Exp $ +.\" $Id: sdpd.8,v 1.3 2007/03/18 15:53:55 plunky Exp $ .\" $FreeBSD: src/usr.sbin/bluetooth/sdpd/sdpd.8,v 1.5 2005/12/06 17:56:36 emax Exp $ .\" .Dd January 13, 2004 @@ -93,7 +93,7 @@ This only works if .Nm was started as root. The default group name is -.Dq Li nobody . +.Dq Li _sdpd . .It Fl h Display usage message and exit. .It Fl u Ar user @@ -105,7 +105,7 @@ This only works if .Nm was started as root. The default user name is -.Dq Li nobody . +.Dq Li _sdpd . .El .Sh CAVEAT The