fix SSID check, also make it optional
This commit is contained in:
@@ -1124,7 +1124,7 @@ async function sendToClient(socket, headers_obj, data = null) {
|
|||||||
headers_obj = headerStringToObj(headers_obj, true);
|
headers_obj = headerStringToObj(headers_obj, true);
|
||||||
}
|
}
|
||||||
if (!socket_sessions[socket.id]) {
|
if (!socket_sessions[socket.id]) {
|
||||||
socket.destroy();
|
if (socket.destroy) socket.destroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!socket.res) {
|
if (!socket.res) {
|
||||||
@@ -1471,10 +1471,15 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
|||||||
if (!headers) return;
|
if (!headers) return;
|
||||||
|
|
||||||
if (headers["wtv-client-serial-number"] != null && socket.ssid == null) {
|
if (headers["wtv-client-serial-number"] != null && socket.ssid == null) {
|
||||||
if (!wtvshared.checkSSID(headers["wtv-client-serial-number"])) {
|
if (minisrv_config.config.require_valid_ssid) {
|
||||||
// close socket for invalid ssid
|
if (!wtvshared.checkSSID(headers["wtv-client-serial-number"])) {
|
||||||
cleanupSocket(socket)
|
// reject invalid SSIDs
|
||||||
return;
|
var errpage = wtvshared.doErrorPage(400, "minisrv ran into a technical problem. Reason: Your SSID is not valid.");
|
||||||
|
headers = errpage[0];
|
||||||
|
data = errpage[1];
|
||||||
|
sendToClient(socket, headers, data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
socket.ssid = wtvshared.makeSafeSSID(headers["wtv-client-serial-number"]);
|
socket.ssid = wtvshared.makeSafeSSID(headers["wtv-client-serial-number"]);
|
||||||
if (socket.ssid != null) {
|
if (socket.ssid != null) {
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
"allow_guests": true, // Allow users to experience the server without registering
|
"allow_guests": true, // Allow users to experience the server without registering
|
||||||
"domain_name": "wtv.zefie.com", // For usenet and future stuff, no need to change just yet,
|
"domain_name": "wtv.zefie.com", // For usenet and future stuff, no need to change just yet,
|
||||||
"max_post_length": 20, // in megabytes
|
"max_post_length": 20, // in megabytes
|
||||||
|
"require_valid_ssid": true, // require a valid SSID (with valid CRC)
|
||||||
"user_accounts": { // user account settings
|
"user_accounts": { // user account settings
|
||||||
"max_users_per_account": 6, // Max total users (including primary) per account
|
"max_users_per_account": 6, // Max total users (including primary) per account
|
||||||
"min_username_length": 5, // minimum username length
|
"min_username_length": 5, // minimum username length
|
||||||
|
|||||||
Reference in New Issue
Block a user