mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-23 01:49:53 +03:00
Merge PR #852: Cedar: retrieve the list of available encryption algorithms from the server
This commit is contained in:
commit
8ec43e7618
@ -456,6 +456,7 @@ PACK *AdminDispatch(RPC *rpc, char *name, PACK *p)
|
|||||||
DECLARE_RPC("GetFarmConnectionStatus", RPC_FARM_CONNECTION_STATUS, StGetFarmConnectionStatus, InRpcFarmConnectionStatus, OutRpcFarmConnectionStatus)
|
DECLARE_RPC("GetFarmConnectionStatus", RPC_FARM_CONNECTION_STATUS, StGetFarmConnectionStatus, InRpcFarmConnectionStatus, OutRpcFarmConnectionStatus)
|
||||||
DECLARE_RPC_EX("SetServerCert", RPC_KEY_PAIR, StSetServerCert, InRpcKeyPair, OutRpcKeyPair, FreeRpcKeyPair)
|
DECLARE_RPC_EX("SetServerCert", RPC_KEY_PAIR, StSetServerCert, InRpcKeyPair, OutRpcKeyPair, FreeRpcKeyPair)
|
||||||
DECLARE_RPC_EX("GetServerCert", RPC_KEY_PAIR, StGetServerCert, InRpcKeyPair, OutRpcKeyPair, FreeRpcKeyPair)
|
DECLARE_RPC_EX("GetServerCert", RPC_KEY_PAIR, StGetServerCert, InRpcKeyPair, OutRpcKeyPair, FreeRpcKeyPair)
|
||||||
|
DECLARE_RPC_EX("GetServerCipherList", RPC_STR, StGetServerCipherList, InRpcStr, OutRpcStr, FreeRpcStr)
|
||||||
DECLARE_RPC_EX("GetServerCipher", RPC_STR, StGetServerCipher, InRpcStr, OutRpcStr, FreeRpcStr)
|
DECLARE_RPC_EX("GetServerCipher", RPC_STR, StGetServerCipher, InRpcStr, OutRpcStr, FreeRpcStr)
|
||||||
DECLARE_RPC_EX("SetServerCipher", RPC_STR, StSetServerCipher, InRpcStr, OutRpcStr, FreeRpcStr)
|
DECLARE_RPC_EX("SetServerCipher", RPC_STR, StSetServerCipher, InRpcStr, OutRpcStr, FreeRpcStr)
|
||||||
DECLARE_RPC("CreateHub", RPC_CREATE_HUB, StCreateHub, InRpcCreateHub, OutRpcCreateHub)
|
DECLARE_RPC("CreateHub", RPC_CREATE_HUB, StCreateHub, InRpcCreateHub, OutRpcCreateHub)
|
||||||
@ -635,6 +636,7 @@ DECLARE_SC_EX("EnumFarmMember", RPC_ENUM_FARM, ScEnumFarmMember, InRpcEnumFarm,
|
|||||||
DECLARE_SC("GetFarmConnectionStatus", RPC_FARM_CONNECTION_STATUS, ScGetFarmConnectionStatus, InRpcFarmConnectionStatus, OutRpcFarmConnectionStatus)
|
DECLARE_SC("GetFarmConnectionStatus", RPC_FARM_CONNECTION_STATUS, ScGetFarmConnectionStatus, InRpcFarmConnectionStatus, OutRpcFarmConnectionStatus)
|
||||||
DECLARE_SC_EX("SetServerCert", RPC_KEY_PAIR, ScSetServerCert, InRpcKeyPair, OutRpcKeyPair, FreeRpcKeyPair)
|
DECLARE_SC_EX("SetServerCert", RPC_KEY_PAIR, ScSetServerCert, InRpcKeyPair, OutRpcKeyPair, FreeRpcKeyPair)
|
||||||
DECLARE_SC_EX("GetServerCert", RPC_KEY_PAIR, ScGetServerCert, InRpcKeyPair, OutRpcKeyPair, FreeRpcKeyPair)
|
DECLARE_SC_EX("GetServerCert", RPC_KEY_PAIR, ScGetServerCert, InRpcKeyPair, OutRpcKeyPair, FreeRpcKeyPair)
|
||||||
|
DECLARE_SC_EX("GetServerCipherList", RPC_STR, ScGetServerCipherList, InRpcStr, OutRpcStr, FreeRpcStr)
|
||||||
DECLARE_SC_EX("GetServerCipher", RPC_STR, ScGetServerCipher, InRpcStr, OutRpcStr, FreeRpcStr)
|
DECLARE_SC_EX("GetServerCipher", RPC_STR, ScGetServerCipher, InRpcStr, OutRpcStr, FreeRpcStr)
|
||||||
DECLARE_SC_EX("SetServerCipher", RPC_STR, ScSetServerCipher, InRpcStr, OutRpcStr, FreeRpcStr)
|
DECLARE_SC_EX("SetServerCipher", RPC_STR, ScSetServerCipher, InRpcStr, OutRpcStr, FreeRpcStr)
|
||||||
DECLARE_SC("CreateHub", RPC_CREATE_HUB, ScCreateHub, InRpcCreateHub, OutRpcCreateHub)
|
DECLARE_SC("CreateHub", RPC_CREATE_HUB, ScCreateHub, InRpcCreateHub, OutRpcCreateHub)
|
||||||
@ -8245,6 +8247,43 @@ UINT StGetServerCipher(ADMIN *a, RPC_STR *t)
|
|||||||
return ERR_NO_ERROR;
|
return ERR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get list of available ciphers for SSL
|
||||||
|
UINT StGetServerCipherList(ADMIN *a, RPC_STR *t)
|
||||||
|
{
|
||||||
|
SERVER *s = a->Server;
|
||||||
|
CEDAR *c = s->Cedar;
|
||||||
|
|
||||||
|
FreeRpcStr(t);
|
||||||
|
Zero(t, sizeof(RPC_STR));
|
||||||
|
|
||||||
|
Lock(c->lock);
|
||||||
|
{
|
||||||
|
UINT i;
|
||||||
|
TOKEN_LIST *ciphers = GetCipherList();
|
||||||
|
if (ciphers->NumTokens > 0)
|
||||||
|
{
|
||||||
|
UINT size = StrSize(ciphers->Token[0]);
|
||||||
|
t->String = Malloc(size);
|
||||||
|
StrCat(t->String, size, ciphers->Token[0]);
|
||||||
|
i = 1;
|
||||||
|
|
||||||
|
for (; i < ciphers->NumTokens; i++)
|
||||||
|
{
|
||||||
|
// We use StrSize() because we need the extra space for ';'
|
||||||
|
size += StrSize(ciphers->Token[i]);
|
||||||
|
t->String = ReAlloc(t->String, size);
|
||||||
|
StrCat(t->String, size, ";");
|
||||||
|
StrCat(t->String, size, ciphers->Token[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FreeToken(ciphers);
|
||||||
|
}
|
||||||
|
Unlock(c->lock);
|
||||||
|
|
||||||
|
return ERR_NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the server certification
|
// Get the server certification
|
||||||
UINT StGetServerCert(ADMIN *a, RPC_KEY_PAIR *t)
|
UINT StGetServerCert(ADMIN *a, RPC_KEY_PAIR *t)
|
||||||
{
|
{
|
||||||
|
@ -1038,6 +1038,7 @@ UINT StEnumFarmMember(ADMIN *a, RPC_ENUM_FARM *t);
|
|||||||
UINT StGetFarmConnectionStatus(ADMIN *a, RPC_FARM_CONNECTION_STATUS *t);
|
UINT StGetFarmConnectionStatus(ADMIN *a, RPC_FARM_CONNECTION_STATUS *t);
|
||||||
UINT StSetServerCert(ADMIN *a, RPC_KEY_PAIR *t);
|
UINT StSetServerCert(ADMIN *a, RPC_KEY_PAIR *t);
|
||||||
UINT StGetServerCert(ADMIN *a, RPC_KEY_PAIR *t);
|
UINT StGetServerCert(ADMIN *a, RPC_KEY_PAIR *t);
|
||||||
|
UINT StGetServerCipherList(ADMIN *a, RPC_STR *t);
|
||||||
UINT StGetServerCipher(ADMIN *a, RPC_STR *t);
|
UINT StGetServerCipher(ADMIN *a, RPC_STR *t);
|
||||||
UINT StSetServerCipher(ADMIN *a, RPC_STR *t);
|
UINT StSetServerCipher(ADMIN *a, RPC_STR *t);
|
||||||
UINT StCreateHub(ADMIN *a, RPC_CREATE_HUB *t);
|
UINT StCreateHub(ADMIN *a, RPC_CREATE_HUB *t);
|
||||||
@ -1181,6 +1182,7 @@ UINT ScEnumFarmMember(RPC *r, RPC_ENUM_FARM *t);
|
|||||||
UINT ScGetFarmConnectionStatus(RPC *r, RPC_FARM_CONNECTION_STATUS *t);
|
UINT ScGetFarmConnectionStatus(RPC *r, RPC_FARM_CONNECTION_STATUS *t);
|
||||||
UINT ScSetServerCert(RPC *r, RPC_KEY_PAIR *t);
|
UINT ScSetServerCert(RPC *r, RPC_KEY_PAIR *t);
|
||||||
UINT ScGetServerCert(RPC *r, RPC_KEY_PAIR *t);
|
UINT ScGetServerCert(RPC *r, RPC_KEY_PAIR *t);
|
||||||
|
UINT ScGetServerCipherList(RPC *r, RPC_STR *t);
|
||||||
UINT ScGetServerCipher(RPC *r, RPC_STR *t);
|
UINT ScGetServerCipher(RPC *r, RPC_STR *t);
|
||||||
UINT ScSetServerCipher(RPC *r, RPC_STR *t);
|
UINT ScSetServerCipher(RPC *r, RPC_STR *t);
|
||||||
UINT ScCreateHub(RPC *r, RPC_CREATE_HUB *t);
|
UINT ScCreateHub(RPC *r, RPC_CREATE_HUB *t);
|
||||||
|
@ -8834,25 +8834,32 @@ UINT PsServerCipherGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ciphers = GetCipherList();
|
UniFormat(tmp, sizeof(tmp), L" %S", t.String);
|
||||||
|
FreeRpcStr(&t);
|
||||||
|
Zero(&t, sizeof(RPC_STR));
|
||||||
|
|
||||||
c->Write(c, _UU("CMD_ServerCipherGet_SERVER"));
|
c->Write(c, _UU("CMD_ServerCipherGet_SERVER"));
|
||||||
|
|
||||||
UniFormat(tmp, sizeof(tmp), L" %S", t.String);
|
|
||||||
c->Write(c, tmp);
|
c->Write(c, tmp);
|
||||||
|
|
||||||
|
ret = ScGetServerCipherList(ps->Rpc, &t);
|
||||||
|
|
||||||
|
if (ret == ERR_NO_ERROR)
|
||||||
|
{
|
||||||
|
ciphers = ParseToken(t.String, ";");
|
||||||
|
|
||||||
|
FreeRpcStr(&t);
|
||||||
|
|
||||||
c->Write(c, L"");
|
c->Write(c, L"");
|
||||||
c->Write(c, _UU("CMD_ServerCipherGet_CIPHERS"));
|
c->Write(c, _UU("CMD_ServerCipherGet_CIPHERS"));
|
||||||
|
|
||||||
for (i = 0;i < ciphers->NumTokens;i++)
|
for (i = 0; i < ciphers->NumTokens; i++)
|
||||||
{
|
{
|
||||||
UniFormat(tmp, sizeof(tmp), L" %S", ciphers->Token[i]);
|
UniFormat(tmp, sizeof(tmp), L" %S", ciphers->Token[i]);
|
||||||
c->Write(c, tmp);
|
c->Write(c, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeToken(ciphers);
|
FreeToken(ciphers);
|
||||||
|
}
|
||||||
FreeRpcStr(&t);
|
|
||||||
|
|
||||||
FreeParamValueList(o);
|
FreeParamValueList(o);
|
||||||
|
|
||||||
|
@ -17018,24 +17018,34 @@ void SmSslDlgInit(HWND hWnd, SM_SSL *s)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the encryption algorithm list
|
if (s->p != NULL)
|
||||||
cipher_list = GetCipherList();
|
{
|
||||||
|
RPC_STR t;
|
||||||
|
Zero(&t, sizeof(t));
|
||||||
|
|
||||||
SetFont(hWnd, C_CIPHER, GetFont("Tahoma", 8, false, false, false, false));
|
SetFont(hWnd, C_CIPHER, GetFont("Tahoma", 8, false, false, false, false));
|
||||||
CbSetHeight(hWnd, C_CIPHER, 18);
|
CbSetHeight(hWnd, C_CIPHER, 18);
|
||||||
for (i = 0;i < cipher_list->NumTokens;i++)
|
|
||||||
|
// Get the list of available encryption algorithms from the server
|
||||||
|
if (ScGetServerCipherList(s->p->Rpc, &t) == ERR_NO_ERROR)
|
||||||
|
{
|
||||||
|
cipher_list = ParseToken(t.String, ";");
|
||||||
|
|
||||||
|
FreeRpcStr(&t);
|
||||||
|
Zero(&t, sizeof(t));
|
||||||
|
|
||||||
|
for (i = 0; i < cipher_list->NumTokens; i++)
|
||||||
{
|
{
|
||||||
wchar_t tmp[MAX_SIZE];
|
wchar_t tmp[MAX_SIZE];
|
||||||
char *name = cipher_list->Token[i];
|
char *name = cipher_list->Token[i];
|
||||||
StrToUni(tmp, sizeof(tmp), name);
|
StrToUni(tmp, sizeof(tmp), name);
|
||||||
CbAddStr(hWnd, C_CIPHER, tmp, 0);
|
CbAddStr(hWnd, C_CIPHER, tmp, 0);
|
||||||
}
|
}
|
||||||
FreeToken(cipher_list);
|
|
||||||
|
|
||||||
if (s->p != NULL)
|
FreeToken(cipher_list);
|
||||||
{
|
}
|
||||||
// Get the encryption algorithm name from the server
|
|
||||||
RPC_STR t;
|
// Get the current encryption algorithm's name from the server
|
||||||
Zero(&t, sizeof(t));
|
|
||||||
if (CALL(hWnd, ScGetServerCipher(s->p->Rpc, &t)))
|
if (CALL(hWnd, ScGetServerCipher(s->p->Rpc, &t)))
|
||||||
{
|
{
|
||||||
wchar_t tmp[MAX_SIZE];
|
wchar_t tmp[MAX_SIZE];
|
||||||
|
@ -16602,7 +16602,8 @@ TOKEN_LIST *GetCipherList()
|
|||||||
|
|
||||||
ciphers->NumTokens++;
|
ciphers->NumTokens++;
|
||||||
|
|
||||||
if (ciphers->Token != NULL) {
|
if (ciphers->Token != NULL)
|
||||||
|
{
|
||||||
ciphers->Token = ReAlloc(ciphers->Token, sizeof(char *) * ciphers->NumTokens);
|
ciphers->Token = ReAlloc(ciphers->Token, sizeof(char *) * ciphers->NumTokens);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user