Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit c669092d authored by Rob Swindell's avatar Rob Swindell 💬

Clean-up and optimize the pre/post exec xtrn modules

Don't load() things unnecessarily (use require() instead).
Fix the X-restriction issue (is not supposed to limit the execution of
programs configured to run as logon events).
parent a852cced
Pipeline #614 passed with stage
in 14 minutes and 14 seconds
// postxtrn.js
// External Program Post Module
// External Program Post-execution Module
// These actions execute after an external program is launched via bbs.exec_xtrn()
"use strict";
load("sbbsdefs.js");
/* text.dat entries */
load("text.js");
var options, program;
if((options=load({}, "modopts.js","xtrn_sec")) == null)
options = {}; // default values
if(options.clear_screen === undefined)
options.clear_screen = true;
function exec_xtrn_post(program)
{
var options;
if ((options = load({}, "modopts.js","xtrn:" + program.code)) == null) {
if ((options = load({}, "modopts.js","xtrn_sec")) == null)
options = {}; // default values
}
require("nodedefs.js", "NODE_LOGN");
if ((options.disable_post_on_logon_event) && (bbs.node_action == NODE_LOGN)) {
exit(1);
}
require("cga_defs.js", "LIGHTGRAY");
console.attributes = 0;
console.attributes = LIGHTGRAY;
......@@ -34,8 +30,7 @@ function exec_xtrn_post(program)
}
}
/* main: */
{
exec_xtrn_post(xtrn_area.prog[argv[0].toLowerCase()] );
exec_xtrn_post(xtrn_area.prog[argv[0].toLowerCase()]);
}
// prextrn.js
// External Program Pre Module
// External Program Pre-execution Module
// These actions execute before an external program is launched via bbs.exec_xtrn()
"use strict";
load("sbbsdefs.js");
/* text.dat entries */
load("text.js");
var options, program;
if((options=load({}, "modopts.js","xtrn_sec")) == null)
options = {}; // default values
function exec_xtrn_pre(program)
{
if ((options.disable_pre_on_logon_event) && (bbs.node_action == NODE_LOGN)) {
exit(1);
}
if (options.restricted_user_msg === undefined) {
options.restricted_user_msg = bbs.text(R_ExternalPrograms);
var options;
if ((options = load({}, "modopts.js","xtrn:" + program.code)) == null) {
if ((options = load({}, "modopts.js","xtrn_sec")) == null)
options = {}; // default values
}
if (user.security.restrictions&UFLAG_X) {
write(options.restricted_user_msg);
exit(1);
require("nodedefs.js", "NODE_LOGN");
if (bbs.node_action == NODE_LOGN) {
if (options.disable_pre_on_logon_event) {
exit(1);
}
} else {
if (options.restricted_user_msg === undefined) {
require("text.js", "R_ExternalPrograms");
options.restricted_user_msg = bbs.text(R_ExternalPrograms);
}
require("userdefs.js", "UFLAG_X");
if (user.security.restrictions&UFLAG_X) {
write(options.restricted_user_msg);
exit(1);
}
}
if (bbs.menu_exists("xtrn/" + program.code)) {
......@@ -37,6 +37,7 @@ function exec_xtrn_pre(program)
console.line_counter=0;
}
require("cga_defs.js", "LIGHTGRAY");
console.attributes = LIGHTGRAY;
if (options.clear_screen_on_exec) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment