summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-base/luasrc')
-rw-r--r--modules/luci-base/luasrc/dispatcher.lua29
-rw-r--r--modules/luci-base/luasrc/http/protocol.lua2
-rw-r--r--modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua20
-rw-r--r--modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua9
-rw-r--r--modules/luci-base/luasrc/util.lua2
5 files changed, 39 insertions, 23 deletions
diff --git a/modules/luci-base/luasrc/dispatcher.lua b/modules/luci-base/luasrc/dispatcher.lua
index 795b62bedb..8b8d1fa349 100644
--- a/modules/luci-base/luasrc/dispatcher.lua
+++ b/modules/luci-base/luasrc/dispatcher.lua
@@ -114,7 +114,14 @@ function authenticator.htmlauth(validator, accs, default)
if context.urltoken.stok then
context.urltoken.stok = nil
- http.header("Set-Cookie", "sysauth=; path="..build_url())
+
+ local cookie = 'sysauth=%s; expires=%s; path=%s/' %{
+ http.getcookie('sysauth') or 'x',
+ 'Thu, 01 Jan 1970 01:00:00 GMT',
+ build_url()
+ }
+
+ http.header("Set-Cookie", cookie)
http.redirect(build_url())
else
require("luci.i18n")
@@ -329,13 +336,14 @@ function dispatch(request)
if not util.contains(accs, user) then
if authen then
local user, sess = authen(sys.user.checkpasswd, accs, def)
+ local token
if not user or not util.contains(accs, user) then
return
else
if not sess then
- local sdat = util.ubus("session", "create", { timeout = luci.config.sauth.sessiontime })
+ local sdat = util.ubus("session", "create", { timeout = tonumber(luci.config.sauth.sessiontime) })
if sdat then
- local token = sys.uniqueid(16)
+ token = sys.uniqueid(16)
util.ubus("session", "set", {
ubus_rpc_session = sdat.ubus_rpc_session,
values = {
@@ -345,15 +353,19 @@ function dispatch(request)
}
})
sess = sdat.ubus_rpc_session
- ctx.urltoken.stok = token
end
end
- if sess then
- http.header("Set-Cookie", "sysauth=" .. sess.."; path="..build_url())
- http.redirect(build_url(unpack(ctx.requestpath)))
+ if sess and token then
+ http.header("Set-Cookie", 'sysauth=%s; path=%s/' %{
+ sess, build_url()
+ })
+
+ ctx.urltoken.stok = token
ctx.authsession = sess
ctx.authuser = user
+
+ http.redirect(build_url(unpack(ctx.requestpath)))
end
end
else
@@ -371,6 +383,9 @@ function dispatch(request)
end
if track.setuser then
+ -- trigger ubus connection before dropping root privs
+ util.ubus()
+
sys.process.setuser(track.setuser)
end
diff --git a/modules/luci-base/luasrc/http/protocol.lua b/modules/luci-base/luasrc/http/protocol.lua
index e9efb44cfa..61d7b802fe 100644
--- a/modules/luci-base/luasrc/http/protocol.lua
+++ b/modules/luci-base/luasrc/http/protocol.lua
@@ -72,7 +72,7 @@ function urlencode( str )
if type(str) == "string" then
str = str:gsub(
- "([^a-zA-Z0-9$_%-%.%+!*'(),])",
+ "([^a-zA-Z0-9$_%-%.!*'(),])",
__chrenc
)
end
diff --git a/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua b/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua
index 6337496692..148bdcbfc5 100644
--- a/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua
+++ b/modules/luci-base/luasrc/sys/zoneinfo/tzdata.lua
@@ -15,7 +15,7 @@ TZ = {
{ 'Africa/Blantyre', 'CAT-2' },
{ 'Africa/Brazzaville', 'WAT-1' },
{ 'Africa/Bujumbura', 'CAT-2' },
- { 'Africa/Cairo', 'EET-2EEST,M4.5.5/0,M9.5.4/24' },
+ { 'Africa/Cairo', 'EET-2EEST,M4.5.4/24,M9.5.4/24' },
{ 'Africa/Casablanca', 'WET0WEST,M3.5.0,M10.5.0/3' },
{ 'Africa/Ceuta', 'CET-1CEST,M3.5.0,M10.5.0/3' },
{ 'Africa/Conakry', 'GMT0' },
@@ -86,7 +86,7 @@ TZ = {
{ 'America/Boise', 'MST7MDT,M3.2.0,M11.1.0' },
{ 'America/Cambridge Bay', 'MST7MDT,M3.2.0,M11.1.0' },
{ 'America/Campo Grande', 'AMT4AMST,M10.3.0/0,M2.3.0/0' },
- { 'America/Cancun', 'CST6CDT,M4.1.0,M10.5.0' },
+ { 'America/Cancun', 'EST5' },
{ 'America/Caracas', 'VET4:30' },
{ 'America/Cayenne', 'GFT3' },
{ 'America/Cayman', 'EST5' },
@@ -178,7 +178,7 @@ TZ = {
{ 'America/Rio Branco', 'ACT5' },
{ 'America/Santa Isabel', 'PST8PDT,M4.1.0,M10.5.0' },
{ 'America/Santarem', 'BRT3' },
- { 'America/Santiago', 'CLT4CLST,M9.1.6/24,M4.4.6/24' },
+ { 'America/Santiago', 'CLT3' },
{ 'America/Santo Domingo', 'AST4' },
{ 'America/Sao Paulo', 'BRT3BRST,M10.3.0/0,M2.3.0/0' },
{ 'America/Scoresbysund', 'EGT1EGST,M3.5.0/0,M10.5.0/1' },
@@ -207,7 +207,7 @@ TZ = {
{ 'Antarctica/Macquarie', 'MIST-11' },
{ 'Antarctica/Mawson', 'MAWT-5' },
{ 'Antarctica/McMurdo', 'NZST-12NZDT,M9.5.0,M4.1.0/3' },
- { 'Antarctica/Palmer', 'CLT4CLST,M9.1.6/24,M4.4.6/24' },
+ { 'Antarctica/Palmer', 'CLT3' },
{ 'Antarctica/Rothera', 'ROTT3' },
{ 'Antarctica/Syowa', 'SYOT-3' },
{ 'Antarctica/Troll', 'UTC0CEST-2,M3.5.0/1,M10.5.0/3' },
@@ -228,18 +228,18 @@ TZ = {
{ 'Asia/Bishkek', 'KGT-6' },
{ 'Asia/Brunei', 'BNT-8' },
{ 'Asia/Chita', 'IRKT-8' },
- { 'Asia/Choibalsan', 'CHOT-8' },
+ { 'Asia/Choibalsan', 'CHOT-8CHOST,M3.5.6,M9.5.6/0' },
{ 'Asia/Colombo', 'IST-5:30' },
{ 'Asia/Damascus', 'EET-2EEST,M3.5.5/0,M10.5.5/0' },
{ 'Asia/Dhaka', 'BDT-6' },
{ 'Asia/Dili', 'TLT-9' },
{ 'Asia/Dubai', 'GST-4' },
{ 'Asia/Dushanbe', 'TJT-5' },
- { 'Asia/Gaza', 'EET-2EEST,M3.5.4/24,M9.3.6/144' },
- { 'Asia/Hebron', 'EET-2EEST,M3.5.4/24,M9.3.6/144' },
+ { 'Asia/Gaza', 'EET-2EEST,M3.5.5/24,M10.3.6/144' },
+ { 'Asia/Hebron', 'EET-2EEST,M3.5.5/24,M10.3.6/144' },
{ 'Asia/Ho Chi Minh', 'ICT-7' },
{ 'Asia/Hong Kong', 'HKT-8' },
- { 'Asia/Hovd', 'HOVT-7' },
+ { 'Asia/Hovd', 'HOVT-7HOVST,M3.5.6,M9.5.6/0' },
{ 'Asia/Irkutsk', 'IRKT-8' },
{ 'Asia/Jakarta', 'WIB-7' },
{ 'Asia/Jayapura', 'WIT-9' },
@@ -282,7 +282,7 @@ TZ = {
{ 'Asia/Tbilisi', 'GET-4' },
{ 'Asia/Thimphu', 'BTT-6' },
{ 'Asia/Tokyo', 'JST-9' },
- { 'Asia/Ulaanbaatar', 'ULAT-8' },
+ { 'Asia/Ulaanbaatar', 'ULAT-8ULAST,M3.5.6,M9.5.6/0' },
{ 'Asia/Urumqi', 'XJT-6' },
{ 'Asia/Ust-Nera', 'VLAT-10' },
{ 'Asia/Vientiane', 'ICT-7' },
@@ -384,7 +384,7 @@ TZ = {
{ 'Pacific/Bougainville', 'BST-11' },
{ 'Pacific/Chatham', 'CHAST-12:45CHADT,M9.5.0/2:45,M4.1.0/3:45' },
{ 'Pacific/Chuuk', 'CHUT-10' },
- { 'Pacific/Easter', 'EAST6EASST,M9.1.6/22,M4.4.6/22' },
+ { 'Pacific/Easter', 'EAST5' },
{ 'Pacific/Efate', 'VUT-11' },
{ 'Pacific/Enderbury', 'PHOT-13' },
{ 'Pacific/Fakaofo', 'TKT-13' },
diff --git a/modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua b/modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua
index facfd0c8bf..fe3f860977 100644
--- a/modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua
+++ b/modules/luci-base/luasrc/sys/zoneinfo/tzoffset.lua
@@ -45,8 +45,7 @@ OFFSET = {
uyst = -7200, -- UYST
fnt = -7200, -- FNT
srt = -10800, -- SRT
- clt = -14400, -- CLT
- clst = -10800, -- CLST
+ clt = -10800, -- CLT
egt = -3600, -- EGT
egst = 0, -- EGST
nst = -12600, -- NST
@@ -73,6 +72,7 @@ OFFSET = {
bnt = 28800, -- BNT
irkt = 28800, -- IRKT
chot = 28800, -- CHOT
+ chost = 32400, -- CHOST
ist = 19800, -- IST
bdt = 21600, -- BDT
tlt = 32400, -- TLT
@@ -80,6 +80,7 @@ OFFSET = {
tjt = 18000, -- TJT
hkt = 28800, -- HKT
hovt = 25200, -- HOVT
+ hovst = 28800, -- HOVST
wib = 25200, -- WIB
wit = 32400, -- WIT
aft = 16200, -- AFT
@@ -106,6 +107,7 @@ OFFSET = {
btt = 21600, -- BTT
jst = 32400, -- JST
ulat = 28800, -- ULAT
+ ulast = 32400, -- ULAST
xjt = 21600, -- XJT
vlat = 36000, -- VLAT
yekt = 18000, -- YEKT
@@ -135,8 +137,7 @@ OFFSET = {
chast = 45900, -- CHAST
chadt = 49500, -- CHADT
chut = 36000, -- CHUT
- east = -21600, -- EAST
- easst = -18000, -- EASST
+ east = -18000, -- EAST
vut = 39600, -- VUT
phot = 46800, -- PHOT
tkt = 46800, -- TKT
diff --git a/modules/luci-base/luasrc/util.lua b/modules/luci-base/luasrc/util.lua
index 8b28b1752d..dcf8230b3e 100644
--- a/modules/luci-base/luasrc/util.lua
+++ b/modules/luci-base/luasrc/util.lua
@@ -643,7 +643,7 @@ function serialize_json(x, cb)
push(tostring(x))
end
else
- push('"%s"' % tostring(x):gsub('["%z\1-\31]',
+ push('"%s"' % tostring(x):gsub('["%z\1-\31\\]',
function(c) return '\\u%04x' % c:byte(1) end))
end