1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-29 10:18:30 +00:00

The start script assumes that group name == user name. This goes wrong

when mrtg needs to be started as root (for example).
When mrtg is started as root, both getgrnam() gndetpwnam() are returning
0 because Without changing the code this ends mrtg (false error).

PR:		ports/95253
Approved by:	maintainer timeout (20 days)
This commit is contained in:
Oliver Lehmann 2006-04-23 17:39:52 +00:00
parent 1039465e55
commit 5f3199f9ee
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=160236
2 changed files with 24 additions and 1 deletions

View File

@ -17,9 +17,10 @@ load_rc_config $name
: ${mrtg_daemon_enable="NO"}
: ${mrtg_daemon_pidfile="/var/run/mrtg/mrtg.pid"}
: ${mrtg_daemon_user="mrtg"}
: ${mrtg_daemon_group="mrtg"}
: ${mrtg_daemon_config="%%PREFIX%%/etc/mrtg/mrtg.cfg"}
: ${mrtg_daemon_flags="--pid-file $mrtg_daemon_pidfile --lock-file /var/run/mrtg/lockfile --confcache-file /var/run/mrtg/confcache --user $mrtg_daemon_user --group $mrtg_daemon_user --daemon $mrtg_daemon_config"}
: ${mrtg_daemon_flags="--pid-file $mrtg_daemon_pidfile --lock-file /var/run/mrtg/lockfile --confcache-file /var/run/mrtg/confcache --user $mrtg_daemon_user --group $mrtg_daemon_group --daemon $mrtg_daemon_config"}
start_precmd="mrtg_daemon_precmd"

View File

@ -0,0 +1,22 @@
--- mrtg.old Fri Feb 3 07:33:33 2006
+++ mrtg Mon Apr 3 11:30:45 2006
@@ -172,11 +172,17 @@
my $gid = $(;
if (defined $opts{group}) {
- $gid = getgrnam($opts{group}) or die "ERROR: Unknown Group: $opts{group})\n";
+ $gid = getgrnam($opts{group});
+ if( $gid =~ /^$/ ) {
+ die "ERROR: Unknown Group: $opts{group}\n";
+ }
}
if (defined $opts{user}) {
- $uid = getpwnam($opts{user}) or die "ERROR: Unknown User: $opts{user})\n";
+ $uid = getpwnam($opts{user});
+ if( $uid =~ /^$/ ) {
+ die "ERROR: Unknown User: $opts{user}\n";
+ }
}
# If we've specified using FHS (http://www.pathname.com/fhs/) on the command line,