Commit graph

9572 commits

Author SHA1 Message Date
Hannu Nyman
d42ce28e20
Merge pull request #1742 from fantom-x/dhcp_cachesize_max
luci-mod-admin-full: limit dns cachesize to 10000
2018-04-10 17:36:29 +03:00
Jo-Philipp Wich
2b516423a0 luci-base: fix rendering of 404 HTML error template
This 404 error template rendering has been broken for a long time due to bad
function environment level in luci.template when invoking the rendering from
the toplevel dispatcher context.

Fix this issue by adding a local function indirection, essentially adding an
additional stack frame.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-10 12:03:15 +02:00
Jo-Philipp Wich
48a5864f06 luci-base: error404: do not access request env directly
Instead of attempting to access the request environment directly (which does
not work anyway using the CGI SGI), use the already sanitized
dispatcher.context.request property to print out the not found url.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-10 12:01:43 +02:00
Jo-Philipp Wich
b194b8882e luci-base: don't propagate null bytes in path information
It is possible to inject unescaped markup using a double encoded null byte
via PATH_INFO on certain leaf nodes.

Since there is no legitimate reason to handle null bytes in any part of the
requested url, simply skip over such bytes when parsing the PATH_INFO value.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-10 11:41:32 +02:00
Jo-Philipp Wich
ad7dc4a492 luci-base: add urldecode() and urlencode() C implementations
The C implementations of urlencode and urldecode are considerably faster
than their current Lua counterparts.

On an AMD Geode system, the C variant is up to ten times faster when
decoding strings and up to four times faster when encoding them.

The functions are also designed to only allocate new strings when any
actual changes are required, otherwise they reuse the existing input
strings, reducing the overal memory usage somewhat.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-10 11:41:32 +02:00
Marc Benoit
fbeea4ee33 luci-mod-admin-full: limit dns cachesize to 10000
The value of cachesize is hardcoded to 10000 in
dnsmasq-2.79/src/option.c to 10000 max

    case 'c':  /* --cache-size */
      {
        int size;

        if (!atoi_check(arg, &size))
          ret_err(gen_err);
        else
          {
            /* zero is OK, and means no caching. */

            if (size < 0)
              size = 0;
            else if (size > 10000)
              size = 10000;

            daemon->cachesize = size;
          }
        break;
      }

Tested on Netgear R7800
Signed-off-by: Marc Benoit <marcb62185@gmail.com>
2018-04-09 20:51:14 -04:00
Hannu Nyman
edd1fab34e
Merge pull request #1741 from dibdot/mwan-fix
luci-app-mwan3: bugfix
2018-04-09 17:33:21 +03:00
Marc Benoit
28d10632a1 luci-mod-admin-full: allow setting dns cachesize
In the case of more powerful routers the default
cachesize value == 150 is too small and can easily
be extended to 1,000's and 10,000's of entries.
It makes sense to make it easy configurable.

Tested on Netgear R7800

Signed-off-by: Marc Benoit <marcb62185@gmail.com>

Fix whitespace, edit the proposed help text.
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-04-09 17:17:02 +03:00
Dirk Brenken
f7f5395f1c luci-app-mwan3: bugfix
* make use of luci.model.uci to fix #1740

Signed-off-by: Dirk Brenken <dev@brenken.org>
2018-04-09 15:50:21 +02:00
Jo-Philipp Wich
b1b5723516 luci-base: consider empty parameters as well when testing POST requirement
The cbi class will react on an empty "cbi.submit" parameter as well so we
must intercept GET requests using that too.

Fixes 186e690c0 ("luci-base: dispatcher: reject non-POST requests with any cbi.submit value")

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-09 07:19:28 +02:00
Hannu Nyman
0ab0303527 i18n: sync translations
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-04-08 20:38:30 +03:00
Hannu Nyman
c7369830b6 timezone data: update to 2018d
Update timezone data to 2018d

http://mm.icann.org/pipermail/tz-announce/2018-March/000049.html

  In 2018, Palestine starts DST on March 24, not March 31.
     Adjust future predictions accordingly.
  Casey Station in Antarctica changed from +11 to +08

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-04-07 23:26:29 +03:00
Jo-Philipp Wich
1104b837cd luci-app-advanced-reboot: remove explicit libuci requirement
Rewrite affected code to use luci.model.uci in order to avoid the need for
using libuci-lua directly.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-07 14:42:51 +02:00
Jo-Philipp Wich
75ac400168 luci-app-vpnbypass: remove explicit libuci requirement
There is no direct user of the libuci-lua api, just some commented out code.
Rewrite the commented code to use the Map's uci cursor and remove the
explicit require.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-07 14:40:44 +02:00
Jo-Philipp Wich
8c636c87ee luci-base: fix luci.model.uci.get_first()
Properly propagate the config parameter to the foreach iterator in order
to fix get_first() lookups.

Fixes #1734.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-07 14:09:18 +02:00
Hannu Nyman
646545da56
Merge pull request #1733 from stangri/master
luci-app-advanced-reboot & luci-app-vpnbypass: fix uci require for ma…
2018-04-07 14:25:07 +03:00
Stan Grishin
7d87297e17 luci-app-advanced-reboot & luci-app-vpnbypass: fix uci require for master
Signed-off-by: Stan Grishin <stangri@melmac.net>
2018-04-07 04:14:58 -07:00
Jo-Philipp Wich
5c31937a0f luci-base: escape path strings and field parameter
Prevent various XSS vectors by not interpolating field and path values
verbatim into script and html contexts.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-07 11:43:44 +02:00
Jo-Philipp Wich
83a59dc0f7 luci-app-openvpn: quote grep expression in getPID()
Fixes c0d9c4f3c ("treewide: filter shell arguments through shellquote() where applicable")

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 23:38:38 +02:00
Hannu Nyman
93040427ff luci-app-mwan: fix translation fallout
Partially fix the fallout from the recent string changes.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-04-06 23:28:41 +03:00
Hannu Nyman
65eacaef16
Merge pull request #1727 from TDT-AG/pr/20180406-luci-app-mwan3-changes
luci-app-mwan3: fix translation and update defaults
2018-04-06 22:39:39 +03:00
Dirk Brenken
52ceba14d9
Merge pull request #1730 from dibdot/travelmate
luci-app-travelmate: bring back cbi element to wifi_add.lua
2018-04-06 18:37:33 +02:00
Dirk Brenken
7c7b6f4ba9 luci-app-travelmate: bring back cbi element to wifi_add.lua
* b00b676 fixed the cbi initialization for SimpleForm, therefore bring
  back "Ignore BSSID" flag with dependent input field

Signed-off-by: Dirk Brenken <dev@brenken.org>
2018-04-06 18:34:41 +02:00
Jo-Philipp Wich
b00b676923 luci-base: properly initialize cbi.js on SimpleForms
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 16:39:39 +02:00
Florian Eckert
af3ef3390c luci-app-mwan3: show default values in interface page if config is not found
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-04-06 12:56:57 +02:00
Florian Eckert
01e0179725 luci-app-mwan3: update translations
Update hint in the interface page.
Update hint in the policy page.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-04-06 12:54:21 +02:00
Jo-Philipp Wich
14da6e85a6 luci-mod-admin-full: dispatch SimpleForm models using the form() action
This fixes issues dicovered by check-controllers.sh

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 12:10:16 +02:00
Jo-Philipp Wich
ec2ad15305 luci-mod-freifunk: dispatch SimpleForm model using the form() action
This fixes issues dicovered by check-controllers.sh

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 12:07:50 +02:00
Jo-Philipp Wich
ef2e7db4ea luci-app-dnscrypt-proxy: dispatch SimpleForm models using the form() action
This fixes issues dicovered by check-controllers.sh

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 12:07:50 +02:00
Jo-Philipp Wich
dacf88216d luci-app-wol: dispatch SimpleForm model using the form() action
This fixes issues dicovered by check-controllers.sh

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 12:07:50 +02:00
Jo-Philipp Wich
1443ff121d luci-app-firewall: dispatch SimpleForm model using the form() action
This fixes issues dicovered by check-controllers.sh

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 12:07:49 +02:00
Jo-Philipp Wich
4a90accda9 luci-app-unbound: dispatch SimpleForm models using the form() action
This fixes issues dicovered by check-controllers.sh

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 12:07:49 +02:00
Jo-Philipp Wich
bf71ae5f1b luci-base: emit a warning if cbi() delegates a SimpleForm instance
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 12:07:49 +02:00
Jo-Philipp Wich
6f47c5657f build: add check-controller.sh, a utility to test controller files
The main purpose of the script is to check if the module declaration
matches and if associated cbi resources are properly referenced.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 12:02:37 +02:00
Jo-Philipp Wich
08a2b27df5 luci-app-mwan3: fix legacy uci api usage
Explicitely require libuci-lua in model classes that use legacy /var/state
cursor handling.

Also add a specific dependency on libuci-lua to the luci-app-mwan3
Makefile in preparation of the upcoming default removal of libuci-lua.

Finally fix the post data dispatching on the notification tab, see #1722
for reference.

Fixes #1726.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 09:35:39 +02:00
Jo-Philipp Wich
24ac0d81ee luci-base: implement luci.model.uci.get_state()
Introduce a get_state() function which can be used to access legacy
uci state variables. This is usually not needed anymore but some
packages (mainly mwan3) still rely on this.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 09:24:36 +02:00
Jo-Philipp Wich
4d6c5d284b luci-proto-ipv6: clarify 6in4 local address hint
Make the hint message more explicit to tell users that the prefix size needs
to be specified as well.

Fixes #1559.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 08:49:41 +02:00
Jo-Philipp Wich
feefc600ed luci-mod-rpc: rework authentication and session handling
- Use the ubus session.login procedure to authenticate credentials
 - Fix testing of allowed usernames
 - Support authentication via sysauth cookie

Fixes #1300, #1700, #1711

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 07:56:56 +02:00
Jo-Philipp Wich
d6b4a3d45a luci-mod-admin-full: fix request path access in uci controller
Fixes #1725
Fixes 731ed77c0 ("treewide: improve handling of page redirections in uci change views")

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-06 06:58:32 +02:00
Jo-Philipp Wich
bfc98bec4d luci-mod-admin-full: escape display parameter
Prevent reflected XSS through the reset button by url encoding the
display parameter.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-05 23:03:01 +02:00
Jo-Philipp Wich
731ed77c0b treewide: improve handling of page redirections in uci change views
Instead of passing the full LuCI request url, pass the relative resolved
request path instead and filter the received value through the lookup()
dispatcher function to only allow paths to actual internal pages.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-05 23:03:01 +02:00
Jo-Philipp Wich
7b04d0bbcf luci-base: introduce luci.dispatcher.lookup()
The lookup function takes multiple, possibly malformed path fragments,
splits them on slashes, constructs a temporary path and looks up the
result in the dispatch tree.

If a matching node has been found, the function will return both the
node reference and the canonical url to it.

If no corresponding node is found, the function returns nil.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-05 23:03:01 +02:00
Dirk Brenken
bc3651ba56
Merge pull request #1723 from dibdot/travelmate
luci-app-travelmate: bugfixes
2018-04-05 22:42:14 +02:00
Dirk Brenken
421dd407f0 luci-app-travelmate: bugfixes
* use the form() action to invoke the SimpleForm models
* fix 'wifi_add' input form

Signed-off-by: Dirk Brenken <dev@brenken.org>
2018-04-05 22:39:46 +02:00
Jo-Philipp Wich
72b973b258 luci-app-adblock: fix SimpleForm page delegation
Invoke the SimpleForm models using the form() action, not the cbi() ones.
This avoids the extraneous rendering of the cbi header template, avoiding
rejected save operations due to duplicated token value.

Fixes #1722.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-05 19:21:50 +02:00
Dirk Brenken
9dcf73b323
Merge pull request #1718 from dibdot/travelmate
luci-app-travelmate: sync with travelmate 1.2.0
2018-04-05 14:43:53 +02:00
Jo-Philipp Wich
ac2210376d
Merge pull request #1709 from dibdot/get_interface-fix
luci-base/network.lua: fix get_interface function
2018-04-05 09:49:49 +02:00
Jo-Philipp Wich
c0d9c4f3ce treewide: filter shell arguments through shellquote() where applicable
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-05 09:37:43 +02:00
Jo-Philipp Wich
45cefe71f6 luci-base: introduce luci.util.shellquote()
Introduce a new function luci.util.shellquote() which encloses the given
string argument in single quotes and escapes any embedded single quote
characters.

This function is intended to be used when interpolating untrusted input
into shell commands.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-05 09:37:43 +02:00
Jo-Philipp Wich
9e4b8a9138 luci-mod-admin-full: fix possible shell injection in bandwith status
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-05 00:33:09 +02:00