- add a patch to untaint $inlast, $outlast; avoids triggering

perl 5.10.1 taint mode checks with rateup and SNMP fetches when
dropping privs with --user

- use SYSCONFDIR

ok jasper@
This commit is contained in:
sthen 2010-01-13 12:33:24 +00:00
parent 4f7478ebae
commit eb80eb681a
2 changed files with 33 additions and 2 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.62 2010/01/05 16:36:33 okan Exp $
# $OpenBSD: Makefile,v 1.63 2010/01/13 12:33:24 sthen Exp $
COMMENT= multi-router traffic grapher
DISTNAME= mrtg-2.16.2
PKGNAME= ${DISTNAME}p0
PKGNAME= ${DISTNAME}p1
CATEGORIES= net
HOMEPAGE= http://oss.oetiker.ch/mrtg/
@ -38,6 +38,10 @@ CONFIGURE_ENV= CPPFLAGS="-I${X11BASE}/include" \
NO_REGRESS= Yes
# SUBST_CMD mangles the file
pre-configure:
@perl -pi -e 's,%%SYSCONFDIR%%,${SYSCONFDIR},g' ${WRKSRC}/bin/mrtg
do-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/mrtg
${INSTALL_DATA_DIR} ${PREFIX}/libdata/perl5/site_perl/Pod

View File

@ -0,0 +1,27 @@
$OpenBSD: patch-bin_mrtg,v 1.1 2010/01/13 12:33:24 sthen Exp $
--- bin/mrtg.orig Wed Jan 13 00:17:19 2010
+++ bin/mrtg Wed Jan 13 00:17:49 2010
@@ -212,7 +212,7 @@ sub main {
my $cfgfile = shift @ARGV;
- if ( !defined $cfgfile and -r "/etc/mrtg.cfg" ) { $cfgfile = "/etc/mrtg.cfg"; }
+ if ( !defined $cfgfile and -r "%%SYSCONFDIR%%/mrtg.cfg" ) { $cfgfile = "%%SYSCONFDIR%%/mrtg.cfg"; }
printusage() unless defined $cfgfile;
@@ -910,6 +910,14 @@ sub writegraphics {
# set values to -1 to tell rateup about unknown values
$inlast = -1 unless defined $inlast;
$outlast = -1 unless defined $outlast;
+
+ # untaint
+ if ($inlast =~ /^([-0-9.]+)$/) {
+ $inlast = $1;
+ }
+ if ($outlast =~ /^([-0-9.]+)$/) {
+ $outlast = $1;
+ }
if ($$rcfg{'options'}{'dorelpercent'}{$router}) {
@exec = ("${FindBin::Bin}${MRTG_lib::SL}rateup",