================== idAsyncServer::VerifyChecksumMessage ================== */
| 1871 | ================== |
| 1872 | */ |
| 1873 | bool idAsyncServer::VerifyChecksumMessage( int clientNum, const netadr_t *from, const idBitMsg &msg, idStr &reply ) { |
| 1874 | int i, numChecksums; |
| 1875 | int checksums[ MAX_PURE_PAKS ]; |
| 1876 | int serverChecksums[ MAX_PURE_PAKS ]; |
| 1877 | |
| 1878 | // pak checksums, in a 0-terminated list |
| 1879 | numChecksums = 0; |
| 1880 | do { |
| 1881 | i = msg.ReadInt( ); |
| 1882 | checksums[ numChecksums++ ] = i; |
| 1883 | // just to make sure a broken client doesn't crash us |
| 1884 | if ( numChecksums >= MAX_PURE_PAKS ) { |
| 1885 | common->Warning( "MAX_PURE_PAKS ( %d ) exceeded in idAsyncServer::ProcessPureMessage\n", MAX_PURE_PAKS ); |
| 1886 | sprintf( reply, "#str_07144" ); |
| 1887 | return false; |
| 1888 | } |
| 1889 | } while ( i ); |
| 1890 | numChecksums--; |
| 1891 | |
| 1892 | fileSystem->GetPureServerChecksums( serverChecksums ); |
| 1893 | assert( serverChecksums[ 0 ] ); |
| 1894 | |
| 1895 | for ( i = 0; serverChecksums[ i ] != 0; i++ ) { |
| 1896 | if ( checksums[ i ] != serverChecksums[ i ] ) { |
| 1897 | common->DPrintf( "client %s: pak missing ( 0x%x )\n", from ? Sys_NetAdrToString( *from ) : va( "%d", clientNum ), serverChecksums[ i ] ); |
| 1898 | sprintf( reply, "pak missing ( 0x%x )\n", serverChecksums[ i ] ); |
| 1899 | return false; |
| 1900 | } |
| 1901 | } |
| 1902 | if ( checksums[ i ] != 0 ) { |
| 1903 | common->DPrintf( "client %s: extra pak file referenced ( 0x%x )\n", from ? Sys_NetAdrToString( *from ) : va( "%d", clientNum ), checksums[ i ] ); |
| 1904 | sprintf( reply, "extra pak file referenced ( 0x%x )\n", checksums[ i ] ); |
| 1905 | return false; |
| 1906 | } |
| 1907 | return true; |
| 1908 | } |
| 1909 | |
| 1910 | /* |
| 1911 | ================== |
nothing calls this directly
no test coverage detected