From 034c1621e9a6627edb257b609db81d61b06f592d Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 10 Nov 2016 08:59:22 +0100 Subject: [PATCH] net: fix url_safe() usage on stock 16.7 This is a bit of a pickle: people should upgrade, but simply use 16.7 and install the plugins. We can't easily pin a core version, so we need to provide these compat stubs instead. --- net/l2tp/Makefile | 2 +- .../src/etc/inc/plugins.inc.d/if_l2tp.inc | 19 +++++++++++++++++++ net/pppoe/Makefile | 2 +- .../src/etc/inc/plugins.inc.d/if_pppoe.inc | 19 +++++++++++++++++++ net/pptp/Makefile | 2 +- .../src/etc/inc/plugins.inc.d/if_pptp.inc | 19 +++++++++++++++++++ 6 files changed, 60 insertions(+), 3 deletions(-) diff --git a/net/l2tp/Makefile b/net/l2tp/Makefile index 7fb4bbe42..826dd9e51 100644 --- a/net/l2tp/Makefile +++ b/net/l2tp/Makefile @@ -1,5 +1,5 @@ PLUGIN_NAME= l2tp -PLUGIN_VERSION= 1.2 +PLUGIN_VERSION= 1.3 PLUGIN_DEPENDS= clog mpd5 PLUGIN_COMMENT= L2TP server based on MPD5 PLUGIN_MAINTAINER= franco@opnsense.org diff --git a/net/l2tp/src/etc/inc/plugins.inc.d/if_l2tp.inc b/net/l2tp/src/etc/inc/plugins.inc.d/if_l2tp.inc index 2aa1648be..17ec98749 100644 --- a/net/l2tp/src/etc/inc/plugins.inc.d/if_l2tp.inc +++ b/net/l2tp/src/etc/inc/plugins.inc.d/if_l2tp.inc @@ -30,6 +30,25 @@ * POSSIBILITY OF SUCH DAMAGE. */ +/* BEGIN remove this in 17.1: provide compat for newer plugin on stock 16.7 */ +require_once 'util.inc'; +if (!function_exists(url_safe)) { + function url_safe($format, $args = array()) + { + if (!is_array($args)) { + /* just in case there's only one argument */ + $args = array($args); + } + + foreach ($args as $id => $arg) { + $args[$id] = urlencode($arg); + } + + return vsprintf($format, $args); + } +} +/* END remove this in 17.1 */ + function if_l2tp_configure() { return array('if_l2tp_configure_do'); diff --git a/net/pppoe/Makefile b/net/pppoe/Makefile index c1304e733..7f8e68fad 100644 --- a/net/pppoe/Makefile +++ b/net/pppoe/Makefile @@ -1,5 +1,5 @@ PLUGIN_NAME= pppoe -PLUGIN_VERSION= 1.2 +PLUGIN_VERSION= 1.3 PLUGIN_DEPENDS= clog mpd5 PLUGIN_COMMENT= PPPoE server based on MPD5 PLUGIN_MAINTAINER= franco@opnsense.org diff --git a/net/pppoe/src/etc/inc/plugins.inc.d/if_pppoe.inc b/net/pppoe/src/etc/inc/plugins.inc.d/if_pppoe.inc index 24f03a4fe..a47c94f53 100644 --- a/net/pppoe/src/etc/inc/plugins.inc.d/if_pppoe.inc +++ b/net/pppoe/src/etc/inc/plugins.inc.d/if_pppoe.inc @@ -30,6 +30,25 @@ * POSSIBILITY OF SUCH DAMAGE. */ +/* BEGIN remove this in 17.1: provide compat for newer plugin on stock 16.7 */ +require_once 'util.inc'; +if (!function_exists(url_safe)) { + function url_safe($format, $args = array()) + { + if (!is_array($args)) { + /* just in case there's only one argument */ + $args = array($args); + } + + foreach ($args as $id => $arg) { + $args[$id] = urlencode($arg); + } + + return vsprintf($format, $args); + } +} +/* END remove this in 17.1 */ + function if_pppoe_configure() { return array('if_pppoe_configure_do'); diff --git a/net/pptp/Makefile b/net/pptp/Makefile index 13fd172d6..b4ca6dd21 100644 --- a/net/pptp/Makefile +++ b/net/pptp/Makefile @@ -1,5 +1,5 @@ PLUGIN_NAME= pptp -PLUGIN_VERSION= 1.2 +PLUGIN_VERSION= 1.3 PLUGIN_DEPENDS= clog mpd5 PLUGIN_COMMENT= PPTP server based on MPD5 PLUGIN_MAINTAINER= franco@opnsense.org diff --git a/net/pptp/src/etc/inc/plugins.inc.d/if_pptp.inc b/net/pptp/src/etc/inc/plugins.inc.d/if_pptp.inc index 90047901c..547af248c 100644 --- a/net/pptp/src/etc/inc/plugins.inc.d/if_pptp.inc +++ b/net/pptp/src/etc/inc/plugins.inc.d/if_pptp.inc @@ -30,6 +30,25 @@ * POSSIBILITY OF SUCH DAMAGE. */ +/* BEGIN remove this in 17.1: provide compat for newer plugin on stock 16.7 */ +require_once 'util.inc'; +if (!function_exists(url_safe)) { + function url_safe($format, $args = array()) + { + if (!is_array($args)) { + /* just in case there's only one argument */ + $args = array($args); + } + + foreach ($args as $id => $arg) { + $args[$id] = urlencode($arg); + } + + return vsprintf($format, $args); + } +} +/* END remove this in 17.1 */ + function if_pptp_configure() { return array('if_pptp_configure_do');