diff --git a/meshagent.js b/meshagent.js
index 1967a0a2..70014606 100644
--- a/meshagent.js
+++ b/meshagent.js
@@ -37,6 +37,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
obj.agentCoreCheck = 0;
obj.agentInfo = null;
obj.agentUpdate = null;
+ obj.agentCoreUpdatePending = false;
const agentUpdateBlockSize = 65520;
obj.remoteaddr = req.ip;
if (obj.remoteaddr.startsWith('::ffff:')) { obj.remoteaddr = obj.remoteaddr.substring(7); }
@@ -149,7 +150,9 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
//obj.parent.parent.debug(1, 'Updating code ' + corename);
// Update new core with task limiting so not to flood the server. This is a high priority task.
+ obj.agentCoreUpdatePending = true;
obj.parent.parent.taskLimiter.launch(function (argument, taskid, taskLimiterQueue) {
+ obj.agentCoreUpdatePending = false;
obj.send(obj.common.ShortToStr(10) + obj.common.ShortToStr(0) + argument.hash + argument.core, function () { obj.parent.parent.taskLimiter.completed(taskid); }); // MeshCommand_CoreModule, start core update
obj.parent.parent.debug(1, 'Updating code ' + argument.name);
agentCoreIsStable();
diff --git a/meshuser.js b/meshuser.js
index 354ba809..0dd0c95c 100644
--- a/meshuser.js
+++ b/meshuser.js
@@ -462,7 +462,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
switch (cmd) {
case 'help': {
- r = 'Available commands: help, args, resetserver, showconfig, usersessions, tasklimiter, cores.';
+ r = 'Available commands: help, args, resetserver, showconfig, usersessions, tasklimiter, setmaxtasks, cores.';
break;
}
case 'args': {
@@ -489,15 +489,21 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
if (obj.parent.parent.taskLimiter != null) {
//var obj = { maxTasks: maxTasks, maxTaskTime: (maxTaskTime * 1000), nextTaskId: 0, currentCount: 0, current: {}, pending: [[], [], []], timer: null };
const tl = obj.parent.parent.taskLimiter;
- r += 'MaxTasks: ' + tl.maxTasks + '
';
- r += 'MaxTaskTime: ' + (tl.maxTaskTime / 1000) + ' seconds
';
- r += 'NextTaskId: ' + tl.nextTaskId + '
';
- r += 'CurrentCount: ' + tl.currentCount + '
';
+ r += 'MaxTasks: ' + tl.maxTasks + ', NextTaskId: ' + tl.nextTaskId + '
';
+ r += 'MaxTaskTime: ' + (tl.maxTaskTime / 1000) + ' seconds, Timer: ' + (tl.timer != null) + '
';
var c = [];
for (var i in tl.current) { c.push(i); }
- r += 'Current: [' + c.join(', ') + ']
';
+ r += 'Current (' + tl.currentCount + '): [' + c.join(', ') + ']
';
r += 'Pending (High/Med/Low): ' + tl.pending[0].length + ', ' + tl.pending[1].length + ', ' + tl.pending[2].length + '
';
- r += 'Timer: ' + (tl.timer != null) + '
';
+ }
+ break;
+ }
+ case 'setmaxtasks': {
+ if ((args["_"].length != 1) || (parseInt(args["_"][0]) < 1) || (parseInt(args["_"][0]) > 1000)) {
+ r = 'Usage: setmaxtasks [1 to 1000]';
+ } else {
+ obj.parent.parent.taskLimiter.maxTasks = parseInt(args["_"][0]);
+ r = 'MaxTasks set to ' + obj.parent.parent.taskLimiter.maxTasks + '.';
}
break;
}
diff --git a/package.json b/package.json
index a5cfd750..becf6780 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "meshcentral",
- "version": "0.2.9-a",
+ "version": "0.2.9-b",
"keywords": [
"Remote Management",
"Intel AMT",
diff --git a/webserver.js b/webserver.js
index 223f84d9..85dfd4c1 100644
--- a/webserver.js
+++ b/webserver.js
@@ -516,6 +516,26 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
if ((domain.newaccounts === 0) || (domain.newaccounts === false)) { res.sendStatus(401); return; }
+ // Check if this request is for an allows email domain
+ if ((domain.newaccountemaildomains != null) && Array.isArray(domain.newaccountemaildomains)) {
+ var i = -1;
+ if (typeof req.body.email == 'string') { i = req.body.email.indexOf('@'); }
+ if (i == -1) {
+ req.session.loginmode = 2;
+ req.session.error = 'Unable to create account.';
+ res.redirect(domain.url);
+ return;
+ }
+ var emailok = false, emaildomain = req.body.email.substring(i + 1).toLowerCase();
+ for (var i in domain.newaccountemaildomains) { if (emaildomain == domain.newaccountemaildomains[i].toLowerCase()) { emailok = true; } }
+ if (emailok == false) {
+ req.session.loginmode = 2;
+ req.session.error = 'Unable to create account.';
+ res.redirect(domain.url);
+ return;
+ }
+ }
+
// Check if we exceed the maximum number of user accounts
obj.db.isMaxType(domain.limits.maxuseraccounts, 'user', domain.id, function (maxExceed) {
if (maxExceed) {