--- mod_autohost/mod_autohost.c 2005-04-15 01:20:24.000000000 -0400 +++ mod_autohost/mod_autohost.c.oden 2006-10-26 20:43:16.000000000 -0400 @@ -250,6 +250,15 @@ return; } +#if defined(PR_SHARED_MODULE) +static void autohost_mod_unload_ev(const void *event_data, void *user_data) { + if (strcmp("mod_autohost.c", (const char *) event_data) == 0) { + /* Unregister ourselves from all events. */ + pr_event_unregister(&autohost_module, NULL, NULL); + } +} +#endif /* PR_SHARED_MODULE */ + static void autohost_postparse_ev(const void *event_data, void *user_data) { config_rec *c = find_config(main_server->conf, CONF_PARAM, "AutoHostEngine", FALSE); @@ -316,6 +325,9 @@ */ static int autohost_init(void) { +#if defined(PR_SHARED_MODULE) + pr_event_register(&autohost_module, "core.module-unload", autohost_mod_unload_ev, NULL); +#endif /* PR_SHARED_MODULE */ pr_event_register(&autohost_module, "core.postparse", autohost_postparse_ev, NULL);