diff -ruN net/rtg.orig/Makefile net/rtg/Makefile --- net/rtg.orig/Makefile 2017-04-11 08:17:49.000000000 +0100 +++ net/rtg/Makefile 2018-04-08 19:33:52.368000000 +0100 @@ -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,11 @@ RUN_DEPENDS= p5-DBI>=0:databases/p5-DBI \ p5-DBD-mysql>=0:databases/p5-DBD-mysql +FLAVORS= web noweb +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,16 +32,16 @@ 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 diff -ruN net/rtg.orig/files/patch-cgilib-0.4_cgi.c net/rtg/files/patch-cgilib-0.4_cgi.c --- net/rtg.orig/files/patch-cgilib-0.4_cgi.c 1970-01-01 01:00:00.000000000 +0100 +++ net/rtg/files/patch-cgilib-0.4_cgi.c 2018-04-02 21:15:02.007100000 +0100 @@ -0,0 +1,15 @@ +--- 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 + #endif ++/* Unnecessary on FreeBSD; malloc.h included in stdlib.h */ ++/* + #ifdef HAVE_MALLOC_H + # include + #endif ++*/ + + #include + diff -ruN net/rtg.orig/files/patch-cgilib-cgi.c net/rtg/files/patch-cgilib-cgi.c --- net/rtg.orig/files/patch-cgilib-cgi.c 2014-01-22 17:40:44.000000000 +0000 +++ net/rtg/files/patch-cgilib-cgi.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +0,0 @@ ---- 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 -@@ -33,9 +33,12 @@ - #ifdef HAVE_CTYPE_H - # include - #endif -+/* Unnecessary on FreeBSD; malloc.h included in stdlib.h */ -+/* - #ifdef HAVE_MALLOC_H - # include - #endif -+*/ - - #include - diff -ruN net/rtg.orig/files/patch-config-config.h.in net/rtg/files/patch-config-config.h.in --- net/rtg.orig/files/patch-config-config.h.in 2016-10-26 08:01:15.000000000 +0100 +++ net/rtg/files/patch-config-config.h.in 1970-01-01 01:00:00.000000000 +0100 @@ -1,27 +0,0 @@ ---- 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 diff -ruN net/rtg.orig/files/patch-config_config.h.in net/rtg/files/patch-config_config.h.in --- net/rtg.orig/files/patch-config_config.h.in 1970-01-01 01:00:00.000000000 +0100 +++ net/rtg/files/patch-config_config.h.in 2018-04-02 21:54:49.494298000 +0100 @@ -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 diff -ruN net/rtg.orig/files/patch-etc-95.php net/rtg/files/patch-etc-95.php --- net/rtg.orig/files/patch-etc-95.php 2016-10-26 08:01:15.000000000 +0100 +++ net/rtg/files/patch-etc-95.php 1970-01-01 01:00:00.000000000 +0100 @@ -1,72 +0,0 @@ ---- etc/95.php.orig 2003-09-24 20:40:57 UTC -+++ etc/95.php -@@ -4,10 +4,8 @@ - print "\n\n\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 == "") { - $PHP_SELF = "95.php"; -@@ -50,8 +48,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; -@@ -89,9 +87,8 @@ Report: 95th percentile
- \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); -+ $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"); -@@ -104,11 +101,11 @@ Report: 95th percentile
- $range="dtime>FROM_UNIXTIME($bt) AND dtime<=FROM_UNIXTIME($et)"; - - $selectQuery="SELECT id, name, description, rid FROM interface WHERE description LIKE \"%$customer%\""; -- $selectResult=mysql_query($selectQuery, $dbc); -- if (mysql_num_rows($selectResult) <= 0) -+ $selectResult=mysqli_query($dbc, $selectQuery); -+ if (mysqli_num_rows($selectResult) <= 0) - print "
No Such Customer Found.
\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; -@@ -127,8 +124,8 @@ Report: 95th percentile
- foreach($ids as $iid=>$name) { - - $selectQuery="SELECT name FROM router WHERE rid=$rids[$iid]"; -- $selectResult=mysql_query($selectQuery, $dbc); -- $selectRow=mysql_fetch_object($selectResult); -+ $selectResult=mysqli_query($dbc, $selectQuery); -+ $selectRow=mysqli_fetch_object($selectResult); - $router = $selectRow->name; - - if ($yellow) $yellow = 0; -@@ -201,7 +198,7 @@ Report: 95th percentile
- echo "

"; - } - -- if ($dbc) mysql_close($dbc); -+ if ($dbc) mysqli_close($dbc); - echo "\n"; - ?> -
diff -ruN net/rtg.orig/files/patch-etc-Makefile.in net/rtg/files/patch-etc-Makefile.in --- net/rtg.orig/files/patch-etc-Makefile.in 2016-10-26 08:01:15.000000000 +0100 +++ net/rtg/files/patch-etc-Makefile.in 1970-01-01 01:00:00.000000000 +0100 @@ -1,49 +0,0 @@ ---- 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: diff -ruN net/rtg.orig/files/patch-etc-rtg.php net/rtg/files/patch-etc-rtg.php --- net/rtg.orig/files/patch-etc-rtg.php 2016-10-26 08:01:15.000000000 +0100 +++ net/rtg/files/patch-etc-rtg.php 1970-01-01 01:00:00.000000000 +0100 @@ -1,122 +0,0 @@ ---- etc/rtg.php.orig 2003-09-24 20:42:03 UTC -+++ etc/rtg.php -@@ -4,10 +4,8 @@ - print "\n\n\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 == "") { - $PHP_SELF = "rtg.php"; -@@ -37,17 +35,17 @@ - # 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); -+ $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); -+ $selectResult=mysqli_query($dbc, $selectQuery); -+ $selectRow=mysqli_fetch_object($selectResult); - $router = $selectRow->router; - } - -@@ -71,8 +69,8 @@ echo "

\n"; - $selectQuery="SELECT DISTINCT name, rid FROM router ORDER BY name"; -- $selectResult=mysql_query($selectQuery, $dbc); -- while ($selectRow=mysql_fetch_object($selectResult)){ -+ $selectResult=mysqli_query($dbc, $selectQuery); -+ while ($selectRow=mysqli_fetch_object($selectResult)){ - echo "