diff options
author | oliver <oliver@FreeBSD.org> | 2006-04-24 01:39:52 +0800 |
---|---|---|
committer | oliver <oliver@FreeBSD.org> | 2006-04-24 01:39:52 +0800 |
commit | bc616f0595e4bd0259afcb4879ba9ed4fc0a6a3b (patch) | |
tree | 5246ef2873095b27618d42c70fb4e947fe495fa7 /net-mgmt/mrtg | |
parent | bdff4dd188cf125e9d028d44dd9cb94ed0f0400a (diff) | |
download | freebsd-ports-gnome-bc616f0595e4bd0259afcb4879ba9ed4fc0a6a3b.tar.gz freebsd-ports-gnome-bc616f0595e4bd0259afcb4879ba9ed4fc0a6a3b.tar.zst freebsd-ports-gnome-bc616f0595e4bd0259afcb4879ba9ed4fc0a6a3b.zip |
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)
Diffstat (limited to 'net-mgmt/mrtg')
-rw-r--r-- | net-mgmt/mrtg/files/mrtg_daemon.sh.in | 3 | ||||
-rw-r--r-- | net-mgmt/mrtg/files/patch-bin_mrtg | 22 |
2 files changed, 24 insertions, 1 deletions
diff --git a/net-mgmt/mrtg/files/mrtg_daemon.sh.in b/net-mgmt/mrtg/files/mrtg_daemon.sh.in index 1f75d573801b..a3ad075b0786 100644 --- a/net-mgmt/mrtg/files/mrtg_daemon.sh.in +++ b/net-mgmt/mrtg/files/mrtg_daemon.sh.in @@ -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" diff --git a/net-mgmt/mrtg/files/patch-bin_mrtg b/net-mgmt/mrtg/files/patch-bin_mrtg new file mode 100644 index 000000000000..3af5781e32d3 --- /dev/null +++ b/net-mgmt/mrtg/files/patch-bin_mrtg @@ -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, |