View | Details | Raw Unified | Return to bug 227376 | Differences between
and this patch

Collapse All | Expand All

(-)net/rtg/Makefile (-9 / +11 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	rtg
4
PORTNAME=	rtg
5
PORTVERSION=	0.7.4
5
PORTVERSION=	0.7.4
6
PORTREVISION=	14
6
PORTREVISION=	15
7
CATEGORIES=	net
7
CATEGORIES=	net
8
MASTER_SITES=	SF \
8
MASTER_SITES=	SF \
9
		ftp://ftpmirror.uk/freebsd-ports/rtg/
9
		ftp://ftpmirror.uk/freebsd-ports/rtg/
Lines 17-25 Link Here
17
RUN_DEPENDS=	p5-DBI>=0:databases/p5-DBI \
17
RUN_DEPENDS=	p5-DBI>=0:databases/p5-DBI \
18
		p5-DBD-mysql>=0:databases/p5-DBD-mysql
18
		p5-DBD-mysql>=0:databases/p5-DBD-mysql
19
19
20
FLAVORS=	web noweb
21
web_PKGNAMESUFFIX=	${PHP_PKGNAMESUFFIX}
22
23
USES=		shebangfix perl5 mysql:client ssl
20
USE_RC_SUBR=	rtgpoll
24
USE_RC_SUBR=	rtgpoll
21
WANT_PERL=	yes
22
USES=		shebangfix mysql:client ssl
23
SHEBANG_FILES=	etc/95.pl etc/report.pl etc/rtgtargmkr.pl.in
25
SHEBANG_FILES=	etc/95.pl etc/report.pl etc/rtgtargmkr.pl.in
24
SUB_FILES=	pkg-message
26
SUB_FILES=	pkg-message
25
GNU_CONFIGURE=	yes
27
GNU_CONFIGURE=	yes
Lines 30-45 Link Here
30
USERS=		rtg
32
USERS=		rtg
31
GROUPS=		rtg
33
GROUPS=		rtg
32
34
33
OPTIONS_DEFINE=	WEB MYSQL
35
.if ${FLAVOR:U} == web
34
OPTIONS_DEFAULT=WEB
36
USES+=		php:web,flavors
37
USE_PHP=	mysqli spl
38
.endif
39
40
OPTIONS_DEFINE=	MYSQL
35
MYSQL_DESC=	Pull MySQL server in as a dependancy for local setups
41
MYSQL_DESC=	Pull MySQL server in as a dependancy for local setups
36
WEB_DESC=	Include PHP-based web client interface pre-requisites
37
42
38
MYSQL_USES=	mysql:server
43
MYSQL_USES=	mysql:server
39
44
40
WEB_USES=	php
41
USE_PHP=	mysqli spl
42
43
CFLAGS+=	-fstack-protector
45
CFLAGS+=	-fstack-protector
44
LDFLAGS+=	-fstack-protector
46
LDFLAGS+=	-fstack-protector
45
47
(-)net/rtg/files/patch-cgilib-0.4_cgi.c (+15 lines)
Line 0 Link Here
1
--- cgilib-0.4/cgi.c.orig	2003-09-25 15:21:06 UTC
2
+++ cgilib-0.4/cgi.c
3
@@ -33,9 +33,12 @@
4
 #ifdef HAVE_CTYPE_H
5
 # include <ctype.h>
6
 #endif
7
+/* Unnecessary on FreeBSD; malloc.h included in stdlib.h */
8
+/*
9
 #ifdef HAVE_MALLOC_H
10
 # include <malloc.h>
11
 #endif
12
+*/
13
 
14
 #include <cgi.h>
15
 
(-)net/rtg/files/patch-cgilib-cgi.c (-15 lines)
Lines 1-15 Link Here
1
--- cgilib-0.4/cgi.c.orig	Thu Sep 25 08:21:06 2003
2
+++ cgilib-0.4/cgi.c	Sat May 14 01:28:33 2005
3
@@ -33,9 +33,12 @@
4
 #ifdef HAVE_CTYPE_H
5
 # include <ctype.h>
6
 #endif
7
+/* Unnecessary on FreeBSD; malloc.h included in stdlib.h */
8
+/*
9
 #ifdef HAVE_MALLOC_H
10
 # include <malloc.h>
11
 #endif
12
+*/
13
 
14
 #include <cgi.h>
15
 
(-)net/rtg/files/patch-config-config.h.in (-27 lines)
Lines 1-27 Link Here
1
--- config/config.h.in.orig	2003-09-25 15:21:14 UTC
2
+++ config/config.h.in
3
@@ -91,19 +91,19 @@
4
 #undef PACKAGE
5
 
6
 /* Define to the address where bug reports for this package should be sent. */
7
-#undef PACKAGE_BUGREPORT
8
+#undef RTG_PACKAGE_BUGREPORT
9
 
10
 /* Define to the full name of this package. */
11
-#undef PACKAGE_NAME
12
+#undef RTG_PACKAGE_NAME
13
 
14
 /* Define to the full name and version of this package. */
15
-#undef PACKAGE_STRING
16
+#undef RTG_PACKAGE_STRING
17
 
18
 /* Define to the one symbol short name of this package. */
19
-#undef PACKAGE_TARNAME
20
+#undef RTG_PACKAGE_TARNAME
21
 
22
 /* Define to the version of this package. */
23
-#undef PACKAGE_VERSION
24
+#undef RTG_PACKAGE_VERSION
25
 
26
 /* Define as the return type of signal handlers (`int' or `void'). */
27
 #undef RETSIGTYPE
(-)net/rtg/files/patch-config_config.h.in (+27 lines)
Line 0 Link Here
1
--- config/config.h.in.orig	2003-09-25 15:21:14 UTC
2
+++ config/config.h.in
3
@@ -91,19 +91,19 @@
4
 #undef PACKAGE
5
 
6
 /* Define to the address where bug reports for this package should be sent. */
7
-#undef PACKAGE_BUGREPORT
8
+#undef RTG_PACKAGE_BUGREPORT
9
 
10
 /* Define to the full name of this package. */
11
-#undef PACKAGE_NAME
12
+#undef RTG_PACKAGE_NAME
13
 
14
 /* Define to the full name and version of this package. */
15
-#undef PACKAGE_STRING
16
+#undef RTG_PACKAGE_STRING
17
 
18
 /* Define to the one symbol short name of this package. */
19
-#undef PACKAGE_TARNAME
20
+#undef RTG_PACKAGE_TARNAME
21
 
22
 /* Define to the version of this package. */
23
-#undef PACKAGE_VERSION
24
+#undef RTG_PACKAGE_VERSION
25
 
26
 /* Define as the return type of signal handlers (`int' or `void'). */
27
 #undef RETSIGTYPE
(-)net/rtg/files/patch-etc-95.php (-72 lines)
Lines 1-72 Link Here
1
--- etc/95.php.orig	2003-09-24 20:40:57 UTC
2
+++ etc/95.php
3
@@ -4,10 +4,8 @@
4
   print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
5
 
6
   /* Connect to RTG MySQL Database */
7
-  $dbc=@mysql_connect ($host, $user, $pass) or
8
-  $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or 
9
+  $dbc=@mysqli_connect ($host, $user, $pass, $db) or
10
      die ("MySQL Connection Failed, Check Configuration.");
11
-  mysql_select_db($db,$dbc);
12
 
13
   if ($PHP_SELF == "") {
14
     $PHP_SELF = "95.php";
15
@@ -50,8 +48,8 @@ function int_stats($statement, $dbc) {
16
   $max = $avg = $nintyfifth = 0;
17
   $rate = array();
18
 
19
-  $selectResult=mysql_query($statement, $dbc);
20
-  while ($selectRow=mysql_fetch_object($selectResult)){
21
+  $selectResult=mysqli_query($dbc, $statement);
22
+  while ($selectRow=mysqli_fetch_object($selectResult)){
23
     $counter = $selectRow->counter;
24
     $sample_secs = $selectRow->unixtime;
25
     $total += $counter;
26
@@ -89,9 +87,8 @@ Report: 95th percentile<BR>
27
 <?php
28
   echo "<FORM ACTION=\"$PHP_SELF\" METHOD=\"GET\">\n";
29
   if (($bt || $smonth)) { 
30
-    $dbc=@mysql_connect ($host, $user, $pass) or
31
-    $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or die ("MySQL Connection Failed, Check Configuration.");
32
-    mysql_select_db($db,$dbc);
33
+    $dbc=@mysqli_connect ($host, $user, $pass, $db) or
34
+      die ("MySQL Connection Failed, Check Configuration.");
35
     /* Format into GNU date syntax */
36
     if ($bt == "") {
37
       $bt = strtotime("$syear-$smonth-$sday $shour:$smin:00");
38
@@ -104,11 +101,11 @@ Report: 95th percentile<BR>
39
     $range="dtime>FROM_UNIXTIME($bt) AND dtime<=FROM_UNIXTIME($et)";
40
 
41
     $selectQuery="SELECT id, name, description, rid FROM interface WHERE description LIKE \"%$customer%\"";
42
-    $selectResult=mysql_query($selectQuery, $dbc);
43
-    if (mysql_num_rows($selectResult) <= 0) 
44
+    $selectResult=mysqli_query($dbc, $selectQuery);
45
+    if (mysqli_num_rows($selectResult) <= 0) 
46
       print "<BR>No Such Customer Found.<BR>\n";
47
     else {
48
-      while ($selectRow=mysql_fetch_object($selectResult)){
49
+      while ($selectRow=mysqli_fetch_object($selectResult)){
50
         $ids[$selectRow->id] = $selectRow->name; 
51
         $rids[$selectRow->id] = $selectRow->rid; 
52
 	$desc[$selectRow->id] = $selectRow->description;
53
@@ -127,8 +124,8 @@ Report: 95th percentile<BR>
54
       foreach($ids as $iid=>$name) {
55
 
56
         $selectQuery="SELECT name FROM router WHERE rid=$rids[$iid]";
57
-        $selectResult=mysql_query($selectQuery, $dbc);
58
-        $selectRow=mysql_fetch_object($selectResult);
59
+        $selectResult=mysqli_query($dbc, $selectQuery);
60
+        $selectRow=mysqli_fetch_object($selectResult);
61
 	$router = $selectRow->name;
62
 
63
         if ($yellow) $yellow = 0;
64
@@ -201,7 +198,7 @@ Report: 95th percentile<BR>
65
     echo "<P><INPUT TYPE=\"SUBMIT\" VALUE=\"Ok\">";
66
   }
67
 
68
-  if ($dbc) mysql_close($dbc);
69
+  if ($dbc) mysqli_close($dbc);
70
   echo "</FORM>\n";
71
 ?>
72
 <BR>
(-)net/rtg/files/patch-etc-Makefile.in (-49 lines)
Lines 1-49 Link Here
1
--- etc/Makefile.in.orig	2003-10-02 15:59:32 UTC
2
+++ etc/Makefile.in
3
@@ -84,19 +84,19 @@ am__quote = @am__quote@
4
 install_sh = @install_sh@
5
 
6
 top_builddir = ..
7
-etcdir = /etc
8
-webdir = /web
9
-reportsdir = /bin
10
+etcdir = @etcdir@
11
+webdir = @webdir@
12
+reportsdir = @bindir@
13
 
14
-ETC = rtg.conf rtgtargmkr.pl routers createdb BER.pm \
15
+ETC = rtg.conf.sample rtgtargmkr.pl routers.sample createdb BER.pm \
16
                SNMP_Session.pm SNMP_util.pm
17
 
18
 WEB = rtg.php 95.php view.php common.php rtg.png rtgback.png
19
 REPORTS = report.pl 95.pl
20
 
21
 EXTRA_DIST = rtgtargmkr.pl.in report.pl 95.pl createdb.in \
22
-               BER.pm SNMP_Session.pm SNMP_util.pm rtg.conf \
23
-	       routers rtg.php 95.php view.php common.php.in rtg.png rtgback.png
24
+               BER.pm SNMP_Session.pm SNMP_util.pm rtg.conf.sample \
25
+	       routers.sample rtg.php 95.php view.php common.php.in rtg.png rtgback.png
26
 
27
 subdir = etc
28
 mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
29
@@ -220,14 +220,14 @@ uninstall-am: uninstall-info-am
30
 all:
31
 
32
 install: installdirs
33
-	@for i in $(ETC) ; do $(INSTALL) $(srcdir)/$$i $(prefix)$(etcdir) ; echo "install: installed $$i in $(prefix)$(etcdir)" ; done
34
-	@for i in $(WEB) ; do $(INSTALL) $(srcdir)/$$i $(prefix)$(webdir) ; echo "install: installed $$i in $(prefix)$(webdir)" ; done
35
-	@for i in $(REPORTS) ; do $(INSTALL) $(srcdir)/$$i $(prefix)$(reportsdir) ; echo "install: installed $$i in $(prefix)$(reportsdir)" ; done
36
+	@for i in $(ETC) ; do $(INSTALL) $(srcdir)/$$i $(DESTDIR)$(etcdir) ; echo "install: installed $$i in $(DESTDIR)$(etcdir)" ; done
37
+	@for i in $(WEB) ; do $(INSTALL) $(srcdir)/$$i $(DESTDIR)$(webdir) ; echo "install: installed $$i in $(DESTDIR)$(webdir)" ; done
38
+	@for i in $(REPORTS) ; do $(INSTALL) $(srcdir)/$$i $(DESTDIR)$(reportsdir) ; echo "install: installed $$i in $(DESTDIR)$(reportsdir)" ; done
39
 
40
 installdirs:
41
-	$(mkinstalldirs) $(prefix)$(etcdir)
42
-	$(mkinstalldirs) $(prefix)$(webdir)
43
-	$(mkinstalldirs) $(prefix)$(reportsdir)
44
+	$(mkinstalldirs) $(DESTDIR)$(etcdir)
45
+	$(mkinstalldirs) $(DESTDIR)$(webdir)
46
+	$(mkinstalldirs) $(DESTDIR)$(reportsdir)
47
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
48
 # Otherwise a system limit (for SysV at least) may be exceeded.
49
 .NOEXPORT:
(-)net/rtg/files/patch-etc-rtg.php (-122 lines)
Lines 1-122 Link Here
1
--- etc/rtg.php.orig	2003-09-24 20:42:03 UTC
2
+++ etc/rtg.php
3
@@ -4,10 +4,8 @@
4
   print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
5
 
6
   /* Connect to RTG MySQL Database */
7
-  $dbc=@mysql_connect ($host, $user, $pass) or
8
-  $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or 
9
+  $dbc=@mysqli_connect ($host, $user, $pass, $db) or
10
      die ("MySQL Connection Failed, Check Configuration.");
11
-  mysql_select_db($db,$dbc);
12
 
13
  if ($PHP_SELF == "") {
14
    $PHP_SELF = "rtg.php";
15
@@ -37,17 +35,17 @@
16
   # Determine router, interface names as necessary
17
   if ($rid && $iid) {
18
     $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]";
19
-    $selectResult=mysql_query($selectQuery, $dbc);
20
-    $selectRow=mysql_fetch_object($selectResult);
21
-    $interfaces = mysql_num_rows($selectResult);
22
+    $selectResult=mysqli_query($dbc, $selectQuery);
23
+    $selectRow=mysqli_fetch_object($selectResult);
24
+    $interfaces = mysqli_num_rows($selectResult);
25
     $name = $selectRow->name;
26
     $description = $selectRow->description;
27
     $speed = ($selectRow->speed)/1000000;
28
     $router = $selectRow->router;
29
   } else if ($rid && !$iid) {
30
     $selectQuery="SELECT name AS router from router where rid=$rid";
31
-    $selectResult=mysql_query($selectQuery, $dbc);
32
-    $selectRow=mysql_fetch_object($selectResult);
33
+    $selectResult=mysqli_query($dbc, $selectQuery);
34
+    $selectRow=mysqli_fetch_object($selectResult);
35
     $router = $selectRow->router;
36
   }
37
 
38
@@ -71,8 +69,8 @@ echo "<FORM ACTION=\"$PHP_SELF\" METHOD=
39
 if (!$rid && !$iid) {
40
  echo "<SELECT NAME=\"rid\" SIZE=10>\n";
41
  $selectQuery="SELECT DISTINCT name, rid FROM router ORDER BY name";
42
- $selectResult=mysql_query($selectQuery, $dbc);
43
- while ($selectRow=mysql_fetch_object($selectResult)){
44
+ $selectResult=mysqli_query($dbc, $selectQuery);
45
+ while ($selectRow=mysqli_fetch_object($selectResult)){
46
     echo "<OPTION VALUE=\"$selectRow->rid\">$selectRow->name\n";
47
  }
48
  echo "</SELECT>\n";
49
@@ -91,8 +89,8 @@ if ($rid && !$iid) {
50
 
51
   echo "<SELECT MULTIPLE NAME=\"iid[]\" SIZE=10>\n"; 
52
   $selectQuery="SELECT id, name, description FROM interface WHERE rid=$rid ORDER BY name";
53
-  $selectResult=mysql_query($selectQuery, $dbc);
54
-  while ($selectRow=mysql_fetch_object($selectResult)){
55
+  $selectResult=mysqli_query($dbc, $selectQuery);
56
+  while ($selectRow=mysqli_fetch_object($selectResult)){
57
      echo "<OPTION VALUE=\"$selectRow->id\">$selectRow->name ($selectRow->description)\n";
58
   }
59
   echo "</SELECT>\n";
60
@@ -152,8 +150,8 @@ if (($bt || $smonth) && $iid) { 
61
   $range="$range AND id=$iid[0]";
62
 
63
   $selectQuery="SELECT description, name, speed FROM interface WHERE rid=$rid AND id=$iid[0]";
64
-  $selectResult=mysql_query($selectQuery, $dbc);
65
-  $selectRow=mysql_fetch_object($selectResult);
66
+  $selectResult=mysqli_query($dbc, $selectQuery);
67
+  $selectRow=mysqli_fetch_object($selectResult);
68
   echo "<TABLE BORDER=0>\n";
69
   echo "<TD><I>Device</I>:</TD><TD>$router ($rid)</TD><TR>\n";
70
   echo "<TD><I>Interface</I>:</TD><TD>$selectRow->name ($iid[0])</TD><TR>\n";
71
@@ -165,12 +163,15 @@ if (($bt || $smonth) && $iid) { 
72
   echo "<P>\n";
73
  
74
   #$selectQuery="SELECT DISTINCT id FROM ifInOctets_$rid WHERE $range";
75
-  #$selectResult=mysql_query($selectQuery, $dbc);
76
-  #if (mysql_num_rows($selectResult) <= 0) {
77
+  #$selectResult=mysqli_query($dbc, $selectQuery);
78
+  #if (mysqli_num_rows($selectResult) <= 0) {
79
   #   print "<BR>No Data Found on Interface for Given Range.<BR>\n";
80
   #}
81
   #else {
82
     $args = "t1=ifInOctets_$rid&t2=ifOutOctets_$rid&begin=$bt&end=$et&units=bits/s&factor=8";
83
+    $args .= "&title=" . urlencode($selectRow->description);
84
+    $args .= "&t1_name=" . urlencode("Input Octets");
85
+    $args .= "&t2_name=" . urlencode("Output Octets");
86
     foreach ($iid as $value) {
87
       $args="$args&iid=$value";
88
     }
89
@@ -181,8 +182,11 @@ if (($bt || $smonth) && $iid) { 
90
     if ($borderb) $args = "$args&borderb=$borderb";
91
     if ($aggr) $args = "$args&aggr=yes";
92
     if ($percentile) $args = "$args&percentile=$nth";
93
-    print "<IMG SRC=rtgplot.cgi?$args><BR>\n";
94
+    print "<IMG SRC=/cgi-bin/rtgplot.cgi?$args><BR>\n";
95
     $args = "t1=ifInUcastPkts_$rid&t2=ifOutUcastPkts_$rid&begin=$bt&end=$et&units=pkts/s";
96
+    $args .= "&title=" . urlencode($selectRow->description);
97
+    $args .= "&t1_name=" . urlencode("Input Packets");
98
+    $args .= "&t2_name=" . urlencode("Output Packets");
99
     foreach ($iid as $value) {
100
       $args="$args&iid=$value";
101
     }
102
@@ -192,13 +196,17 @@ if (($bt || $smonth) && $iid) { 
103
     if ($borderb) $args = "$args&borderb=$borderb";
104
     if ($aggr) $args = "$args&aggr=yes";
105
     if ($percentile) $args = "$args&percentile=$nth";
106
-    print "<IMG SRC=rtgplot.cgi?$args><BR>\n";
107
+    print "<IMG SRC=/cgi-bin/rtgplot.cgi?$args><BR>\n";
108
     if ($errors) 
109
-       print "<IMG SRC=rtgplot.cgi?t1=ifInErrors_$rid&begin=$bt&end=$et&units=errors&impulses=yes>\n";
110
+    {
111
+       print "<IMG SRC=/cgi-bin/rtgplot.cgi?t1=ifInErrors_$rid&begin=$bt&end=$et&units=errors&impulses=yes";
112
+       print "&title=" . urlencode($selectRow->description);
113
+       print "&t1_name=" . urlencode("Errors") . ">\n";
114
+    }
115
 #  }
116
 } 
117
 
118
-mysql_close($dbc);
119
+mysqli_close($dbc);
120
 ?>
121
 
122
 <P>
(-)net/rtg/files/patch-etc-rtgtargmkr.pl.in (-29 lines)
Lines 1-29 Link Here
1
--- etc/rtgtargmkr.pl.in.orig	2016-11-04 16:36:53 UTC
2
+++ etc/rtgtargmkr.pl.in
3
@@ -126,7 +126,7 @@ sub find_router_id {
4
         &sql_insert($sql);
5
         $rid = &find_router_id($router);
6
         foreach $mib ( keys %mibs_of_interest ) {
7
-          $sql = "CREATE TABLE $mib"."_$rid (id INT NOT NULL, dtime DATETIME NOT NULL, counter BIGINT NOT NULL, KEY $mib"."_$rid". "_idx (dtime))";
8
+          $sql = "CREATE TABLE $mib"."_$rid (id INT NOT NULL, dtime DATETIME NOT NULL, counter BIGINT NOT NULL, KEY $mib"."_$rid". "_idx (dtime), KEY id_dtime_idx (id,dtime))";
9
           &sql_insert($sql);
10
         }
11
     }
12
@@ -289,7 +289,7 @@ sub main {
13
       $year + 1900, $hour, $min;
14
     print CFG "# Host\tOID\tBits\tCommunity\tTable\tID\tDescription\n";
15
 
16
-    foreach $router (@routers) {
17
+    POKE: foreach $router (@routers) {
18
         $bits = $counterBits{$router};
19
         # Sanity check bits
20
         $bits = $defbits if ( ( $bits != 32 ) && ( $bits != 64 ) );
21
@@ -304,7 +304,7 @@ sub main {
22
         $system = join ( ' ', @result );
23
         print "System: $system\n" if $DEBUG;
24
         $session = SNMP_Session->open( $router, $communities{$router}, 161 )
25
-          || die "Error opening SNMP session to $router";
26
+          || ( print "Error opening SNMP session to $router" and next POKE );
27
         if ( $system =~ /.*Cisco.*WS-.*/ ) {
28
             $system = "Catalyst";
29
             $session->map_table( $catalyst, \&process );
(-)net/rtg/files/patch-etc-view.php (-117 lines)
Lines 1-117 Link Here
1
--- etc/view.php.orig	2003-09-26 15:58:34 UTC
2
+++ etc/view.php
3
@@ -11,10 +11,8 @@
4
   print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
5
 
6
   /* Connect to RTG MySQL Database */
7
-  $dbc=@mysql_connect ($host, $user, $pass) or
8
-  $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or 
9
+  $dbc=@mysqli_connect ($host, $user, $pass, $db) or
10
      die ("MySQL Connection Failed, Check Configuration.");
11
-  mysql_select_db($db,$dbc);
12
 
13
   # Global variables off by default in newer versions of PHP
14
   if (!$PHP_SELF) {
15
@@ -26,17 +24,17 @@
16
   # Determine router, interface names as necessary
17
   if ($rid && $iid) {
18
     $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";
19
-    $selectResult=mysql_query($selectQuery, $dbc);
20
-    $selectRow=mysql_fetch_object($selectResult);
21
-    $interfaces = mysql_num_rows($selectResult);
22
+    $selectResult=mysqli_query($dbc, $selectQuery);
23
+    $selectRow=mysqli_fetch_object($selectResult);
24
+    $interfaces = mysqli_num_rows($selectResult);
25
     $name = $selectRow->name;
26
     $description = $selectRow->description;
27
     $speed = ($selectRow->speed)/1000000;
28
     $router = $selectRow->router;
29
   } else if ($rid && !$iid) {
30
     $selectQuery="SELECT name AS router from router where rid=$rid";
31
-    $selectResult=mysql_query($selectQuery, $dbc);
32
-    $selectRow=mysql_fetch_object($selectResult);
33
+    $selectResult=mysqli_query($dbc, $selectQuery);
34
+    $selectRow=mysqli_fetch_object($selectResult);
35
     $router = $selectRow->router;
36
   }
37
 
38
@@ -68,12 +66,12 @@
39
  if (!$rid) {
40
     print "Monitored Devices: <P>\n";
41
     $selectQuery="SELECT rid, name FROM router";
42
-    $selectResult=mysql_query($selectQuery, $dbc);
43
-    if (mysql_num_rows($selectResult) <= 0) 
44
+    $selectResult=mysqli_query($dbc, $selectQuery);
45
+    if (mysqli_num_rows($selectResult) <= 0) 
46
       print "<BR>No Routers Found.<BR>\n";
47
     else {
48
       print "<UL>\n";
49
-      while ($selectRow=mysql_fetch_object($selectResult)){
50
+      while ($selectRow=mysqli_fetch_object($selectResult)){
51
         print "<LI><A HREF=\"$PHP_SELF?rid=$selectRow->rid\">";
52
         print "$selectRow->name</A><BR>\n";
53
       }
54
@@ -95,19 +93,22 @@
55
 
56
       $bt = $et - (60*60*24);
57
       print "<B>Day View:</B><BR>\n";
58
-      print "<IMG SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\">\n";
59
+      print "<IMG SRC=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes";
60
+      print "&title=" . urlencode("$router: $name ($description)") . "&t1_name=" . urlencode("Input Octets") . "&t2_name=" . urlencode("Output Octets") . "\">\n";
61
       print "<BR><B>$router: $name ($description)</B>\n";
62
       print "<BR><HR>\n";
63
 
64
       $bt = $et - (60*60*24*7);
65
       print "<B>Week View:</B><BR>\n";
66
-      print "<IMG SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\">\n";
67
+      print "<IMG SRC=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes";
68
+      print "&title=" . urlencode("$router: $name ($description)") . "&t1_name=" . urlencode("Input Octets") . "&t2_name=" . urlencode("Output Octets") . "\">\n";
69
       print "<BR><B>$router: $name ($description)</B>\n";
70
       print "<BR><HR>\n";
71
 
72
       $bt = $et - (60*60*24*30);
73
       print "<B>Month View:</B><BR>\n";
74
-      print "<IMG SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\">\n";
75
+      print "<IMG SRC=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes";
76
+      print "&title=" . urlencode("$router: $name ($description)") . "&t1_name=" . urlencode("Input Octets") . "&t2_name=" . urlencode("Output Octets") . "\">\n";
77
       print "<BR><B>$router: $name ($description)</B>\n";
78
       print "<BR><BR>\n";
79
     }
80
@@ -116,8 +117,8 @@
81
 
82
  if ($rid && !$iid) {
83
     $selectQuery="SELECT id, name, description FROM interface WHERE rid=$rid";
84
-    $selectResult=mysql_query($selectQuery, $dbc);
85
-    $interfaces = mysql_num_rows($selectResult);
86
+    $selectResult=mysqli_query($dbc, $selectQuery);
87
+    $interfaces = mysqli_num_rows($selectResult);
88
     if ($interfaces <= 0) 
89
       print "<BR>No Interfaces Found for Router $router (ID: $rid).<BR>\n";
90
     else {
91
@@ -129,12 +130,15 @@
92
       print gmdate('D, d M Y H:i:s \G\M\T', time())."\n";
93
       print "</TABLE><HR>\n";
94
       print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"10\">\n";
95
-      while ($selectRow=mysql_fetch_object($selectResult)){
96
+      while ($selectRow=mysqli_fetch_object($selectResult)){
97
         $ids[$selectRow->id] = $selectRow->name; 
98
 	$desc[$selectRow->id] = $selectRow->description;
99
 	$iid = $selectRow->id;
100
 	print "<TD><A HREF=\"$PHP_SELF?rid=$rid&iid=$iid\">\n";
101
-	print "<IMG HEIGHT=\"135\" WIDTH=\"500\" SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\" BORDER=\"0\">\n";
102
+	print "<IMG HEIGHT=\"135\" WIDTH=\"500\" SRC=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid;
103
+	print "&title=" . urlencode("$router: " . $selectRow->name . " (" . $selectRow->description . ")");
104
+	print "&t1_name=" . urlencode("Input Octets") . "&t2_name=" . urlencode("Output Octets");
105
+	print "&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\" BORDER=\"0\">\n";
106
 	print "</A><BR>\n";
107
         print "<B>$selectRow->name ($selectRow->description)</B>\n";
108
         if ($even) {
109
@@ -148,7 +152,7 @@
110
     print "<INPUT TYPE=\"SUBMIT\" VALUE=\"Back to Main\">\n";
111
   }
112
 
113
-  if ($dbc) mysql_close($dbc);
114
+  if ($dbc) mysqli_close($dbc);
115
   echo "</FORM>\n";
116
 ?>
117
 
(-)net/rtg/files/patch-etc_95.php (+288 lines)
Line 0 Link Here
1
--- etc/95.php.orig	2003-09-24 20:40:57 UTC
2
+++ etc/95.php
3
@@ -1,41 +1,37 @@
4
 <?php
5
   include('./common.php');
6
 
7
-  print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
8
+  print "<html>\n<!-- RTG Version $VERSION -->\n<head>\n";
9
 
10
   /* Connect to RTG MySQL Database */
11
-  $dbc=@mysql_connect ($host, $user, $pass) or
12
-  $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or 
13
+  $dbc=@mysqli_connect ($host, $user, $pass, $db) or
14
      die ("MySQL Connection Failed, Check Configuration.");
15
-  mysql_select_db($db,$dbc);
16
 
17
-  if ($PHP_SELF == "") {
18
+  if (!isset($PHP_SELF) || ($PHP_SELF == "")) {
19
     $PHP_SELF = "95.php";
20
-    $customer = $_GET['customer'];
21
-    $syear = $_GET['syear'];
22
-    $eyear = $_GET['eyear'];
23
-    $smonth = $_GET['smonth'];
24
-    $emonth = $_GET['emonth'];
25
-    $sday = $_GET['sday'];
26
-    $eday = $_GET['eday'];
27
-    $shour = $_GET['shour'];
28
-    $ehour = $_GET['ehour'];
29
-    $smin = $_GET['smin'];
30
-    $emin = $_GET['emin'];
31
-    $debug = $_GET['debug'];
32
+    $customer = isset($_GET['customer'])?$_GET['customer']:"";
33
+    $syear = isset($_GET['syear'])?$_GET['syear']:"";
34
+    $eyear = isset($_GET['eyear'])?$_GET['eyear']:"";
35
+    $smonth = isset($_GET['smonth'])?$_GET['smonth']:"";
36
+    $emonth = isset($_GET['emonth'])?$_GET['emonth']:"";
37
+    $sday = isset($_GET['sday'])?$_GET['sday']:"";
38
+    $eday = isset($_GET['eday'])?$_GET['eday']:"";
39
+    $shour = isset($_GET['shour'])?$_GET['shour']:"";
40
+    $ehour = isset($_GET['ehour'])?$_GET['ehour']:"";
41
+    $smin = isset($_GET['smin'])?$_GET['smin']:"";
42
+    $emin = isset($_GET['emin'])?$_GET['emin']:"";
43
+    $debug = isset($_GET['debug'])?$_GET['debug']:"";
44
   }
45
 
46
- print "<TITLE>RTG: ";
47
- if ($customer) print "$customer\n";
48
+ print "<title>RTG: ";
49
+ if ($customer != "") print "$customer\n";
50
 ?>
51
 
52
-</TITLE>
53
-</HEAD>
54
-<BODY BGCOLOR="ffffff">
55
-<A HREF="http://rtg.sourceforge.net" ALT="[RTG Home Page]">
56
-<IMG SRC="rtg.png" BORDER="0">
57
-</A>
58
-<P>
59
+</title>
60
+</head>
61
+<body bgcolor="ffffff">
62
+<a href="http://rtg.sourceforge.net"><img src="rtg.png" border="0" alt="[RTG Home Page]" /></a>
63
+<p>
64
 
65
 <?php
66
 function cmp($c1, $c2) {
67
@@ -50,8 +46,8 @@ function int_stats($statement, $dbc) {
68
   $max = $avg = $nintyfifth = 0;
69
   $rate = array();
70
 
71
-  $selectResult=mysql_query($statement, $dbc);
72
-  while ($selectRow=mysql_fetch_object($selectResult)){
73
+  $selectResult=mysqli_query($dbc, $statement);
74
+  while ($selectRow=mysqli_fetch_object($selectResult)){
75
     $counter = $selectRow->counter;
76
     $sample_secs = $selectRow->unixtime;
77
     $total += $counter;
78
@@ -83,132 +79,136 @@ function int_stats($statement, $dbc) {
79
 }
80
 ?>
81
 
82
-<HR>
83
-Report: 95th percentile<BR>
84
+<hr />
85
+Report: 95th percentile<br />
86
 
87
 <?php
88
-  echo "<FORM ACTION=\"$PHP_SELF\" METHOD=\"GET\">\n";
89
-  if (($bt || $smonth)) { 
90
-    $dbc=@mysql_connect ($host, $user, $pass) or
91
-    $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or die ("MySQL Connection Failed, Check Configuration.");
92
-    mysql_select_db($db,$dbc);
93
+  echo "<form action=\"$PHP_SELF\" method=\"get\">\n";
94
+  if (($bt != "") || ($smonth != "")) {
95
+    $dbc=@mysqli_connect ($host, $user, $pass, $db) or
96
+      die ("MySQL Connection Failed, Check Configuration.");
97
     /* Format into GNU date syntax */
98
     if ($bt == "") {
99
       $bt = strtotime("$syear-$smonth-$sday $shour:$smin:00");
100
       $et = strtotime("$eyear-$emonth-$eday $ehour:$emin:59");
101
     }
102
-    echo "Customer: $customer <BR>\n";
103
+    echo "Customer: $customer <br />\n";
104
     print strftime("Period: %m/%d/%Y %H:%M - ", $bt);
105
     print strftime("%m/%d/%Y %H:%M<P>\n", $et);
106
 
107
-    $range="dtime>FROM_UNIXTIME($bt) AND dtime<=FROM_UNIXTIME($et)";
108
+    $range="`dtime`>FROM_UNIXTIME(" . mysqli_real_escape_string($dbc, $bt) . 
109
+      ") AND `dtime`<=FROM_UNIXTIME(" . mysqli_real_escape_string($dbc, $et) . ")";
110
 
111
-    $selectQuery="SELECT id, name, description, rid FROM interface WHERE description LIKE \"%$customer%\"";
112
-    $selectResult=mysql_query($selectQuery, $dbc);
113
-    if (mysql_num_rows($selectResult) <= 0) 
114
-      print "<BR>No Such Customer Found.<BR>\n";
115
+    $selectQuery="SELECT `id`, `name`, `description`, `rid` FROM `interface` WHERE " .
116
+      "`description` LIKE \"%" . mysqli_real_escape_string($dbc, $customer) . "%\"";
117
+    $selectResult=mysqli_query($dbc, $selectQuery);
118
+    if (mysqli_num_rows($selectResult) <= 0) 
119
+      print "<br />No Such Customer Found.<br />\n";
120
     else {
121
-      while ($selectRow=mysql_fetch_object($selectResult)){
122
+      while ($selectRow=mysqli_fetch_object($selectResult)){
123
         $ids[$selectRow->id] = $selectRow->name; 
124
         $rids[$selectRow->id] = $selectRow->rid; 
125
 	$desc[$selectRow->id] = $selectRow->description;
126
       }
127
-      echo "<TABLE BORDER=\"1\">\n";
128
-      echo "<TR BGCOLOR=\"#E0E0E0\">\n";
129
-      echo "<TH COLSPAN=\"3\">Interface<TH COLSPAN=\"2\">Current Rate<TH COLSPAN=\"2\">Max Rate<TH COLSPAN=\"2\">95th %\n";
130
+      echo "<table border=\"1\">\n";
131
+      echo "<tr bgcolor=\"#E0E0E0\">\n";
132
+      echo "<th colspan=\"3\">Interface</th><th colspan=\"2\">Current Rate</th><th colspan=\"2\">Max Rate</th><th colspan=\"2\">95th %</th>\n";
133
       if ($debug) 
134
-        echo "<TH COLSPAN=\"2\">Samples<TH COLSPAN=\"2\">Ignore Top\n";
135
-      echo "<TR BGCOLOR=\"#E0E0E0\">\n";
136
-      echo "<TH>Name<TH>Description<TH>Router<TH>In (Mbps)<TH>Out (Mbps)<TH>In<TH>Out<TH>In<TH>Out\n";
137
+        echo "<th colspan=\"2\">Samples</th><th colspan=\"2\">Ignore Top</th>\n";
138
+      echo "</tr>\n";
139
+      echo "<tr bgcolor=\"#E0E0E0\">\n";
140
+      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";
141
       if ($debug) 
142
-        echo "<TH>In<TH>Out<TH>In<TH>Out\n";
143
-      echo "<TR BGCOLOR=\"#ffffcc\">\n";
144
+        echo "<th>In</th><th>Out</th><th>In</th><th>Out</th>\n";
145
+      echo "</tr>\n";
146
+      echo "<tr bgcolor=\"#ffffcc\">\n";
147
       $yellow = 1;
148
       foreach($ids as $iid=>$name) {
149
 
150
-        $selectQuery="SELECT name FROM router WHERE rid=$rids[$iid]";
151
-        $selectResult=mysql_query($selectQuery, $dbc);
152
-        $selectRow=mysql_fetch_object($selectResult);
153
+        $selectQuery="SELECT `name` FROM `router` WHERE `rid`=$rids[$iid]";
154
+        $selectResult=mysqli_query($dbc, $selectQuery);
155
+        $selectRow=mysqli_fetch_object($selectResult);
156
 	$router = $selectRow->name;
157
 
158
         if ($yellow) $yellow = 0;
159
 	else $yellow = 1;
160
 
161
-        echo "<TD>$name<TD>$desc[$iid]<TD>$router";
162
+        echo "<td>$name</td><td>$desc[$iid]</td><td>$router</td>";
163
 
164
-        $selectQuery="SELECT counter, UNIX_TIMESTAMP(dtime) as unixtime, dtime from ifInOctets_$rids[$iid] WHERE $range AND id=$iid ORDER BY dtime";
165
+        $selectQuery="SELECT `counter`, UNIX_TIMESTAMP(`dtime`) AS `unixtime`, `dtime` FROM `ifInOctets_$rids[$iid]` WHERE $range AND `id`=$iid ORDER BY `dtime`";
166
         list ($intbytes_in, $maxin, $avgin, $nfin,$insamples,$inignore) = int_stats($selectQuery, $dbc);
167
 	$bytesin = round($intbytes_in/1000000);
168
 
169
-        $selectQuery="SELECT counter, UNIX_TIMESTAMP(dtime) as unixtime, dtime from ifOutOctets_$rids[$iid] WHERE $range AND id=$iid ORDER BY dtime";
170
+        $selectQuery="SELECT `counter`, UNIX_TIMESTAMP(`dtime`) AS `unixtime`, `dtime` FROM `ifOutOctets_$rids[$iid]` WHERE $range AND `id`=$iid ORDER BY `dtime`";
171
         list ($intbytes_out, $maxout, $avgout, $nfout,$outsamples,$outignore) = int_stats($selectQuery, $dbc);
172
 	$bytesout = round($intbytes_in/1000000);
173
 
174
-	printf("<TD ALIGN=\"right\">%2.2f", $avgin/1000000);
175
-	printf("<TD ALIGN=\"right\">%2.2f", $avgout/1000000);
176
-	printf("<TD ALIGN=\"right\">%2.2f", $maxin/1000000);
177
-	printf("<TD ALIGN=\"right\">%2.2f", $maxout/1000000);
178
-	printf("<TD ALIGN=\"right\">%2.2f", $nfin/1000000);
179
-	printf("<TD ALIGN=\"right\">%2.2f", $nfout/1000000);
180
+	printf("<td align=\"right\">%2.2f</td>", $avgin/1000000);
181
+	printf("<td align=\"right\">%2.2f</td>", $avgout/1000000);
182
+	printf("<td align=\"right\">%2.2f</td>", $maxin/1000000);
183
+	printf("<td align=\"right\">%2.2f</td>", $maxout/1000000);
184
+	printf("<td align=\"right\">%2.2f</td>", $nfin/1000000);
185
+	printf("<td align=\"right\">%2.2f</td>", $nfout/1000000);
186
 	if ($debug) {
187
-          echo "<TD ALIGN=\"right\">$insamples<TD ALIGN=\"right\">$outsamples<TD ALIGN=\"right\">$inignore<TD ALIGN=\"right\">$outignore";
188
+          echo "<td align=\"right\">$insamples</td><td align=\"right\">$outsamples</td><td align=\"right\">$inignore</td><td align=\"right\">$outignore</td>";
189
 	}
190
-	if ($yellow) echo "<TR BGCOLOR=\"#ffffcc\">\n";
191
-	else echo "<TR BGCOLOR=\"#94D6E7\">\n";
192
+        echo "</tr>\n";
193
+	if ($yellow) echo "<tr bgcolor=\"#ffffcc\">\n";
194
+	else echo "<tr bgcolor=\"#94D6E7\">\n";
195
       }
196
-      echo "</TABLE>\n";
197
+      echo "</table>\n";
198
     }
199
   } else {
200
-    echo "Customer Name: <INPUT TYPE=\"text\" NAME=\"customer\"><BR>\n";
201
-    echo "<P><TABLE>\n";
202
-    echo "<TD>From: \n";
203
-    echo "<TD><INPUT TYPE=TEXT NAME=\"smonth\" SIZE=3 MAXLENGTH=2 VALUE=\"";
204
+    echo "Customer Name: <input type=\"text\" name=\"customer\" /><br />\n";
205
+    echo "<p><table>\n";
206
+    echo "<tr><td>From: </td>\n";
207
+    echo "<td><input type=\"text\" name=\"smonth\" size=\"3\" maxlength=\"2\" value=\"";
208
     print (date("m"));
209
-    echo "\"> / \n";
210
-    echo "<INPUT TYPE=TEXT NAME=\"sday\" SIZE=3 MAXLENGTH=2 VALUE=\"";
211
+    echo "\" /> / \n";
212
+    echo "<input type=\"text\" name=\"sday\" size=\"3\" maxlength=\"2\" value=\"";
213
     printf("%02d", (date("d") - 1));
214
-    echo "\"> / \n";
215
-    echo "<INPUT TYPE=TEXT NAME=\"syear\" SIZE=5 MAXLENGTH=4 VALUE=\"";
216
+    echo "\" /> / \n";
217
+    echo "<input type=\"text\" name=\"syear\" size=\"5\" maxlength=\"4\" value=\"";
218
     print (date("Y"));
219
-    echo "\">\n";
220
-    echo "<TD><INPUT TYPE=TEXT NAME=\"shour\" SIZE=3 MAXLENGTH=2 VALUE=\"";
221
+    echo "\" /></td>\n";
222
+    echo "<td><input type=\"text\" name=\"shour\" size=\"3\" maxlength=\"2\" value=\"";
223
     print (date("H"));
224
-    echo "\">:\n";
225
-    echo "<INPUT TYPE=TEXT NAME=\"smin\" SIZE=3 MAXLENGTH=2 VALUE=\"";
226
+    echo "\" />:\n";
227
+    echo "<input type=\"text\" name=\"smin\" size=\"3\" maxlength=\"2\" value=\"";
228
     print (date("i"));
229
-    echo "\">\n";
230
+    echo "\" /></td></tr>\n";
231
 
232
-    echo "<TR><TD>To: \n";
233
-    echo "<TD><INPUT TYPE=TEXT NAME=\"emonth\" SIZE=3 MAXLENGTH=2 VALUE=\"";
234
+    echo "<tr><td>To: </td>\n";
235
+    echo "<td><input type=\"text\" name=\"emonth\" size=\"3\" maxlength=\"2\" value=\"";
236
     print (date("m"));
237
-    echo "\"> / \n";
238
-    echo "<INPUT TYPE=TEXT NAME=\"eday\" SIZE=3 MAXLENGTH=2 VALUE=\"";
239
+    echo "\" /> / \n";
240
+    echo "<input type=\"text\" name=\"eday\" size=\"3\" maxlength=\"2\" value=\"";
241
     print (date("d"));
242
-    echo "\"> / \n";
243
-    echo "<INPUT TYPE=TEXT NAME=\"eyear\" SIZE=5 MAXLENGTH=4 VALUE=\"";
244
+    echo "\" /> / \n";
245
+    echo "<input type=\"text\" name=\"eyear\" size=\"5\" maxlength=\"4\" value=\"";
246
     print (date("Y"));
247
-    echo "\">\n";
248
-    echo "<TD><INPUT TYPE=TEXT NAME=\"ehour\" SIZE=3 MAXLENGTH=2 VALUE=\"";
249
+    echo "\" /></td>\n";
250
+    echo "<td><input type=\"text\" name=\"ehour\" size=\"3\" maxlength=\"2\" value=\"";
251
     print (date("H"));
252
-    echo "\">:\n";
253
-    echo "<INPUT TYPE=TEXT NAME=\"emin\" SIZE=3 MAXLENGTH=2 VALUE=\"";
254
+    echo "\" />:\n";
255
+    echo "<input type=\"text\" name=\"emin\" size=\"3\" maxlength=\"2\" value=\"";
256
     print (date("i"));
257
-    echo "\">\n";
258
-    echo "<TR><TD>Debug: \n";
259
-    echo "<TD><INPUT TYPE=CHECKBOX NAME=\"debug\">\n";
260
-    echo "</TABLE>\n";
261
+    echo "\" /></td></tr>\n";
262
+    echo "<tr><td>Debug: </td>\n";
263
+    echo "<td><input type=\"checkbox\" name=\"debug\" /></td></tr>\n";
264
+    echo "</table>\n";
265
 
266
-    echo "<P><INPUT TYPE=\"SUBMIT\" VALUE=\"Ok\">";
267
+    echo "<p><input type=\"submit\" VALUE=\"Ok\" />";
268
   }
269
 
270
-  if ($dbc) mysql_close($dbc);
271
-  echo "</FORM>\n";
272
+  if ($dbc) mysqli_close($dbc);
273
+  echo "</form>\n";
274
 ?>
275
-<BR>
276
-<HR>
277
-<FONT FACE="Arial" SIZE="2">
278
+<br />
279
+<hr />
280
+<font face="Arial" size="2">
281
 <?php
282
- print "<A HREF=\"http://rtg.sourceforge.net\">RTG</A> Version $VERSION</FONT>";
283
+ print "<a href=\"http://rtg.sourceforge.net\">RTG</a> Version $VERSION</font>";
284
 ?>
285
-</BODY>
286
-</HTML>
287
+</body>
288
+</html>
(-)net/rtg/files/patch-etc_95.pl (-1 / +50 lines)
Lines 1-4 Link Here
1
--- etc/95.pl.orig	2016-11-04 16:36:01 UTC
1
--- etc/95.pl.orig	2018-04-02 20:14:41 UTC
2
+++ etc/95.pl
2
+++ etc/95.pl
3
@@ -31,7 +31,7 @@ $pass="rtgdefault";
3
@@ -31,7 +31,7 @@ $pass="rtgdefault";
4
 $onedaysec=60*60*24;
4
 $onedaysec=60*60*24;
Lines 9-11 Link Here
9
 foreach $conf (@configs) {
9
 foreach $conf (@configs) {
10
   if (open CONF, "<$conf") {
10
   if (open CONF, "<$conf") {
11
     print "Reading [$conf].\n" if $DEBUG;
11
     print "Reading [$conf].\n" if $DEBUG;
12
@@ -207,13 +207,13 @@ print "Period: [", format_dt($startdate)
13
 write;
14
 ($name,$router, $ratein, $rateout, $maxratein, $maxrateout, $nfratein, $nfrateout) = ("Connection", "", "Mbps", "Mbps", "Mbps", "Mbps", "Mbps", "Mbps");
15
 write;
16
-print "--------------------------------------------------------------------------------\n";
17
+print "----------------------------------------------------------------------------------------------------\n";
18
 
19
 $dbh= DBI->connect("DBI:mysql:$db:host=$host", $user, $pass);
20
 $dbh2= DBI->connect("DBI:mysql:$db:host=$host", $user, $pass);
21
-$range="dtime>$startdate and dtime<=$enddate";
22
+$range="`dtime`>$startdate AND `dtime`<=$enddate";
23
 
24
-$statement="SELECT id FROM interface WHERE description LIKE \"%$cust%\"";
25
+$statement="SELECT `id` FROM `interface` WHERE `description` LIKE \"%$cust%\"";
26
 $sth = $dbh->prepare($statement)
27
   or die "Can't prepare $statement: $dbh->errstr\n";
28
 $rv = $sth->execute
29
@@ -223,19 +223,19 @@ while (@row = $sth->fetchrow_array ()) {
30
 }
31
 
32
 foreach $interface (@interfaces) {
33
-  $statement="SELECT rid, name, speed FROM interface WHERE id=$interface";
34
+  $statement="SELECT `rid`, `name`, `speed` FROM `interface` WHERE `id`=$interface";
35
   &run_query($statement);
36
   ($rid, $name, $speed) = @row;
37
 
38
-  $statement="SELECT rid, name FROM router WHERE rid=$rid";
39
+  $statement="SELECT `rid`, `name` FROM `router` WHERE `rid`=$rid";
40
   &run_query($statement);
41
   ($rid, $router) = @row;
42
 
43
-  $statement="SELECT counter, UNIX_TIMESTAMP(dtime), dtime FROM ifInOctets_".$rid." WHERE $range AND id=$interface ORDER BY dtime"; 
44
+  $statement="SELECT `counter`, UNIX_TIMESTAMP(`dtime`), `dtime` FROM `ifInOctets_".$rid."` WHERE $range AND `id`=$interface ORDER BY `dtime`"; 
45
   ($intbytes_in, $maxin, $avgin, $nfin) = &interface_stats($statement);
46
   $bytesin = int($intbytes_in/1000000 + .5);
47
 
48
-  $statement="SELECT counter, UNIX_TIMESTAMP(dtime), dtime FROM ifOutOctets_".$rid." WHERE $range AND id=$interface ORDER BY dtime"; 
49
+  $statement="SELECT `counter`, UNIX_TIMESTAMP(`dtime`), `dtime` FROM `ifOutOctets_".$rid."` WHERE $range AND `id`=$interface ORDER BY `dtime`"; 
50
   ($intbytes_out, $maxout, $avgout, $nfout) = &interface_stats($statement);
51
   $bytesout = int($intbytes_out/1000000 + .5);
52
 
53
@@ -279,6 +279,6 @@ $rc = $dbh->disconnect;
54
 exit;
55
 
56
 format STDOUT = 
57
-@<<<<<<<<<<< @<<<<<<<<<<< @>>>>>>>  @>>>>>>>  @>>>>>>  @>>>>>>  @>>>>>>  @>>>>>>
58
+@<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<< @>>>>>>>  @>>>>>>>  @>>>>>>  @>>>>>>  @>>>>>>  @>>>>>>
59
 $name,$router, $ratein, $rateout, $maxratein, $maxrateout, $nfratein, $nfrateout  
60
 .
(-)net/rtg/files/patch-etc_Makefile.in (+49 lines)
Line 0 Link Here
1
--- etc/Makefile.in.orig	2003-10-02 15:59:32 UTC
2
+++ etc/Makefile.in
3
@@ -84,19 +84,19 @@ am__quote = @am__quote@
4
 install_sh = @install_sh@
5
 
6
 top_builddir = ..
7
-etcdir = /etc
8
-webdir = /web
9
-reportsdir = /bin
10
+etcdir = @etcdir@
11
+webdir = @webdir@
12
+reportsdir = @bindir@
13
 
14
-ETC = rtg.conf rtgtargmkr.pl routers createdb BER.pm \
15
+ETC = rtg.conf.sample rtgtargmkr.pl routers.sample createdb BER.pm \
16
                SNMP_Session.pm SNMP_util.pm
17
 
18
 WEB = rtg.php 95.php view.php common.php rtg.png rtgback.png
19
 REPORTS = report.pl 95.pl
20
 
21
 EXTRA_DIST = rtgtargmkr.pl.in report.pl 95.pl createdb.in \
22
-               BER.pm SNMP_Session.pm SNMP_util.pm rtg.conf \
23
-	       routers rtg.php 95.php view.php common.php.in rtg.png rtgback.png
24
+               BER.pm SNMP_Session.pm SNMP_util.pm rtg.conf.sample \
25
+	       routers.sample rtg.php 95.php view.php common.php.in rtg.png rtgback.png
26
 
27
 subdir = etc
28
 mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
29
@@ -220,14 +220,14 @@ uninstall-am: uninstall-info-am
30
 all:
31
 
32
 install: installdirs
33
-	@for i in $(ETC) ; do $(INSTALL) $(srcdir)/$$i $(prefix)$(etcdir) ; echo "install: installed $$i in $(prefix)$(etcdir)" ; done
34
-	@for i in $(WEB) ; do $(INSTALL) $(srcdir)/$$i $(prefix)$(webdir) ; echo "install: installed $$i in $(prefix)$(webdir)" ; done
35
-	@for i in $(REPORTS) ; do $(INSTALL) $(srcdir)/$$i $(prefix)$(reportsdir) ; echo "install: installed $$i in $(prefix)$(reportsdir)" ; done
36
+	@for i in $(ETC) ; do $(INSTALL) $(srcdir)/$$i $(DESTDIR)$(etcdir) ; echo "install: installed $$i in $(DESTDIR)$(etcdir)" ; done
37
+	@for i in $(WEB) ; do $(INSTALL) $(srcdir)/$$i $(DESTDIR)$(webdir) ; echo "install: installed $$i in $(DESTDIR)$(webdir)" ; done
38
+	@for i in $(REPORTS) ; do $(INSTALL) $(srcdir)/$$i $(DESTDIR)$(reportsdir) ; echo "install: installed $$i in $(DESTDIR)$(reportsdir)" ; done
39
 
40
 installdirs:
41
-	$(mkinstalldirs) $(prefix)$(etcdir)
42
-	$(mkinstalldirs) $(prefix)$(webdir)
43
-	$(mkinstalldirs) $(prefix)$(reportsdir)
44
+	$(mkinstalldirs) $(DESTDIR)$(etcdir)
45
+	$(mkinstalldirs) $(DESTDIR)$(webdir)
46
+	$(mkinstalldirs) $(DESTDIR)$(reportsdir)
47
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
48
 # Otherwise a system limit (for SysV at least) may be exceeded.
49
 .NOEXPORT:
(-)net/rtg/files/patch-etc_SNMP__util.pm (+22 lines)
Line 0 Link Here
1
--- etc/SNMP_util.pm.orig	2018-04-02 22:51:02 UTC
2
+++ etc/SNMP_util.pm
3
@@ -1129,16 +1129,16 @@ sub snmpMIB_to_OID ($) {
4
       $buf =~ s/OBJECT-GROUP/OBJECT IDENTIFIER/;
5
       $buf =~ s/MODULE-IDENTITY/OBJECT IDENTIFIER/;
6
       $buf =~ s/ IMPORTS .*\;//;
7
-      $buf =~ s/ SEQUENCE {.*}//;
8
+      $buf =~ s/ SEQUENCE \{.*}//;
9
       $buf =~ s/ SYNTAX .*//;
10
       $buf =~ s/ [\w-]+ ::= OBJECT IDENTIFIER//;
11
-      $buf =~ s/ OBJECT IDENTIFIER .* ::= {/ OBJECT IDENTIFIER ::= {/;
12
+      $buf =~ s/ OBJECT IDENTIFIER .* ::= \{/ OBJECT IDENTIFIER ::= {/;
13
       $buf =~ s/".*"//;
14
       if ($buf =~ /"/) {
15
 	$quote = 1;
16
       }
17
 
18
-      if ($buf =~ / ([\w\-]+) OBJECT IDENTIFIER ::= {([^}]+)}/) {
19
+      if ($buf =~ / ([\w\-]+) OBJECT IDENTIFIER ::= \{([^}]+)}/) {
20
 	$var = $1;
21
 	$buf = $2;
22
 	undef $val;
(-)net/rtg/files/patch-etc_common.php.in (+6 lines)
Lines 1-5 Link Here
1
--- etc/common.php.in.orig	2003-09-26 15:52:29 UTC
1
--- etc/common.php.in.orig	2003-09-26 15:52:29 UTC
2
+++ etc/common.php.in
2
+++ etc/common.php.in
3
@@ -1,4 +1,4 @@
4
-<?
5
+<?php
6
  /* Begin with reasonable defaults */
7
  $VERSION = "@VERSION@";
8
  $host="localhost";
3
@@ -6,10 +6,13 @@
9
@@ -6,10 +6,13 @@
4
  $pass="rtgdefault";
10
  $pass="rtgdefault";
5
  $db="rtg";
11
  $db="rtg";
(-)net/rtg/files/patch-etc_createdb.in (+146 lines)
Line 0 Link Here
1
--- etc/createdb.in.orig	2018-04-02 22:52:32 UTC
2
+++ etc/createdb.in
3
@@ -23,11 +23,8 @@ echo ""
4
 
5
 # Create the necessary SQL in two /tmp files
6
 cat <<EOT >/tmp/mysql.sql
7
-INSERT INTO user (Host, User, Password) VALUES ('$HOST','$USER',PASSWORD("$RTGPASS"));
8
-INSERT INTO db (Host, Db, User, Select_priv, Insert_priv, Update_priv, Delete_priv, 
9
-Create_priv, Drop_priv, Grant_priv, References_priv, Index_priv, Alter_priv) 
10
-VALUES ('$HOST','$DATABASE','$USER','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
11
-FLUSH PRIVILEGES;
12
+CREATE USER '$USER'@'$HOST' IDENTIFIED BY '$RTG_PASS';
13
+GRANT ALL ON '$DATABASE'.* TO '$USER'@'$HOST';
14
 EOT
15
 
16
 cat <<EOT >/tmp/rtg.sql
17
@@ -35,81 +32,81 @@ cat <<EOT >/tmp/rtg.sql
18
 # Table structure for table 'router'
19
 #
20
 
21
-CREATE TABLE router (
22
-  rid int(11) unsigned NOT NULL auto_increment,
23
-  name char(120) NOT NULL default '',
24
-  pop char(10) NOT NULL default '',
25
-  popid tinyint(3) unsigned NOT NULL default '0',
26
-  PRIMARY KEY  (rid)
27
+CREATE TABLE `router` (
28
+  `rid` int(11) unsigned NOT NULL auto_increment,
29
+  `name` char(120) NOT NULL default '',
30
+  `pop` char(10) NOT NULL default '',
31
+  `popid` tinyint(3) unsigned NOT NULL default '0',
32
+  PRIMARY KEY (`rid`)
33
 );
34
 
35
 #
36
 # Table structure for table 'interface'
37
 #
38
 
39
-CREATE TABLE interface (
40
-  id int(11) unsigned NOT NULL auto_increment,
41
-  name char(255) NOT NULL default '',
42
-  rid int(11) NOT NULL default '0',
43
-  speed bigint(11) default NULL,
44
-  description char(255) default NULL,
45
-  status enum('active','inactive') default 'active',
46
-  PRIMARY KEY  (id)
47
+CREATE TABLE `interface` (
48
+  `id` int(11) unsigned NOT NULL auto_increment,
49
+  `name` char(255) NOT NULL default '',
50
+  `rid` int(11) NOT NULL default '0',
51
+  `speed` bigint(11) default NULL,
52
+  `description` char(255) default NULL,
53
+  `status` enum('active','inactive') default 'active',
54
+  PRIMARY KEY (`id`)
55
 );
56
 
57
 #
58
 # Table structure for table 'ifInOctets'
59
 #
60
 
61
-CREATE TABLE ifInOctets (
62
-  id int(11) NOT NULL default '0',
63
-  dtime datetime NOT NULL default '0000-00-00 00:00:00',
64
-  counter bigint(20) NOT NULL default '0',
65
-  KEY ifInOctets_idx (dtime)
66
+CREATE TABLE `ifInOctets` (
67
+  `id` int(11) NOT NULL default '0',
68
+  `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
69
+  `counter` bigint(20) NOT NULL default '0',
70
+  KEY `ifInOctets_idx` (`dtime`)
71
 );
72
 
73
 #
74
 # Table structure for table 'ifOutOctets'
75
 #
76
 
77
-CREATE TABLE ifOutOctets (
78
-  id int(11) NOT NULL default '0',
79
-  dtime datetime NOT NULL default '0000-00-00 00:00:00',
80
-  counter bigint(20) NOT NULL default '0',
81
-  KEY ifOutOctets_idx (dtime)
82
+CREATE TABLE `ifOutOctets` (
83
+  `id` int(11) NOT NULL default '0',
84
+  `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
85
+  `counter` bigint(20) NOT NULL default '0',
86
+  KEY `ifOutOctets_idx` (`dtime`)
87
 );
88
 
89
 #
90
 # Table structure for table 'ifInUcastPkts'
91
 #
92
 
93
-CREATE TABLE ifInUcastPkts (
94
-  id int(11) NOT NULL default '0',
95
-  dtime datetime NOT NULL default '0000-00-00 00:00:00',
96
-  counter bigint(20) NOT NULL default '0',
97
-  KEY ifInUcastPkts_idx (dtime)
98
+CREATE TABLE `ifInUcastPkts` (
99
+  `id` int(11) NOT NULL default '0',
100
+  `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
101
+  `counter` bigint(20) NOT NULL default '0',
102
+  KEY `ifInUcastPkts_idx` (`dtime`)
103
 );
104
 
105
 #
106
 # Table structure for table 'ifOutUcastPkts'
107
 #
108
 
109
-CREATE TABLE ifOutUcastPkts (
110
-  id int(11) NOT NULL default '0',
111
-  dtime datetime NOT NULL default '0000-00-00 00:00:00',
112
-  counter bigint(20) NOT NULL default '0',
113
-  KEY ifOutUcastPkts_idx (dtime)
114
+CREATE TABLE `ifOutUcastPkts` (
115
+  `id` int(11) NOT NULL default '0',
116
+  `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
117
+  `counter` bigint(20) NOT NULL default '0',
118
+  KEY `ifOutUcastPkts_idx` (`dtime`)
119
 );
120
 
121
 #
122
 # Table structure for table 'ifInErrors'
123
 #
124
 
125
-CREATE TABLE ifInErrors (
126
-  id int(11) NOT NULL default '0',
127
-  dtime datetime NOT NULL default '0000-00-00 00:00:00',
128
-  counter bigint(20) NOT NULL default '0',
129
-  KEY ifInErrors_idx (dtime)
130
+CREATE TABLE `ifInErrors` (
131
+  `id` int(11) NOT NULL default '0',
132
+  `dtime` datetime NOT NULL default '0000-00-00 00:00:00',
133
+  `counter` bigint(20) NOT NULL default '0',
134
+  KEY `ifInErrors_idx` (`dtime`)
135
 );
136
 EOT
137
 
138
@@ -117,8 +114,6 @@ echo "Adding user \"$USER\" to MySQL dat
139
 cat /tmp/mysql.sql | $MYSQLBIN/mysql -u root -p$ROOTPASS mysql
140
 echo "Creating RTG database \"$DATABASE\"..."
141
 $MYSQLBIN/mysqladmin -u root -p$ROOTPASS create $DATABASE
142
-echo "Reloading MySQL privileges..."
143
-$MYSQLBIN/mysqladmin -u root -p$ROOTPASS flush-privileges
144
 echo "Creating RTG tables..."
145
 cat /tmp/rtg.sql | $MYSQLBIN/mysql -u $USER -p$RTGPASS $DATABASE
146
 echo "Done."
(-)net/rtg/files/patch-etc_report.pl (-1 / +50 lines)
Lines 1-4 Link Here
1
--- etc/report.pl.orig	2016-11-04 16:36:08 UTC
1
--- etc/report.pl.orig	2018-04-02 20:14:41 UTC
2
+++ etc/report.pl
2
+++ etc/report.pl
3
@@ -30,7 +30,7 @@ $pass="rtgdefault";
3
@@ -30,7 +30,7 @@ $pass="rtgdefault";
4
 $onedaysec=60*60*24;
4
 $onedaysec=60*60*24;
Lines 9-11 Link Here
9
 foreach $conf (@configs) {
9
 foreach $conf (@configs) {
10
   if (open CONF, "<$conf") {
10
   if (open CONF, "<$conf") {
11
     print "Reading [$conf].\n" if $DEBUG;
11
     print "Reading [$conf].\n" if $DEBUG;
12
@@ -192,13 +192,13 @@ print "Period: [", format_dt($startdate)
13
 write;
14
 ($router,$name,$bytesin, $bytesout, $ratein, $rateout, $utilin, $utilout, $maxratein, $maxrateout, $maxutilin, $maxutilout) = ("","Connection", "MBytes", "MBytes", "Mbps", "Mbps", "In %", "Out%",  "Mbps", "Mbps", "In%", "Out%");
15
 write;
16
-print "----------------------------------------------------------------------------------------------------------\n";
17
+print "------------------------------------------------------------------------------------------------------------------------------\n";
18
 
19
 $dbh= DBI->connect("DBI:mysql:$db:host=$host", $user, $pass);
20
 $dbh2= DBI->connect("DBI:mysql:$db:host=$host", $user, $pass);
21
-$range="dtime>$startdate and dtime<=$enddate";
22
+$range="`dtime`>$startdate and `dtime`<=$enddate";
23
 
24
-$statement="SELECT id FROM interface WHERE description LIKE \"%$cust%\"";
25
+$statement="SELECT `id` FROM `interface` WHERE `description` LIKE \"%$cust%\"";
26
 $sth = $dbh->prepare($statement)
27
         or die "Can't prepare $statement: $dbh->errstr\n";
28
 $rv = $sth->execute
29
@@ -209,19 +209,19 @@ while (@row = $sth->fetchrow_array ())
30
 }
31
 
32
 foreach $interface (@interfaces) {
33
-  $statement="SELECT rid, name, speed FROM interface WHERE id=$interface";
34
+  $statement="SELECT `rid`, `name`, `speed` FROM `interface` WHERE `id`=$interface";
35
   &run_query($statement);
36
   ($rid, $name, $speed) = @row;
37
 
38
-  $statement="SELECT rid, name FROM router WHERE rid=$rid";
39
+  $statement="SELECT `rid`, `name` FROM `router` WHERE `rid`=$rid";
40
   &run_query($statement);
41
   ($rid, $router) = @row;
42
 
43
-  $statement="SELECT counter, UNIX_TIMESTAMP(dtime), dtime FROM ifInOctets_".$rid." WHERE $range AND id=$interface ORDER BY dtime"; 
44
+  $statement="SELECT `counter`, UNIX_TIMESTAMP(`dtime`), `dtime` FROM `ifInOctets_".$rid."` WHERE $range AND `id`=$interface ORDER BY `dtime`"; 
45
   ($intbytes_in, $maxin, $avgin) = &interface_stats($statement);
46
   $bytesin = int($intbytes_in/1000000 + .5);
47
 
48
-  $statement="SELECT counter, UNIX_TIMESTAMP(dtime), dtime FROM ifOutOctets_".$rid." WHERE $range AND id=$interface ORDER BY dtime"; 
49
+  $statement="SELECT `counter`, UNIX_TIMESTAMP(`dtime`), `dtime` FROM `ifOutOctets_".$rid."` WHERE $range AND `id`=$interface ORDER BY `dtime`"; 
50
   ($intbytes_out, $maxout, $avgout) = &interface_stats($statement);
51
   $bytesout = int($intbytes_out/1000000 + .5);
52
 
53
@@ -267,6 +267,6 @@ $rc = $dbh->disconnect;
54
 exit;
55
 
56
 format STDOUT = 
57
-@<<<<<<<<<<< @<<<<<<<<<<< @>>>>>>> @>>>>>>> @>>>>>> @>>>>>> @>>>>> @>>>>> @>>>>>> @>>>>>> @>>>>> @>>>>>
58
+@<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<< @>>>>>>> @>>>>>>> @>>>>>> @>>>>>> @>>>>> @>>>>> @>>>>>> @>>>>>> @>>>>> @>>>>>
59
 $name,$router,&commify($bytesin), &commify($bytesout), $ratein, $rateout, $utilin, $utilout, $maxratein, $maxrateout, $maxutilin, $maxutilout  
60
 .
(-)net/rtg/files/patch-etc_rtg.conf (+10 lines)
Line 0 Link Here
1
--- etc/rtg.conf.orig	2018-04-02 23:07:32 UTC
2
+++ etc/rtg.conf
3
@@ -12,3 +12,7 @@ DB_Database	rtg
4
 DB_User	snmp
5
 DB_Pass	rtgdefault
6
 Threads 5
7
+# Set Update_desc to 1 to cause rtgtargmkr.pl to auto-update descriptions from
8
+# SNMP port data
9
+Update_desc	0
10
+
(-)net/rtg/files/patch-etc_rtg.php (+389 lines)
Line 0 Link Here
1
--- etc/rtg.php.orig	2003-09-24 20:42:03 UTC
2
+++ etc/rtg.php
3
@@ -1,146 +1,152 @@
4
 <?php
5
   include('./common.php');
6
 
7
-  print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
8
+  print "<html>\n<!-- RTG Version $VERSION -->\n<head>\n";
9
 
10
   /* Connect to RTG MySQL Database */
11
-  $dbc=@mysql_connect ($host, $user, $pass) or
12
-  $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or 
13
+  $dbc=@mysqli_connect ($host, $user, $pass, $db) or
14
      die ("MySQL Connection Failed, Check Configuration.");
15
-  mysql_select_db($db,$dbc);
16
 
17
- if ($PHP_SELF == "") {
18
+ if (!isset($PHP_SELF) || $PHP_SELF == "") {
19
    $PHP_SELF = "rtg.php";
20
-   $errors = $_GET['errors'];
21
-   $scalex = $_GET['scalex'];
22
-   $scaley = $_GET['scaley'];
23
-   $aggr = $_GET['aggr'];
24
-   $percentile = $_GET['percentile'];
25
-   $nth = $_GET['nth'];
26
-   $xplot = $_GET['xplot'];
27
-   $yplot = $_GET['yplot'];
28
-   $borderb = $_GET['borderb'];
29
-   $iid = $_GET['iid'];
30
-   $rid = $_GET['rid'];
31
-   $syear = $_GET['syear'];
32
-   $eyear = $_GET['eyear'];
33
-   $smonth = $_GET['smonth'];
34
-   $emonth = $_GET['emonth'];
35
-   $sday = $_GET['sday'];
36
-   $eday = $_GET['eday'];
37
-   $shour = $_GET['shour'];
38
-   $ehour = $_GET['ehour'];
39
-   $smin = $_GET['smin'];
40
-   $emin = $_GET['emin'];
41
+   $errors = isset($_GET['errors'])?$_GET['errors']:"";
42
+   $scalex = isset($_GET['scalex'])?$_GET['scalex']:"";
43
+   $scaley = isset($_GET['scaley'])?$_GET['scaley']:"";
44
+   $aggr = isset($_GET['aggr'])?$_GET['aggr']:"";
45
+   $percentile = isset($_GET['percentile'])?$_GET['percentile']:"";
46
+   $nth = isset($_GET['nth'])?$_GET['nth']:"";
47
+   $xplot = isset($_GET['xplot'])?$_GET['xplot']:"";
48
+   $yplot = isset($_GET['yplot'])?$_GET['yplot']:"";
49
+   $borderb = isset($_GET['borderb'])?$_GET['borderb']:"";
50
+   $iid = isset($_GET['iid'])?$_GET['iid']:"";
51
+   $rid = isset($_GET['rid'])?$_GET['rid']:"";
52
+   $syear = isset($_GET['syear'])?$_GET['syear']:"";
53
+   $eyear = isset($_GET['eyear'])?$_GET['eyear']:"";
54
+   $smonth = isset($_GET['smonth'])?$_GET['smonth']:"";
55
+   $emonth = isset($_GET['emonth'])?$_GET['emonth']:"";
56
+   $sday = isset($_GET['sday'])?$_GET['sday']:"";
57
+   $eday = isset($_GET['eday'])?$_GET['eday']:"";
58
+   $shour = isset($_GET['shour'])?$_GET['shour']:"";
59
+   $ehour = isset($_GET['ehour'])?$_GET['ehour']:"";
60
+   $smin = isset($_GET['smin'])?$_GET['smin']:"";
61
+   $emin = isset($_GET['emin'])?$_GET['emin']:"";
62
  }
63
 
64
   # Determine router, interface names as necessary
65
-  if ($rid && $iid) {
66
-    $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]";
67
-    $selectResult=mysql_query($selectQuery, $dbc);
68
-    $selectRow=mysql_fetch_object($selectResult);
69
-    $interfaces = mysql_num_rows($selectResult);
70
+  if (($rid != "") && ($iid != "")) {
71
+    $selectQuery="SELECT `a`.`name`, `a`.`description`, `a`.`speed`, `b`.`name` " .
72
+      "AS `router` FROM `interface` `a`, `router` `b` WHERE `a`.`rid`=`b`.`rid` " .
73
+      "AND `a`.`rid`=" . mysqli_real_escape_string($dbc, $rid) . " AND `a`.`id`=" .
74
+      mysqli_real_escape_string($dbc, $iid[0]);
75
+    $selectResult=mysqli_query($dbc, $selectQuery);
76
+    $selectRow=mysqli_fetch_object($selectResult);
77
+    $interfaces = mysqli_num_rows($selectResult);
78
     $name = $selectRow->name;
79
     $description = $selectRow->description;
80
     $speed = ($selectRow->speed)/1000000;
81
     $router = $selectRow->router;
82
-  } else if ($rid && !$iid) {
83
-    $selectQuery="SELECT name AS router from router where rid=$rid";
84
-    $selectResult=mysql_query($selectQuery, $dbc);
85
-    $selectRow=mysql_fetch_object($selectResult);
86
+  } else if (($rid != "") && ($iid == "")) {
87
+    $selectQuery="SELECT `name` AS `router` FROM `router` WHERE `rid`=" .
88
+      mysqli_real_escape_string($dbc, $rid);
89
+    $selectResult=mysqli_query($dbc, $selectQuery);
90
+    $selectRow=mysqli_fetch_object($selectResult);
91
     $router = $selectRow->router;
92
   }
93
 
94
   # Generate Title 
95
-  echo "<TITLE>RTG: ";
96
-  if ($rid && $iid) echo "$router: $name";
97
-  else if ($rid && !$iid) echo "$router";
98
-  echo "</TITLE>\n";
99
+  echo "<title>RTG: ";
100
+  if (($rid != "") && ($iid != "")) echo "$router: $name";
101
+  else if (($rid != "") && ($iid == "")) echo "$router";
102
+  echo "</title>\n";
103
 ?>
104
 
105
-</HEAD>
106
-<BODY BACKGROUND="rtgback.png" BGCOLOR="ffffff">
107
-<A HREF="http://rtg.sourceforge.net" ALT="[RTG Home Page]">
108
-<IMG SRC="rtg.png" BORDER="0">
109
-</A>
110
-<P>
111
+</head>
112
+<body background="rtgback.png" bgcolor="ffffff">
113
+<a href="http://rtg.sourceforge.net" alt="[RTG Home Page]"><img src="rtg.png" border="0" /></a>
114
+<p>
115
 
116
 <?php
117
-echo "<FORM ACTION=\"$PHP_SELF\" METHOD=\"get\">\n";
118
+echo "<form action=\"$PHP_SELF\" method=\"get\">\n";
119
 
120
-if (!$rid && !$iid) {
121
- echo "<SELECT NAME=\"rid\" SIZE=10>\n";
122
- $selectQuery="SELECT DISTINCT name, rid FROM router ORDER BY name";
123
- $selectResult=mysql_query($selectQuery, $dbc);
124
- while ($selectRow=mysql_fetch_object($selectResult)){
125
-    echo "<OPTION VALUE=\"$selectRow->rid\">$selectRow->name\n";
126
+if (($rid == "") && ($iid == "")) {
127
+ echo "<select name=\"rid\" size=\"10\">\n";
128
+ $selectQuery="SELECT DISTINCT `name`, `rid` FROM `router` ORDER BY `name`";
129
+ $selectResult=mysqli_query($dbc, $selectQuery);
130
+ while ($selectRow=mysqli_fetch_object($selectResult)){
131
+    echo "<option value=\"$selectRow->rid\">$selectRow->name</option>\n";
132
  }
133
- echo "</SELECT>\n";
134
+ echo "</select>\n";
135
 }
136
 
137
-if ($smonth != "" && $iid == "") {
138
- echo "<BLOCKQUOTE><FONT SIZE=+1><STRONG>\n";
139
+if (($smonth != "") && ($iid == "")) {
140
+ echo "<blockquote><font size=\"+1\"><b>\n";
141
  echo "Please select an interface!\n";
142
- echo "</FONT></STRONG></BLOCKQUOTE>\n";
143
+ echo "</b></font></blockquote>\n";
144
 }
145
 
146
-if ($rid && !$iid) {
147
-  echo "<SELECT NAME=\"rid\" SIZE=10>\n"; 
148
-  echo "<OPTION SELECTED VALUE=\"$rid\">$router\n";
149
-  echo "</SELECT>\n";
150
+if (($rid != "") && ($iid == "")) {
151
+  echo "<select name=\"rid\" size=\"10\">\n"; 
152
+  echo "<option selected value=\"$rid\">$router</option>\n";
153
+  echo "</select>\n";
154
 
155
-  echo "<SELECT MULTIPLE NAME=\"iid[]\" SIZE=10>\n"; 
156
-  $selectQuery="SELECT id, name, description FROM interface WHERE rid=$rid ORDER BY name";
157
-  $selectResult=mysql_query($selectQuery, $dbc);
158
-  while ($selectRow=mysql_fetch_object($selectResult)){
159
-     echo "<OPTION VALUE=\"$selectRow->id\">$selectRow->name ($selectRow->description)\n";
160
+  echo "<select multiple name=\"iid[]\" size=\"10\">\n";
161
+  $selectQuery="SELECT `id`, `name`, `description` FROM `interface` WHERE " .
162
+    "`rid`=" . mysqli_real_escape_string($dbc, $rid) . " ORDER BY `name`";
163
+  $selectResult=mysqli_query($dbc, $selectQuery);
164
+  while ($selectRow=mysqli_fetch_object($selectResult)){
165
+     echo "<option value=\"$selectRow->id\">$selectRow->name ($selectRow->description)</option>\n";
166
   }
167
-  echo "</SELECT>\n";
168
+  echo "</select>\n";
169
 
170
-  echo "<P><TABLE>\n";
171
-  echo "<TD>From: \n";
172
-  echo "<TD><INPUT TYPE=TEXT NAME=\"smonth\" SIZE=3 MAXLENGTH=2 VALUE=\"";
173
+  echo "<p><table>\n";
174
+  echo "<tr><td>From: </td>\n";
175
+  echo "<td><input type=\"text\" name=\"smonth\" size=\"3\" maxlength=\"2\" value=\"";
176
   print (date("m"));
177
-  echo "\"> / \n";
178
-  echo "<INPUT TYPE=TEXT NAME=\"sday\" SIZE=3 MAXLENGTH=2 VALUE=\"";
179
+  echo "\" /> / \n";
180
+  echo "<input type=\"text\" name=\"sday\" size=\"3\" maxlength=\"2\" value=\"";
181
   print (date("d"));
182
-  echo "\"> / \n";
183
-  echo "<INPUT TYPE=TEXT NAME=\"syear\" SIZE=5 MAXLENGTH=4 VALUE=\"";
184
+  echo "\" /> / \n";
185
+  echo "<input type=\"text\" name=\"syear\" size=\"5\" maxlength=\"4\" value=\"";
186
   print (date("Y"));
187
-  echo "\">\n";
188
-  echo "<TD><INPUT TYPE=TEXT NAME=\"shour\" SIZE=3 MAXLENGTH=2 VALUE=\"00\">:\n";
189
-  echo "<INPUT TYPE=TEXT NAME=\"smin\" SIZE=3 MAXLENGTH=2 VALUE=\"00\">\n";
190
+  echo "\" />\n";
191
+  echo "</td>";
192
+  echo "<td><input type=\"text\" name=\"shour\" size=\"3\" maxlength=\"2\" value=\"00\" />:\n";
193
+  echo "<input type=\"text\" name=\"smin\" size=\"3\" maxlength=\"2\" value=\"00\" />\n";
194
+  echo "</td></tr>\n";
195
 
196
-  echo "<TR><TD>To: \n";
197
-  echo "<TD><INPUT TYPE=TEXT NAME=\"emonth\" SIZE=3 MAXLENGTH=2 VALUE=\"";
198
+  echo "<tr><td>To: </td>\n";
199
+  echo "<td><input type=\"text\" name=\"emonth\" size=\"3\" maxlength=\"2\" value=\"";
200
   print (date("m"));
201
-  echo "\"> / \n";
202
-  echo "<INPUT TYPE=TEXT NAME=\"eday\" SIZE=3 MAXLENGTH=2 VALUE=\"";
203
+  echo "\" /> / \n";
204
+  echo "<input type=\"text\" name=\"eday\" size=\"3\" maxlength=\"2\" value=\"";
205
   print (date("d"));
206
-  echo "\"> / \n";
207
-  echo "<INPUT TYPE=TEXT NAME=\"eyear\" SIZE=5 MAXLENGTH=4 VALUE=\"";
208
+  echo "\" /> / \n";
209
+  echo "<input type=\"text\" name=\"eyear\" size=\"5\" maxlength=\"4\" value=\"";
210
   print (date("Y"));
211
-  echo "\">\n";
212
-  echo "<TD><INPUT TYPE=TEXT NAME=\"ehour\" SIZE=3 MAXLENGTH=2 VALUE=\"23\">:\n";
213
-  echo "<INPUT TYPE=TEXT NAME=\"emin\" SIZE=3 MAXLENGTH=2 VALUE=\"59\">\n";
214
-  echo "<TR><TD>Aggregate Interfaces: \n";
215
-  echo "<TD><INPUT TYPE=CHECKBOX NAME=\"aggr\">\n";
216
-  echo "<TR><TD><INPUT TYPE=TEXT NAME=\"nth\" SIZE=2 MAXLENGTH=2 VALUE=\"95\">th Percentile: \n";
217
-  echo "<TD><INPUT TYPE=CHECKBOX NAME=\"percentile\">\n";
218
-  echo "<TR><TD>Fit to Data: \n";
219
-  echo "<TD><INPUT TYPE=CHECKBOX NAME=\"scalex\">\n";
220
-  echo "<TR><TD>Fit to Speed: \n";
221
-  echo "<TD><INPUT TYPE=CHECKBOX NAME=\"scaley\">\n";
222
-  echo "<TR><TD>X Size: \n";
223
-  echo "<TD><INPUT TYPE=TEXT NAME=\"xplot\" SIZE=3 VALUE=\"500\">\n";
224
-  echo "<TR><TD>Y Size: \n";
225
-  echo "<TD><INPUT TYPE=TEXT NAME=\"yplot\" SIZE=3 VALUE=\"150\">\n";
226
-  echo "<TR><TD>BorderB: \n";
227
-  echo "<TD><INPUT TYPE=TEXT NAME=\"borderb\" SIZE=3 VALUE=\"70\">\n";
228
-  echo "</TABLE>\n";
229
+  echo "\" />\n";
230
+  echo "</td>";
231
+  echo "<td><input type=\"text\" name=\"ehour\" size=\"3\" maxlength=\"2\" value=\"23\" />:\n";
232
+  echo "<input type=\"text\" name=\"emin\" size=\"3\" maxlength=\"2\" value=\"59\" />\n";
233
+  echo "</td></tr>\n";
234
+
235
+  echo "<tr><td>Aggregate Interfaces: </td>\n";
236
+  echo "<td><input type=\"checkbox\" name=\"aggr\" /></td></tr>\n";
237
+  echo "<tr><td><input type=\"text\" name=\"nth\" size=\"2\" maxlength=\"2\" value=\"95\" />th Percentile: </td>\n";
238
+  echo "<td><input type=\"checkbox\" name=\"percentile\" /></td></tr>\n";
239
+  echo "<tr><td>Fit to Data: </td>\n";
240
+  echo "<td><input type=\"checkbox\" name=\"scalex\" /></td></tr>\n";
241
+  echo "<tr><td>Fit to Speed: </td>\n";
242
+  echo "<td><input type=\"checkbox\" name=\"scaley\" /></td></tr>\n";
243
+  echo "<tr><td>X Size: </td>\n";
244
+  echo "<td><input type=\"text\" name=\"xplot\" size=\"3\" value=\"500\" /></td></tr>\n";
245
+  echo "<tr><td>Y Size: </td>\n";
246
+  echo "<td><input type=\"text\" name=\"yplot\" size=\"3\" value=\"150\" /></td></tr>\n";
247
+  echo "<tr><td>BorderB: </td>\n";
248
+  echo "<td><input type=\"text\" name=\"borderb\" size=\"3\" value=\"70\" /></td></tr>\n";
249
+  echo "</table>\n";
250
 }
251
 
252
-if (($bt || $smonth) && $iid) { 
253
+if (($bt != "" || $smonth != "") && ($iid != "")) { 
254
 
255
   /* Format into GNU date syntax */
256
   if ($bt == "") {
257
@@ -148,67 +154,84 @@ if (($bt || $smonth) && $iid) { 
258
     $et = strtotime("$eyear-$emonth-$eday $ehour:$emin:59");
259
   }
260
 
261
-  $range="dtime>FROM_UNIXTIME($bt) AND dtime<=FROM_UNIXTIME($et)";
262
-  $range="$range AND id=$iid[0]";
263
+  $range="`dtime`>FROM_UNIXTIME(" . mysqli_real_escape_string($dbc, $bt) . ") AND " .
264
+    "`dtime`<=FROM_UNIXTIME(" . mysqli_real_escape_string($dbc, $et) . ") " .
265
+    "AND `id`=" . mysqli_real_escape_string($dbc, $iid[0]);
266
 
267
-  $selectQuery="SELECT description, name, speed FROM interface WHERE rid=$rid AND id=$iid[0]";
268
-  $selectResult=mysql_query($selectQuery, $dbc);
269
-  $selectRow=mysql_fetch_object($selectResult);
270
-  echo "<TABLE BORDER=0>\n";
271
-  echo "<TD><I>Device</I>:</TD><TD>$router ($rid)</TD><TR>\n";
272
-  echo "<TD><I>Interface</I>:</TD><TD>$selectRow->name ($iid[0])</TD><TR>\n";
273
-  printf ("<TD><I>Speed</I>:</TD><TD>%2.3f Mbps</TD><TR>\n", $selectRow->speed / 1000000);
274
-  echo "<TD><I>Description</I>:</TD><TD>$selectRow->description</TD><TR>\n";
275
-  print strftime("<TD><I>Period</I>:</TD><TD>%m/%d/%Y %H:%M - ", $bt);
276
-  print strftime("%m/%d/%Y %H:%M</TD>\n", $et);
277
-  echo "</TABLE>\n";
278
-  echo "<P>\n";
279
+  $selectQuery="SELECT `description`, `name`, `speed` FROM `interface` WHERE " .
280
+    "`rid`=" . mysqli_real_escape_string($dbc, $rid) . " AND `id`=" .
281
+    mysqli_real_escape_string($dbc, $iid[0]);
282
+  $selectResult=mysqli_query($dbc, $selectQuery);
283
+  $selectRow=mysqli_fetch_object($selectResult);
284
+  echo "<table border=\"0\">\n";
285
+  echo "<tr><td><i>Device</i>:</td><td>$router ($rid)</td></tr>\n";
286
+  echo "<tr><td><i>Interface</i>:</td><td>$selectRow->name ($iid[0])</td></tr>\n";
287
+  printf ("<tr><td><i>Speed</i>:</td><td>%2.3f Mbps</td></tr>\n", $selectRow->speed / 1000000);
288
+  echo "<tr><td><i>Description</i>:</td><td>$selectRow->description</td></tr>\n";
289
+  print strftime("<tr><td><i>Period</i>:</td><td>%m/%d/%Y %H:%M - ", $bt);
290
+  print strftime("%m/%d/%Y %H:%M</td>\n", $et);
291
+  echo "</tr>\n";
292
+  echo "</table>\n";
293
+  echo "<p>\n";
294
  
295
   #$selectQuery="SELECT DISTINCT id FROM ifInOctets_$rid WHERE $range";
296
-  #$selectResult=mysql_query($selectQuery, $dbc);
297
-  #if (mysql_num_rows($selectResult) <= 0) {
298
+  #$selectResult=mysqli_query($dbc, $selectQuery);
299
+  #if (mysqli_num_rows($selectResult) <= 0) {
300
   #   print "<BR>No Data Found on Interface for Given Range.<BR>\n";
301
   #}
302
   #else {
303
-    $args = "t1=ifInOctets_$rid&t2=ifOutOctets_$rid&begin=$bt&end=$et&units=bits/s&factor=8";
304
+    $args = "t1=ifInOctets_$rid&amp;t2=ifOutOctets_$rid&amp;begin=$bt&amp;";
305
+    $args .= "end=$et&amp;units=bits/s&amp;factor=8";
306
+    $args .= "&amp;title=" . urlencode($selectRow->description);
307
+    $args .= "&amp;t1_name=" . urlencode("Input Octets");
308
+    $args .= "&amp;t2_name=" . urlencode("Output Octets");
309
     foreach ($iid as $value) {
310
-      $args="$args&iid=$value";
311
+      $args="$args&amp;iid=" . urlencode($value);
312
     }
313
-    if ($scalex) $args = "$args&scalex=yes";
314
-    if ($scaley) $args = "$args&scaley=yes";
315
-    if ($xplot) $args = "$args&xplot=$xplot";
316
-    if ($yplot) $args = "$args&yplot=$yplot";
317
-    if ($borderb) $args = "$args&borderb=$borderb";
318
-    if ($aggr) $args = "$args&aggr=yes";
319
-    if ($percentile) $args = "$args&percentile=$nth";
320
-    print "<IMG SRC=rtgplot.cgi?$args><BR>\n";
321
-    $args = "t1=ifInUcastPkts_$rid&t2=ifOutUcastPkts_$rid&begin=$bt&end=$et&units=pkts/s";
322
+    if ($scalex != "") $args = "$args&amp;scalex=yes";
323
+    if ($scaley != "") $args = "$args&amp;scaley=yes";
324
+    if ($xplot != "") $args = "$args&amp;xplot=$xplot";
325
+    if ($yplot != "") $args = "$args&amp;yplot=$yplot";
326
+    if ($borderb != "") $args = "$args&amp;borderb=$borderb";
327
+    if ($aggr != "") $args = "$args&amp;aggr=yes";
328
+    if ($percentile != "") $args = "$args&amp;percentile=$nth";
329
+    print "<img src=\"/cgi-bin/rtgplot.cgi?$args\" alt=\"graph\" /><br />\n";
330
+    $args = "t1=ifInUcastPkts_$rid&amp;t2=ifOutUcastPkts_$rid&amp;begin=$bt&amp;";
331
+    $args .= "end=$et&amp;units=pkts/s";
332
+    $args .= "&amp;title=" . urlencode($selectRow->description);
333
+    $args .= "&amp;t1_name=" . urlencode("Input Packets");
334
+    $args .= "&amp;t2_name=" . urlencode("Output Packets");
335
     foreach ($iid as $value) {
336
-      $args="$args&iid=$value";
337
+      $args="$args&amp;iid=" . urlencode($value);
338
+    }
339
+    if ($scalex != "") $args = "$args&amp;scalex=yes";
340
+    if ($xplot != "") $args = "$args&amp;xplot=$xplot";
341
+    if ($yplot != "") $args = "$args&amp;yplot=$yplot";
342
+    if ($borderb != "") $args = "$args&amp;borderb=$borderb";
343
+    if ($aggr != "") $args = "$args&amp;aggr=yes";
344
+    if ($percentile != "") $args = "$args&amp;percentile=$nth";
345
+    print "<img src=\"/cgi-bin/rtgplot.cgi?$args\" alt=\"graph\" /><br />\n";
346
+    if ($errors != "")
347
+    {
348
+       print "<img src=\"/cgi-bin/rtgplot.cgi?t1=ifInErrors_$rid&amp;begin=$bt";
349
+       print "&amp;end=$et&amp;units=errors&amp;impulses=yes";
350
+       print "&amp;title=" . urlencode($selectRow->description);
351
+       print "&amp;t1_name=" . urlencode("Errors") . "\" alt=\"graph\" />\n";
352
     }
353
-    if ($scalex) $args = "$args&scalex=yes";
354
-    if ($xplot) $args = "$args&xplot=$xplot";
355
-    if ($yplot) $args = "$args&yplot=$yplot";
356
-    if ($borderb) $args = "$args&borderb=$borderb";
357
-    if ($aggr) $args = "$args&aggr=yes";
358
-    if ($percentile) $args = "$args&percentile=$nth";
359
-    print "<IMG SRC=rtgplot.cgi?$args><BR>\n";
360
-    if ($errors) 
361
-       print "<IMG SRC=rtgplot.cgi?t1=ifInErrors_$rid&begin=$bt&end=$et&units=errors&impulses=yes>\n";
362
 #  }
363
 } 
364
 
365
-mysql_close($dbc);
366
+mysqli_close($dbc);
367
 ?>
368
 
369
-<P>
370
-<INPUT TYPE="SUBMIT" VALUE="Ok">
371
-</FORM>
372
-<BR>
373
-<HR>
374
-<FONT FACE="Arial" SIZE="2">
375
+<p>
376
+<input type="submit" value="Ok" />
377
+</form>
378
+<br />
379
+<hr />
380
+<font face="Arial" size="2">
381
 <?php
382
- print "<A HREF=\"http://rtg.sourceforge.net\">RTG</A> Version $VERSION</FONT>";
383
-?>
384
-</BODY>
385
-</HTML>
386
+ print "<a href=\"http://rtg.sourceforge.net\">RTG</a> Version $VERSION</font>";
387
+?></p>
388
+</body>
389
+</html>
(-)net/rtg/files/patch-etc_rtgtargmkr.pl.in (+110 lines)
Line 0 Link Here
1
--- etc/rtgtargmkr.pl.in.orig	2018-04-02 20:14:41 UTC
2
+++ etc/rtgtargmkr.pl.in
3
@@ -10,10 +10,11 @@
4
 # Local customization
5
 
6
 $community   = "public";         # Default SNMP community
7
-$defbits     = 32;               # Default OID bits: 32/64
8
+$defbits     = 64;               # Default OID bits: 32/64
9
 $output      = "targets.cfg";    # Output target file name
10
 $router_file = "routers";        # Input list of devices to poll
11
 $conf_file   = "rtg.conf";       # RTGpoll and RTGplot configurations
12
+$update_desc = 0;		 # Update interface descriptions
13
 $INFO        = 1;                # Print informational messages
14
 $DEBUG       = 0;                # Print debug messages
15
 $DBOFF       = 0;                # Turn database queries off (debug)
16
@@ -77,7 +78,7 @@ $catalyst = [
17
 );
18
 
19
 # Default locations to find RTG configuration file
20
-@configs = ("rtg.conf", "/usr/local/rtg/etc/rtg.conf", "/etc/rtg.conf");
21
+@configs = ("rtg.conf", "@RTG_HOME@/etc/rtg.conf", "/usr/local/rtg/etc/rtg.conf", "/etc/rtg.conf");
22
 foreach $conf (@configs) {
23
   if (open CONF, "<$conf") {
24
     print "Reading [$conf].\n" if $DEBUG;
25
@@ -93,7 +94,9 @@ foreach $conf (@configs) {
26
         $db_db=$cVals[1];
27
       } elsif ($cVals[0] =~ /Interval/) {
28
         $interval=$cVals[1];
29
-      }	
30
+      }	elsif ($cVals[0] =~ /Update_desc/) {
31
+        $update_desc=$cVals[1];
32
+      }
33
     }
34
     last;
35
   }
36
@@ -113,7 +116,7 @@ sub sql_insert {
37
 # exist, create a new entry and corresponding tables.
38
 sub find_router_id {
39
     ($router) = @_;
40
-    $sql = "SELECT DISTINCT rid FROM router WHERE name=\"$router\"";
41
+    $sql = "SELECT DISTINCT `rid` FROM `router` WHERE `name`=\"$router\"";
42
     print "SQL: $sql\n" if $DEBUG;
43
     my $sth = $dbh->prepare($sql)
44
       or die "Can't prepare $sql: $dbh->errstr\n";
45
@@ -121,12 +124,12 @@ sub find_router_id {
46
       or die "can't execute the query: $sth->errstr\n";
47
     if ( $sth->rows == 0 ) {
48
         print "No router id found for $router...";
49
-        $sql = "INSERT INTO router (name) VALUES(\"$router\")";
50
+        $sql = "INSERT INTO `router` (`name`) VALUES(\"$router\")";
51
         print "adding.\n";
52
         &sql_insert($sql);
53
         $rid = &find_router_id($router);
54
         foreach $mib ( keys %mibs_of_interest ) {
55
-          $sql = "CREATE TABLE $mib"."_$rid (id INT NOT NULL, dtime DATETIME NOT NULL, counter BIGINT NOT NULL, KEY $mib"."_$rid". "_idx (dtime))";
56
+          $sql = "CREATE TABLE `$mib"."_$rid` (`id` INT NOT NULL, `dtime` DATETIME NOT NULL, `counter` BIGINT NOT NULL, KEY `$mib"."_$rid". "_idx` (`dtime`), KEY `id_dtime_idx` (`id`,`dtime`))";
57
           &sql_insert($sql);
58
         }
59
     }
60
@@ -143,7 +146,7 @@ sub find_router_id {
61
 sub find_interface_id {
62
     ( $rid, $int, $desc, $speed ) = @_;
63
     $desc =~ s/ +$//g;    #remove trailing whitespace
64
-    $sql = "SELECT id, description FROM interface WHERE rid=$rid AND name=\"$int\"";
65
+    $sql = "SELECT `id`, `description` FROM `interface` WHERE `rid`=$rid AND `name`=\"$int\"";
66
     print "SQL: $sql\n" if $DEBUG;
67
     my $sth = $dbh->prepare($sql)
68
       or die "Can't prepare $sql: $dbh->errstr\n";
69
@@ -152,7 +155,7 @@ sub find_interface_id {
70
     if ( $sth->rows == 0 ) {
71
         print "No id found for $int on device $rid...";
72
         $desc =~ s/\"/\\\"/g;    # Fix " in desc
73
-        $sql = "INSERT INTO interface (name, rid, speed, description) VALUES(\"$int\", $rid, $speed, \"$desc\")";
74
+        $sql = "INSERT INTO `interface` (`name`, `rid`, `speed`, `description`) VALUES(\"$int\", $rid, $speed, \"$desc\")";
75
         print "adding.\n";
76
         &sql_insert($sql);
77
         $iid = &find_interface_id( $rid, $int, $desc, $speed );
78
@@ -164,7 +167,13 @@ sub find_interface_id {
79
             print "Interface description changed.\n";
80
             print "Was: \"$row[1]\"\n";
81
             print "Now: \"$desc\"\n";
82
-            print "Suggest: UPDATE interface SET description='$desc' WHERE id=$iid\n";
83
+            if ( $update_desc == 1 ) {
84
+              $sql = "UPDATE `interface` SET `description`='$desc' WHERE `id`=$iid";
85
+              &sql_insert($sql);
86
+              print "Updated.\n";
87
+            } else {
88
+              print "Suggest: UPDATE `interface` SET `description`='$desc' WHERE `id`=$iid\n";
89
+            }
90
         }
91
     }
92
     $sth->finish;
93
@@ -289,7 +298,7 @@ sub main {
94
       $year + 1900, $hour, $min;
95
     print CFG "# Host\tOID\tBits\tCommunity\tTable\tID\tDescription\n";
96
 
97
-    foreach $router (@routers) {
98
+    POKE: foreach $router (@routers) {
99
         $bits = $counterBits{$router};
100
         # Sanity check bits
101
         $bits = $defbits if ( ( $bits != 32 ) && ( $bits != 64 ) );
102
@@ -304,7 +313,7 @@ sub main {
103
         $system = join ( ' ', @result );
104
         print "System: $system\n" if $DEBUG;
105
         $session = SNMP_Session->open( $router, $communities{$router}, 161 )
106
-          || die "Error opening SNMP session to $router";
107
+          || ( print "Error opening SNMP session to $router" and next POKE );
108
         if ( $system =~ /.*Cisco.*WS-.*/ ) {
109
             $system = "Catalyst";
110
             $session->map_table( $catalyst, \&process );
(-)net/rtg/files/patch-etc_view.php (+258 lines)
Line 0 Link Here
1
--- etc/view.php.orig	2003-09-26 15:58:34 UTC
2
+++ etc/view.php
3
@@ -8,154 +8,163 @@
4
   header("Cache-Control: no-cache, must-revalidate");
5
   header("Pragma: no-cache");
6
 
7
-  print "<HTML>\n<!-- RTG Version $VERSION -->\n<HEAD>\n";
8
+  print "<html>\n<!-- RTG Version $VERSION -->\n<head>\n";
9
 
10
   /* Connect to RTG MySQL Database */
11
-  $dbc=@mysql_connect ($host, $user, $pass) or
12
-  $dbc=@mysql_connect ("$host:/var/lib/mysql/mysql.sock", $user, $pass) or 
13
+  $dbc=@mysqli_connect ($host, $user, $pass, $db) or
14
      die ("MySQL Connection Failed, Check Configuration.");
15
-  mysql_select_db($db,$dbc);
16
 
17
   # Global variables off by default in newer versions of PHP
18
-  if (!$PHP_SELF) {
19
+  if (!isset($PHP_SELF) || ($PHP_SELF == "")) {
20
     $PHP_SELF = "view.php";
21
-    $rid = $_GET['rid'];
22
-    $iid = $_GET['iid'];
23
+    $rid = isset($_GET['rid'])?$_GET['rid']:"";
24
+    $iid = isset($_GET['iid'])?$_GET['iid']:"";
25
   }
26
 
27
   # Determine router, interface names as necessary
28
-  if ($rid && $iid) {
29
-    $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";
30
-    $selectResult=mysql_query($selectQuery, $dbc);
31
-    $selectRow=mysql_fetch_object($selectResult);
32
-    $interfaces = mysql_num_rows($selectResult);
33
+  if (($rid != "") && ($iid != "")) {
34
+    $selectQuery="SELECT `a`.`name`, `a`.`description`, `a`.`speed`, `b`.`name` " .
35
+      "AS `router` FROM `interface` `a`, `router` `b` WHERE `a`.`rid`=`b`.`rid` " .
36
+      "AND `a`.`rid`=" . mysqli_real_escape_string($dbc, $rid) . " AND `a`.`id`=" .
37
+      mysqli_real_escape_string($dbc, $iid);
38
+    $selectResult=mysqli_query($dbc, $selectQuery);
39
+    $selectRow=mysqli_fetch_object($selectResult);
40
+    $interfaces = mysqli_num_rows($selectResult);
41
     $name = $selectRow->name;
42
     $description = $selectRow->description;
43
     $speed = ($selectRow->speed)/1000000;
44
     $router = $selectRow->router;
45
-  } else if ($rid && !$iid) {
46
-    $selectQuery="SELECT name AS router from router where rid=$rid";
47
-    $selectResult=mysql_query($selectQuery, $dbc);
48
-    $selectRow=mysql_fetch_object($selectResult);
49
+  } else if (($rid != "")&& ($iid == "")) {
50
+    $selectQuery="SELECT `name` AS `router` FROM `router` WHERE `rid`=" .
51
+      mysqli_real_escape_string($dbc, $rid);
52
+    $selectResult=mysqli_query($dbc, $selectQuery);
53
+    $selectRow=mysqli_fetch_object($selectResult);
54
     $router = $selectRow->router;
55
   }
56
 
57
   # Generate Title 
58
-  echo "<TITLE>RTG: ";
59
-  if ($rid && $iid) echo "$router: $name";
60
-  else if ($rid && !$iid) echo "$router";
61
-  echo "</TITLE>\n";
62
+  echo "<title>RTG: ";
63
+  if (($rid != "") && ($iid != "")) echo "$router: $name";
64
+  else if (($rid != "")&& ($iid == "")) echo "$router";
65
+  echo "</title>\n";
66
 
67
-  print "<meta HTTP-EQUIV=\"Refresh\" CONTENT=\"300\">\n";
68
-  print "<meta HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n";
69
-  print "<meta HTTP-EQUIV=\"Cache-Control\" CONTENT=\"no-cache\">\n";
70
-  print "<meta HTTP-EQUIV=\"Expires\" CONTENT=\"".gmdate('D, d M Y H:i:s \G\M\T', time() + 300)."\">\n";
71
-  print "<meta HTTP-EQUIV=\"Generator\" CONTENT=\"RTG $VERSION\">\n";
72
-  print "<meta HTTP-EQUIV=\"Date\" CONTENT=\"".gmdate('D, d M Y H:i:s \G\M\T', time())."\">\n";
73
-  print "<meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n";
74
+  print "<meta http-equiv=\"Refresh\" content=\"300\" />\n";
75
+  print "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";
76
+  print "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
77
+  print "<meta http-equiv=\"Expires\" content=\"".gmdate('D, d M Y H:i:s \G\M\T', time() + 300)."\" />\n";
78
+  print "<meta http-equiv=\"Generator\" content=\"RTG $VERSION\" />\n";
79
+  print "<meta http-equiv=\"Date\" content=\"".gmdate('D, d M Y H:i:s \G\M\T', time())."\" />\n";
80
+  print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n";
81
 ?>
82
 
83
-</HEAD>
84
-<BODY BGCOLOR="ffffff">
85
-<A HREF="http://rtg.sourceforge.net" ALT="[RTG Home Page]">
86
-<IMG SRC="rtg.png" BORDER="0"></A><P><HR>
87
+</head>
88
+<body bgcolor="ffffff">
89
+<a href="http://rtg.sourceforge.net"<img src="rtg.png" border="0" alt="[RTG Home Page]" /></a><p><hr />
90
 
91
 <?php
92
- echo "<FORM ACTION=\"$PHP_SELF\" METHOD=\"GET\">\n";
93
+ echo "<form action=\"$PHP_SELF\" method=\"get\">\n";
94
 
95
  $et = time();
96
  
97
- if (!$rid) {
98
+ if ($rid == "") {
99
     print "Monitored Devices: <P>\n";
100
-    $selectQuery="SELECT rid, name FROM router";
101
-    $selectResult=mysql_query($selectQuery, $dbc);
102
-    if (mysql_num_rows($selectResult) <= 0) 
103
-      print "<BR>No Routers Found.<BR>\n";
104
+    $selectQuery="SELECT `rid`, `name` FROM `router`";
105
+    $selectResult=mysqli_query($dbc, $selectQuery);
106
+    if (mysqli_num_rows($selectResult) <= 0) 
107
+      print "<br />No Routers Found.<br />\n";
108
     else {
109
-      print "<UL>\n";
110
-      while ($selectRow=mysql_fetch_object($selectResult)){
111
-        print "<LI><A HREF=\"$PHP_SELF?rid=$selectRow->rid\">";
112
-        print "$selectRow->name</A><BR>\n";
113
+      print "<ul>\n";
114
+      while ($selectRow=mysqli_fetch_object($selectResult)){
115
+        print "<li><a href=\"$PHP_SELF?rid=$selectRow->rid\">";
116
+        print "$selectRow->name</a></li><br />\n";
117
       }
118
-      print "</UL>\n";
119
+      print "</ul>\n";
120
     }
121
  }
122
 
123
- if ($rid && $iid) {
124
+ if (($rid != "") && ($iid != "")) {
125
     if ($interfaces <= 0)
126
-      print "<BR>Interface $iid Not Found for Router $router (ID: $rid).<BR>\n";
127
+      print "<br />Interface $iid Not Found for Router $router (ID: $rid).<br />\n";
128
     else {
129
-      print "<TABLE>\n";
130
-      print "<TD>System:<TD>$router\n";
131
-      print "<TR><TD>Interface:<TD>$name\n";
132
-      print "<TR><TD>Description:<TD>$description\n";
133
-      print "<TR><TD>Speed:<TD>$speed Mbps\n";
134
-      print "<TR><TD>Page Generated:<TD>".gmdate('D, d M Y H:i:s \G\M\T', time())."\n";
135
-      print "</TABLE><HR>\n";
136
+      print "<table>\n";
137
+      print "<tr><td>System:</td><td>$router</td></tr>\n";
138
+      print "<tr><td>Interface:</td><td>$name</td></tr>\n";
139
+      print "<tr><td>Description:</td><td>$description</td></tr>\n";
140
+      print "<tr><td>Speed:</td><td>$speed Mbps</td></tr>\n";
141
+      print "<tr><td>Page Generated:</td><td>".gmdate('D, d M Y H:i:s \G\M\T', time())."</td></tr>\n";
142
+      print "</table><hr />\n";
143
 
144
       $bt = $et - (60*60*24);
145
-      print "<B>Day View:</B><BR>\n";
146
-      print "<IMG SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\">\n";
147
-      print "<BR><B>$router: $name ($description)</B>\n";
148
-      print "<BR><HR>\n";
149
+      print "<b>Day View:</b><br />\n";
150
+      print "<img src=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&amp;t2=ifOutOctets_".$rid."&amp;iid=$iid&amp;begin=$bt&amp;end=$et&amp;units=bits/s&amp;factor=8&amp;filled=yes";
151
+      print "&amp;title=" . urlencode("$router: $name ($description)") . "&amp;t1_name=" . urlencode("Input Octets") . "&amp;t2_name=" . urlencode("Output Octets") . "\" />\n";
152
+      print "<br /><b>$router: $name ($description)</b>\n";
153
+      print "<br /><hr />\n";
154
 
155
       $bt = $et - (60*60*24*7);
156
-      print "<B>Week View:</B><BR>\n";
157
-      print "<IMG SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\">\n";
158
-      print "<BR><B>$router: $name ($description)</B>\n";
159
-      print "<BR><HR>\n";
160
+      print "<b>Week View:</b><br />\n";
161
+      print "<img src=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&amp;t2=ifOutOctets_".$rid."&amp;iid=$iid&amp;begin=$bt&amp;end=$et&amp;units=bits/s&amp;factor=8&amp;filled=yes";
162
+      print "&amp;title=" . urlencode("$router: $name ($description)") . "&amp;t1_name=" . urlencode("Input Octets") . "&amp;t2_name=" . urlencode("Output Octets") . "\" />\n";
163
+      print "<br /><b>$router: $name ($description)</b>\n";
164
+      print "<br /><hr />\n";
165
 
166
       $bt = $et - (60*60*24*30);
167
-      print "<B>Month View:</B><BR>\n";
168
-      print "<IMG SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\">\n";
169
-      print "<BR><B>$router: $name ($description)</B>\n";
170
-      print "<BR><BR>\n";
171
+      print "<b>Month View:</b><br />\n";
172
+      print "<img src=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&amp;t2=ifOutOctets_".$rid."&amp;iid=$iid&amp;begin=$bt&amp;end=$et&amp;units=bits/s&amp;factor=8&amp;filled=yes";
173
+      print "&amp;title=" . urlencode("$router: $name ($description)") . "&amp;t1_name=" . urlencode("Input Octets") . "&amp;t2_name=" . urlencode("Output Octets") . "\" />\n";
174
+      print "<br /><b>$router: $name ($description)</b>\n";
175
+      print "<br /><br />\n";
176
     }
177
-    print "<INPUT TYPE=\"SUBMIT\" VALUE=\"Back to Main\">\n";
178
+    print "<input type=\"submit\" value=\"Back to Main\" />\n";
179
  }
180
 
181
- if ($rid && !$iid) {
182
-    $selectQuery="SELECT id, name, description FROM interface WHERE rid=$rid";
183
-    $selectResult=mysql_query($selectQuery, $dbc);
184
-    $interfaces = mysql_num_rows($selectResult);
185
+ if (($rid != "") && ($iid == "")) {
186
+    $selectQuery="SELECT `id`, `name`, `description` FROM `interface` WHERE " .
187
+      "`rid`=" . mysqli_real_escape_string($dbc, $rid);
188
+    $selectResult=mysqli_query($dbc, $selectQuery);
189
+    $interfaces = mysqli_num_rows($selectResult);
190
     if ($interfaces <= 0) 
191
-      print "<BR>No Interfaces Found for Router $router (ID: $rid).<BR>\n";
192
+      print "<br />No Interfaces Found for Router $router (ID: $rid).<br />\n";
193
     else {
194
       $bt = $et - (60*60*12);
195
-      print "<TABLE>\n";
196
-      print "<TD>System:<TD>$router\n";
197
-      print "<TR><TD>Interfaces:<TD>$interfaces\n";
198
-      print "<TR><TD>Page Generated:<TD>";
199
-      print gmdate('D, d M Y H:i:s \G\M\T', time())."\n";
200
-      print "</TABLE><HR>\n";
201
-      print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"10\">\n";
202
-      while ($selectRow=mysql_fetch_object($selectResult)){
203
+      print "<table>\n";
204
+      print "<tr><td>System:</td><td>$router</td></tr>\n";
205
+      print "<tr><td>Interfaces:</td><td>$interfaces</td></tr>\n";
206
+      print "<tr><td>Page Generated:</td><td>";
207
+      print gmdate('D, d M Y H:i:s \G\M\T', time())."</td></tr>\n";
208
+      print "</table><hr />\n";
209
+      print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"10\">\n";
210
+      print "<tr>\n";
211
+      while ($selectRow=mysqli_fetch_object($selectResult)){
212
         $ids[$selectRow->id] = $selectRow->name; 
213
 	$desc[$selectRow->id] = $selectRow->description;
214
 	$iid = $selectRow->id;
215
-	print "<TD><A HREF=\"$PHP_SELF?rid=$rid&iid=$iid\">\n";
216
-	print "<IMG HEIGHT=\"135\" WIDTH=\"500\" SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\" BORDER=\"0\">\n";
217
-	print "</A><BR>\n";
218
-        print "<B>$selectRow->name ($selectRow->description)</B>\n";
219
-        if ($even) {
220
+	print "<td><a href=\"$PHP_SELF?rid=$rid&amp;iid=$iid\">\n";
221
+	print "<img height=\"135\" width=\"500\" src=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&amp;t2=ifOutOctets_".$rid;
222
+	print "&amp;title=" . urlencode("$router: " . $selectRow->name . " (" . $selectRow->description . ")");
223
+	print "&amp;t1_name=" . urlencode("Input Octets") . "&t2_name=" . urlencode("Output Octets");
224
+	print "&amp;iid=$iid&amp;begin=$bt&amp;end=$et&amp;units=bits/s&amp;factor=8&amp;filled=yes\" border=\"0\" />\n";
225
+	print "</a><br />\n";
226
+        print "<b>$selectRow->name ($selectRow->description)</b>\n";
227
+        if ($even == 1) {
228
 	  $even = 0;
229
-	  print "<TR>\n";
230
+	  print "</tr><tr>\n";
231
 	}
232
 	else $even = 1;
233
       }
234
-      print "</TABLE>\n";
235
+      print "</tr></table>\n";
236
     }
237
-    print "<INPUT TYPE=\"SUBMIT\" VALUE=\"Back to Main\">\n";
238
+    print "<input type=\"submit\" value=\"Back to Main\" />\n";
239
   }
240
 
241
-  if ($dbc) mysql_close($dbc);
242
-  echo "</FORM>\n";
243
+  if ($dbc) mysqli_close($dbc);
244
+  echo "</form>\n";
245
 ?>
246
 
247
-<HR>
248
-<FONT FACE="Arial" SIZE="2">
249
+<hr />
250
+<font face="Arial" size="2">
251
 <?php
252
- print "<A HREF=\"http://rtg.sourceforge.net\">RTG</A> Version $VERSION</FONT>";
253
+ print "<a href=\"http://rtg.sourceforge.net\">RTG</a> Version $VERSION</font>";
254
 ?>
255
-</BODY>
256
-</HTML>
257
+</body>
258
+</html>
(-)net/rtg/files/patch-man-rtgplot.1 (-43 lines)
Lines 1-43 Link Here
1
--- man/rtgplot.1.orig	2003-09-25 04:10:36 UTC
2
+++ man/rtgplot.1
3
@@ -10,7 +10,8 @@
4
 -t tablename(s) -i interface(s) [options] begin end
5
 .br
6
 .B rtgplot.cgi
7
-?t1=tablename &t2=tablename &iid=interface &begin=unixtime &end=unixtime &[options]
8
+?t1=tablename &t`_name=descname &t2=tablename &t2_name=descname &iid=interface 
9
+&begin=unixtime &end=unixtime &[options]
10
 .SH DESCRIPTION
11
 .I rtgplot
12
 generates traffic plots of RTG data in PNG format.  It operates in
13
@@ -82,14 +83,19 @@ pixels.
14
 Set plot bottom border to 
15
 .RI <size> 
16
 pixels.
17
+.TP
18
+.IR "title=<title>"
19
+Set graph title to
20
+.RI <title>
21
 .PP
22
 .SH "EXAMPLES"
23
 .PP
24
 .br
25
 Example HTML IMG TAG:
26
 .PP
27
-<IMG SRC="rtgplot.cgi? t1=ifInOctets_2& t2=ifOutOctets_2& iid=4& 
28
-begin=1046754000& end=1046840399& units=bits/s& factor=8& scalex=yes">
29
+<IMG SRC="rtgplot.cgi? t1=ifInOctets_2& t1_name=Input& t2=ifOutOctets_2& 
30
+t2_name=Output& iid=4& begin=1046754000& end=1046840399& units=bits/s& 
31
+factor=8& scalex=yes& title=Bandwidth+Graph">
32
 .PP
33
 will plot two lines from the MySQL tables ifInOctets_2 and ifOutOctets_2
34
 corresponding to interface 4 on router 2 for the time span 1046754000 to
35
@@ -97,6 +103,8 @@ corresponding to interface 4 on router 2
36
 second; the units argument is displayed as the Y-axis label on the plot.
37
 The scalex argument auto-adjusts the X time axis according to the available 
38
 data samples rather than according to the actual time span given.  
39
+It will have a graph title of "Bandwidth Graph" and legend tags of "Input"
40
+and "Output" for t1 and t2 respectively.
41
 .PP
42
 Draw a 95th percentile line:
43
 .PP
(-)net/rtg/files/patch-man-rtgpoll.1 (-12 lines)
Lines 1-12 Link Here
1
--- man/rtgpoll.1.orig	2003-09-24 17:26:57 UTC
2
+++ man/rtgpoll.1
3
@@ -31,6 +31,9 @@ Disable database inserts.
4
 .IR "\-m"
5
 Skip checking for multiple instances.
6
 .TP
7
+.IR "\-p file"
8
+PID file.  Process ID file.
9
+.TP
10
 .IR "\-z"
11
 Force database insertion of zero deltas.
12
 .TP
(-)net/rtg/files/patch-man_rtgplot.1 (+43 lines)
Line 0 Link Here
1
--- man/rtgplot.1.orig	2003-09-25 04:10:36 UTC
2
+++ man/rtgplot.1
3
@@ -10,7 +10,8 @@
4
 -t tablename(s) -i interface(s) [options] begin end
5
 .br
6
 .B rtgplot.cgi
7
-?t1=tablename &t2=tablename &iid=interface &begin=unixtime &end=unixtime &[options]
8
+?t1=tablename &t`_name=descname &t2=tablename &t2_name=descname &iid=interface 
9
+&begin=unixtime &end=unixtime &[options]
10
 .SH DESCRIPTION
11
 .I rtgplot
12
 generates traffic plots of RTG data in PNG format.  It operates in
13
@@ -82,14 +83,19 @@ pixels.
14
 Set plot bottom border to 
15
 .RI <size> 
16
 pixels.
17
+.TP
18
+.IR "title=<title>"
19
+Set graph title to
20
+.RI <title>
21
 .PP
22
 .SH "EXAMPLES"
23
 .PP
24
 .br
25
 Example HTML IMG TAG:
26
 .PP
27
-<IMG SRC="rtgplot.cgi? t1=ifInOctets_2& t2=ifOutOctets_2& iid=4& 
28
-begin=1046754000& end=1046840399& units=bits/s& factor=8& scalex=yes">
29
+<IMG SRC="rtgplot.cgi? t1=ifInOctets_2& t1_name=Input& t2=ifOutOctets_2& 
30
+t2_name=Output& iid=4& begin=1046754000& end=1046840399& units=bits/s& 
31
+factor=8& scalex=yes& title=Bandwidth+Graph">
32
 .PP
33
 will plot two lines from the MySQL tables ifInOctets_2 and ifOutOctets_2
34
 corresponding to interface 4 on router 2 for the time span 1046754000 to
35
@@ -97,6 +103,8 @@ corresponding to interface 4 on router 2
36
 second; the units argument is displayed as the Y-axis label on the plot.
37
 The scalex argument auto-adjusts the X time axis according to the available 
38
 data samples rather than according to the actual time span given.  
39
+It will have a graph title of "Bandwidth Graph" and legend tags of "Input"
40
+and "Output" for t1 and t2 respectively.
41
 .PP
42
 Draw a 95th percentile line:
43
 .PP
(-)net/rtg/files/patch-man_rtgpoll.1 (+12 lines)
Line 0 Link Here
1
--- man/rtgpoll.1.orig	2003-09-24 17:26:57 UTC
2
+++ man/rtgpoll.1
3
@@ -31,6 +31,9 @@ Disable database inserts.
4
 .IR "\-m"
5
 Skip checking for multiple instances.
6
 .TP
7
+.IR "\-p file"
8
+PID file.  Process ID file.
9
+.TP
10
 .IR "\-z"
11
 Force database insertion of zero deltas.
12
 .TP
(-)net/rtg/files/patch-src-rtg.h (-13 lines)
Lines 1-13 Link Here
1
--- src/rtg.h.orig	2003-09-25 15:56:04 UTC
2
+++ src/rtg.h
3
@@ -42,9 +42,7 @@
4
 #define DEFAULT_DB_PASS "rtgdefault"
5
 #define DEFAULT_SNMP_VER 1
6
 #define DEFAULT_SNMP_PORT 161
7
-
8
-/* PID File */
9
-#define PIDFILE "/tmp/rtgpoll.pid"
10
+#define DEFAULT_PIDFILE "/tmp/rtgpoll.pid"
11
 
12
 #define STAT_DESCRIP_ERROR 99
13
 #define HASHSIZE 5000
(-)net/rtg/files/patch-src-rtgplot.c (-74 lines)
Lines 1-74 Link Here
1
--- src/rtgplot.c.orig	2003-10-02 15:27:52 UTC
2
+++ src/rtgplot.c
3
@@ -221,7 +221,10 @@ int main(int argc, char **argv) {
4
 						plot_line(data[i][j], &img, &graph, colors->shade, TRUE);
5
 					else
6
 						plot_line(data[i][j], &img, &graph, colors->shade, FALSE);
7
-					snprintf(intname, sizeof(intname), "%s%d", arguments.table[i], arguments.iid[j]);
8
+					if (arguments.tablename[i])
9
+						snprintf(intname, sizeof(intname), "%s", arguments.tablename[i]);
10
+					else
11
+						snprintf(intname, sizeof(intname), "%s%d", arguments.table[i], arguments.iid[j]);
12
 					plot_legend(&img, rate[i][j], &graph, colors->shade, intname, offset);
13
 					offset++;
14
 				}
15
@@ -629,15 +632,15 @@ void plot_legend(gdImagePtr * img, rate_
16
 	if (set.verbose >= HIGH)
17
 		fprintf(dfp, "Plotting legend (%s).\n", __FUNCTION__);
18
 
19
-	gdImageFilledRectangle(*img, BORDER_L,
20
+	gdImageFilledRectangle(*img, BORDER_L - 10,
21
 			     BORDER_T + graph->image.yplot_area + 37 + 10 * offset,
22
-	BORDER_L + 7, BORDER_T + graph->image.yplot_area + 44 + 10 * offset, color);
23
-	gdImageRectangle(*img, BORDER_L, BORDER_T + graph->image.yplot_area + 37 + 10 * offset,
24
-	       BORDER_L + 7, BORDER_T + graph->image.yplot_area + 44 + 10 * offset,
25
+	BORDER_L - 3, BORDER_T + graph->image.yplot_area + 44 + 10 * offset, color);
26
+	gdImageRectangle(*img, BORDER_L - 10, BORDER_T + graph->image.yplot_area + 37 + 10 * offset,
27
+	       BORDER_L - 3, BORDER_T + graph->image.yplot_area + 44 + 10 * offset,
28
 			 std_colors[black]);
29
 
30
-	if (strlen(interface) > 17) {
31
-		interface[17] = '\0';
32
+	if (strlen(interface) > 15) {
33
+		interface[15] = '\0';
34
 	}
35
 	snprintf(string, sizeof(string), "%s", interface);
36
 	for (i = 0; i < (17 - strlen(interface)); i++) {
37
@@ -662,7 +665,7 @@ void plot_legend(gdImagePtr * img, rate_
38
 			units(rate.cur, cur), graph->units,
39
 			units((float)rate.total, total));
40
 	}
41
-	gdImageString(*img, gdFontSmall, BORDER_L + 10,
42
+	gdImageString(*img, gdFontSmall, BORDER_L,
43
 		      BORDER_T + graph->image.yplot_area + 33 + (10 * offset), string, std_colors[black]);
44
 }
45
 
46
@@ -866,6 +869,13 @@ void plot_labels(gdImagePtr * img, graph
47
 	title_offset = 1 - (0.01 * (strlen(VERSION) + strlen(COPYRIGHT) + 2));
48
 	snprintf(string, sizeof(string), "%s %s", COPYRIGHT, VERSION);
49
 	gdImageString(*img, gdFontSmall, BORDER_L + (graph->image.xplot_area * title_offset), BORDER_T - 15, string, std_colors[black]);
50
+
51
+	/* title */
52
+	if (graph->titlestr)
53
+	{
54
+		snprintf(string, sizeof(string), "%s", graph->titlestr);
55
+		gdImageString(*img, gdFontMediumBold, BORDER_L + 5, BORDER_T - 16, string, std_colors[black]);
56
+	}
57
 }
58
 
59
 
60
@@ -1342,10 +1352,14 @@ void parseWeb(arguments_t *arguments, gr
61
 			}
62
 		}
63
 /* XXX REB - Warning: Deprecated, tN argument will go away in RTG 0.8 XXX */
64
+		snprintf(var, sizeof(var), "title");
65
+		graph->titlestr = cgiGetValue(cgiArg, var); 
66
 		for (i = 0; i < MAXTABLES; i++) {
67
 			snprintf(var, sizeof(var), "t%d", i + 1);
68
 			if ((arguments->table[i] = cgiGetValue(cgiArg, var)))
69
 				arguments->tables_to_plot++;
70
+			snprintf(var, sizeof(var), "t%d_name", i + 1);
71
+			arguments->tablename[i] = cgiGetValue(cgiArg, var);
72
 		}
73
 		if ((graph->units = cgiGetValue(cgiArg, "units")) == NULL) {
74
 			graph->units = malloc(sizeof(DEFAULT_UNITS));
(-)net/rtg/files/patch-src-rtgplot.h (-26 lines)
Lines 1-26 Link Here
1
--- src/rtgplot.h	2003-09-24 15:43:39.000000000 +0100
2
+++ src/rtgplot.h.new	2010-04-20 21:41:37.131774833 +0100
3
@@ -11,6 +11,7 @@
4
 
5
 #include <gd.h>
6
 #include <gdfonts.h>
7
+#include <gdfontmb.h>
8
 #include <strings.h>
9
 
10
 #define XPLOT_AREA 500
11
@@ -95,6 +96,7 @@
12
     int scaley; 
13
     range_t range;
14
     image_t image;
15
+    char *titlestr;
16
 } graph_t;
17
 
18
 /* A linked list of colors that we iterate through each line */
19
@@ -106,6 +108,7 @@
20
 
21
 typedef struct arguments_struct {
22
     char *table[MAXTABLES];
23
+    char *tablename[MAXTABLES];
24
     int iid[MAXIIDS];
25
     int tables_to_plot;
26
     int iids_to_plot;
(-)net/rtg/files/patch-src-rtgpoll.c (-65 lines)
Lines 1-65 Link Here
1
--- src/rtgpoll.c.orig	2003-09-25 15:56:04 UTC
2
+++ src/rtgpoll.c
3
@@ -13,6 +13,7 @@
4
 stats_t stats =
5
 {PTHREAD_MUTEX_INITIALIZER, 0, 0, 0, 0, 0, 0, 0, 0, 0.0};
6
 char *target_file = NULL;
7
+char *pidfile = NULL;
8
 target_t *current = NULL;
9
 MYSQL mysql;
10
 int entries = 0;
11
@@ -41,7 +42,7 @@ int main(int argc, char *argv[]) {
12
     config_defaults(&set);
13
 
14
     /* Parse the command-line. */
15
-    while ((ch = getopt(argc, argv, "c:dhmt:vz")) != EOF)
16
+    while ((ch = getopt(argc, argv, "c:dhmp:t:vz")) != EOF)
17
 	switch ((char) ch) {
18
 	case 'c':
19
 	    conf_file = optarg;
20
@@ -55,6 +56,9 @@ int main(int argc, char *argv[]) {
21
 	case 'm':
22
 	    set.multiple++;
23
 	    break;
24
+	case 'p':
25
+	    pidfile = optarg;
26
+	    break;
27
 	case 't':
28
 	    target_file = optarg;
29
 	    break;
30
@@ -66,6 +70,9 @@ int main(int argc, char *argv[]) {
31
 	    break;
32
 	}
33
 
34
+    if (!pidfile)
35
+        pidfile = DEFAULT_PIDFILE;
36
+
37
     if (set.verbose >= LOW)
38
 	printf("RTG version %s starting.\n", VERSION);
39
 
40
@@ -78,7 +85,7 @@ int main(int argc, char *argv[]) {
41
     sigaddset(&signal_set, SIGINT);
42
     sigaddset(&signal_set, SIGQUIT);
43
 	if (!set.multiple) 
44
-    	checkPID(PIDFILE);
45
+    	checkPID(pidfile);
46
 
47
     if (pthread_sigmask(SIG_BLOCK, &signal_set, NULL) != 0)
48
 	printf("pthread_sigmask error\n");
49
@@ -244,7 +251,7 @@ void *sig_handler(void *arg)
50
                 if (set.verbose >= LOW)
51
                    printf("Quiting: received signal %d.\n", sig_number);
52
                 rtg_dbdisconnect(&mysql);
53
-                unlink(PIDFILE);
54
+                unlink(pidfile);
55
                 exit(1);
56
                 break;
57
         }
58
@@ -259,6 +266,7 @@ void usage(char *prog)
59
     printf("\nOptions:\n");
60
     printf("  -c <file>   Specify configuration file\n");
61
     printf("  -d          Disable database inserts\n");
62
+    printf("  -p <file>   Specify pid file (defaults to /tmp/rtgpoll.pid)\n");
63
     printf("  -t <file>   Specify target file\n");
64
     printf("  -v          Increase verbosity\n");
65
 	printf("  -m          Allow multiple instances\n");
(-)net/rtg/files/patch-src_rtg.h (+16 lines)
Line 0 Link Here
1
--- src/rtg.h.orig	2003-09-25 15:56:04 UTC
2
+++ src/rtg.h
3
@@ -40,11 +40,9 @@
4
 #define DEFAULT_DB_DB "rtg"
5
 #define DEFAULT_DB_USER "snmp"
6
 #define DEFAULT_DB_PASS "rtgdefault"
7
-#define DEFAULT_SNMP_VER 1
8
+#define DEFAULT_SNMP_VER 2
9
 #define DEFAULT_SNMP_PORT 161
10
-
11
-/* PID File */
12
-#define PIDFILE "/tmp/rtgpoll.pid"
13
+#define DEFAULT_PIDFILE "/tmp/rtgpoll.pid"
14
 
15
 #define STAT_DESCRIP_ERROR 99
16
 #define HASHSIZE 5000
(-)net/rtg/files/patch-src_rtgplot.c (+74 lines)
Line 0 Link Here
1
--- src/rtgplot.c.orig	2003-10-02 15:27:52 UTC
2
+++ src/rtgplot.c
3
@@ -221,7 +221,10 @@ int main(int argc, char **argv) {
4
 						plot_line(data[i][j], &img, &graph, colors->shade, TRUE);
5
 					else
6
 						plot_line(data[i][j], &img, &graph, colors->shade, FALSE);
7
-					snprintf(intname, sizeof(intname), "%s%d", arguments.table[i], arguments.iid[j]);
8
+					if (arguments.tablename[i])
9
+						snprintf(intname, sizeof(intname), "%s", arguments.tablename[i]);
10
+					else
11
+						snprintf(intname, sizeof(intname), "%s%d", arguments.table[i], arguments.iid[j]);
12
 					plot_legend(&img, rate[i][j], &graph, colors->shade, intname, offset);
13
 					offset++;
14
 				}
15
@@ -629,15 +632,15 @@ void plot_legend(gdImagePtr * img, rate_
16
 	if (set.verbose >= HIGH)
17
 		fprintf(dfp, "Plotting legend (%s).\n", __FUNCTION__);
18
 
19
-	gdImageFilledRectangle(*img, BORDER_L,
20
+	gdImageFilledRectangle(*img, BORDER_L - 10,
21
 			     BORDER_T + graph->image.yplot_area + 37 + 10 * offset,
22
-	BORDER_L + 7, BORDER_T + graph->image.yplot_area + 44 + 10 * offset, color);
23
-	gdImageRectangle(*img, BORDER_L, BORDER_T + graph->image.yplot_area + 37 + 10 * offset,
24
-	       BORDER_L + 7, BORDER_T + graph->image.yplot_area + 44 + 10 * offset,
25
+	BORDER_L - 3, BORDER_T + graph->image.yplot_area + 44 + 10 * offset, color);
26
+	gdImageRectangle(*img, BORDER_L - 10, BORDER_T + graph->image.yplot_area + 37 + 10 * offset,
27
+	       BORDER_L - 3, BORDER_T + graph->image.yplot_area + 44 + 10 * offset,
28
 			 std_colors[black]);
29
 
30
-	if (strlen(interface) > 17) {
31
-		interface[17] = '\0';
32
+	if (strlen(interface) > 15) {
33
+		interface[15] = '\0';
34
 	}
35
 	snprintf(string, sizeof(string), "%s", interface);
36
 	for (i = 0; i < (17 - strlen(interface)); i++) {
37
@@ -662,7 +665,7 @@ void plot_legend(gdImagePtr * img, rate_
38
 			units(rate.cur, cur), graph->units,
39
 			units((float)rate.total, total));
40
 	}
41
-	gdImageString(*img, gdFontSmall, BORDER_L + 10,
42
+	gdImageString(*img, gdFontSmall, BORDER_L,
43
 		      BORDER_T + graph->image.yplot_area + 33 + (10 * offset), string, std_colors[black]);
44
 }
45
 
46
@@ -866,6 +869,13 @@ void plot_labels(gdImagePtr * img, graph
47
 	title_offset = 1 - (0.01 * (strlen(VERSION) + strlen(COPYRIGHT) + 2));
48
 	snprintf(string, sizeof(string), "%s %s", COPYRIGHT, VERSION);
49
 	gdImageString(*img, gdFontSmall, BORDER_L + (graph->image.xplot_area * title_offset), BORDER_T - 15, string, std_colors[black]);
50
+
51
+	/* title */
52
+	if (graph->titlestr)
53
+	{
54
+		snprintf(string, sizeof(string), "%s", graph->titlestr);
55
+		gdImageString(*img, gdFontMediumBold, BORDER_L + 5, BORDER_T - 16, string, std_colors[black]);
56
+	}
57
 }
58
 
59
 
60
@@ -1342,10 +1352,14 @@ void parseWeb(arguments_t *arguments, gr
61
 			}
62
 		}
63
 /* XXX REB - Warning: Deprecated, tN argument will go away in RTG 0.8 XXX */
64
+		snprintf(var, sizeof(var), "title");
65
+		graph->titlestr = cgiGetValue(cgiArg, var); 
66
 		for (i = 0; i < MAXTABLES; i++) {
67
 			snprintf(var, sizeof(var), "t%d", i + 1);
68
 			if ((arguments->table[i] = cgiGetValue(cgiArg, var)))
69
 				arguments->tables_to_plot++;
70
+			snprintf(var, sizeof(var), "t%d_name", i + 1);
71
+			arguments->tablename[i] = cgiGetValue(cgiArg, var);
72
 		}
73
 		if ((graph->units = cgiGetValue(cgiArg, "units")) == NULL) {
74
 			graph->units = malloc(sizeof(DEFAULT_UNITS));
(-)net/rtg/files/patch-src_rtgplot.h (+26 lines)
Line 0 Link Here
1
--- src/rtgplot.h.orig	2003-09-24 14:43:39 UTC
2
+++ src/rtgplot.h
3
@@ -11,6 +11,7 @@
4
 
5
 #include <gd.h>
6
 #include <gdfonts.h>
7
+#include <gdfontmb.h>
8
 #include <strings.h>
9
 
10
 #define XPLOT_AREA 500
11
@@ -95,6 +96,7 @@ typedef struct graph_struct {
12
     int scaley; 
13
     range_t range;
14
     image_t image;
15
+    char *titlestr;
16
 } graph_t;
17
 
18
 /* A linked list of colors that we iterate through each line */
19
@@ -106,6 +108,7 @@ typedef struct color_struct {
20
 
21
 typedef struct arguments_struct {
22
     char *table[MAXTABLES];
23
+    char *tablename[MAXTABLES];
24
     int iid[MAXIIDS];
25
     int tables_to_plot;
26
     int iids_to_plot;
(-)net/rtg/files/patch-src_rtgpoll.c (+65 lines)
Line 0 Link Here
1
--- src/rtgpoll.c.orig	2003-09-25 15:56:04 UTC
2
+++ src/rtgpoll.c
3
@@ -13,6 +13,7 @@
4
 stats_t stats =
5
 {PTHREAD_MUTEX_INITIALIZER, 0, 0, 0, 0, 0, 0, 0, 0, 0.0};
6
 char *target_file = NULL;
7
+char *pidfile = NULL;
8
 target_t *current = NULL;
9
 MYSQL mysql;
10
 int entries = 0;
11
@@ -41,7 +42,7 @@ int main(int argc, char *argv[]) {
12
     config_defaults(&set);
13
 
14
     /* Parse the command-line. */
15
-    while ((ch = getopt(argc, argv, "c:dhmt:vz")) != EOF)
16
+    while ((ch = getopt(argc, argv, "c:dhmp:t:vz")) != EOF)
17
 	switch ((char) ch) {
18
 	case 'c':
19
 	    conf_file = optarg;
20
@@ -55,6 +56,9 @@ int main(int argc, char *argv[]) {
21
 	case 'm':
22
 	    set.multiple++;
23
 	    break;
24
+	case 'p':
25
+	    pidfile = optarg;
26
+	    break;
27
 	case 't':
28
 	    target_file = optarg;
29
 	    break;
30
@@ -66,6 +70,9 @@ int main(int argc, char *argv[]) {
31
 	    break;
32
 	}
33
 
34
+    if (!pidfile)
35
+        pidfile = DEFAULT_PIDFILE;
36
+
37
     if (set.verbose >= LOW)
38
 	printf("RTG version %s starting.\n", VERSION);
39
 
40
@@ -78,7 +85,7 @@ int main(int argc, char *argv[]) {
41
     sigaddset(&signal_set, SIGINT);
42
     sigaddset(&signal_set, SIGQUIT);
43
 	if (!set.multiple) 
44
-    	checkPID(PIDFILE);
45
+    	checkPID(pidfile);
46
 
47
     if (pthread_sigmask(SIG_BLOCK, &signal_set, NULL) != 0)
48
 	printf("pthread_sigmask error\n");
49
@@ -244,7 +251,7 @@ void *sig_handler(void *arg)
50
                 if (set.verbose >= LOW)
51
                    printf("Quiting: received signal %d.\n", sig_number);
52
                 rtg_dbdisconnect(&mysql);
53
-                unlink(PIDFILE);
54
+                unlink(pidfile);
55
                 exit(1);
56
                 break;
57
         }
58
@@ -259,6 +266,7 @@ void usage(char *prog)
59
     printf("\nOptions:\n");
60
     printf("  -c <file>   Specify configuration file\n");
61
     printf("  -d          Disable database inserts\n");
62
+    printf("  -p <file>   Specify pid file (defaults to /tmp/rtgpoll.pid)\n");
63
     printf("  -t <file>   Specify target file\n");
64
     printf("  -v          Increase verbosity\n");
65
 	printf("  -m          Allow multiple instances\n");
(-)net/rtg/files/patch-src_rtgutil.c (+10 lines)
Line 0 Link Here
1
--- src/rtgutil.c.orig	2018-04-02 23:03:54 UTC
2
+++ src/rtgutil.c
3
@@ -37,6 +37,7 @@ int read_rtg_config(char *file, config_t
4
               else if (!strcasecmp(p1, "DB_Database")) strncpy(set->dbdb, p2, sizeof(set->dbdb));
5
               else if (!strcasecmp(p1, "DB_User")) strncpy(set->dbuser, p2, sizeof(set->dbuser));
6
               else if (!strcasecmp(p1, "DB_Pass")) strncpy(set->dbpass, p2, sizeof(set->dbpass));
7
+              else if (!strcasecmp(p1, "Update_desc")) ; // no-op
8
 
9
 /* Long longs not ANSI C.  If OS doesn't support atoll() use default. */
10
               else if (!strcasecmp(p1, "OutOfRange")) 

Return to bug 227376