# HG changeset patch # User Dan # Date 1188058966 14400 # Node ID 2332ebd75f61c128c52e0d788f55fdd2f8c49dcb # Parent 6457a9b983c68fe0bc60cbfd2f133f5ac6979b32 Added a few low-level checks in config.php for changes of search algorithm and AES cipher parameters diff -r 6457a9b983c6 -r 2332ebd75f61 includes/common.php --- a/includes/common.php Sat Aug 25 12:11:31 2007 -0400 +++ b/includes/common.php Sat Aug 25 12:22:46 2007 -0400 @@ -149,6 +149,44 @@ grinding_halt('Version mismatch', '
It seems that the Enano release we\'re trying to run ('.$version.') is different from the version specified in your database ('.enano_version().'). Perhaps you need to upgrade?
'); } +// +// Low level maintenance +// + +// If the search algorithm backend has been changed, empty out the search cache (the two cache formats are incompatible with each other) +if ( getConfig('last_search_algo') != SEARCH_MODE ) +{ + if ( !$db->sql_query('DELETE FROM '.table_prefix.'search_cache;') ) + $db->_die(); + setConfig('last_search_algo', SEARCH_MODE); +} + +// If the AES key size has been changed, bail out and fast +if ( !getConfig('aes_key_size') ) +{ + setConfig('aes_key_size', AES_BITS); +} +else if ( $ks = getConfig('aes_key_size') ) +{ + if ( intval($ks) != AES_BITS ) + { + grinding_halt('AES key size changed', 'Enano has detected that the AES key size in constants.php has been changed. This change cannot be performed after installation, otherwise the private key would have to be re-generated and all passwords would have to be re-encrypted.
Please change the key size back to ' . $ks . ' bits and reload this page.
'); + } +} + +// Same for AES block size +if ( !getConfig('aes_block_size') ) +{ + setConfig('aes_block_size', AES_BLOCKSIZE); +} +else if ( $ks = getConfig('aes_block_size') ) +{ + if ( intval($ks) != AES_BLOCKSIZE ) + { + grinding_halt('AES block size changed', 'Enano has detected that the AES block size in constants.php has been changed. This change cannot be performed after installation, otherwise all passwords would have to be re-encrypted.
Please change the block size back to ' . $ks . ' bits and reload this page.
'); + } +} + // Our list of tables included in Enano $system_table_list = Array( table_prefix.'categories',