Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Nov 2018 19:41:00 +0000 (UTC)
From:      Matthias Fechner <mfechner@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r484406 - in head/net/rtg: . files
Message-ID:  <201811071941.wA7Jf0BO081053@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mfechner
Date: Wed Nov  7 19:40:59 2018
New Revision: 484406
URL: https://svnweb.freebsd.org/changeset/ports/484406

Log:
  * Fix runtime PHP errors that stop the code working if short_opentag is disabled (default!)
  * Remove most PHP warnings/notices that go to error_log
  * Convert patches to new format where needed
  * Fix HTML output to be valid
  * Fix quoting of SQL objects
  * Fix escaping of user-provided SQL data (potential sql injection)
  * Widen fields in 95.php and 95.pl for interface and router names
  * Fix warnings in perl modules in newer perl versions
  * Fix createdb script to use CREATE USER/GRANT not manipulate user db directly
  * Add "Update_desc" config entry to auto-update port descriptions from snmp
  * Update default SNMP version to 2
  * Although this doesn't reference any CVE's, it does contain fixes for potential security issues
  
  PR:		227376
  Submitted by:	freebsd-ports@dan.me.uk (maintainer)
  Reported by:	freebsd-ports@dan.me.uk (maintainer)
  Reviewed by:	mfechner
  Approved by:	mentors (timeout), portmgr (timeout)
  MFC after:	2 days
  Differential Revision:	https://reviews.freebsd.org/D17637

Added:
  head/net/rtg/files/patch-cgilib-0.4_cgi.c
     - copied, changed from r484405, head/net/rtg/files/patch-cgilib-cgi.c
  head/net/rtg/files/patch-config_config.h.in
     - copied unchanged from r484405, head/net/rtg/files/patch-config-config.h.in
  head/net/rtg/files/patch-etc_95.php   (contents, props changed)
  head/net/rtg/files/patch-etc_Makefile.in
     - copied unchanged from r484405, head/net/rtg/files/patch-etc-Makefile.in
  head/net/rtg/files/patch-etc_SNMP__util.pm   (contents, props changed)
  head/net/rtg/files/patch-etc_createdb.in   (contents, props changed)
  head/net/rtg/files/patch-etc_rtg.conf   (contents, props changed)
  head/net/rtg/files/patch-etc_rtg.php   (contents, props changed)
  head/net/rtg/files/patch-etc_rtgtargmkr.pl.in   (contents, props changed)
  head/net/rtg/files/patch-etc_view.php   (contents, props changed)
  head/net/rtg/files/patch-man_rtgplot.1
     - copied unchanged from r484405, head/net/rtg/files/patch-man-rtgplot.1
  head/net/rtg/files/patch-man_rtgpoll.1
     - copied unchanged from r484405, head/net/rtg/files/patch-man-rtgpoll.1
  head/net/rtg/files/patch-src_rtg.h
     - copied, changed from r484405, head/net/rtg/files/patch-src-rtg.h
  head/net/rtg/files/patch-src_rtgplot.c
     - copied unchanged from r484405, head/net/rtg/files/patch-src-rtgplot.c
  head/net/rtg/files/patch-src_rtgplot.h
     - copied, changed from r484405, head/net/rtg/files/patch-src-rtgplot.h
  head/net/rtg/files/patch-src_rtgpoll.c
     - copied unchanged from r484405, head/net/rtg/files/patch-src-rtgpoll.c
  head/net/rtg/files/patch-src_rtgutil.c   (contents, props changed)
Deleted:
  head/net/rtg/files/patch-cgilib-cgi.c
  head/net/rtg/files/patch-config-config.h.in
  head/net/rtg/files/patch-etc-95.php
  head/net/rtg/files/patch-etc-Makefile.in
  head/net/rtg/files/patch-etc-rtg.php
  head/net/rtg/files/patch-etc-rtgtargmkr.pl.in
  head/net/rtg/files/patch-etc-view.php
  head/net/rtg/files/patch-man-rtgplot.1
  head/net/rtg/files/patch-man-rtgpoll.1
  head/net/rtg/files/patch-src-rtg.h
  head/net/rtg/files/patch-src-rtgplot.c
  head/net/rtg/files/patch-src-rtgplot.h
  head/net/rtg/files/patch-src-rtgpoll.c
Modified:
  head/net/rtg/Makefile
  head/net/rtg/files/patch-etc_95.pl
  head/net/rtg/files/patch-etc_common.php.in
  head/net/rtg/files/patch-etc_report.pl

Modified: head/net/rtg/Makefile
==============================================================================
--- head/net/rtg/Makefile	Wed Nov  7 19:17:02 2018	(r484405)
+++ head/net/rtg/Makefile	Wed Nov  7 19:40:59 2018	(r484406)
@@ -3,7 +3,7 @@
 
 PORTNAME=	rtg
 PORTVERSION=	0.7.4
-PORTREVISION=	14
+PORTREVISION=	15
 CATEGORIES=	net
 MASTER_SITES=	SF \
 		ftp://ftpmirror.uk/freebsd-ports/rtg/
@@ -17,9 +17,13 @@ LIB_DEPENDS=	libnetsnmp.so:net-mgmt/net-snmp
 RUN_DEPENDS=	p5-DBI>=0:databases/p5-DBI \
 		p5-DBD-mysql>=0:databases/p5-DBD-mysql
 
+FLAVORS=	web noweb
+noweb_PKGNAMESUFFIX=	poller
+web_PKGNAMESUFFIX=	${PHP_PKGNAMESUFFIX}
+
+USES=		shebangfix perl5 mysql:client ssl
 USE_RC_SUBR=	rtgpoll
-WANT_PERL=	yes
-USES=		shebangfix mysql:client ssl
+
 SHEBANG_FILES=	etc/95.pl etc/report.pl etc/rtgtargmkr.pl.in
 SUB_FILES=	pkg-message
 GNU_CONFIGURE=	yes
@@ -30,18 +34,21 @@ CONFIGURE_ARGS+=	--sysconfdir=${PREFIX}/etc/${PORTNAME
 USERS=		rtg
 GROUPS=		rtg
 
-OPTIONS_DEFINE=	WEB MYSQL
-OPTIONS_DEFAULT=WEB
+.if ${FLAVOR:U} == web
+USES+=		php:web,flavors
+USE_PHP=	mysqli spl
+.endif
+
+OPTIONS_DEFINE=	MYSQL
 MYSQL_DESC=	Pull MySQL server in as a dependancy for local setups
-WEB_DESC=	Include PHP-based web client interface pre-requisites
 
 MYSQL_USES=	mysql:server
 
-WEB_USES=	php
-USE_PHP=	mysqli spl
-
 CFLAGS+=	-fstack-protector
 LDFLAGS+=	-fstack-protector
+
+pre-configure:
+	${REINPLACE_CMD} -e 's/my_thread_init/mysql_thread_init/' ${WRKSRC}/configure
 
 post-patch:
 	@${MV} ${WRKSRC}/etc/rtg.conf ${WRKSRC}/etc/rtg.conf.sample

Copied and modified: head/net/rtg/files/patch-cgilib-0.4_cgi.c (from r484405, head/net/rtg/files/patch-cgilib-cgi.c)
==============================================================================
--- head/net/rtg/files/patch-cgilib-cgi.c	Wed Nov  7 19:17:02 2018	(r484405, copy source)
+++ head/net/rtg/files/patch-cgilib-0.4_cgi.c	Wed Nov  7 19:40:59 2018	(r484406)
@@ -1,5 +1,5 @@
---- cgilib-0.4/cgi.c.orig	Thu Sep 25 08:21:06 2003
-+++ cgilib-0.4/cgi.c	Sat May 14 01:28:33 2005
+--- cgilib-0.4/cgi.c.orig	2003-09-25 15:21:06 UTC
++++ cgilib-0.4/cgi.c
 @@ -33,9 +33,12 @@
  #ifdef HAVE_CTYPE_H
  # include <ctype.h>

Copied: head/net/rtg/files/patch-config_config.h.in (from r484405, head/net/rtg/files/patch-config-config.h.in)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/rtg/files/patch-config_config.h.in	Wed Nov  7 19:40:59 2018	(r484406, copy of r484405, head/net/rtg/files/patch-config-config.h.in)
@@ -0,0 +1,27 @@
+--- config/config.h.in.orig	2003-09-25 15:21:14 UTC
++++ config/config.h.in
+@@ -91,19 +91,19 @@
+ #undef PACKAGE
+ 
+ /* Define to the address where bug reports for this package should be sent. */
+-#undef PACKAGE_BUGREPORT
++#undef RTG_PACKAGE_BUGREPORT
+ 
+ /* Define to the full name of this package. */
+-#undef PACKAGE_NAME
++#undef RTG_PACKAGE_NAME
+ 
+ /* Define to the full name and version of this package. */
+-#undef PACKAGE_STRING
++#undef RTG_PACKAGE_STRING
+ 
+ /* Define to the one symbol short name of this package. */
+-#undef PACKAGE_TARNAME
++#undef RTG_PACKAGE_TARNAME
+ 
+ /* Define to the version of this package. */
+-#undef PACKAGE_VERSION
++#undef RTG_PACKAGE_VERSION
+ 
+ /* Define as the return type of signal handlers (`int' or `void'). */
+ #undef RETSIGTYPE

Added: head/net/rtg/files/patch-etc_95.php
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/rtg/files/patch-etc_95.php	Wed Nov  7 19:40:59 2018	(r484406)
@@ -0,0 +1,288 @@
+--- etc/95.php.orig	2003-09-24 20:40:57 UTC
++++ etc/95.php
+@@ -1,41 +1,37 @@
+ <?php
+   include('./common.php');
+ 
+-  print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
++  print "<html>\n<!-- RTG Version $VERSION -->\n<head>\n";
+ 
+   /* Connect to RTG MySQL Database */
+-  $dbc=@mysql_connect ($host, $user, $pass) or
+-  $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or 
++  $dbc=@mysqli_connect ($host, $user, $pass, $db) or
+      die ("MySQL Connection Failed, Check Configuration.");
+-  mysql_select_db($db,$dbc);
+ 
+-  if ($PHP_SELF == "") {
++  if (!isset($PHP_SELF) || ($PHP_SELF == "")) {
+     $PHP_SELF = "95.php";
+-    $customer = $_GET['customer'];
+-    $syear = $_GET['syear'];
+-    $eyear = $_GET['eyear'];
+-    $smonth = $_GET['smonth'];
+-    $emonth = $_GET['emonth'];
+-    $sday = $_GET['sday'];
+-    $eday = $_GET['eday'];
+-    $shour = $_GET['shour'];
+-    $ehour = $_GET['ehour'];
+-    $smin = $_GET['smin'];
+-    $emin = $_GET['emin'];
+-    $debug = $_GET['debug'];
++    $customer = isset($_GET['customer'])?$_GET['customer']:"";
++    $syear = isset($_GET['syear'])?$_GET['syear']:"";
++    $eyear = isset($_GET['eyear'])?$_GET['eyear']:"";
++    $smonth = isset($_GET['smonth'])?$_GET['smonth']:"";
++    $emonth = isset($_GET['emonth'])?$_GET['emonth']:"";
++    $sday = isset($_GET['sday'])?$_GET['sday']:"";
++    $eday = isset($_GET['eday'])?$_GET['eday']:"";
++    $shour = isset($_GET['shour'])?$_GET['shour']:"";
++    $ehour = isset($_GET['ehour'])?$_GET['ehour']:"";
++    $smin = isset($_GET['smin'])?$_GET['smin']:"";
++    $emin = isset($_GET['emin'])?$_GET['emin']:"";
++    $debug = isset($_GET['debug'])?$_GET['debug']:"";
+   }
+ 
+- print "<TITLE>RTG: ";
+- if ($customer) print "$customer\n";
++ print "<title>RTG: ";
++ if ($customer != "") print "$customer\n";
+ ?>
+ 
+-</TITLE>
+-</HEAD>
+-<BODY BGCOLOR="ffffff">
+-<A HREF="http://rtg.sourceforge.net" ALT="[RTG Home Page]">
+-<IMG SRC="rtg.png" BORDER="0">
+-</A>
+-<P>
++</title>
++</head>
++<body bgcolor="ffffff">
++<a href="http://rtg.sourceforge.net"><img src="rtg.png" border="0" alt="[RTG Home Page]" /></a>
++<p>
+ 
+ <?php
+ function cmp($c1, $c2) {
+@@ -50,8 +46,8 @@ function int_stats($statement, $dbc) {
+   $max = $avg = $nintyfifth = 0;
+   $rate = array();
+ 
+-  $selectResult=mysql_query($statement, $dbc);
+-  while ($selectRow=mysql_fetch_object($selectResult)){
++  $selectResult=mysqli_query($dbc, $statement);
++  while ($selectRow=mysqli_fetch_object($selectResult)){
+     $counter = $selectRow->counter;
+     $sample_secs = $selectRow->unixtime;
+     $total += $counter;
+@@ -83,132 +79,136 @@ function int_stats($statement, $dbc) {
+ }
+ ?>
+ 
+-<HR>
+-Report: 95th percentile<BR>
++<hr />
++Report: 95th percentile<br />
+ 
+ <?php
+-  echo "<FORM ACTION=\"$PHP_SELF\" METHOD=\"GET\">\n";
+-  if (($bt || $smonth)) { 
+-    $dbc=@mysql_connect ($host, $user, $pass) or
+-    $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or die ("MySQL Connection Failed, Check Configuration.");
+-    mysql_select_db($db,$dbc);
++  echo "<form action=\"$PHP_SELF\" method=\"get\">\n";
++  if (($bt != "") || ($smonth != "")) {
++    $dbc=@mysqli_connect ($host, $user, $pass, $db) or
++      die ("MySQL Connection Failed, Check Configuration.");
+     /* Format into GNU date syntax */
+     if ($bt == "") {
+       $bt = strtotime("$syear-$smonth-$sday $shour:$smin:00");
+       $et = strtotime("$eyear-$emonth-$eday $ehour:$emin:59");
+     }
+-    echo "Customer: $customer <BR>\n";
++    echo "Customer: $customer <br />\n";
+     print strftime("Period: %m/%d/%Y %H:%M - ", $bt);
+     print strftime("%m/%d/%Y %H:%M<P>\n", $et);
+ 
+-    $range="dtime>FROM_UNIXTIME($bt) AND dtime<=FROM_UNIXTIME($et)";
++    $range="`dtime`>FROM_UNIXTIME(" . mysqli_real_escape_string($dbc, $bt) . 
++      ") AND `dtime`<=FROM_UNIXTIME(" . mysqli_real_escape_string($dbc, $et) . ")";
+ 
+-    $selectQuery="SELECT id, name, description, rid FROM interface WHERE description LIKE \"%$customer%\"";
+-    $selectResult=mysql_query($selectQuery, $dbc);
+-    if (mysql_num_rows($selectResult) <= 0) 
+-      print "<BR>No Such Customer Found.<BR>\n";
++    $selectQuery="SELECT `id`, `name`, `description`, `rid` FROM `interface` WHERE " .
++      "`description` LIKE \"%" . mysqli_real_escape_string($dbc, $customer) . "%\"";
++    $selectResult=mysqli_query($dbc, $selectQuery);
++    if (mysqli_num_rows($selectResult) <= 0) 
++      print "<br />No Such Customer Found.<br />\n";
+     else {
+-      while ($selectRow=mysql_fetch_object($selectResult)){
++      while ($selectRow=mysqli_fetch_object($selectResult)){
+         $ids[$selectRow->id] = $selectRow->name; 
+         $rids[$selectRow->id] = $selectRow->rid; 
+ 	$desc[$selectRow->id] = $selectRow->description;
+       }
+-      echo "<TABLE BORDER=\"1\">\n";
+-      echo "<TR BGCOLOR=\"#E0E0E0\">\n";
+-      echo "<TH COLSPAN=\"3\">Interface<TH COLSPAN=\"2\">Current Rate<TH COLSPAN=\"2\">Max Rate<TH COLSPAN=\"2\">95th %\n";
++      echo "<table border=\"1\">\n";
++      echo "<tr bgcolor=\"#E0E0E0\">\n";
++      echo "<th colspan=\"3\">Interface</th><th colspan=\"2\">Current Rate</th><th colspan=\"2\">Max Rate</th><th colspan=\"2\">95th %</th>\n";
+       if ($debug) 
+-        echo "<TH COLSPAN=\"2\">Samples<TH COLSPAN=\"2\">Ignore Top\n";
+-      echo "<TR BGCOLOR=\"#E0E0E0\">\n";
+-      echo "<TH>Name<TH>Description<TH>Router<TH>In (Mbps)<TH>Out (Mbps)<TH>In<TH>Out<TH>In<TH>Out\n";
++        echo "<th colspan=\"2\">Samples</th><th colspan=\"2\">Ignore Top</th>\n";
++      echo "</tr>\n";
++      echo "<tr bgcolor=\"#E0E0E0\">\n";
++      echo "<th>Name</th><th>Description</th><th>Router</th><th>In (Mbps)</th><th>Out (Mbps)</th><th>In</th><th>Out</th><th>In</th><th>Out</th>\n";
+       if ($debug) 
+-        echo "<TH>In<TH>Out<TH>In<TH>Out\n";
+-      echo "<TR BGCOLOR=\"#ffffcc\">\n";
++        echo "<th>In</th><th>Out</th><th>In</th><th>Out</th>\n";
++      echo "</tr>\n";
++      echo "<tr bgcolor=\"#ffffcc\">\n";
+       $yellow = 1;
+       foreach($ids as $iid=>$name) {
+ 
+-        $selectQuery="SELECT name FROM router WHERE rid=$rids[$iid]";
+-        $selectResult=mysql_query($selectQuery, $dbc);
+-        $selectRow=mysql_fetch_object($selectResult);
++        $selectQuery="SELECT `name` FROM `router` WHERE `rid`=$rids[$iid]";
++        $selectResult=mysqli_query($dbc, $selectQuery);
++        $selectRow=mysqli_fetch_object($selectResult);
+ 	$router = $selectRow->name;
+ 
+         if ($yellow) $yellow = 0;
+ 	else $yellow = 1;
+ 
+-        echo "<TD>$name<TD>$desc[$iid]<TD>$router";
++        echo "<td>$name</td><td>$desc[$iid]</td><td>$router</td>";
+ 
+-        $selectQuery="SELECT counter, UNIX_TIMESTAMP(dtime) as unixtime, dtime from ifInOctets_$rids[$iid] WHERE $range AND id=$iid ORDER BY dtime";
++        $selectQuery="SELECT `counter`, UNIX_TIMESTAMP(`dtime`) AS `unixtime`, `dtime` FROM `ifInOctets_$rids[$iid]` WHERE $range AND `id`=$iid ORDER BY `dtime`";
+         list ($intbytes_in, $maxin, $avgin, $nfin,$insamples,$inignore) = int_stats($selectQuery, $dbc);
+ 	$bytesin = round($intbytes_in/1000000);
+ 
+-        $selectQuery="SELECT counter, UNIX_TIMESTAMP(dtime) as unixtime, dtime from ifOutOctets_$rids[$iid] WHERE $range AND id=$iid ORDER BY dtime";
++        $selectQuery="SELECT `counter`, UNIX_TIMESTAMP(`dtime`) AS `unixtime`, `dtime` FROM `ifOutOctets_$rids[$iid]` WHERE $range AND `id`=$iid ORDER BY `dtime`";
+         list ($intbytes_out, $maxout, $avgout, $nfout,$outsamples,$outignore) = int_stats($selectQuery, $dbc);
+ 	$bytesout = round($intbytes_in/1000000);
+ 
+-	printf("<TD ALIGN=\"right\">%2.2f", $avgin/1000000);
+-	printf("<TD ALIGN=\"right\">%2.2f", $avgout/1000000);
+-	printf("<TD ALIGN=\"right\">%2.2f", $maxin/1000000);
+-	printf("<TD ALIGN=\"right\">%2.2f", $maxout/1000000);
+-	printf("<TD ALIGN=\"right\">%2.2f", $nfin/1000000);
+-	printf("<TD ALIGN=\"right\">%2.2f", $nfout/1000000);
++	printf("<td align=\"right\">%2.2f</td>", $avgin/1000000);
++	printf("<td align=\"right\">%2.2f</td>", $avgout/1000000);
++	printf("<td align=\"right\">%2.2f</td>", $maxin/1000000);
++	printf("<td align=\"right\">%2.2f</td>", $maxout/1000000);
++	printf("<td align=\"right\">%2.2f</td>", $nfin/1000000);
++	printf("<td align=\"right\">%2.2f</td>", $nfout/1000000);
+ 	if ($debug) {
+-          echo "<TD ALIGN=\"right\">$insamples<TD ALIGN=\"right\">$outsamples<TD ALIGN=\"right\">$inignore<TD ALIGN=\"right\">$outignore";
++          echo "<td align=\"right\">$insamples</td><td align=\"right\">$outsamples</td><td align=\"right\">$inignore</td><td align=\"right\">$outignore</td>";
+ 	}
+-	if ($yellow) echo "<TR BGCOLOR=\"#ffffcc\">\n";
+-	else echo "<TR BGCOLOR=\"#94D6E7\">\n";
++        echo "</tr>\n";
++	if ($yellow) echo "<tr bgcolor=\"#ffffcc\">\n";
++	else echo "<tr bgcolor=\"#94D6E7\">\n";
+       }
+-      echo "</TABLE>\n";
++      echo "</table>\n";
+     }
+   } else {
+-    echo "Customer Name: <INPUT TYPE=\"text\" NAME=\"customer\"><BR>\n";
+-    echo "<P><TABLE>\n";
+-    echo "<TD>From: \n";
+-    echo "<TD><INPUT TYPE=TEXT NAME=\"smonth\" SIZE=3 MAXLENGTH=2 VALUE=\"";
++    echo "Customer Name: <input type=\"text\" name=\"customer\" /><br />\n";
++    echo "<p><table>\n";
++    echo "<tr><td>From: </td>\n";
++    echo "<td><input type=\"text\" name=\"smonth\" size=\"3\" maxlength=\"2\" value=\"";
+     print (date("m"));
+-    echo "\"> / \n";
+-    echo "<INPUT TYPE=TEXT NAME=\"sday\" SIZE=3 MAXLENGTH=2 VALUE=\"";
++    echo "\" /> / \n";
++    echo "<input type=\"text\" name=\"sday\" size=\"3\" maxlength=\"2\" value=\"";
+     printf("%02d", (date("d") - 1));
+-    echo "\"> / \n";
+-    echo "<INPUT TYPE=TEXT NAME=\"syear\" SIZE=5 MAXLENGTH=4 VALUE=\"";
++    echo "\" /> / \n";
++    echo "<input type=\"text\" name=\"syear\" size=\"5\" maxlength=\"4\" value=\"";
+     print (date("Y"));
+-    echo "\">\n";
+-    echo "<TD><INPUT TYPE=TEXT NAME=\"shour\" SIZE=3 MAXLENGTH=2 VALUE=\"";
++    echo "\" /></td>\n";
++    echo "<td><input type=\"text\" name=\"shour\" size=\"3\" maxlength=\"2\" value=\"";
+     print (date("H"));
+-    echo "\">:\n";
+-    echo "<INPUT TYPE=TEXT NAME=\"smin\" SIZE=3 MAXLENGTH=2 VALUE=\"";
++    echo "\" />:\n";
++    echo "<input type=\"text\" name=\"smin\" size=\"3\" maxlength=\"2\" value=\"";
+     print (date("i"));
+-    echo "\">\n";
++    echo "\" /></td></tr>\n";
+ 
+-    echo "<TR><TD>To: \n";
+-    echo "<TD><INPUT TYPE=TEXT NAME=\"emonth\" SIZE=3 MAXLENGTH=2 VALUE=\"";
++    echo "<tr><td>To: </td>\n";
++    echo "<td><input type=\"text\" name=\"emonth\" size=\"3\" maxlength=\"2\" value=\"";
+     print (date("m"));
+-    echo "\"> / \n";
+-    echo "<INPUT TYPE=TEXT NAME=\"eday\" SIZE=3 MAXLENGTH=2 VALUE=\"";
++    echo "\" /> / \n";
++    echo "<input type=\"text\" name=\"eday\" size=\"3\" maxlength=\"2\" value=\"";
+     print (date("d"));
+-    echo "\"> / \n";
+-    echo "<INPUT TYPE=TEXT NAME=\"eyear\" SIZE=5 MAXLENGTH=4 VALUE=\"";
++    echo "\" /> / \n";
++    echo "<input type=\"text\" name=\"eyear\" size=\"5\" maxlength=\"4\" value=\"";
+     print (date("Y"));
+-    echo "\">\n";
+-    echo "<TD><INPUT TYPE=TEXT NAME=\"ehour\" SIZE=3 MAXLENGTH=2 VALUE=\"";
++    echo "\" /></td>\n";
++    echo "<td><input type=\"text\" name=\"ehour\" size=\"3\" maxlength=\"2\" value=\"";
+     print (date("H"));
+-    echo "\">:\n";
+-    echo "<INPUT TYPE=TEXT NAME=\"emin\" SIZE=3 MAXLENGTH=2 VALUE=\"";
++    echo "\" />:\n";
++    echo "<input type=\"text\" name=\"emin\" size=\"3\" maxlength=\"2\" value=\"";
+     print (date("i"));
+-    echo "\">\n";
+-    echo "<TR><TD>Debug: \n";
+-    echo "<TD><INPUT TYPE=CHECKBOX NAME=\"debug\">\n";
+-    echo "</TABLE>\n";
++    echo "\" /></td></tr>\n";
++    echo "<tr><td>Debug: </td>\n";
++    echo "<td><input type=\"checkbox\" name=\"debug\" /></td></tr>\n";
++    echo "</table>\n";
+ 
+-    echo "<P><INPUT TYPE=\"SUBMIT\" VALUE=\"Ok\">";
++    echo "<p><input type=\"submit\" VALUE=\"Ok\" />";
+   }
+ 
+-  if ($dbc) mysql_close($dbc);
+-  echo "</FORM>\n";
++  if ($dbc) mysqli_close($dbc);
++  echo "</form>\n";
+ ?>
+-<BR>
+-<HR>
+-<FONT FACE="Arial" SIZE="2">
++<br />
++<hr />
++<font face="Arial" size="2">
+ <?php
+- print "<A HREF=\"http://rtg.sourceforge.net\">RTG</A>; Version $VERSION</FONT>";
++ print "<a href=\"http://rtg.sourceforge.net\">RTG</a>; Version $VERSION</font>";
+ ?>
+-</BODY>
+-</HTML>
++</body>
++</html>

Modified: head/net/rtg/files/patch-etc_95.pl
==============================================================================
--- head/net/rtg/files/patch-etc_95.pl	Wed Nov  7 19:17:02 2018	(r484405)
+++ head/net/rtg/files/patch-etc_95.pl	Wed Nov  7 19:40:59 2018	(r484406)
@@ -1,4 +1,4 @@
---- etc/95.pl.orig	2016-11-04 16:36:01 UTC
+--- etc/95.pl.orig	2018-04-02 20:14:41 UTC
 +++ etc/95.pl
 @@ -31,7 +31,7 @@ $pass="rtgdefault";
  $onedaysec=60*60*24;
@@ -9,3 +9,52 @@
  foreach $conf (@configs) {
    if (open CONF, "<$conf") {
      print "Reading [$conf].\n" if $DEBUG;
+@@ -207,13 +207,13 @@ print "Period: [", format_dt($startdate)
+ write;
+ ($name,$router, $ratein, $rateout, $maxratein, $maxrateout, $nfratein, $nfrateout) = ("Connection", "", "Mbps", "Mbps", "Mbps", "Mbps", "Mbps", "Mbps");
+ write;
+-print "--------------------------------------------------------------------------------\n";
++print "----------------------------------------------------------------------------------------------------\n";
+ 
+ $dbh= DBI->connect("DBI:mysql:$db:host=$host", $user, $pass);
+ $dbh2= DBI->connect("DBI:mysql:$db:host=$host", $user, $pass);
+-$range="dtime>$startdate and dtime<=$enddate";
++$range="`dtime`>$startdate AND `dtime`<=$enddate";
+ 
+-$statement="SELECT id FROM interface WHERE description LIKE \"%$cust%\"";
++$statement="SELECT `id` FROM `interface` WHERE `description` LIKE \"%$cust%\"";
+ $sth = $dbh->prepare($statement)
+   or die "Can't prepare $statement: $dbh->errstr\n";
+ $rv = $sth->execute
+@@ -223,19 +223,19 @@ while (@row = $sth->fetchrow_array ()) {
+ }
+ 
+ foreach $interface (@interfaces) {
+-  $statement="SELECT rid, name, speed FROM interface WHERE id=$interface";
++  $statement="SELECT `rid`, `name`, `speed` FROM `interface` WHERE `id`=$interface";
+   &run_query($statement);
+   ($rid, $name, $speed) = @row;
+ 
+-  $statement="SELECT rid, name FROM router WHERE rid=$rid";
++  $statement="SELECT `rid`, `name` FROM `router` WHERE `rid`=$rid";
+   &run_query($statement);
+   ($rid, $router) = @row;
+ 
+-  $statement="SELECT counter, UNIX_TIMESTAMP(dtime), dtime FROM ifInOctets_".$rid." WHERE $range AND id=$interface ORDER BY dtime"; 
++  $statement="SELECT `counter`, UNIX_TIMESTAMP(`dtime`), `dtime` FROM `ifInOctets_".$rid."` WHERE $range AND `id`=$interface ORDER BY `dtime`"; 
+   ($intbytes_in, $maxin, $avgin, $nfin) = &interface_stats($statement);
+   $bytesin = int($intbytes_in/1000000 + .5);
+ 
+-  $statement="SELECT counter, UNIX_TIMESTAMP(dtime), dtime FROM ifOutOctets_".$rid." WHERE $range AND id=$interface ORDER BY dtime"; 
++  $statement="SELECT `counter`, UNIX_TIMESTAMP(`dtime`), `dtime` FROM `ifOutOctets_".$rid."` WHERE $range AND `id`=$interface ORDER BY `dtime`"; 
+   ($intbytes_out, $maxout, $avgout, $nfout) = &interface_stats($statement);
+   $bytesout = int($intbytes_out/1000000 + .5);
+ 
+@@ -279,6 +279,6 @@ $rc = $dbh->disconnect;
+ exit;
+ 
+ format STDOUT = 
+-@<<<<<<<<<<< @<<<<<<<<<<< @>>>>>>>  @>>>>>>>  @>>>>>>  @>>>>>>  @>>>>>>  @>>>>>>
++@<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<< @>>>>>>>  @>>>>>>>  @>>>>>>  @>>>>>>  @>>>>>>  @>>>>>>
+ $name,$router, $ratein, $rateout, $maxratein, $maxrateout, $nfratein, $nfrateout  
+ .

Copied: head/net/rtg/files/patch-etc_Makefile.in (from r484405, head/net/rtg/files/patch-etc-Makefile.in)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/rtg/files/patch-etc_Makefile.in	Wed Nov  7 19:40:59 2018	(r484406, copy of r484405, head/net/rtg/files/patch-etc-Makefile.in)
@@ -0,0 +1,49 @@
+--- etc/Makefile.in.orig	2003-10-02 15:59:32 UTC
++++ etc/Makefile.in
+@@ -84,19 +84,19 @@ am__quote = @am__quote@
+ install_sh = @install_sh@
+ 
+ top_builddir = ..
+-etcdir = /etc
+-webdir = /web
+-reportsdir = /bin
++etcdir = @etcdir@
++webdir = @webdir@
++reportsdir = @bindir@
+ 
+-ETC = rtg.conf rtgtargmkr.pl routers createdb BER.pm \
++ETC = rtg.conf.sample rtgtargmkr.pl routers.sample createdb BER.pm \
+                SNMP_Session.pm SNMP_util.pm
+ 
+ WEB = rtg.php 95.php view.php common.php rtg.png rtgback.png
+ REPORTS = report.pl 95.pl
+ 
+ EXTRA_DIST = rtgtargmkr.pl.in report.pl 95.pl createdb.in \
+-               BER.pm SNMP_Session.pm SNMP_util.pm rtg.conf \
+-	       routers rtg.php 95.php view.php common.php.in rtg.png rtgback.png
++               BER.pm SNMP_Session.pm SNMP_util.pm rtg.conf.sample \
++	       routers.sample rtg.php 95.php view.php common.php.in rtg.png rtgback.png
+ 
+ subdir = etc
+ mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+@@ -220,14 +220,14 @@ uninstall-am: uninstall-info-am
+ all:
+ 
+ install: installdirs
+-	@for i in $(ETC) ; do $(INSTALL) $(srcdir)/$$i $(prefix)$(etcdir) ; echo "install: installed $$i in $(prefix)$(etcdir)" ; done
+-	@for i in $(WEB) ; do $(INSTALL) $(srcdir)/$$i $(prefix)$(webdir) ; echo "install: installed $$i in $(prefix)$(webdir)" ; done
+-	@for i in $(REPORTS) ; do $(INSTALL) $(srcdir)/$$i $(prefix)$(reportsdir) ; echo "install: installed $$i in $(prefix)$(reportsdir)" ; done
++	@for i in $(ETC) ; do $(INSTALL) $(srcdir)/$$i $(DESTDIR)$(etcdir) ; echo "install: installed $$i in $(DESTDIR)$(etcdir)" ; done
++	@for i in $(WEB) ; do $(INSTALL) $(srcdir)/$$i $(DESTDIR)$(webdir) ; echo "install: installed $$i in $(DESTDIR)$(webdir)" ; done
++	@for i in $(REPORTS) ; do $(INSTALL) $(srcdir)/$$i $(DESTDIR)$(reportsdir) ; echo "install: installed $$i in $(DESTDIR)$(reportsdir)" ; done
+ 
+ installdirs:
+-	$(mkinstalldirs) $(prefix)$(etcdir)
+-	$(mkinstalldirs) $(prefix)$(webdir)
+-	$(mkinstalldirs) $(prefix)$(reportsdir)
++	$(mkinstalldirs) $(DESTDIR)$(etcdir)
++	$(mkinstalldirs) $(DESTDIR)$(webdir)
++	$(mkinstalldirs) $(DESTDIR)$(reportsdir)
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
+ .NOEXPORT:

Added: head/net/rtg/files/patch-etc_SNMP__util.pm
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/rtg/files/patch-etc_SNMP__util.pm	Wed Nov  7 19:40:59 2018	(r484406)
@@ -0,0 +1,22 @@
+--- etc/SNMP_util.pm.orig	2018-04-02 22:51:02 UTC
++++ etc/SNMP_util.pm
+@@ -1129,16 +1129,16 @@ sub snmpMIB_to_OID ($) {
+       $buf =~ s/OBJECT-GROUP/OBJECT IDENTIFIER/;
+       $buf =~ s/MODULE-IDENTITY/OBJECT IDENTIFIER/;
+       $buf =~ s/ IMPORTS .*\;//;
+-      $buf =~ s/ SEQUENCE {.*}//;
++      $buf =~ s/ SEQUENCE \{.*}//;
+       $buf =~ s/ SYNTAX .*//;
+       $buf =~ s/ [\w-]+ ::= OBJECT IDENTIFIER//;
+-      $buf =~ s/ OBJECT IDENTIFIER .* ::= {/ OBJECT IDENTIFIER ::= {/;
++      $buf =~ s/ OBJECT IDENTIFIER .* ::= \{/ OBJECT IDENTIFIER ::= {/;
+       $buf =~ s/".*"//;
+       if ($buf =~ /"/) {
+ 	$quote = 1;
+       }
+ 
+-      if ($buf =~ / ([\w\-]+) OBJECT IDENTIFIER ::= {([^}]+)}/) {
++      if ($buf =~ / ([\w\-]+) OBJECT IDENTIFIER ::= \{([^}]+)}/) {
+ 	$var = $1;
+ 	$buf = $2;
+ 	undef $val;

Modified: head/net/rtg/files/patch-etc_common.php.in
==============================================================================
--- head/net/rtg/files/patch-etc_common.php.in	Wed Nov  7 19:17:02 2018	(r484405)
+++ head/net/rtg/files/patch-etc_common.php.in	Wed Nov  7 19:40:59 2018	(r484406)
@@ -1,5 +1,11 @@
 --- etc/common.php.in.orig	2003-09-26 15:52:29 UTC
 +++ etc/common.php.in
+@@ -1,4 +1,4 @@
+-<?
++<?php
+  /* Begin with reasonable defaults */
+  $VERSION = "@VERSION@";
+  $host="localhost";
 @@ -6,10 +6,13 @@
   $pass="rtgdefault";
   $db="rtg";

Added: head/net/rtg/files/patch-etc_createdb.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/rtg/files/patch-etc_createdb.in	Wed Nov  7 19:40:59 2018	(r484406)
@@ -0,0 +1,146 @@
+--- etc/createdb.in.orig	2018-04-02 22:52:32 UTC
++++ etc/createdb.in
+@@ -23,11 +23,8 @@ echo ""
+ 
+ # Create the necessary SQL in two /tmp files
+ cat <<EOT >/tmp/mysql.sql
+-INSERT INTO user (Host, User, Password) VALUES ('$HOST','$USER',PASSWORD("$RTGPASS"));
+-INSERT INTO db (Host, Db, User, Select_priv, Insert_priv, Update_priv, Delete_priv, 
+-Create_priv, Drop_priv, Grant_priv, References_priv, Index_priv, Alter_priv) 
+-VALUES ('$HOST','$DATABASE','$USER','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
+-FLUSH PRIVILEGES;
++CREATE USER '$USER'@'$HOST' IDENTIFIED BY '$RTG_PASS';
++GRANT ALL ON '$DATABASE'.* TO '$USER'@'$HOST';
+ EOT
+ 
+ cat <<EOT >/tmp/rtg.sql
+@@ -35,81 +32,81 @@ cat <<EOT >/tmp/rtg.sql
+ # Table structure for table 'router'
+ #
+ 
+-CREATE TABLE router (
+-  rid int(11) unsigned NOT NULL auto_increment,
+-  name char(120) NOT NULL default '',
+-  pop char(10) NOT NULL default '',
+-  popid tinyint(3) unsigned NOT NULL default '0',
+-  PRIMARY KEY  (rid)
++CREATE TABLE `router` (
++  `rid` int(11) unsigned NOT NULL auto_increment,
++  `name` char(120) NOT NULL default '',
++  `pop` char(10) NOT NULL default '',
++  `popid` tinyint(3) unsigned NOT NULL default '0',
++  PRIMARY KEY (`rid`)
+ );
+ 
+ #
+ # Table structure for table 'interface'
+ #
+ 
+-CREATE TABLE interface (
+-  id int(11) unsigned NOT NULL auto_increment,
+-  name char(255) NOT NULL default '',
+-  rid int(11) NOT NULL default '0',
+-  speed bigint(11) default NULL,
+-  description char(255) default NULL,
+-  status enum('active','inactive') default 'active',
+-  PRIMARY KEY  (id)
++CREATE TABLE `interface` (
++  `id` int(11) unsigned NOT NULL auto_increment,
++  `name` char(255) NOT NULL default '',
++  `rid` int(11) NOT NULL default '0',
++  `speed` bigint(11) default NULL,
++  `description` char(255) default NULL,
++  `status` enum('active','inactive') default 'active',
++  PRIMARY KEY (`id`)
+ );
+ 
+ #
+ # Table structure for table 'ifInOctets'
+ #
+ 
+-CREATE TABLE ifInOctets (
+-  id int(11) NOT NULL default '0',
+-  dtime datetime NOT NULL default '0000-00-00 00:00:00',
+-  counter bigint(20) NOT NULL default '0',
+-  KEY ifInOctets_idx (dtime)
++CREATE TABLE `ifInOctets` (
++  `id` int(11) NOT NULL default '0',
++  `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
++  `counter` bigint(20) NOT NULL default '0',
++  KEY `ifInOctets_idx` (`dtime`)
+ );
+ 
+ #
+ # Table structure for table 'ifOutOctets'
+ #
+ 
+-CREATE TABLE ifOutOctets (
+-  id int(11) NOT NULL default '0',
+-  dtime datetime NOT NULL default '0000-00-00 00:00:00',
+-  counter bigint(20) NOT NULL default '0',
+-  KEY ifOutOctets_idx (dtime)
++CREATE TABLE `ifOutOctets` (
++  `id` int(11) NOT NULL default '0',
++  `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
++  `counter` bigint(20) NOT NULL default '0',
++  KEY `ifOutOctets_idx` (`dtime`)
+ );
+ 
+ #
+ # Table structure for table 'ifInUcastPkts'
+ #
+ 
+-CREATE TABLE ifInUcastPkts (
+-  id int(11) NOT NULL default '0',
+-  dtime datetime NOT NULL default '0000-00-00 00:00:00',
+-  counter bigint(20) NOT NULL default '0',
+-  KEY ifInUcastPkts_idx (dtime)
++CREATE TABLE `ifInUcastPkts` (
++  `id` int(11) NOT NULL default '0',
++  `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
++  `counter` bigint(20) NOT NULL default '0',
++  KEY `ifInUcastPkts_idx` (`dtime`)
+ );
+ 
+ #
+ # Table structure for table 'ifOutUcastPkts'
+ #
+ 
+-CREATE TABLE ifOutUcastPkts (
+-  id int(11) NOT NULL default '0',
+-  dtime datetime NOT NULL default '0000-00-00 00:00:00',
+-  counter bigint(20) NOT NULL default '0',
+-  KEY ifOutUcastPkts_idx (dtime)
++CREATE TABLE `ifOutUcastPkts` (
++  `id` int(11) NOT NULL default '0',
++  `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
++  `counter` bigint(20) NOT NULL default '0',
++  KEY `ifOutUcastPkts_idx` (`dtime`)
+ );
+ 
+ #
+ # Table structure for table 'ifInErrors'
+ #
+ 
+-CREATE TABLE ifInErrors (
+-  id int(11) NOT NULL default '0',
+-  dtime datetime NOT NULL default '0000-00-00 00:00:00',
+-  counter bigint(20) NOT NULL default '0',
+-  KEY ifInErrors_idx (dtime)
++CREATE TABLE `ifInErrors` (
++  `id` int(11) NOT NULL default '0',
++  `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
++  `counter` bigint(20) NOT NULL default '0',
++  KEY `ifInErrors_idx` (`dtime`)
+ );
+ EOT
+ 
+@@ -117,8 +114,6 @@ echo "Adding user \"$USER\" to MySQL dat
+ cat /tmp/mysql.sql | $MYSQLBIN/mysql -u root -p$ROOTPASS mysql
+ echo "Creating RTG database \"$DATABASE\"..."
+ $MYSQLBIN/mysqladmin -u root -p$ROOTPASS create $DATABASE
+-echo "Reloading MySQL privileges..."
+-$MYSQLBIN/mysqladmin -u root -p$ROOTPASS flush-privileges
+ echo "Creating RTG tables..."
+ cat /tmp/rtg.sql | $MYSQLBIN/mysql -u $USER -p$RTGPASS $DATABASE
+ echo "Done."

Modified: head/net/rtg/files/patch-etc_report.pl
==============================================================================
--- head/net/rtg/files/patch-etc_report.pl	Wed Nov  7 19:17:02 2018	(r484405)
+++ head/net/rtg/files/patch-etc_report.pl	Wed Nov  7 19:40:59 2018	(r484406)
@@ -1,4 +1,4 @@
---- etc/report.pl.orig	2016-11-04 16:36:08 UTC
+--- etc/report.pl.orig	2018-04-02 20:14:41 UTC
 +++ etc/report.pl
 @@ -30,7 +30,7 @@ $pass="rtgdefault";
  $onedaysec=60*60*24;
@@ -9,3 +9,52 @@
  foreach $conf (@configs) {
    if (open CONF, "<$conf") {
      print "Reading [$conf].\n" if $DEBUG;
+@@ -192,13 +192,13 @@ print "Period: [", format_dt($startdate)
+ write;
+ ($router,$name,$bytesin, $bytesout, $ratein, $rateout, $utilin, $utilout, $maxratein, $maxrateout, $maxutilin, $maxutilout) = ("","Connection", "MBytes", "MBytes", "Mbps", "Mbps", "In %", "Out%",  "Mbps", "Mbps", "In%", "Out%");
+ write;
+-print "----------------------------------------------------------------------------------------------------------\n";
++print "------------------------------------------------------------------------------------------------------------------------------\n";
+ 
+ $dbh= DBI->connect("DBI:mysql:$db:host=$host", $user, $pass);
+ $dbh2= DBI->connect("DBI:mysql:$db:host=$host", $user, $pass);
+-$range="dtime>$startdate and dtime<=$enddate";
++$range="`dtime`>$startdate and `dtime`<=$enddate";
+ 
+-$statement="SELECT id FROM interface WHERE description LIKE \"%$cust%\"";
++$statement="SELECT `id` FROM `interface` WHERE `description` LIKE \"%$cust%\"";
+ $sth = $dbh->prepare($statement)
+         or die "Can't prepare $statement: $dbh->errstr\n";
+ $rv = $sth->execute
+@@ -209,19 +209,19 @@ while (@row = $sth->fetchrow_array ())
+ }
+ 
+ foreach $interface (@interfaces) {
+-  $statement="SELECT rid, name, speed FROM interface WHERE id=$interface";
++  $statement="SELECT `rid`, `name`, `speed` FROM `interface` WHERE `id`=$interface";
+   &run_query($statement);
+   ($rid, $name, $speed) = @row;
+ 
+-  $statement="SELECT rid, name FROM router WHERE rid=$rid";
++  $statement="SELECT `rid`, `name` FROM `router` WHERE `rid`=$rid";
+   &run_query($statement);
+   ($rid, $router) = @row;
+ 
+-  $statement="SELECT counter, UNIX_TIMESTAMP(dtime), dtime FROM ifInOctets_".$rid." WHERE $range AND id=$interface ORDER BY dtime"; 
++  $statement="SELECT `counter`, UNIX_TIMESTAMP(`dtime`), `dtime` FROM `ifInOctets_".$rid."` WHERE $range AND `id`=$interface ORDER BY `dtime`"; 
+   ($intbytes_in, $maxin, $avgin) = &interface_stats($statement);
+   $bytesin = int($intbytes_in/1000000 + .5);
+ 
+-  $statement="SELECT counter, UNIX_TIMESTAMP(dtime), dtime FROM ifOutOctets_".$rid." WHERE $range AND id=$interface ORDER BY dtime"; 
++  $statement="SELECT `counter`, UNIX_TIMESTAMP(`dtime`), `dtime` FROM `ifOutOctets_".$rid."` WHERE $range AND `id`=$interface ORDER BY `dtime`"; 
+   ($intbytes_out, $maxout, $avgout) = &interface_stats($statement);
+   $bytesout = int($intbytes_out/1000000 + .5);
+ 
+@@ -267,6 +267,6 @@ $rc = $dbh->disconnect;
+ exit;
+ 
+ format STDOUT = 
+-@<<<<<<<<<<< @<<<<<<<<<<< @>>>>>>> @>>>>>>> @>>>>>> @>>>>>> @>>>>> @>>>>> @>>>>>> @>>>>>> @>>>>> @>>>>>
++@<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<< @>>>>>>> @>>>>>>> @>>>>>> @>>>>>> @>>>>> @>>>>> @>>>>>> @>>>>>> @>>>>> @>>>>>
+ $name,$router,&commify($bytesin), &commify($bytesout), $ratein, $rateout, $utilin, $utilout, $maxratein, $maxrateout, $maxutilin, $maxutilout  
+ .

Added: head/net/rtg/files/patch-etc_rtg.conf
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/rtg/files/patch-etc_rtg.conf	Wed Nov  7 19:40:59 2018	(r484406)
@@ -0,0 +1,10 @@
+--- etc/rtg.conf.orig	2018-04-02 23:07:32 UTC
++++ etc/rtg.conf
+@@ -12,3 +12,7 @@ DB_Database	rtg
+ DB_User	snmp
+ DB_Pass	rtgdefault
+ Threads 5
++# Set Update_desc to 1 to cause rtgtargmkr.pl to auto-update descriptions from
++# SNMP port data
++Update_desc	0
++

Added: head/net/rtg/files/patch-etc_rtg.php
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/rtg/files/patch-etc_rtg.php	Wed Nov  7 19:40:59 2018	(r484406)
@@ -0,0 +1,389 @@
+--- etc/rtg.php.orig	2003-09-24 20:42:03 UTC
++++ etc/rtg.php
+@@ -1,146 +1,152 @@
+ <?php
+   include('./common.php');
+ 
+-  print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
++  print "<html>\n<!-- RTG Version $VERSION -->\n<head>\n";
+ 
+   /* Connect to RTG MySQL Database */
+-  $dbc=@mysql_connect ($host, $user, $pass) or
+-  $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or 
++  $dbc=@mysqli_connect ($host, $user, $pass, $db) or
+      die ("MySQL Connection Failed, Check Configuration.");
+-  mysql_select_db($db,$dbc);
+ 
+- if ($PHP_SELF == "") {
++ if (!isset($PHP_SELF) || $PHP_SELF == "") {
+    $PHP_SELF = "rtg.php";
+-   $errors = $_GET['errors'];
+-   $scalex = $_GET['scalex'];
+-   $scaley = $_GET['scaley'];
+-   $aggr = $_GET['aggr'];
+-   $percentile = $_GET['percentile'];
+-   $nth = $_GET['nth'];
+-   $xplot = $_GET['xplot'];
+-   $yplot = $_GET['yplot'];
+-   $borderb = $_GET['borderb'];
+-   $iid = $_GET['iid'];
+-   $rid = $_GET['rid'];
+-   $syear = $_GET['syear'];
+-   $eyear = $_GET['eyear'];
+-   $smonth = $_GET['smonth'];
+-   $emonth = $_GET['emonth'];
+-   $sday = $_GET['sday'];
+-   $eday = $_GET['eday'];
+-   $shour = $_GET['shour'];
+-   $ehour = $_GET['ehour'];
+-   $smin = $_GET['smin'];
+-   $emin = $_GET['emin'];
++   $errors = isset($_GET['errors'])?$_GET['errors']:"";
++   $scalex = isset($_GET['scalex'])?$_GET['scalex']:"";
++   $scaley = isset($_GET['scaley'])?$_GET['scaley']:"";
++   $aggr = isset($_GET['aggr'])?$_GET['aggr']:"";
++   $percentile = isset($_GET['percentile'])?$_GET['percentile']:"";
++   $nth = isset($_GET['nth'])?$_GET['nth']:"";
++   $xplot = isset($_GET['xplot'])?$_GET['xplot']:"";
++   $yplot = isset($_GET['yplot'])?$_GET['yplot']:"";
++   $borderb = isset($_GET['borderb'])?$_GET['borderb']:"";
++   $iid = isset($_GET['iid'])?$_GET['iid']:"";
++   $rid = isset($_GET['rid'])?$_GET['rid']:"";
++   $syear = isset($_GET['syear'])?$_GET['syear']:"";
++   $eyear = isset($_GET['eyear'])?$_GET['eyear']:"";
++   $smonth = isset($_GET['smonth'])?$_GET['smonth']:"";
++   $emonth = isset($_GET['emonth'])?$_GET['emonth']:"";
++   $sday = isset($_GET['sday'])?$_GET['sday']:"";
++   $eday = isset($_GET['eday'])?$_GET['eday']:"";
++   $shour = isset($_GET['shour'])?$_GET['shour']:"";
++   $ehour = isset($_GET['ehour'])?$_GET['ehour']:"";
++   $smin = isset($_GET['smin'])?$_GET['smin']:"";
++   $emin = isset($_GET['emin'])?$_GET['emin']:"";
+  }
+ 
+   # Determine router, interface names as necessary
+-  if ($rid && $iid) {
+-    $selectQuery="SELECT a.name, a.description, a.speed, b.name AS router FROM interface a, router b WHERE a.rid=b.rid AND a.rid=$rid AND a.id=$iid[0]";
+-    $selectResult=mysql_query($selectQuery, $dbc);
+-    $selectRow=mysql_fetch_object($selectResult);
+-    $interfaces = mysql_num_rows($selectResult);
++  if (($rid != "") && ($iid != "")) {
++    $selectQuery="SELECT `a`.`name`, `a`.`description`, `a`.`speed`, `b`.`name` " .
++      "AS `router` FROM `interface` `a`, `router` `b` WHERE `a`.`rid`=`b`.`rid` " .
++      "AND `a`.`rid`=" . mysqli_real_escape_string($dbc, $rid) . " AND `a`.`id`=" .
++      mysqli_real_escape_string($dbc, $iid[0]);
++    $selectResult=mysqli_query($dbc, $selectQuery);
++    $selectRow=mysqli_fetch_object($selectResult);
++    $interfaces = mysqli_num_rows($selectResult);
+     $name = $selectRow->name;
+     $description = $selectRow->description;
+     $speed = ($selectRow->speed)/1000000;
+     $router = $selectRow->router;
+-  } else if ($rid && !$iid) {
+-    $selectQuery="SELECT name AS router from router where rid=$rid";
+-    $selectResult=mysql_query($selectQuery, $dbc);
+-    $selectRow=mysql_fetch_object($selectResult);
++  } else if (($rid != "") && ($iid == "")) {
++    $selectQuery="SELECT `name` AS `router` FROM `router` WHERE `rid`=" .
++      mysqli_real_escape_string($dbc, $rid);
++    $selectResult=mysqli_query($dbc, $selectQuery);
++    $selectRow=mysqli_fetch_object($selectResult);
+     $router = $selectRow->router;
+   }
+ 
+   # Generate Title 
+-  echo "<TITLE>RTG: ";
+-  if ($rid && $iid) echo "$router: $name";
+-  else if ($rid && !$iid) echo "$router";
+-  echo "</TITLE>\n";
++  echo "<title>RTG: ";
++  if (($rid != "") && ($iid != "")) echo "$router: $name";
++  else if (($rid != "") && ($iid == "")) echo "$router";
++  echo "</title>\n";
+ ?>
+ 
+-</HEAD>
+-<BODY BACKGROUND="rtgback.png" BGCOLOR="ffffff">
+-<A HREF="http://rtg.sourceforge.net" ALT="[RTG Home Page]">
+-<IMG SRC="rtg.png" BORDER="0">
+-</A>
+-<P>
++</head>
++<body background="rtgback.png" bgcolor="ffffff">
++<a href="http://rtg.sourceforge.net" alt="[RTG Home Page]"><img src="rtg.png" border="0" /></a>
++<p>
+ 
+ <?php
+-echo "<FORM ACTION=\"$PHP_SELF\" METHOD=\"get\">\n";
++echo "<form action=\"$PHP_SELF\" method=\"get\">\n";
+ 
+-if (!$rid && !$iid) {
+- echo "<SELECT NAME=\"rid\" SIZE=10>\n";
+- $selectQuery="SELECT DISTINCT name, rid FROM router ORDER BY name";
+- $selectResult=mysql_query($selectQuery, $dbc);
+- while ($selectRow=mysql_fetch_object($selectResult)){
+-    echo "<OPTION VALUE=\"$selectRow->rid\">$selectRow->name\n";
++if (($rid == "") && ($iid == "")) {
++ echo "<select name=\"rid\" size=\"10\">\n";
++ $selectQuery="SELECT DISTINCT `name`, `rid` FROM `router` ORDER BY `name`";
++ $selectResult=mysqli_query($dbc, $selectQuery);
++ while ($selectRow=mysqli_fetch_object($selectResult)){
++    echo "<option value=\"$selectRow->rid\">$selectRow->name</option>\n";
+  }
+- echo "</SELECT>\n";
++ echo "</select>\n";
+ }
+ 
+-if ($smonth != "" && $iid == "") {
+- echo "<BLOCKQUOTE><FONT SIZE=+1><STRONG>\n";
++if (($smonth != "") && ($iid == "")) {
++ echo "<blockquote><font size=\"+1\"><b>\n";
+  echo "Please select an interface!\n";
+- echo "</FONT></STRONG></BLOCKQUOTE>\n";
++ echo "</b></font></blockquote>\n";
+ }
+ 
+-if ($rid && !$iid) {
+-  echo "<SELECT NAME=\"rid\" SIZE=10>\n"; 
+-  echo "<OPTION SELECTED VALUE=\"$rid\">$router\n";
+-  echo "</SELECT>\n";
++if (($rid != "") && ($iid == "")) {
++  echo "<select name=\"rid\" size=\"10\">\n"; 
++  echo "<option selected value=\"$rid\">$router</option>\n";
++  echo "</select>\n";
+ 
+-  echo "<SELECT MULTIPLE NAME=\"iid[]\" SIZE=10>\n"; 
+-  $selectQuery="SELECT id, name, description FROM interface WHERE rid=$rid ORDER BY name";
+-  $selectResult=mysql_query($selectQuery, $dbc);
+-  while ($selectRow=mysql_fetch_object($selectResult)){
+-     echo "<OPTION VALUE=\"$selectRow->id\">$selectRow->name ($selectRow->description)\n";
++  echo "<select multiple name=\"iid[]\" size=\"10\">\n";
++  $selectQuery="SELECT `id`, `name`, `description` FROM `interface` WHERE " .
++    "`rid`=" . mysqli_real_escape_string($dbc, $rid) . " ORDER BY `name`";
++  $selectResult=mysqli_query($dbc, $selectQuery);
++  while ($selectRow=mysqli_fetch_object($selectResult)){
++     echo "<option value=\"$selectRow->id\">$selectRow->name ($selectRow->description)</option>\n";
+   }
+-  echo "</SELECT>\n";
++  echo "</select>\n";
+ 
+-  echo "<P><TABLE>\n";
+-  echo "<TD>From: \n";
+-  echo "<TD><INPUT TYPE=TEXT NAME=\"smonth\" SIZE=3 MAXLENGTH=2 VALUE=\"";
++  echo "<p><table>\n";
++  echo "<tr><td>From: </td>\n";
++  echo "<td><input type=\"text\" name=\"smonth\" size=\"3\" maxlength=\"2\" value=\"";
+   print (date("m"));
+-  echo "\"> / \n";
+-  echo "<INPUT TYPE=TEXT NAME=\"sday\" SIZE=3 MAXLENGTH=2 VALUE=\"";
++  echo "\" /> / \n";
++  echo "<input type=\"text\" name=\"sday\" size=\"3\" maxlength=\"2\" value=\"";
+   print (date("d"));
+-  echo "\"> / \n";
+-  echo "<INPUT TYPE=TEXT NAME=\"syear\" SIZE=5 MAXLENGTH=4 VALUE=\"";
++  echo "\" /> / \n";
++  echo "<input type=\"text\" name=\"syear\" size=\"5\" maxlength=\"4\" value=\"";
+   print (date("Y"));
+-  echo "\">\n";
+-  echo "<TD><INPUT TYPE=TEXT NAME=\"shour\" SIZE=3 MAXLENGTH=2 VALUE=\"00\">:\n";
+-  echo "<INPUT TYPE=TEXT NAME=\"smin\" SIZE=3 MAXLENGTH=2 VALUE=\"00\">\n";
++  echo "\" />\n";
++  echo "</td>";
++  echo "<td><input type=\"text\" name=\"shour\" size=\"3\" maxlength=\"2\" value=\"00\" />:\n";
++  echo "<input type=\"text\" name=\"smin\" size=\"3\" maxlength=\"2\" value=\"00\" />\n";
++  echo "</td></tr>\n";
+ 
+-  echo "<TR><TD>To: \n";
+-  echo "<TD><INPUT TYPE=TEXT NAME=\"emonth\" SIZE=3 MAXLENGTH=2 VALUE=\"";
++  echo "<tr><td>To: </td>\n";
++  echo "<td><input type=\"text\" name=\"emonth\" size=\"3\" maxlength=\"2\" value=\"";
+   print (date("m"));
+-  echo "\"> / \n";
+-  echo "<INPUT TYPE=TEXT NAME=\"eday\" SIZE=3 MAXLENGTH=2 VALUE=\"";
++  echo "\" /> / \n";
++  echo "<input type=\"text\" name=\"eday\" size=\"3\" maxlength=\"2\" value=\"";
+   print (date("d"));
+-  echo "\"> / \n";
+-  echo "<INPUT TYPE=TEXT NAME=\"eyear\" SIZE=5 MAXLENGTH=4 VALUE=\"";
++  echo "\" /> / \n";
++  echo "<input type=\"text\" name=\"eyear\" size=\"5\" maxlength=\"4\" value=\"";
+   print (date("Y"));
+-  echo "\">\n";
+-  echo "<TD><INPUT TYPE=TEXT NAME=\"ehour\" SIZE=3 MAXLENGTH=2 VALUE=\"23\">:\n";
+-  echo "<INPUT TYPE=TEXT NAME=\"emin\" SIZE=3 MAXLENGTH=2 VALUE=\"59\">\n";
+-  echo "<TR><TD>Aggregate Interfaces: \n";
+-  echo "<TD><INPUT TYPE=CHECKBOX NAME=\"aggr\">\n";
+-  echo "<TR><TD><INPUT TYPE=TEXT NAME=\"nth\" SIZE=2 MAXLENGTH=2 VALUE=\"95\">th Percentile: \n";
+-  echo "<TD><INPUT TYPE=CHECKBOX NAME=\"percentile\">\n";
+-  echo "<TR><TD>Fit to Data: \n";
+-  echo "<TD><INPUT TYPE=CHECKBOX NAME=\"scalex\">\n";
+-  echo "<TR><TD>Fit to Speed: \n";
+-  echo "<TD><INPUT TYPE=CHECKBOX NAME=\"scaley\">\n";
+-  echo "<TR><TD>X Size: \n";
+-  echo "<TD><INPUT TYPE=TEXT NAME=\"xplot\" SIZE=3 VALUE=\"500\">\n";
+-  echo "<TR><TD>Y Size: \n";
+-  echo "<TD><INPUT TYPE=TEXT NAME=\"yplot\" SIZE=3 VALUE=\"150\">\n";
+-  echo "<TR><TD>BorderB: \n";
+-  echo "<TD><INPUT TYPE=TEXT NAME=\"borderb\" SIZE=3 VALUE=\"70\">\n";
+-  echo "</TABLE>\n";
++  echo "\" />\n";
++  echo "</td>";
++  echo "<td><input type=\"text\" name=\"ehour\" size=\"3\" maxlength=\"2\" value=\"23\" />:\n";
++  echo "<input type=\"text\" name=\"emin\" size=\"3\" maxlength=\"2\" value=\"59\" />\n";
++  echo "</td></tr>\n";
++
++  echo "<tr><td>Aggregate Interfaces: </td>\n";
++  echo "<td><input type=\"checkbox\" name=\"aggr\" /></td></tr>\n";

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811071941.wA7Jf0BO081053>