1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 09:29:52 +03:00

Cedar/SM.c: move UDP ports setting outside of the OpenVPN/SSTP dialog

This commit moves the UDP ports setting right below the TCP listeners and uses the new RPC methods to get and set them.
This commit is contained in:
Davide Beatrici 2020-05-20 04:41:18 +02:00
parent c52e49de2d
commit c4838006b1
10 changed files with 105 additions and 62 deletions

View File

@ -1072,7 +1072,6 @@ UINT SmOpenVpnDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param
switch (LOWORD(wParam))
{
case R_OPENVPN:
case E_UDP:
case R_SSTP:
SmOpenVpnDlgUpdate(hWnd, s);
break;
@ -1084,12 +1083,6 @@ UINT SmOpenVpnDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param
SmOpenVpnDlgOnOk(hWnd, s, false);
break;
case B_DEFAULT:
ToStr(tmp, OPENVPN_UDP_PORT);
SetTextA(hWnd, E_UDP, tmp);
FocusEx(hWnd, E_UDP);
break;
case B_CONFIG:
// Create an OpenVPN configuration
{
@ -1198,13 +1191,11 @@ void SmOpenVpnDlgInit(HWND hWnd, SM_SERVER *s)
}
Check(hWnd, R_OPENVPN, t.EnableOpenVPN);
SetTextA(hWnd, E_UDP, t.OpenVPNPortList);
Check(hWnd, R_SSTP, t.EnableSSTP);
SetIcon(hWnd, 0, ICO_OPENVPN);
DlgFont(hWnd, S_TITLE, 14, true);
SetFont(hWnd, E_UDP, GetFont("Verdana", 10, false, false, false, false));
DlgFont(hWnd, R_OPENVPN, 0, true);
DlgFont(hWnd, S_TOOL, 11, true);
@ -1224,10 +1215,6 @@ void SmOpenVpnDlgUpdate(HWND hWnd, SM_SERVER *s)
b1 = IsChecked(hWnd, R_OPENVPN);
b2 = IsChecked(hWnd, R_SSTP);
SetEnable(hWnd, S_UDP, b1);
SetEnable(hWnd, E_UDP, b1);
SetEnable(hWnd, B_DEFAULT, b1);
SetEnable(hWnd, S_UDP2, b1);
SetEnable(hWnd, S_TOOL, b1);
SetEnable(hWnd, S_TOOL2, b1);
SetEnable(hWnd, B_CONFIG, b1);
@ -1246,7 +1233,6 @@ void SmOpenVpnDlgOnOk(HWND hWnd, SM_SERVER *s, bool no_close)
Zero(&t, sizeof(t));
t.EnableOpenVPN = IsChecked(hWnd, R_OPENVPN);
GetTxtA(hWnd, E_UDP, t.OpenVPNPortList, sizeof(t.OpenVPNPortList));
t.EnableSSTP = IsChecked(hWnd, R_SSTP);
if (CALL(hWnd, ScSetOpenVpnSstpConfig(s->Rpc, &t)) == false)
@ -18272,6 +18258,7 @@ void SmServerDlgRefresh(HWND hWnd, SM_SERVER *p)
{
RPC_ENUM_HUB t;
RPC_LISTENER_LIST t2;
RPC_PORTS t3;
DDNS_CLIENT_STATUS st;
RPC_AZURE_STATUS sta;
UINT i;
@ -18389,6 +18376,32 @@ void SmServerDlgRefresh(HWND hWnd, SM_SERVER *p)
FreeRpcListenerList(&t2);
}
// Get the UDP ports
Zero(&t3, sizeof(RPC_PORTS));
if (CALL(hWnd, ScGetPortsUDP(p->Rpc, &t3)))
{
char str[MAX_SIZE];
Zero(str, sizeof(str));
if (t3.Num > 0)
{
UINT i;
Format(str, sizeof(str), "%u", t3.Ports[0]);
for (i = 1; i < t3.Num; ++i)
{
char tmp[MAX_SIZE];
Format(tmp, sizeof(tmp), ", %u", t3.Ports[i]);
StrCat(str, sizeof(str), tmp);
}
}
SetTextA(hWnd, E_UDP, str);
FreeRpcPorts(&t3);
}
// Get the DDNS client state
Zero(&st, sizeof(st));
if (ScGetDDnsClientStatus(p->Rpc, &st) == ERR_NO_ERROR && IsEmptyStr(st.CurrentFqdn) == false)
@ -18664,6 +18677,45 @@ UINT SmServerDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *pa
}
break;
case B_APPLY:
{
// Apply UDP ports
bool ret;
LIST* ports;
RPC_PORTS t;
char tmp[MAX_SIZE];
GetTxtA(hWnd, E_UDP, tmp, sizeof(tmp));
ports = StrToPortList(tmp, false);
t.Num = LIST_NUM(ports);
if (t.Num > 0)
{
UINT i;
t.Ports = Malloc(sizeof(UINT) * t.Num);
for (i = 0; i < t.Num; ++i)
{
t.Ports[i] = (UINT)LIST_DATA(ports, i);
}
}
else
{
t.Ports = NULL;
}
ReleaseList(ports);
if (CALL(hWnd, ScSetPortsUDP(p->Rpc, &t)))
{
SmServerDlgRefresh(hWnd, p);
}
Free(t.Ports);
break;
}
case B_SSL:
// SSL related
SmSslDlg(hWnd, p);

View File

@ -995,7 +995,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 420
TOPMARGIN, 5
BOTTOMMARGIN, 326
BOTTOMMARGIN, 303
END
D_SM_DDNS, DIALOG
@ -1908,11 +1908,11 @@ BEGIN
PUSHBUTTON "@B_DELETE",B_DELETE,385,129,39,16
GROUPBOX "@STATIC1",IDC_STATIC,7,149,176,106
LTEXT "@STATIC2",IDC_STATIC,14,160,108,9
CONTROL "",L_LISTENER,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,14,173,109,76
PUSHBUTTON "@B_CREATE_LISTENER",B_CREATE_LISTENER,128,170,48,16
PUSHBUTTON "@B_DELETE_LISTENER",B_DELETE_LISTENER,128,191,48,16
PUSHBUTTON "@B_START",B_START,128,211,48,16
PUSHBUTTON "@B_STOP",B_STOP,128,232,48,16
CONTROL "",L_LISTENER,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,14,172,109,48
PUSHBUTTON "@B_CREATE_LISTENER",B_CREATE_LISTENER,128,172,48,12
PUSHBUTTON "@B_DELETE_LISTENER",B_DELETE_LISTENER,128,184,48,12
PUSHBUTTON "@B_START",B_START,128,196,48,12
PUSHBUTTON "@B_STOP",B_STOP,128,208,48,12
GROUPBOX "@STATIC3",IDC_STATIC,187,149,245,106
ICON ICO_KEY,IDC_STATIC,194,161,20,18
PUSHBUTTON "@B_SSL",B_SSL,218,163,100,16
@ -1951,6 +1951,9 @@ BEGIN
PUSHBUTTON "@B_REFRESH",B_REFRESH,307,281,71,16
PUSHBUTTON "@IDCANCEL",IDCANCEL,381,281,50,16
ICON ICO_AZURE,IDC_STATIC,108,281,20,18
EDITTEXT E_UDP,14,224,109,12,ES_AUTOHSCROLL
LTEXT "@S_UDP",S_UDP,14,238,162,16
PUSHBUTTON "@B_APPLY",B_APPLY,128,224,48,12
END
D_SM_STATUS DIALOGEX 0, 0, 335, 250
@ -4066,34 +4069,30 @@ BEGIN
LTEXT "@S07",IDC_STATIC,88,51,154,55
END
D_SM_OPENVPN DIALOGEX 0, 0, 427, 331
D_SM_OPENVPN DIALOGEX 0, 0, 427, 308
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "@D_SM_OPENVPN"
FONT 9, "MS Shell Dlg", 400, 0, 0x80
BEGIN
ICON ICO_OPENVPN,IDC_STATIC,7,5,20,18
LTEXT "@S_TITLE",S_TITLE,32,6,385,16
GROUPBOX "@S_13",IDC_STATIC,8,26,409,173
GROUPBOX "@S_13",IDC_STATIC,7,26,409,142
LTEXT "@S_1",IDC_STATIC,15,36,195,37
CONTROL 205,IDC_STATIC,"Static",SS_BITMAP,217,35,194,75
CONTROL "@R_OPENVPN",R_OPENVPN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,75,194,9
LTEXT "@S_UDP",S_UDP,25,87,186,9
EDITTEXT E_UDP,25,96,127,13,ES_AUTOHSCROLL
PUSHBUTTON "@B_DEFAULT",B_DEFAULT,159,95,52,15
LTEXT "@S_UDP2",S_UDP2,26,113,383,24
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,138,395,1
LTEXT "@S_TOOL",S_TOOL,15,143,392,12
LTEXT "@S_TOOL2",S_TOOL2,24,157,385,22
PUSHBUTTON "@B_CONFIG",B_CONFIG,120,177,189,15
GROUPBOX "@S_2",IDC_STATIC,7,202,409,98
LTEXT "@S_3",IDC_STATIC,14,212,195,37
CONTROL 206,IDC_STATIC,"Static",SS_BITMAP,215,209,194,85
CONTROL "@R_SSTP",R_SSTP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,252,194,9
LTEXT "@S_SSTP",S_SSTP,21,265,188,33
LTEXT "@S_4",IDC_STATIC,7,302,186,24
PUSHBUTTON "@B_IPSEC",B_IPSEC,195,311,93,15
DEFPUSHBUTTON "@IDOK",IDOK,311,311,52,14
PUSHBUTTON "@IDCANCEL",IDCANCEL,368,311,52,14
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,14,107,395,1
LTEXT "@S_TOOL",S_TOOL,15,112,392,12
LTEXT "@S_TOOL2",S_TOOL2,24,126,385,22
PUSHBUTTON "@B_CONFIG",B_CONFIG,120,146,189,15
GROUPBOX "@S_2",IDC_STATIC,7,175,409,98
LTEXT "@S_3",IDC_STATIC,14,185,195,37
CONTROL 206,IDC_STATIC,"Static",SS_BITMAP,215,182,194,85
CONTROL "@R_SSTP",R_SSTP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,225,194,9
LTEXT "@S_SSTP",S_SSTP,21,238,188,33
LTEXT "@S_4",IDC_STATIC,7,279,186,24
PUSHBUTTON "@B_IPSEC",B_IPSEC,195,288,93,15
DEFPUSHBUTTON "@IDOK",IDOK,311,288,52,14
PUSHBUTTON "@IDCANCEL",IDCANCEL,368,288,52,14
END
D_SM_DDNS DIALOGEX 0, 0, 415, 287

View File

@ -396,7 +396,6 @@
#define B_IPSEC 1096
#define S_INFO 1097
#define B_OPENVPN 1097
#define B_DEFAULT 1097
#define S_PORT 1098
#define B_BRIDGE2 1098
#define B_DDNS 1098
@ -960,7 +959,7 @@
#define S_WIN8 1457
#define R_OPENVPN 1458
#define S_UDP 1459
#define S_UDP2 1460
#define B_APPLY 1460
#define S_TOOL 1461
#define S_TOOL2 1462
#define R_SSTP 1463

View File

@ -2576,6 +2576,8 @@ B_CREATE_LISTENER 创建(&R)
B_DELETE_LISTENER 删除(&T)
B_START 开始(&G)
B_STOP 停止(&P)
S_UDP Multiple UDP ports can be specified by splitting them with a space or a comma. Leave empty to disable the UDP listener.
B_APPLY Apply
STATIC3 VPN Server 和网络信息和设置(&N)
B_SSL 加密与网络(&E)
B_STATUS 查看服务器状态(&V)
@ -3883,9 +3885,6 @@ CAPTION OpenVPN / MS-SSTP 设置
S_TITLE OpenVPN / MS-SSTP VPN 克隆 Server 功能设置
S_1 本 VPN Server 具有 OpenVPN 技术责任有限公司的 OpenVPN 软件产品的克隆功能。\r\n\r\n任何 OpenVPN Client 都可以连接到此 VPN Server。
R_OPENVPN 启用 OpenVPN 克隆 Server 功能(&O)
S_UDP 监听 OpenVPN 的 UDP 端口:
B_DEFAULT 恢复默认值(&D)
S_UDP2 多重 UDP 端口可以用空格或者逗号隔开的字母来指定。 \r\nOpenVPN Server 功能也可以在 TCP 端口上运行。任何在 VPN Server 上被定义为监听端的 TCP 端口都可以平等的、分别的接受 OpenVPN 协议。
S_TOOL OpenVPN Client 的示例文件生成工具
S_TOOL2 创建一个 OpenVPN Client 配置是一项艰难的工作。您可以使用此工具来生成一个合适的 OpenVPN Client 配置文件。生成的配置示例文件可马上应用。本来OpenVPN Client 会要求客户手写一个很难的配置文件。这个工具就可以帮助您创建一个有用的配置样本。您所需要为 OpenVPN Client 生成的配置文件就是点击以下按钮。
B_CONFIG 为 OpenVPN Client 生成配置样本文件(&C)

View File

@ -2555,6 +2555,8 @@ B_CREATE_LISTENER C&reate
B_DELETE_LISTENER Dele&te
B_START Start
B_STOP Sto&p
S_UDP Multiple UDP ports can be specified by splitting them with a space or a comma. Leave empty to disable the UDP listener.
B_APPLY Apply
STATIC3 VPN Server and &Network Information and Settings:
B_SSL &Encryption and Network
B_STATUS &View Server Status
@ -3866,9 +3868,6 @@ CAPTION OpenVPN / MS-SSTP Settings
S_TITLE OpenVPN / MS-SSTP VPN Clone Server Function Settings
S_1 This VPN Server has the clone functions of OpenVPN software products by OpenVPN Technologies, Inc.\r\n\r\nAny OpenVPN Clients can connect to this VPN Server.
R_OPENVPN Enable &OpenVPN Clone Server Function
S_UDP UDP Ports to Listen for OpenVPN:
B_DEFAULT Restore &Default
S_UDP2 Multiple UDP ports can be specified with splitting by space or comma letters.\r\nOpenVPN Server Function also runs on TCP ports. Any TCP ports which are defined as listeners on the VPN Server accepts OpenVPN Protocol respectively and equally.
S_TOOL Sample File Generating Tool for OpenVPN Clients
S_TOOL2 Making a OpenVPN Client configuration file is a very difficult job. You can use this tool to generate an appropriate OpenVPN Client configuration file. The generated configuration sample can be used immediately.
B_CONFIG Generate a Sample &Configuration File for OpenVPN Clients

View File

@ -2560,6 +2560,8 @@ B_CREATE_LISTENER 新規作成(&R)
B_DELETE_LISTENER 削除(&T)
B_START 開始(&G)
B_STOP 停止(&P)
S_UDP 複数の UDP ポートを指定するには、スペースかカンマで区切ってください。空欄にすると UDP リスナーを停止します。
B_APPLY 適用
STATIC3 サーバー情報の参照および設定(&N)
B_SSL 暗号化と通信関係の設定(&W)
B_STATUS サーバー状態の表示(&V)
@ -3871,9 +3873,6 @@ CAPTION OpenVPN / MS-SSTP 設定
S_TITLE OpenVPN / MS-SSTP VPN サーバー機能設定
S_1 OpenVPN 社の OpenVPN ソフトウェア製品と同等の VPN サーバー機能を搭載しています。\r\n\r\nOpenVPN クライアントからこの VPN Server に接続できます。
R_OPENVPN &OpenVPN サーバー機能を有効にする
S_UDP OpenVPN サービスを提供する &UDP ポート:
B_DEFAULT 標準に戻す(&D)
S_UDP2 UDP ポートは複数指定できます。複数指定する場合はスペースまたはカンマで区切ってください。\r\nOpenVPN サーバー機能は TCP ポートでも有効になります。この場合、この VPN Server に現在作成されているすべての TCP リスナポートで OpenVPN プロトコルがサポートされます。
S_TOOL OpenVPN クライアント用サンプル設定ファイル自動作成ツール
S_TOOL2 本来、OpenVPN クライアントを使うためには設定ファイルを手動で記述する必要があり、これは難易度が高い作業です。しかし、以下のボタンをクリックするだけでこの VPN Server に接続することができる基本的な OpenVPN クライアント用の設定ファイルを自動的に生成することができます。
B_CONFIG OpenVPN クライアント用のサンプル設定ファイルを生成(&C)

View File

@ -2538,6 +2538,8 @@ B_CREATE_LISTENER 새로 만들기 (&R)
B_DELETE_LISTENER 삭제 (&T)
B_START 시작 (&G)
B_STOP 정지 (&P)
S_UDP Multiple UDP ports can be specified by splitting them with a space or a comma. Leave empty to disable the UDP listener.
B_APPLY Apply
STATIC3 서버 정보의 확인 및 설정 (&N)
B_SSL 암호화 및 통신 관계의 설정 (&W)
B_STATUS 서버 상태보기 (&V)
@ -3849,9 +3851,6 @@ CAPTION OpenVPN/MS-SSTP 설정
S_TITLE OpenVPN/MS-SSTP VPN 서버 기능 설정
S_1 OpenVPN 사의 OpenVPN 소프트웨어 제품과 동일한 VPN 서버 기능을 탑재하고 있습니다. \r\n\r\nOpenVPN 클라이언트에서이 VPN Server에 연결할 수 있습니다.
R_OPENVPN & OpenVPN 서버 기능을 활성화하려면
S_UDP OpenVPN 서비스를 제공 및 UDP 포트:
B_DEFAULT 기본값 복원 (&D)
S_UDP2 UDP 포트는 여러 지정할 수 있습니다. 복수 지정하려면 공백 또는 쉼표로 구분하십시오. \r\nOpenVPN 서버 기능은 TCP 포트에서도 사용할 수 있습니다. 이 경우 VPN Server에 현재 생성되어있는 모든 TCP 리스너 포트에서 OpenVPN 프로토콜이 지원됩니다.
S_TOOL OpenVPN 클라이언트 샘플 설정 파일 자동 생성 도구
S_TOOL2 원래 OpenVPN 클라이언트를 사용하기 위해서는 설정 파일을 수동으로 작성해야하며 이것은 난이도가 높은 작업입니다. 그러나 다음 버튼을 클릭하면이 VPN Server에 연결할 수있는 기본적인 OpenVPN 클라이언트의 설정 파일을 자동으로 생성 할 수 있습니다.
B_CONFIG OpenVPN 클라이언트의 샘플 구성 파일을 생성 (&C)

View File

@ -2504,6 +2504,8 @@ B_CREATE_LISTENER C&riar
B_DELETE_LISTENER Exclui&r
B_START Iniciar
B_STOP Para&r
S_UDP Multiple UDP ports can be specified by splitting them with a space or a comma. Leave empty to disable the UDP listener.
B_APPLY Apply
STATIC3 Informações e configurações do servidor VPN e da rede:
B_SSL Criptografia e &rede
B_STATUS &Ver status do servidor
@ -3641,9 +3643,6 @@ CAPTION OpenVPN / MS-SSTP Settings
S_TITLE OpenVPN / MS-SSTP VPN Clone Server Function Settings
S_1 This VPN Server has the clone functions of OpenVPN software products by OpenVPN Technologies, Inc.\r\n\r\nAny OpenVPN Clients can connect to this VPN Server.
R_OPENVPN Ativar função OpenVPN Clone Server
S_UDP UDP Ports to Listen for OpenVPN:
B_DEFAULT Restore &Default
S_UDP2 Multiple UDP ports can be specified with splitting by space or comma letters.\r\nOpenVPN Server Function also runs on TCP ports. Any TCP ports which are defined as listeners on the VPN Server accepts OpenVPN Protocol respectively and equally.
S_TOOL Sample File Generating Tool for OpenVPN Clients
S_TOOL2 Making a OpenVPN Client configuration file is a very difficult job. You can use this tool to generate an appropriate OpenVPN Client configuration file. The generated configuration sample can be used immediately.
B_CONFIG Generate a Sample &Configuration File for OpenVPN Clients

View File

@ -2556,6 +2556,8 @@ B_CREATE_LISTENER C&reate
B_DELETE_LISTENER Dele&te
B_START Start
B_STOP Sto&p
S_UDP Multiple UDP ports can be specified by splitting them with a space or a comma. Leave empty to disable the UDP listener.
B_APPLY Apply
STATIC3 VPN Server and &Network Information and Settings:
B_SSL &Encryption and Network
B_STATUS &View Server Status
@ -3867,9 +3869,6 @@ CAPTION OpenVPN / MS-SSTP Settings
S_TITLE OpenVPN / MS-SSTP VPN Clone Server Function Settings
S_1 This VPN Server has the clone functions of OpenVPN software products by OpenVPN Technologies, Inc.\r\n\r\nAny OpenVPN Clients can connect to this VPN Server.
R_OPENVPN Enable &OpenVPN Clone Server Function
S_UDP UDP Ports to Listen for OpenVPN:
B_DEFAULT Restore &Default
S_UDP2 Multiple UDP ports can be specified with splitting by space or comma letters.\r\nOpenVPN Server Function also runs on TCP ports. Any TCP ports which are defined as listeners on the VPN Server accepts OpenVPN Protocol respectively and equally.
S_TOOL Sample File Generating Tool for OpenVPN Clients
S_TOOL2 Making a OpenVPN Client configuration file is a very difficult job. You can use this tool to generate an appropriate OpenVPN Client configuration file. The generated configuration sample can be used immediately.
B_CONFIG Generate a Sample &Configuration File for OpenVPN Clients

View File

@ -2578,6 +2578,8 @@ B_CREATE_LISTENER 創建(&R)
B_DELETE_LISTENER 刪除(&T)
B_START 開始(&G)
B_STOP 停止(&P)
S_UDP Multiple UDP ports can be specified by splitting them with a space or a comma. Leave empty to disable the UDP listener.
B_APPLY Apply
STATIC3 VPN Server 和網路資訊和設置(&N)
B_SSL 加密與網路(&E)
B_STATUS 查看伺服器狀態(&V)
@ -3884,9 +3886,6 @@ CAPTION OpenVPN / MS-SSTP 設置
S_TITLE OpenVPN / MS-SSTP VPN 克隆 Server 功能設置
S_1 本 VPN Server 具有 OpenVPN 技術責任有限公司的 OpenVPN 軟體產品的克隆功能。\r\n\r\n任何 OpenVPN Client 都可以連接到此 VPN Server。
R_OPENVPN 啟用 OpenVPN 克隆 Server 功能(&O)
S_UDP 監聽 OpenVPN 的 UDP 埠:
B_DEFAULT 恢復預設值(&D)
S_UDP2 多重 UDP 埠可以用空格或者逗號隔開的字母來指定。 \r\nOpenVPN Server 功能也可以在 TCP 埠上運行。任何在 VPN Server 上被定義為監聽端的 TCP 埠都可以平等的、分別的接受 OpenVPN 協議。
S_TOOL OpenVPN Client 的示例文件生成工具
S_TOOL2 創建一個 OpenVPN Client 配置是一項艱難的工作。您可以使用此工具來生成一個合適的 OpenVPN Client 設定檔。生成的配置示例檔可馬上應用。本來OpenVPN Client 會要求客戶手寫一個很難的設定檔。這個工具就可以説明您創建一個有用的配置樣本。您所需要為 OpenVPN Client 生成的設定檔就是點擊以下按鈕。
B_CONFIG 為 OpenVPN Client 生成配置樣本檔(&C)