WickedShell / echelon

http://echelon.bigbrotherbot.net
14 stars 7 forks source link

GUID Invalid #44

Closed FrikFry closed 12 years ago

FrikFry commented 12 years ago

Everyone with cod servers is getting this issue because the guid checker does not have cases for cod1-7. This ought to resolve it:

function guidCheck($game, $guid) { switch($game) { case 'q3a': return preg_match('/^[A-F0-9]{32}$/', $guid); break; case 'cod': case 'cod2': case 'cod4': return preg_match('/^[a-f0-9]{32}$/', $guid); break; case 'cod5': return preg_match('/^[a-f0-9]{32}$/', $guid); break; case 'cod6': case 'cod7': return preg_match('/^[0-9]{5,}$/', $guid); break; case 'moh': case 'bfbc2': return pregmatch('/^EA[a-f0-9]{32}$/i', $guid); break; case 'bf3': case 'iourt31': case 'etpro': case 'wop': case 'smg': case 'smg11': case 'oa081': case 'ro2': case 'alt': return preg_match('/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i', $guid); break; default: return false; } }

WickedShell commented 12 years ago

Absolutely right. Except based on what I was told, cod 1 and 2 are allowed to have shorter GUID's, thus with the above they'd fail. Is it guaranteed that COD will have hexadecimal guids? (And btw the way you rearranged some of the cases breaks the check, and will result in invalid GUID's for bf3, urt, etpro, smg, wop, oa, ro2. This function uses case fall through quite heavily and suffers from random rearrangements.

I switched default case to be true as well, as that simply means a game echelon doesn't know about, and no reason to get all angry because it doesn't know about it. I'll leave this open for now but I believe this is fixed.

FrikFry commented 12 years ago

On 10/25/2011 5:18 PM, WickedShell wrote:

Absolutely right. Except based on what I was told, cod 1 and 2 are allowed to have shorter GUID's, thus with the above they'd fail. Is it guaranteed that COD will have hexadecimal guids? (And btw the way you rearranged some of the cases breaks the check, and will result in invalid GUID's for bf3, urt, etpro, smg, wop, oa, ro2. This function uses case fall through quite heavily and suffers from random rearrangements.

I switched default case to be true as well, as that simply means a game echelon doesn't know about, and no reason to get all angry because it doesn't know about it. I'll leave this open for now but I believe this is fixed.

Rgr. Wasn't aware of that with the cod1 and 2 guids.