Skip to content

Instantly share code, notes, and snippets.

View rbgarga's full-sized avatar

Renato Botelho rbgarga

View GitHub Profile
@rbgarga
rbgarga / -
Created August 26, 2015 14:40
diff --exclude=.git --exclude=conf -ruN ../bootstrap/etc/inc/auth.inc ./etc/inc/auth.inc
--- ../bootstrap/etc/inc/auth.inc 2015-08-26 10:03:32.000000000 -0300
+++ ./etc/inc/auth.inc 2015-08-26 11:36:55.000000000 -0300
@@ -309,7 +309,7 @@
foreach ($names as $name) {
$group = getGroupEntry($name);
if (is_array($group['priv'])) {
- $privs = array_merge($privs, $group['priv']);
+ $privs = array_merge( $privs, $group['priv']);
}
@rbgarga
rbgarga / -
Created August 26, 2015 14:40
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/bandwidth_by_ip.php ./usr/local/www/bandwidth_by_ip.php
--- ../bootstrap/usr/local/www/bandwidth_by_ip.php 2015-08-26 10:03:32.000000000 -0300
+++ ./usr/local/www/bandwidth_by_ip.php 2015-08-26 11:36:55.000000000 -0300
@@ -1,8 +1,6 @@
<?php
/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- *
+ bandwidth_by_ip.php
@rbgarga
rbgarga / -
Created August 26, 2015 15:22
diff --exclude=.git --exclude=conf -ruNw ../bootstrap/usr/local/www/bandwidth_by_ip.php ./usr/local/www/bandwidth_by_ip.php
--- ../bootstrap/usr/local/www/bandwidth_by_ip.php 2015-08-26 10:03:32.000000000 -0300
+++ ./usr/local/www/bandwidth_by_ip.php 2015-08-26 12:14:09.000000000 -0300
@@ -1,8 +1,6 @@
<?php
/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- *
+ bandwidth_by_ip.php
@rbgarga
rbgarga / gist:8940380
Created February 11, 2014 18:01
error building squid33 with PF
| #include <net/pf/pfvar.h>
configure:25138: result: no
configure:25138: checking for net/pfvar.h
configure:25138: c++ -c -O2 -pipe -fno-strict-aliasing -Wno-unused-private-field -std=c++0x -I/usr/local/include -I/usr/include -I/usr/include conftest.cpp >&5
In file included from conftest.cpp:247:
In file included from /usr/include/netinet/ip_compat.h:169:
/usr/include/net/if_var.h:130:16: error: use of undeclared identifier 'IFNAMSIZ'
char if_xname[IFNAMSIZ]; /* external name (name + unit) */
^
/usr/include/net/if_var.h:156:17: error: field has incomplete type 'struct if_data'
@rbgarga
rbgarga / -
Created February 18, 2014 12:32
diff --git a/usr/local/www/pkg_mgr_install.php b/usr/local/www/pkg_mgr_install.php
index 289505c..1e61e0c 100755
--- a/usr/local/www/pkg_mgr_install.php
+++ b/usr/local/www/pkg_mgr_install.php
@@ -114,7 +114,7 @@ Rounded("div#mainareapkg","bl br","#FFF","#eeeeee","smooth");
ob_flush();
-$pkgname = str_replace(array("<", ">", ";", "&", "'"), "", htmlspecialchars_decode($_GET['pkg']));
+$pkgname = str_replace(array("<", ">", ";", "&", "'", '"'), "", htmlspecialchars_decode($_GET['pkg'], ENT_QUOTES | ENT_HTML401));
diff --git a/etc/inc/filter_log.inc b/etc/inc/filter_log.inc
index 330cc09..31aa76b 100644
--- a/etc/inc/filter_log.inc
+++ b/etc/inc/filter_log.inc
@@ -47,22 +47,17 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = "", $fil
if ($filtertext)
$tail = 5000;
- /* FreeBSD 8 splits pf log lines into two lines, so we need to at least
- * tail twice as many, plus some extra to account for unparseable lines */
May 30 10:28:24 pfs22amd64 php-fpm[246]: /rc.newwanip: rc.newwanip: Informational is starting vtnet0.
May 30 10:28:24 pfs22amd64 kernel: done.
May 30 10:28:24 pfs22amd64 php-fpm[246]: /rc.newwanip: rc.newwanip: on (IP address: 10.0.2.15) (interface: WAN[wan]) (real interface: vtnet0).
May 30 10:28:24 pfs22amd64 php-fpm[246]: /rc.newwanip: ROUTING: setting default route to 10.0.2.2
May 30 10:28:24 pfs22amd64 kernel: pflog0: promiscuous mode enabled
May 30 10:28:25 pfs22amd64 kernel: ...
May 30 10:28:26 pfs22amd64 kernel: .done.
May 30 10:28:26 pfs22amd64 php-fpm[246]: /rc.newwanip: Resyncing OpenVPN instances for interface WAN.
May 30 10:28:26 pfs22amd64 kernel: done.
May 30 10:28:26 pfs22amd64 php-fpm[246]: /rc.newwanip: Creating rrd update script

Keybase proof

I hereby claim:

  • I am rbgarga on github.
  • I am garga (https://keybase.io/garga) on keybase.
  • I have a public key whose fingerprint is E3DA 9B2A 6160 99CB 4B31 7641 F1F0 E7A1 9F62 5790

To claim this, I am signing this object:

diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index dda8765..3619bda 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -2399,7 +2399,7 @@ function filter_generate_user_rule($rule) {
case 'cs5': $aline['dscp'] = " dscp 40 "; break;
case 'cs6': $aline['dscp'] = " dscp 48 "; break;
case 'cs7': $aline['dscp'] = " dscp 56 "; break;
- default: $aline['dscp'] = " dscp " . preg_replace('/\s.*$/', '', $rule['dscp']) . " "; break;
+ default: $aline['dscp'] = " dscp " . $rule['dscp'] . " "; break;
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 6be3e27..6ece099 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -1241,18 +1241,20 @@ function interface_bring_down($interface = "wan", $destroy = false, $ifacecfg =
unlink_if_exists("{$g['varetc_path']}/dhclient_{$interface}.conf");
if(does_interface_exist("$realif")) {
mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " delete", true);
- interface_ipalias_cleanup($interface);
- if ($destroy == true)