diff --git a/feeds/ucentral/uspot/files/usr/share/uspot/accounting.uc b/feeds/ucentral/uspot/files/usr/share/uspot/accounting.uc index 37b5fa2f7..f5195c81d 100755 --- a/feeds/ucentral/uspot/files/usr/share/uspot/accounting.uc +++ b/feeds/ucentral/uspot/files/usr/share/uspot/accounting.uc @@ -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) { diff --git a/feeds/ucentral/uspot/files/usr/share/uspot/common.uc b/feeds/ucentral/uspot/files/usr/share/uspot/common.uc index 8328afe4a..6f0ac0fd7 100644 --- a/feeds/ucentral/uspot/files/usr/share/uspot/common.uc +++ b/feeds/ucentral/uspot/files/usr/share/uspot/common.uc @@ -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) {