summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/protocol/dhcp.js12
-rwxr-xr-xmodules/luci-base/root/usr/libexec/rpcd/luci11
-rw-r--r--modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json7
3 files changed, 11 insertions, 19 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/protocol/dhcp.js b/modules/luci-base/htdocs/luci-static/resources/protocol/dhcp.js
index b0b65974a..f0a3ec579 100644
--- a/modules/luci-base/htdocs/luci-static/resources/protocol/dhcp.js
+++ b/modules/luci-base/htdocs/luci-static/resources/protocol/dhcp.js
@@ -3,10 +3,12 @@
'require form';
'require network';
-var callHostname = rpc.declare({
- object: 'luci',
- method: 'getHostname',
- expect: { result: '' }
+var callFileRead = rpc.declare({
+ object: 'file',
+ method: 'read',
+ params: [ 'path' ],
+ expect: { data: '' },
+ filter: function(value) { return value.trim() }
});
return network.registerProtocol('dhcp', {
@@ -20,7 +22,7 @@ return network.registerProtocol('dhcp', {
o = s.taboption('general', form.Value, 'hostname', _('Hostname to send when requesting DHCP'));
o.datatype = 'hostname';
o.load = function(section_id) {
- return callHostname().then(L.bind(function(hostname) {
+ return callFileRead('/proc/sys/kernel/hostname').then(L.bind(function(hostname) {
this.placeholder = hostname;
return form.Value.prototype.load.apply(this, [section_id]);
}, this));
diff --git a/modules/luci-base/root/usr/libexec/rpcd/luci b/modules/luci-base/root/usr/libexec/rpcd/luci
index b8243b827..850b159ac 100755
--- a/modules/luci-base/root/usr/libexec/rpcd/luci
+++ b/modules/luci-base/root/usr/libexec/rpcd/luci
@@ -468,17 +468,6 @@ local methods = {
return rv
end
- },
-
- getHostname = {
- call = function()
- local fs = require "nixio.fs"
- local hostname, code, err = fs.readfile("/proc/sys/kernel/hostname")
- if err then
- return { error = err }, 1
- end
- return { result = hostname:gsub("\n$", "") }
- end
}
}
diff --git a/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json b/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
index 417296a39..1952a7c3a 100644
--- a/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
+++ b/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
@@ -22,12 +22,13 @@
"read": {
"file": {
"/": [ "list" ],
- "/*": [ "list" ]
+ "/*": [ "list" ],
+ "/proc/sys/kernel/hostname": [ "read" ]
},
"ubus": {
- "file": [ "list", "stat" ],
+ "file": [ "list", "read", "stat" ],
"iwinfo": [ "assoclist", "freqlist", "txpowerlist", "countrylist" ],
- "luci": [ "getBoardJSON", "getDUIDHints", "getHostHints", "getIfaddrs", "getInitList", "getLocaltime", "getTimezones", "getDHCPLeases", "getLEDs", "getNetworkDevices", "getUSBDevices", "getHostname", "getWirelessDevices" ],
+ "luci": [ "getBoardJSON", "getDUIDHints", "getHostHints", "getIfaddrs", "getInitList", "getLocaltime", "getTimezones", "getDHCPLeases", "getLEDs", "getNetworkDevices", "getUSBDevices", "getWirelessDevices" ],
"network.device": [ "status" ],
"network.interface": [ "dump" ],
"network": [ "get_proto_handlers" ],