Add sender verification to publish and swap object

Continuation of 8035df0

This is important to have on publish to identify cheaters who spam
create objects in the database or create objects with bad inventory.

- Renamed variables to backport to vanilla
- Removed % and & due to code filtering in publicvariableval.txt

Changes in modular_build.sqf were the same as player_build.sqf.

Tested with building, upgrading buildable/vehicle/tent, downgrading,
buying a vehicle, destroying tent and removing an object.
This commit is contained in:
ebayShopper
2017-11-03 16:09:14 -04:00
parent 6e48434001
commit 42e00475d6
41 changed files with 154 additions and 109 deletions

View File

@@ -1,8 +1,8 @@
/*
[_objectID,_objectUID,_activatingPlayer,_object,DZE_AuthKey] call server_deleteObj;
[_objectID,_objectUID,_activatingPlayer,_object,dayz_authKey] call server_deleteObj;
For PV calls from the client use this function, otherwise if calling directly from the server use server_deleteObjDirect
*/
private["_id","_uid","_key","_activatingPlayer","_object","_clientKey","_PlayerUID","_PUIDIndex","_processDelete"];
private["_id","_uid","_key","_activatingPlayer","_object","_clientKey","_exitReason","_PlayerUID","_processDelete"];
if (count _this < 5) exitWith {diag_log "Server_DeleteObj error: Improper parameter format";};
_id = _this select 0;
@@ -12,11 +12,9 @@ _object = _this select 3;
_clientKey = _this select 4;
_processDelete = if (count _this > 5) then {_this select 5} else {true};
_PlayerUID = getPlayerUID _activatingPlayer;
_PUIDIndex = DZE_ServerPUIDArray find _PlayerUID;
if (_object distance _activatingPlayer > (Z_VehicleDistance + 10)) exitWith {diag_log format["Server_DeleteObj error: Delete verification failed, referenced player is too far away from object. PV ARRAY: %1", _this];};
if (_PUIDIndex < 0) exitWith {diag_log format["Server_DeleteObj error: PUID NOT FOUND ON SERVER. PV ARRAY: %1", _this];};
if ((((DZE_ServerClientKeys select _PUIDIndex) select 0) != (owner _activatingPlayer)) || (((DZE_ServerClientKeys select _PUIDIndex) select 1) != _clientKey)) exitWith {diag_log format["Server_DeleteObj error: CLIENT AUTH KEY INCORRECT OR UNRECOGNIZED. PV ARRAY: %1", _this];};
_exitReason = [_this,"DeleteObj",_object,_clientKey,_PlayerUID,_activatingPlayer] call server_verifySender;
if (_exitReason != "") exitWith {diag_log _exitReason};
if (isServer) then {
if (_processDelete) then {deleteVehicle _object};
@@ -25,11 +23,11 @@ if (isServer) then {
//Send request
_key = format["CHILD:304:%1:",_id];
_key call server_hiveWrite;
diag_log format["DELETE: Player %1 with Player UID %2 deleted object with ID: %3",_activatingPlayer, _PlayerUID, _id];
diag_log format["DELETE: Player %1(%2) deleted object with ID: %3",_activatingPlayer, _PlayerUID, _id];
} else {
//Send request
_key = format["CHILD:310:%1:",_uid];
_key call server_hiveWrite;
diag_log format["DELETE: Player %1 with Player UID %2 deleted object with UID: %3",_activatingPlayer, _PlayerUID, _uid];
diag_log format["DELETE: Player %1(%2) deleted object with UID: %3",_activatingPlayer, _PlayerUID, _uid];
};
};