1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-12 02:34:59 +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

@ -10239,6 +10239,9 @@ UINT StGetProtoOptions(ADMIN *a, RPC_PROTO_OPTIONS *t)
case PROTO_OPTION_BOOL:
rpc_option->Bool = option->Bool;
break;
case PROTO_OPTION_UINT32:
rpc_option->UInt32 = option->UInt32;
break;
case PROTO_OPTION_STRING:
rpc_option->String = CopyStr(option->String);
break;
@ -10305,6 +10308,9 @@ UINT StSetProtoOptions(ADMIN *a, RPC_PROTO_OPTIONS *t)
case PROTO_OPTION_BOOL:
option->Bool = rpc_option->Bool;
break;
case PROTO_OPTION_UINT32:
option->UInt32 = rpc_option->UInt32;
break;
case PROTO_OPTION_STRING:
Free(option->String);
option->String = CopyStr(rpc_option->String);
@ -12700,6 +12706,9 @@ void InRpcProtoOptions(RPC_PROTO_OPTIONS *t, PACK *p)
case PROTO_OPTION_BOOL:
PackGetDataEx2(p, "Value", &option->Bool, sizeof(option->Bool), i);
break;
case PROTO_OPTION_UINT32:
PackGetDataEx2(p, "Value", &option->UInt32, sizeof(option->UInt32), i);
break;
default:
Debug("InRpcProtoOptions(): unhandled type %u!\n", option->Type);
}
@ -12731,6 +12740,9 @@ void OutRpcProtoOptions(PACK *p, RPC_PROTO_OPTIONS *t)
case PROTO_OPTION_BOOL:
PackAddDataEx(p, "Value", &option->Bool, sizeof(option->Bool), i, t->Num);
break;
case PROTO_OPTION_UINT32:
PackAddDataEx(p, "Value", &option->UInt32, sizeof(option->UInt32), i, t->Num);
break;
default:
Debug("OutRpcProtoOptions(): unhandled type %u!\n", option->Type);
}