Files
DayZ-Epoch/SQF/dayz_server/compile/server_verifySender.sqf
ebayShopper 42e00475d6 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.
2017-11-03 16:09:14 -04:00

33 lines
1.2 KiB
Plaintext

/*
PVEH does not provide any information about the sender in A2, so
this is necessary to verify the sender was not spoofed.
*/
private ["_clientKey","_exitReason","_function","_index","_object","_params","_player","_playerUID"];
_params = _this select 0;
_function = "Server_" + (_this select 1);
_object = _this select 2;
_clientKey = _this select 3;
_playerUID = _this select 4;
_player = _this select 5;
_index = dayz_serverPUIDArray find _playerUID;
_exitReason = switch true do {
//If object or player is null distance returns 9999+
//If object or player was moved with setPos on client, position takes a second to update on server
//Coordinates can be used in place of object
case (_object distance _player > (Z_VehicleDistance + 10)): {
format["%1 error: Verification failed, player is too far from object. PV ARRAY: %2",_function,_params]
};
case (_index < 0): {
format["%1 error: PUID NOT FOUND ON SERVER. PV ARRAY: %2",_function,_params]
};
case (((dayz_serverClientKeys select _index) select 0 != owner _player) or ((dayz_serverClientKeys select _index) select 1 != _clientKey)): {
format["%1 error: CLIENT AUTH KEY INCORRECT OR UNRECOGNIZED. PV ARRAY: %2",_function,_params]
};
default {""};
};
_exitReason