1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2026-02-03 17:20:10 +03:00

Cedar: Add support for 32 bit unsigned integer Proto options

This commit also fixes a bug which caused the server to initialize all boolean options to false.

It was caused by SiLoadProtoCfg() not checking whether the item exists in the configuration file.

CfgGetBool() always returns false if the item doesn't exist.
This commit is contained in:
Davide Beatrici
2021-04-21 08:12:45 +02:00
parent 6a25ccfa28
commit 4b05de1a93
5 changed files with 44 additions and 7 deletions

View File

@ -6362,11 +6362,19 @@ void SiLoadProtoCfg(PROTO *p, FOLDER *f)
for (j = 0; j < LIST_NUM(options); ++j)
{
PROTO_OPTION *option = LIST_DATA(options, j);
if (CfgIsItem(ff, option->Name) == false)
{
continue;
}
switch (option->Type)
{
case PROTO_OPTION_BOOL:
option->Bool = CfgGetBool(ff, option->Name);
break;
case PROTO_OPTION_UINT32:
option->UInt32 = CfgGetInt(ff, option->Name);
break;
case PROTO_OPTION_STRING:
{
UINT size;
@ -6414,11 +6422,14 @@ void SiWriteProtoCfg(FOLDER *f, PROTO *p)
const PROTO_OPTION *option = LIST_DATA(options, j);
switch (option->Type)
{
case PROTO_OPTION_STRING:
CfgAddStr(ff, option->Name, option->String);
break;
case PROTO_OPTION_BOOL:
CfgAddBool(ff, option->Name, option->Bool);
break;
case PROTO_OPTION_STRING:
CfgAddStr(ff, option->Name, option->String);
case PROTO_OPTION_UINT32:
CfgAddInt(ff, option->Name, option->UInt32);
break;
default:
Debug("SiWriteProtoCfg(): unhandled option type %u!\n", option->Type);