mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2025-07-08 00:34:57 +03:00
Compare commits
9 Commits
1b23c31c02
...
5.02.5182
Author | SHA1 | Date | |
---|---|---|---|
ff37c35cfa | |||
56c12de929 | |||
2789b16c12 | |||
f6c185f279 | |||
44821c7130 | |||
64cb8e1eff | |||
fc7093ed36 | |||
370d83ffa0 | |||
645d5ebb55 |
51
.github/ISSUE_TEMPLATE.md
vendored
51
.github/ISSUE_TEMPLATE.md
vendored
@ -1,51 +0,0 @@
|
|||||||
Hi, there!
|
|
||||||
|
|
||||||
Thank you for using SoftEther.
|
|
||||||
|
|
||||||
If you are running SoftEther VPN 4.x (i.e. Stable Edition), please read the comparison with Developer Edition at:
|
|
||||||
|
|
||||||
https://github.com/SoftEtherVPN/SoftEtherVPN#comparison-with-stable-edition
|
|
||||||
|
|
||||||
Before you submit an issue, please read the following:
|
|
||||||
|
|
||||||
Is this a question?
|
|
||||||
|
|
||||||
- If the answer is "yes", then please ask your question on [www.vpnusers.com](http://www.vpnusers.com).
|
|
||||||
The issue section on GitHub is reserved for bugs and feature requests.
|
|
||||||
|
|
||||||
- If the answer is "no", please read the following:
|
|
||||||
|
|
||||||
We provide a template which is specifically made for bug reports, in order to be sure that the report includes enough details to be helpful.
|
|
||||||
|
|
||||||
Please use or adapt it as needed.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Prerequisites
|
|
||||||
|
|
||||||
* [ ] Can you reproduce?
|
|
||||||
* [ ] Are you running the latest version of SoftEtherVPN?
|
|
||||||
|
|
||||||
**SoftEther version:**
|
|
||||||
**Component:** [Server, Client, Bridge, etc.]
|
|
||||||
**Operating system:** [Windows, Linux, BSD, macOS, etc.]
|
|
||||||
**Architecture:** [64 bit, 32 bit]
|
|
||||||
|
|
||||||
[In case it's a computer with known specs, such as the Raspberry Pi, you can specify it omitting the details.]
|
|
||||||
**Processor:** [Specify brand and model. Example: AMD Ryzen 7 1800x]
|
|
||||||
|
|
||||||
### Description
|
|
||||||
|
|
||||||
[Description of the bug]
|
|
||||||
|
|
||||||
**Expected behavior:**
|
|
||||||
[What you expected to happen]
|
|
||||||
|
|
||||||
**Actual behavior:**
|
|
||||||
[What actually happened]
|
|
||||||
|
|
||||||
### Steps to reproduce
|
|
||||||
|
|
||||||
1. [First step]
|
|
||||||
2. [Second step]
|
|
||||||
3. [And so on...]
|
|
87
.github/ISSUE_TEMPLATE/bug_report_or_issue_report.yml
vendored
Normal file
87
.github/ISSUE_TEMPLATE/bug_report_or_issue_report.yml
vendored
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
name: Bug Report or Issue Report
|
||||||
|
description: File a bug report or an issue report
|
||||||
|
labels: "needs-triage"
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for taking the time to fill out this bug report!
|
||||||
|
We provide a template which is specifically made for bug reports, to be sure that the report includes enough details to be helpful.
|
||||||
|
|
||||||
|
- type: checkboxes
|
||||||
|
attributes:
|
||||||
|
label: Are you using SoftEther VPN 5.x?
|
||||||
|
description: |
|
||||||
|
This issue tracker is for SoftEther VPN Developer Edition versioned 5.x.
|
||||||
|
Please report issues about SoftEther VPN Stable Edition versioned 4.x through the correct path.
|
||||||
|
See also [the top of the issue tracker](https://github.com/SoftEtherVPN/SoftEtherVPN/issues/new/choose).
|
||||||
|
options:
|
||||||
|
- label: Yes, I'm using SoftEther VPN 5.x, not 4.x.
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: Version
|
||||||
|
description: |
|
||||||
|
The exact version you are using.
|
||||||
|
It would be very nice if you let us know version tag or commit hash.
|
||||||
|
placeholder: "5.02.5180 / 09b7e4f / 5.01.9674+git20200806+8181039+dfsg2-2build1"
|
||||||
|
|
||||||
|
- type: dropdown
|
||||||
|
attributes:
|
||||||
|
label: Component
|
||||||
|
description: Which component did you encounter an issue with?
|
||||||
|
multiple: true
|
||||||
|
options:
|
||||||
|
- VPN Server
|
||||||
|
- VPN Bridge
|
||||||
|
- VPN Client
|
||||||
|
- VPN Tools
|
||||||
|
- Other
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: Operating system & version
|
||||||
|
placeholder: "Windows 11 Pro 23H2 / Ubuntu 22.04 / FreeBSD 14.0 / macOS Sonoma / Independent"
|
||||||
|
description: |
|
||||||
|
Let us know about your operating system and version.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: Architecture or Hardware model
|
||||||
|
placeholder: "amd64 / aarch64 / Raspberry Pi 4B+ / Apple M2"
|
||||||
|
description: |
|
||||||
|
Necessary if your issue is architecture-specific.
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Steps to reproduce
|
||||||
|
placeholder: Having detailed steps helps us reproduce the bug.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: ✔️ Expected Behavior
|
||||||
|
placeholder: What do you expect to happen?
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: ❌ Actual Behavior
|
||||||
|
placeholder: What happened actually?
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Anything else?
|
||||||
|
description: |
|
||||||
|
Links? References?
|
||||||
|
Anything that will give us more context about the issue you are encountering!
|
||||||
|
|
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
contact_links:
|
||||||
|
- name: Are you using SoftEther VPN 4.x?
|
||||||
|
about: This repository is for SoftEther VPN 5.x Developer Edition, developed independently from SoftEther VPN 4.x. Visit vpnusers.com if you would like to report issues or ask questions about version 4.x!
|
||||||
|
url: https://www.vpnusers.com/
|
||||||
|
|
||||||
|
- name: Questions about SoftEtherVPN 5.x
|
||||||
|
about: Visit Discussions to ask community to help.
|
||||||
|
url: https://github.com/SoftEtherVPN/SoftEtherVPN/discussions/new?category=q-a
|
@ -30,7 +30,6 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>Older versions of SoftEther VPN before June 2019 don't support JSON-RPC APIs.</li>
|
<li>Older versions of SoftEther VPN before June 2019 don't support JSON-RPC APIs.</li>
|
||||||
<li>If you want to completely disable the JSON-RPC on your VPN Server, set the <code>DisableJsonRpcWebApi</code> variable to <code>true</code> on the <code>vpn_server.config</code>.</li>
|
<li>If you want to completely disable the JSON-RPC on your VPN Server, set the <code>DisableJsonRpcWebApi</code> variable to <code>true</code> on the <code>vpn_server.config</code>.</li>
|
||||||
<li>You may also restrict access to JSON-RPC API to a specific subnet, e.g. your internal network, by setting the <code>JsonRpcWebApiAllowedSubnet</code> variable to, for example, <code>192.168.0.0/16</code>.</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<h3 id="json-rpc-specification">JSON-RPC specification</h3>
|
<h3 id="json-rpc-specification">JSON-RPC specification</h3>
|
||||||
<p>You must use HTTPS 1.1 <code>POST</code> method to call each of JSON-RPC APIs.<br />
|
<p>You must use HTTPS 1.1 <code>POST</code> method to call each of JSON-RPC APIs.<br />
|
||||||
|
@ -25,7 +25,6 @@ https://<vpn_server_hostname>:<port>/api/
|
|||||||
|
|
||||||
- Older versions of SoftEther VPN before June 2019 don't support JSON-RPC APIs.
|
- Older versions of SoftEther VPN before June 2019 don't support JSON-RPC APIs.
|
||||||
- If you want to completely disable the JSON-RPC on your VPN Server, set the `DisableJsonRpcWebApi` variable to `true` on the `vpn_server.config`.
|
- If you want to completely disable the JSON-RPC on your VPN Server, set the `DisableJsonRpcWebApi` variable to `true` on the `vpn_server.config`.
|
||||||
- You may also restrict access to JSON-RPC API to a specific subnet, e.g. your internal network, by setting the `JsonRpcWebApiAllowedSubnet` variable to, for example, `192.168.0.0/16`.
|
|
||||||
|
|
||||||
|
|
||||||
### JSON-RPC specification
|
### JSON-RPC specification
|
||||||
|
@ -25,7 +25,6 @@ https://<vpn_server_hostname>:<port>/api/
|
|||||||
|
|
||||||
- Older versions of SoftEther VPN before June 2019 don't support JSON-RPC APIs.
|
- Older versions of SoftEther VPN before June 2019 don't support JSON-RPC APIs.
|
||||||
- If you want to completely disable the JSON-RPC on your VPN Server, set the `DisableJsonRpcWebApi` variable to `true` on the `vpn_server.config`.
|
- If you want to completely disable the JSON-RPC on your VPN Server, set the `DisableJsonRpcWebApi` variable to `true` on the `vpn_server.config`.
|
||||||
- You may also restrict access to JSON-RPC API to a specific subnet, e.g. your internal network, by setting the `JsonRpcWebApiAllowedSubnet` variable to, for example, `192.168.0.0/16`.
|
|
||||||
|
|
||||||
|
|
||||||
### JSON-RPC specification
|
### JSON-RPC specification
|
||||||
|
@ -1161,7 +1161,8 @@ void Win32EthMakeCombinedName(char *dst, UINT dst_size, char *nicname, char *gui
|
|||||||
|
|
||||||
if (IsEmptyStr(guid) == false)
|
if (IsEmptyStr(guid) == false)
|
||||||
{
|
{
|
||||||
Format(dst, dst_size, "%s (ID=%010u)", nicname, Win32EthGenIdFromGuid(guid));
|
// Allow to combine "FriendlyName" consisting of a NULL character and ID.
|
||||||
|
Format(dst, dst_size, "%s(ID=%010u)", nicname, Win32EthGenIdFromGuid(guid));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1185,18 +1186,19 @@ UINT Win32EthGetNameAndIdFromCombinedName(char *name, UINT name_size, char *str)
|
|||||||
|
|
||||||
len = StrLen(str);
|
len = StrLen(str);
|
||||||
|
|
||||||
if (len >= 16)
|
// Allow to combine "FriendlyName" consisting of a NULL character and ID beginning with "(ID=".
|
||||||
|
if (len >= 15)
|
||||||
{
|
{
|
||||||
StrCpy(id_str, sizeof(id_str), str + len - 16);
|
StrCpy(id_str, sizeof(id_str), str + len - 15);
|
||||||
|
|
||||||
if (StartWith(id_str, " (ID="))
|
if (StartWith(id_str, "(ID="))
|
||||||
{
|
{
|
||||||
if (EndWith(id_str, ")"))
|
if (EndWith(id_str, ")"))
|
||||||
{
|
{
|
||||||
char num[MAX_SIZE];
|
char num[MAX_SIZE];
|
||||||
|
|
||||||
Zero(num, sizeof(num));
|
Zero(num, sizeof(num));
|
||||||
StrCpy(num, sizeof(num), id_str + 5);
|
StrCpy(num, sizeof(num), id_str + 4);
|
||||||
|
|
||||||
num[StrLen(num) - 1] = 0;
|
num[StrLen(num) - 1] = 0;
|
||||||
|
|
||||||
@ -1204,7 +1206,7 @@ UINT Win32EthGetNameAndIdFromCombinedName(char *name, UINT name_size, char *str)
|
|||||||
|
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
name[len - 16] = 0;
|
name[len - 15] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1346,6 +1348,8 @@ TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden, bool enum_normal, boo
|
|||||||
|
|
||||||
Debug("%s - %s\n", a->Guid, a->Title);
|
Debug("%s - %s\n", a->Guid, a->Title);
|
||||||
}
|
}
|
||||||
|
// Make sure that "FriendlyName" does not cosist a NULL character.
|
||||||
|
Debug("%s,- s=%d, t=%s, %s,\n", a->Guid, show, tmp, a->Title[0] == 0 ? "check=NG FriendlyName(Title) is NULL !" : "check=OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
*total_num_including_hidden = ret->NumTokens;
|
*total_num_including_hidden = ret->NumTokens;
|
||||||
@ -1405,7 +1409,7 @@ LIST *GetEthAdapterListInternal()
|
|||||||
UINT size;
|
UINT size;
|
||||||
char *buf;
|
char *buf;
|
||||||
UINT i, j;
|
UINT i, j;
|
||||||
char *qos_tag = " (Microsoft's Packet Scheduler)";
|
char *qos_tag = "(Microsoft's Packet Scheduler)"; // Allow to combine "FriendlyName" consisting of a NULL character and QOS tag.
|
||||||
SU *su = NULL;
|
SU *su = NULL;
|
||||||
LIST *su_adapter_list = NULL;
|
LIST *su_adapter_list = NULL;
|
||||||
|
|
||||||
@ -1660,7 +1664,8 @@ ANSI_STR:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Format(tmp, sizeof(tmp), "%s (%u)", a->Title, k + 1);
|
// Allow to combine "FriendlyName" consisting of a NULL character and SEQ number.
|
||||||
|
Format(tmp, sizeof(tmp), "%s(%u)", a->Title, k + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ok = true;
|
ok = true;
|
||||||
|
@ -5740,7 +5740,6 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
|
|||||||
UINT num = 0, max = 19;
|
UINT num = 0, max = 19;
|
||||||
SERVER *server;
|
SERVER *server;
|
||||||
char *vpn_http_target = HTTP_VPN_TARGET2;
|
char *vpn_http_target = HTTP_VPN_TARGET2;
|
||||||
bool disableJsonRpcWebApi;
|
|
||||||
// Validate arguments
|
// Validate arguments
|
||||||
if (c == NULL)
|
if (c == NULL)
|
||||||
{
|
{
|
||||||
@ -5751,15 +5750,6 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
|
|||||||
|
|
||||||
s = c->FirstSock;
|
s = c->FirstSock;
|
||||||
|
|
||||||
disableJsonRpcWebApi = server->DisableJsonRpcWebApi;
|
|
||||||
if (!disableJsonRpcWebApi && !IsZeroIP(&server->JsonRpcWebApiAllowedSubnetAddr)
|
|
||||||
&& !IsZeroIP(&server->JsonRpcWebApiAllowedSubnetMask)) {
|
|
||||||
// restrict JSON-RPC Web API to specified subnet only
|
|
||||||
if (!IsInSameNetwork(&s->RemoteIP, &server->JsonRpcWebApiAllowedSubnetAddr, &server->JsonRpcWebApiAllowedSubnetMask)) {
|
|
||||||
disableJsonRpcWebApi = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
bool not_found_error = false;
|
bool not_found_error = false;
|
||||||
@ -5792,7 +5782,7 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
|
|||||||
// Receive the data since it's POST
|
// Receive the data since it's POST
|
||||||
data_size = GetContentLength(h);
|
data_size = GetContentLength(h);
|
||||||
|
|
||||||
if (disableJsonRpcWebApi == false)
|
if (server->DisableJsonRpcWebApi == false)
|
||||||
{
|
{
|
||||||
if (StrCmpi(h->Target, "/api") == 0 || StrCmpi(h->Target, "/api/") == 0)
|
if (StrCmpi(h->Target, "/api") == 0 || StrCmpi(h->Target, "/api/") == 0)
|
||||||
{
|
{
|
||||||
@ -5878,7 +5868,7 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
|
|||||||
}
|
}
|
||||||
else if (StrCmpi(h->Method, "OPTIONS") == 0)
|
else if (StrCmpi(h->Method, "OPTIONS") == 0)
|
||||||
{
|
{
|
||||||
if (disableJsonRpcWebApi == false)
|
if (server->DisableJsonRpcWebApi == false)
|
||||||
{
|
{
|
||||||
if (StrCmpi(h->Target, "/api") == 0 || StrCmpi(h->Target, "/api/") == 0 || StartWith(h->Target, "/admin"))
|
if (StrCmpi(h->Target, "/api") == 0 || StrCmpi(h->Target, "/api/") == 0 || StartWith(h->Target, "/admin"))
|
||||||
{
|
{
|
||||||
@ -5949,7 +5939,7 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
|
|||||||
BUF *b = NULL;
|
BUF *b = NULL;
|
||||||
*error_detail_str = "HTTP_ROOT";
|
*error_detail_str = "HTTP_ROOT";
|
||||||
|
|
||||||
if (disableJsonRpcWebApi == false)
|
if (server->DisableJsonRpcWebApi == false)
|
||||||
{
|
{
|
||||||
b = ReadDump("|wwwroot/index.html");
|
b = ReadDump("|wwwroot/index.html");
|
||||||
}
|
}
|
||||||
@ -6029,7 +6019,7 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
|
|||||||
|
|
||||||
if (b == false)
|
if (b == false)
|
||||||
{
|
{
|
||||||
if (disableJsonRpcWebApi == false)
|
if (server->DisableJsonRpcWebApi == false)
|
||||||
{
|
{
|
||||||
if (StartWith(h->Target, "/api?") || StartWith(h->Target, "/api/") || StrCmpi(h->Target, "/api") == 0)
|
if (StartWith(h->Target, "/api?") || StartWith(h->Target, "/api/") || StrCmpi(h->Target, "/api") == 0)
|
||||||
{
|
{
|
||||||
|
@ -753,11 +753,45 @@ LIST *SuGetAdapterList(SU *u)
|
|||||||
for (i = 0;i < u->AdapterInfoList.NumAdapters;i++)
|
for (i = 0;i < u->AdapterInfoList.NumAdapters;i++)
|
||||||
{
|
{
|
||||||
SL_ADAPTER_INFO *info = &u->AdapterInfoList.Adapters[i];
|
SL_ADAPTER_INFO *info = &u->AdapterInfoList.Adapters[i];
|
||||||
SU_ADAPTER_LIST *a = SuAdapterInfoToAdapterList(info);
|
|
||||||
|
|
||||||
if (a != NULL)
|
if (IsEmptyStr(info->FriendlyName))
|
||||||
{
|
{
|
||||||
Add(ret, a);
|
// Some NetAdapterCx drivers doesn't report the FriendlyName in the kernel mode.
|
||||||
|
// So we attempt to obtain the DriverDesc string from NetCfg registry key alternatively.
|
||||||
|
char regkey[MAX_PATH] = {0};
|
||||||
|
char tmp[MAX_PATH] = {0};
|
||||||
|
char adapter_guid[MAX_PATH] = {0};
|
||||||
|
|
||||||
|
UniToStr(adapter_guid, sizeof(adapter_guid), info->AdapterId + StrLen(SL_ADAPTER_ID_PREFIX));
|
||||||
|
|
||||||
|
if (GetClassRegKeyWin32(regkey, sizeof(regkey), tmp, sizeof(tmp), adapter_guid))
|
||||||
|
{
|
||||||
|
char *driver_desc = MsRegReadStrEx2(REG_LOCAL_MACHINE, regkey, "DriverDesc", false, true);
|
||||||
|
|
||||||
|
if (driver_desc != NULL)
|
||||||
|
{
|
||||||
|
StrCpy(info->FriendlyName, sizeof(info->FriendlyName), driver_desc);
|
||||||
|
Free(driver_desc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
SU_ADAPTER_LIST *a = SuAdapterInfoToAdapterList(info);
|
||||||
|
|
||||||
|
char macstr[128] = {0};
|
||||||
|
BinToStr(macstr, sizeof(macstr), info->MacAddress, sizeof(info->MacAddress));
|
||||||
|
|
||||||
|
if (a != NULL)
|
||||||
|
{
|
||||||
|
// Debug("SU: Adapter %u (OK): ID=%S, MAC=%s, FriendlyName=%s\n", i, info->AdapterId, macstr, info->FriendlyName);
|
||||||
|
|
||||||
|
Add(ret, a);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Debug("SU: Adapter %u (NG): ID=%S, MAC=%s, FriendlyName=%s\n", i, info->AdapterId, macstr, info->FriendlyName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -827,7 +861,8 @@ SU_ADAPTER_LIST *SuAdapterInfoToAdapterList(SL_ADAPTER_INFO *info)
|
|||||||
Copy(&t.Info, info, sizeof(SL_ADAPTER_INFO));
|
Copy(&t.Info, info, sizeof(SL_ADAPTER_INFO));
|
||||||
|
|
||||||
UniToStr(tmp, sizeof(tmp), info->AdapterId);
|
UniToStr(tmp, sizeof(tmp), info->AdapterId);
|
||||||
if (IsEmptyStr(tmp) || IsEmptyStr(info->FriendlyName) || StartWith(tmp, SL_ADAPTER_ID_PREFIX) == false)
|
// Make the NIC appear in the "Local Bridge Settings" list regardless of a NULL character consisted in "FriendlyName".
|
||||||
|
if (IsEmptyStr(tmp) || /* IsEmptyStr(info->FriendlyName) || */ StartWith(tmp, SL_ADAPTER_ID_PREFIX) == false)
|
||||||
{
|
{
|
||||||
// Name is invalid
|
// Name is invalid
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include "Mayaqua/Internat.h"
|
#include "Mayaqua/Internat.h"
|
||||||
#include "Mayaqua/Memory.h"
|
#include "Mayaqua/Memory.h"
|
||||||
#include "Mayaqua/Microsoft.h"
|
#include "Mayaqua/Microsoft.h"
|
||||||
#include "Mayaqua/Network.h"
|
|
||||||
#include "Mayaqua/Object.h"
|
#include "Mayaqua/Object.h"
|
||||||
#include "Mayaqua/OS.h"
|
#include "Mayaqua/OS.h"
|
||||||
#include "Mayaqua/Pack.h"
|
#include "Mayaqua/Pack.h"
|
||||||
@ -6033,15 +6032,6 @@ void SiLoadServerCfg(SERVER *s, FOLDER *f)
|
|||||||
// Disable JSON-RPC Web API
|
// Disable JSON-RPC Web API
|
||||||
s->DisableJsonRpcWebApi = CfgGetBool(f, "DisableJsonRpcWebApi");
|
s->DisableJsonRpcWebApi = CfgGetBool(f, "DisableJsonRpcWebApi");
|
||||||
|
|
||||||
char tmpaddr[MAX_PATH];
|
|
||||||
if (CfgGetStr(f, "JsonRpcWebApiAllowedSubnet", tmpaddr, sizeof(tmpaddr))) {
|
|
||||||
IP _subnet, _mask;
|
|
||||||
if (ParseIpAndMask46(tmpaddr, &_subnet, &_mask)) {
|
|
||||||
s->JsonRpcWebApiAllowedSubnetAddr = _subnet;
|
|
||||||
s->JsonRpcWebApiAllowedSubnetMask = _mask;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bits of Diffie-Hellman parameters
|
// Bits of Diffie-Hellman parameters
|
||||||
c->DhParamBits = CfgGetInt(f, "DhParamBits");
|
c->DhParamBits = CfgGetInt(f, "DhParamBits");
|
||||||
if (c->DhParamBits == 0)
|
if (c->DhParamBits == 0)
|
||||||
@ -6375,11 +6365,6 @@ void SiWriteServerCfg(FOLDER *f, SERVER *s)
|
|||||||
|
|
||||||
// Disable JSON-RPC Web API
|
// Disable JSON-RPC Web API
|
||||||
CfgAddBool(f, "DisableJsonRpcWebApi", s->DisableJsonRpcWebApi);
|
CfgAddBool(f, "DisableJsonRpcWebApi", s->DisableJsonRpcWebApi);
|
||||||
|
|
||||||
char tmpaddr[MAX_PATH];
|
|
||||||
IPAndMaskToStr(tmpaddr, sizeof(tmpaddr),
|
|
||||||
&s->JsonRpcWebApiAllowedSubnetAddr, &s->JsonRpcWebApiAllowedSubnetMask);
|
|
||||||
CfgAddStr(f, "JsonRpcWebApiAllowedSubnet", tmpaddr);
|
|
||||||
}
|
}
|
||||||
Unlock(c->lock);
|
Unlock(c->lock);
|
||||||
}
|
}
|
||||||
|
@ -276,9 +276,6 @@ struct SERVER
|
|||||||
IP ListenIP; // Listen IP
|
IP ListenIP; // Listen IP
|
||||||
bool StrictSyslogDatetimeFormat; // Make syslog datetime format strict RFC3164
|
bool StrictSyslogDatetimeFormat; // Make syslog datetime format strict RFC3164
|
||||||
bool DisableJsonRpcWebApi; // Disable JSON-RPC Web API
|
bool DisableJsonRpcWebApi; // Disable JSON-RPC Web API
|
||||||
|
|
||||||
IP JsonRpcWebApiAllowedSubnetAddr; // If set, allow access to JSON-RPC Web API from
|
|
||||||
IP JsonRpcWebApiAllowedSubnetMask; // this subnet only
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -2124,6 +2124,24 @@ IO *FileOpenEx(char *name, bool write_mode, bool read_lock)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Replace the specified character in the string with a new character
|
||||||
|
wchar_t *UniReplaceCharW(wchar_t *src, UINT size, wchar_t c, wchar_t newc) {
|
||||||
|
if (src == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
for (; *src; src++, size -= sizeof(wchar_t)) {
|
||||||
|
if (size < sizeof(wchar_t)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (*src == c) {
|
||||||
|
*src = newc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (wchar_t *)src;
|
||||||
|
}
|
||||||
|
|
||||||
IO *FileOpenExW(wchar_t *name, bool write_mode, bool read_lock)
|
IO *FileOpenExW(wchar_t *name, bool write_mode, bool read_lock)
|
||||||
{
|
{
|
||||||
wchar_t tmp[MAX_SIZE];
|
wchar_t tmp[MAX_SIZE];
|
||||||
@ -2140,9 +2158,12 @@ IO *FileOpenExW(wchar_t *name, bool write_mode, bool read_lock)
|
|||||||
IO *o = ZeroMalloc(sizeof(IO));
|
IO *o = ZeroMalloc(sizeof(IO));
|
||||||
name++;
|
name++;
|
||||||
UniStrCpy(o->NameW, sizeof(o->NameW), name);
|
UniStrCpy(o->NameW, sizeof(o->NameW), name);
|
||||||
|
#ifdef OS_WIN32
|
||||||
|
UniReplaceCharW(o->NameW, sizeof(o->NameW), L'\\', L'/'); // Path separator "/" is used.
|
||||||
|
#endif // OS_WIN32
|
||||||
UniToStr(o->Name, sizeof(o->Name), o->NameW);
|
UniToStr(o->Name, sizeof(o->Name), o->NameW);
|
||||||
o->HamMode = true;
|
o->HamMode = true;
|
||||||
o->HamBuf = ReadHamcoreW(name);
|
o->HamBuf = ReadHamcoreW(o->NameW);
|
||||||
if (o->HamBuf == NULL)
|
if (o->HamBuf == NULL)
|
||||||
{
|
{
|
||||||
Free(o);
|
Free(o);
|
||||||
|
@ -6986,18 +6986,6 @@ void IPToStr6Inner(char *str, IP *ip)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format IP and subnet mask as "<ip>/<masksize>"
|
|
||||||
void IPAndMaskToStr(char *str, UINT size, IP *ip, IP *subnet)
|
|
||||||
{
|
|
||||||
int iplen;
|
|
||||||
UINT masksize;
|
|
||||||
|
|
||||||
IPToStr(str, size, ip);
|
|
||||||
iplen = StrLen(str);
|
|
||||||
masksize = SubnetMaskToInt(subnet);
|
|
||||||
Format(str + iplen, size - iplen, "/%d", masksize);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert the string to an IP address
|
// Convert the string to an IP address
|
||||||
bool StrToIP6(IP *ip, char *str)
|
bool StrToIP6(IP *ip, char *str)
|
||||||
{
|
{
|
||||||
|
@ -1289,7 +1289,6 @@ void IPToStr6(char *str, UINT size, IP *ip);
|
|||||||
void IP6AddrToStr(char *str, UINT size, IPV6_ADDR *addr);
|
void IP6AddrToStr(char *str, UINT size, IPV6_ADDR *addr);
|
||||||
void IPToStr6Array(char *str, UINT size, UCHAR *bytes);
|
void IPToStr6Array(char *str, UINT size, UCHAR *bytes);
|
||||||
void IPToStr6Inner(char *str, IP *ip);
|
void IPToStr6Inner(char *str, IP *ip);
|
||||||
void IPAndMaskToStr(char *str, UINT size, IP *ip, IP *subnet);
|
|
||||||
void IntToSubnetMask6(IP *ip, UINT i);
|
void IntToSubnetMask6(IP *ip, UINT i);
|
||||||
void IPAnd6(IP *dst, IP *a, IP *b);
|
void IPAnd6(IP *dst, IP *a, IP *b);
|
||||||
void GetAllRouterMulticastAddress6(IP *ip);
|
void GetAllRouterMulticastAddress6(IP *ip);
|
||||||
|
Reference in New Issue
Block a user