21 Sep, 2007, Guest wrote in the 1st comment:
Votes: 0
Bug: Registering default IMC packets breaks if another module registers one first
Danger: Medium - IMC default packets used to run the majority of the network functions will not work, rendering the client useless.
Found by: Samson
Fixed by: Samson



imc.c, global variables

Locate:
bool imcpacketdebug = FALSE;


Below that, add:
bool default_packets_registered = FALSE; // Cheesy global for a stupid problem!


imc.c, imc_register_default_packets

Locate:
/*
* Once registered, these are not cleared unless the mud is shut down
*/
if( first_phandler )
return;


Change to:
/*
* Once registered, these are not cleared unless the mud is shut down
*/
if( default_packets_registered )
return;


Locate:
imc_register_packet_handler( "close-notify", imc_recv_closenotify );


Below that, add:
default_packets_registered = TRUE;


If you have other code modules which use the IMC network and they register packet handlers ( which they should, IMC won't process them without one ) any module which loads and initializes itself before IMC has a chance to register its own default packets will cause first_handler to not be NULL anymore and thus bail out when it shouldn't. So it needed to be tweaked a bit to prevent that from happening.
0.0/1