mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-11-01 19:07:47 +00:00
uspot: radius_call: unlink tmp file after exec
If debug is disabled, this commit deletes the temporary json files
passed to radius-client.
Furthermore, to reduce the risk of collision, use a different prefix in
accounting.uc ('uacct') vs common.uc ('acct').
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
This commit is contained in:
committed by
John Crispin
parent
db37e3727d
commit
fc80a4aa84
@@ -73,11 +73,15 @@ function radius_init(interface, mac, payload) {
|
||||
}
|
||||
|
||||
function radius_call(interface, mac, payload) {
|
||||
let cfg = fs.open('/tmp/acct' + mac + '.json', 'w');
|
||||
let path = '/tmp/uacct' + mac + '.json';
|
||||
let cfg = fs.open(path, 'w');
|
||||
cfg.write(payload);
|
||||
cfg.close();
|
||||
|
||||
system('/usr/bin/radius-client /tmp/acct' + mac + '.json');
|
||||
system('/usr/bin/radius-client ' + path);
|
||||
|
||||
if (!+config[interface].debug)
|
||||
fs.unlink(path);
|
||||
}
|
||||
|
||||
function radius_stop(interface, mac, payload, remove) {
|
||||
|
||||
@@ -221,13 +221,19 @@ return {
|
||||
return payload;
|
||||
},
|
||||
|
||||
// call radius-client with the provided payload and return reply
|
||||
radius_call: function(ctx, payload) {
|
||||
let type = payload.acct ? 'acct' : 'auth';
|
||||
let cfg = fs.open('/tmp/' + type + ctx.mac + '.json', 'w');
|
||||
let path = '/tmp/' + (payload.acct ? 'acct' : 'auth') + ctx.mac + '.json';
|
||||
let cfg = fs.open(path, 'w');
|
||||
cfg.write(payload);
|
||||
cfg.close();
|
||||
|
||||
return this.fs_popen('/usr/bin/radius-client /tmp/' + type + ctx.mac + '.json');
|
||||
let reply = this.fs_popen('/usr/bin/radius-client ' + path);
|
||||
|
||||
if (!+config.def_captive.debug)
|
||||
fs.unlink(path);
|
||||
|
||||
return reply;
|
||||
},
|
||||
|
||||
uam_url: function(ctx, res) {
|
||||
|
||||
Reference in New Issue
Block a user