hook_fn casts were hiding UB (#265)

This commit is contained in:
Eric Mertens 2021-08-19 20:09:40 -07:00 committed by GitHub
parent b6b40dda24
commit 82436efb60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 187 additions and 149 deletions

View file

@ -13,10 +13,10 @@
static const char chm_adminonly_desc[] =
"Enables channel mode +A that blocks non-admins from joining a channel";
static void h_can_join(hook_data_channel *);
static void h_can_join(void *);
mapi_hfn_list_av1 adminonly_hfnlist[] = {
{ "can_join", (hookfn) h_can_join },
{ "can_join", h_can_join },
{ NULL, NULL }
};
@ -41,8 +41,9 @@ _moddeinit(void)
DECLARE_MODULE_AV2(chm_adminonly, _modinit, _moddeinit, NULL, NULL, adminonly_hfnlist, NULL, NULL, chm_adminonly_desc);
static void
h_can_join(hook_data_channel *data)
h_can_join(void *data_)
{
hook_data_channel *data = data_;
struct Client *source_p = data->client;
struct Channel *chptr = data->chptr;

View file

@ -14,10 +14,10 @@ static const char chm_insecure_desc[] =
"Adds channel mode +U that allows non-SSL users to join a channel, "
"disallowing them by default";
static void h_can_join(hook_data_channel *);
static void h_can_join(void *);
mapi_hfn_list_av1 sslonly_hfnlist[] = {
{ "can_join", (hookfn) h_can_join },
{ "can_join", h_can_join },
{ NULL, NULL }
};
@ -43,8 +43,9 @@ _moddeinit(void)
DECLARE_MODULE_AV2(chm_insecure, _modinit, _moddeinit, NULL, NULL, sslonly_hfnlist, NULL, NULL, chm_insecure_desc);
static void
h_can_join(hook_data_channel *data)
h_can_join(void *data_)
{
hook_data_channel *data = data_;
struct Client *source_p = data->client;
struct Channel *chptr = data->chptr;

View file

@ -40,16 +40,18 @@ static const char chm_nonotice_desc[] =
static unsigned int mode_nonotice;
static void chm_nonotice_process(hook_data_privmsg_channel *);
static void chm_nonotice_process(void *);
mapi_hfn_list_av1 chm_nonotice_hfnlist[] = {
{ "privmsg_channel", (hookfn) chm_nonotice_process },
{ "privmsg_channel", chm_nonotice_process },
{ NULL, NULL }
};
static void
chm_nonotice_process(hook_data_privmsg_channel *data)
chm_nonotice_process(void *data_)
{
hook_data_privmsg_channel *data = data_;
/* don't waste CPU if message is already blocked */
if (data->approved || data->msgtype != MESSAGE_TYPE_NOTICE)
return;

View file

@ -13,10 +13,10 @@
static const char chm_operonly_desc[] =
"Adds channel mode +O which makes a channel operator-only";
static void h_can_join(hook_data_channel *);
static void h_can_join(void *);
mapi_hfn_list_av1 operonly_hfnlist[] = {
{ "can_join", (hookfn) h_can_join },
{ "can_join", h_can_join },
{ NULL, NULL }
};
@ -42,8 +42,9 @@ _moddeinit(void)
DECLARE_MODULE_AV2(chm_operonly, _modinit, _moddeinit, NULL, NULL, operonly_hfnlist, NULL, NULL, chm_operonly_desc);
static void
h_can_join(hook_data_channel *data)
h_can_join(void *data_)
{
hook_data_channel *data = data_;
struct Client *source_p = data->client;
struct Channel *chptr = data->chptr;

View file

@ -21,10 +21,10 @@
static const char chm_operpeace_desc[] =
"Adds channel mode +M which prohibits operators from being kicked";
static void hdl_can_kick(hook_data_channel_approval *);
static void hdl_can_kick(void *);
mapi_hfn_list_av1 chm_operpeace_hfnlist[] = {
{ "can_kick", (hookfn) hdl_can_kick },
{ "can_kick", hdl_can_kick },
{ NULL, NULL }
};
@ -49,8 +49,9 @@ _moddeinit(void)
DECLARE_MODULE_AV2(chm_operpeace, _modinit, _moddeinit, NULL, NULL, chm_operpeace_hfnlist, NULL, NULL, chm_operpeace_desc);
static void
hdl_can_kick(hook_data_channel_approval *data)
hdl_can_kick(void *data_)
{
hook_data_channel_approval *data = data_;
struct Client *source_p = data->client;
struct Client *who = data->target;
struct Channel *chptr = data->chptr;

View file

@ -43,7 +43,7 @@ static unsigned int mode_regmsg;
static void chm_regmsg_process(void *);
mapi_hfn_list_av1 chm_regmsg_hfnlist[] = {
{ "privmsg_channel", (hookfn) chm_regmsg_process },
{ "privmsg_channel", chm_regmsg_process },
{ NULL, NULL }
};

View file

@ -13,10 +13,10 @@
static const char chm_sslonly_desc[] =
"Adds channel mode +S that bans non-SSL users from joing a channel";
static void h_can_join(hook_data_channel *);
static void h_can_join(void *);
mapi_hfn_list_av1 sslonly_hfnlist[] = {
{ "can_join", (hookfn) h_can_join },
{ "can_join", h_can_join },
{ NULL, NULL }
};
@ -41,8 +41,9 @@ _moddeinit(void)
DECLARE_MODULE_AV2(chm_sslonly, _modinit, _moddeinit, NULL, NULL, sslonly_hfnlist, NULL, NULL, chm_sslonly_desc);
static void
h_can_join(hook_data_channel *data)
h_can_join(void *data_)
{
hook_data_channel *data = data_;
struct Client *source_p = data->client;
struct Channel *chptr = data->chptr;

View file

@ -19,18 +19,19 @@
static const char restrict_desc[] = "Restricts channel creation to authenticated users and IRC operators only";
static void h_can_create_channel_authenticated(hook_data_client_approval *);
static void h_can_create_channel_authenticated(void *);
mapi_hfn_list_av1 restrict_hfnlist[] = {
{ "can_create_channel", (hookfn) h_can_create_channel_authenticated },
{ "can_create_channel", h_can_create_channel_authenticated },
{ NULL, NULL }
};
DECLARE_MODULE_AV2(createauthonly, NULL, NULL, NULL, NULL, restrict_hfnlist, NULL, NULL, restrict_desc);
static void
h_can_create_channel_authenticated(hook_data_client_approval *data)
h_can_create_channel_authenticated(void *data_)
{
hook_data_client_approval *data = data_;
struct Client *source_p = data->client;
if (*source_p->user->suser == '\0' && !IsOperGeneral(source_p))

View file

@ -19,18 +19,19 @@
static const char restrict_desc[] = "Restricts channel creation to IRC operators";
static void h_can_create_channel_authenticated(hook_data_client_approval *);
static void h_can_create_channel_authenticated(void *);
mapi_hfn_list_av1 restrict_hfnlist[] = {
{ "can_create_channel", (hookfn) h_can_create_channel_authenticated },
{ "can_create_channel", h_can_create_channel_authenticated },
{ NULL, NULL }
};
DECLARE_MODULE_AV2(createoperonly, NULL, NULL, NULL, NULL, restrict_hfnlist, NULL, NULL, restrict_desc);
static void
h_can_create_channel_authenticated(hook_data_client_approval *data)
h_can_create_channel_authenticated(void *data_)
{
hook_data_client_approval *data = data_;
struct Client *source_p = data->client;
if (!IsOperGeneral(source_p))

View file

@ -6,7 +6,7 @@
static void check_new_user(void *data);
mapi_hfn_list_av1 drain_hfnlist[] = {
{ "new_local_user", (hookfn) check_new_user },
{ "new_local_user", check_new_user },
{ NULL, NULL }
};

View file

@ -112,7 +112,7 @@ mapi_hlist_av1 test_hlist[] = {
static void show_example_hook(void *unused);
mapi_hfn_list_av1 test_hfnlist[] = {
{ "doing_example_hook", (hookfn) show_example_hook },
{ "doing_example_hook", show_example_hook },
{ NULL, NULL }
};

View file

@ -90,10 +90,10 @@ static char check_str[21] = "";
static unsigned filter_chmode, filter_umode;
mapi_hfn_list_av1 filter_hfnlist[] = {
{ "privmsg_user", (hookfn) filter_msg_user },
{ "privmsg_channel", (hookfn) filter_msg_channel },
{ "client_quit", (hookfn) filter_client_quit },
{ "client_exit", (hookfn) on_client_exit },
{ "privmsg_user", filter_msg_user },
{ "privmsg_channel", filter_msg_channel },
{ "client_quit", filter_client_quit },
{ "client_exit", on_client_exit },
{ NULL, NULL }
};

View file

@ -18,18 +18,19 @@
static const char noi_desc[] =
"Do not allow users to remove user mode +i unless they are operators";
static void h_noi_umode_changed(hook_data_umode_changed *);
static void h_noi_umode_changed(void *);
mapi_hfn_list_av1 noi_hfnlist[] = {
{ "umode_changed", (hookfn) h_noi_umode_changed },
{ "umode_changed", h_noi_umode_changed },
{ NULL, NULL }
};
DECLARE_MODULE_AV2(force_user_invis, NULL, NULL, NULL, NULL, noi_hfnlist, NULL, NULL, noi_desc);
static void
h_noi_umode_changed(hook_data_umode_changed *hdata)
h_noi_umode_changed(void *data)
{
hook_data_umode_changed *hdata = data;
struct Client *source_p = hdata->client;
if (MyClient(source_p) && !IsOperGeneral(source_p) && !IsInvisible(source_p)) {

View file

@ -17,11 +17,11 @@
static const char helpops_desc[] = "The helpops system as used by freenode";
static rb_dlink_list helper_list = { NULL, NULL, 0 };
static void h_hdl_stats_request(hook_data_int *hdata);
static void h_hdl_new_remote_user(struct Client *client_p);
static void h_hdl_client_exit(hook_data_client_exit *hdata);
static void h_hdl_umode_changed(hook_data_umode_changed *hdata);
static void h_hdl_whois(hook_data_client *hdata);
static void h_hdl_stats_request(void *hdata);
static void h_hdl_new_remote_user(void *client_p);
static void h_hdl_client_exit(void *hdata);
static void h_hdl_umode_changed(void *hdata);
static void h_hdl_whois(void *hdata);
static void recurse_client_exit(struct Client *client_p);
static void helper_add(struct Client *client_p);
static void helper_delete(struct Client *client_p);
@ -30,12 +30,12 @@ static void me_dehelper(struct MsgBuf *, struct Client *, struct Client *, int,
static void do_dehelper(struct Client *source_p, struct Client *target_p);
mapi_hfn_list_av1 helpops_hfnlist[] = {
{ "doing_stats", (hookfn) h_hdl_stats_request },
{ "new_remote_user", (hookfn) h_hdl_new_remote_user },
{ "client_exit", (hookfn) h_hdl_client_exit },
{ "umode_changed", (hookfn) h_hdl_umode_changed },
{ "doing_whois", (hookfn) h_hdl_whois },
{ "doing_whois_global", (hookfn) h_hdl_whois },
{ "doing_stats", h_hdl_stats_request },
{ "new_remote_user", h_hdl_new_remote_user },
{ "client_exit", h_hdl_client_exit },
{ "umode_changed", h_hdl_umode_changed },
{ "doing_whois", h_hdl_whois },
{ "doing_whois_global", h_hdl_whois },
{ NULL, NULL }
};
@ -137,8 +137,9 @@ _moddeinit(void)
}
static void
h_hdl_stats_request(hook_data_int *hdata)
h_hdl_stats_request(void *data)
{
hook_data_int *hdata = data;
struct Client *target_p;
rb_dlink_node *helper_ptr;
unsigned int count = 0;
@ -183,8 +184,9 @@ helper_delete(struct Client *client_p)
}
static void
h_hdl_new_remote_user(struct Client *client_p)
h_hdl_new_remote_user(void *data)
{
struct Client *client_p = data;
if (client_p->umodes & user_modes[UMODECHAR_HELPOPS])
helper_add(client_p);
}
@ -210,14 +212,16 @@ recurse_client_exit(struct Client *client_p)
}
static void
h_hdl_client_exit(hook_data_client_exit *hdata)
h_hdl_client_exit(void *data)
{
hook_data_client_exit *hdata = data;
recurse_client_exit(hdata->target);
}
static void
h_hdl_umode_changed(hook_data_umode_changed *hdata)
h_hdl_umode_changed(void *data)
{
hook_data_umode_changed *hdata = data;
struct Client *source_p = hdata->client;
/* didn't change +h umode, we don't need to do anything */
@ -245,8 +249,9 @@ h_hdl_umode_changed(hook_data_umode_changed *hdata)
}
static void
h_hdl_whois(hook_data_client *hdata)
h_hdl_whois(void *data)
{
hook_data_client *hdata = data;
struct Client *source_p = hdata->client;
struct Client *target_p = hdata->target;

View file

@ -17,7 +17,7 @@ static const char hide_desc[] = "Hides channel memberships not shared";
static void h_huc_doing_whois_channel_visibility(void *);
mapi_hfn_list_av1 huc_hfnlist[] = {
{ "doing_whois_channel_visibility", (hookfn) h_huc_doing_whois_channel_visibility },
{ "doing_whois_channel_visibility", h_huc_doing_whois_channel_visibility },
{ NULL, NULL }
};

View file

@ -55,9 +55,9 @@ static void me_heal(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, i
static int modinit(void);
static void modfini(void);
static void client_exit_hook(hook_data_client_exit *);
static void new_local_user_hook(struct Client *);
static void doing_stats_hook(hook_data_int *hdata);
static void client_exit_hook(void *);
static void new_local_user_hook(void *);
static void doing_stats_hook(void *);
static void hurt_check_event(void *);
static void hurt_expire_event(void *);
@ -98,9 +98,9 @@ struct Message heal_msgtab = {
/* {{{ Misc module stuff */
mapi_hfn_list_av1 hurt_hfnlist[] = {
{"client_exit", (hookfn) client_exit_hook},
{"new_local_user", (hookfn) new_local_user_hook},
{"doing_stats", (hookfn) doing_stats_hook},
{"client_exit", client_exit_hook},
{"new_local_user", new_local_user_hook},
{"doing_stats", doing_stats_hook},
{NULL, NULL},
};
@ -429,8 +429,9 @@ hurt_expire_event(void *unused)
/* {{{ static void client_exit_hook() */
static void
client_exit_hook(hook_data_client_exit *data)
client_exit_hook(void *data_)
{
hook_data_client_exit *data = data_;
s_assert(data != NULL);
s_assert(data->target != NULL);
@ -440,8 +441,9 @@ client_exit_hook(hook_data_client_exit *data)
/* {{{ static void new_local_user_hook() */
static void
new_local_user_hook(struct Client *source_p)
new_local_user_hook(void *data)
{
struct Client *source_p = data;
if (IsAnyDead(source_p) || !EmptyString(source_p->user->suser) ||
IsExemptKline(source_p))
return;
@ -458,8 +460,9 @@ new_local_user_hook(struct Client *source_p)
/* {{{ static void doing_stats_hook() */
static void
doing_stats_hook(hook_data_int *hdata)
doing_stats_hook(void *data)
{
hook_data_int *hdata = data;
rb_dlink_node *ptr;
hurt_t *hurt;
struct Client *source_p;

View file

@ -8,18 +8,19 @@
#include "s_conf.h"
#include "numeric.h"
static void h_can_join(hook_data_channel *);
static void h_can_join(void *);
mapi_hfn_list_av1 invex_regonly_hfnlist[] = {
{ "can_join", (hookfn) h_can_join },
{ "can_join", h_can_join },
{ NULL, NULL }
};
DECLARE_MODULE_AV1(invex_regonly, NULL, NULL, NULL, NULL, invex_regonly_hfnlist, "$Revision$");
static void
h_can_join(hook_data_channel *data)
h_can_join(void *data_)
{
hook_data_channel *data = data_;
struct Client *source_p = data->client;
struct Channel *chptr = data->chptr;
struct Ban *invex = NULL;

View file

@ -40,8 +40,8 @@ _moddeinit(void)
static void check_umode_change(void *data);
static void check_new_user(void *data);
mapi_hfn_list_av1 ip_cloaking_hfnlist[] = {
{ "umode_changed", (hookfn) check_umode_change },
{ "new_local_user", (hookfn) check_new_user },
{ "umode_changed", check_umode_change },
{ "new_local_user", check_new_user },
{ NULL, NULL }
};

View file

@ -36,8 +36,8 @@ _moddeinit(void)
static void check_umode_change(void *data);
static void check_new_user(void *data);
mapi_hfn_list_av1 ip_cloaking_hfnlist[] = {
{ "umode_changed", (hookfn) check_umode_change },
{ "new_local_user", (hookfn) check_new_user },
{ "umode_changed", check_umode_change },
{ "new_local_user", check_new_user },
{ NULL, NULL }
};

View file

@ -40,8 +40,8 @@ _moddeinit(void)
static void check_umode_change(void *data);
static void check_new_user(void *data);
mapi_hfn_list_av1 ip_cloaking_hfnlist[] = {
{ "umode_changed", (hookfn) check_umode_change },
{ "new_local_user", (hookfn) check_new_user },
{ "umode_changed", check_umode_change },
{ "new_local_user", check_new_user },
{ NULL, NULL }
};

View file

@ -36,8 +36,8 @@ _moddeinit(void)
static void check_umode_change(void *data);
static void check_new_user(void *data);
mapi_hfn_list_av1 ip_cloaking_hfnlist[] = {
{ "umode_changed", (hookfn) check_umode_change },
{ "new_local_user", (hookfn) check_new_user },
{ "umode_changed", check_umode_change },
{ "new_local_user", check_new_user },
{ NULL, NULL }
};

View file

@ -42,7 +42,7 @@
static const char description[] = "Provides the REMOVE command, an alternative to KICK";
static void m_remove(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void remove_quote_part(hook_data_privmsg_channel *);
static void remove_quote_part(void *);
unsigned int CAP_REMOVE;
static char part_buf[REASONLEN + 1];
@ -54,7 +54,7 @@ struct Message remove_msgtab = {
mapi_clist_av1 remove_clist[] = { &remove_msgtab, NULL };
mapi_hfn_list_av1 remove_hfnlist[] = {
{ "privmsg_channel", (hookfn) remove_quote_part },
{ "privmsg_channel", remove_quote_part },
{ NULL, NULL }
};
mapi_cap_list_av2 remove_cap_list[] = {
@ -213,8 +213,9 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
}
static void
remove_quote_part(hook_data_privmsg_channel *data)
remove_quote_part(void *data_)
{
hook_data_privmsg_channel *data = data_;
if (data->approved || EmptyString(data->text) || data->msgtype != MESSAGE_TYPE_PART)
return;

View file

@ -67,7 +67,7 @@ mapi_clist_av1 webirc_clist[] = { &webirc_msgtab, NULL };
static void new_local_user(void *data);
mapi_hfn_list_av1 webirc_hfnlist[] = {
/* unintuitive but correct--we want to be called first */
{ "new_local_user", (hookfn) new_local_user, HOOK_LOWEST },
{ "new_local_user", new_local_user, HOOK_LOWEST },
{ NULL, NULL }
};

View file

@ -25,7 +25,7 @@ static const char nokill_desc[] = "Prevents operators from killing services";
static void block_services_kill(void *data);
mapi_hfn_list_av1 no_kill_services_hfnlist[] = {
{ "can_kill", (hookfn) block_services_kill },
{ "can_kill", block_services_kill },
{ NULL, NULL }
};

View file

@ -14,18 +14,19 @@
static const char no_locops_desc[] = "Disables local operators";
static void h_nl_umode_changed(hook_data_umode_changed *);
static void h_nl_umode_changed(void *);
mapi_hfn_list_av1 nl_hfnlist[] = {
{ "umode_changed", (hookfn) h_nl_umode_changed },
{ "umode_changed", h_nl_umode_changed },
{ NULL, NULL }
};
DECLARE_MODULE_AV2(no_locops, NULL, NULL, NULL, NULL, nl_hfnlist, NULL, NULL, no_locops_desc);
static void
h_nl_umode_changed(hook_data_umode_changed *hdata)
h_nl_umode_changed(void *data)
{
hook_data_umode_changed *hdata = data;
struct Client *source_p = hdata->client;
if (MyClient(source_p) && source_p->umodes & UMODE_LOCOPS)

View file

@ -16,18 +16,19 @@
static const char noi_desc[] =
"Disallow operators from setting user mode +i on themselves";
static void h_noi_umode_changed(hook_data_umode_changed *);
static void h_noi_umode_changed(void *);
mapi_hfn_list_av1 noi_hfnlist[] = {
{ "umode_changed", (hookfn) h_noi_umode_changed },
{ "umode_changed", h_noi_umode_changed },
{ NULL, NULL }
};
DECLARE_MODULE_AV2(no_oper_invis, NULL, NULL, NULL, NULL, noi_hfnlist, NULL, NULL, noi_desc);
static void
h_noi_umode_changed(hook_data_umode_changed *hdata)
h_noi_umode_changed(void *data)
{
hook_data_umode_changed *hdata = data;
struct Client *source_p = hdata->client;
if (MyClient(source_p) && IsOper(source_p) && !IsOperInvis(source_p) &&

View file

@ -34,13 +34,13 @@ static void hack_can_invite(void *data);
static void handle_client_exit(void *data);
mapi_hfn_list_av1 override_hfnlist[] = {
{ "umode_changed", (hookfn) check_umode_change },
{ "get_channel_access", (hookfn) hack_channel_access, HOOK_HIGHEST },
{ "can_join", (hookfn) hack_can_join, HOOK_HIGHEST },
{ "can_kick", (hookfn) hack_can_kick, HOOK_HIGHEST },
{ "can_send", (hookfn) hack_can_send, HOOK_HIGHEST },
{ "can_invite", (hookfn) hack_can_invite, HOOK_HIGHEST },
{ "client_exit", (hookfn) handle_client_exit },
{ "umode_changed", check_umode_change },
{ "get_channel_access", hack_channel_access, HOOK_HIGHEST },
{ "can_join", hack_can_join, HOOK_HIGHEST },
{ "can_kick", hack_can_kick, HOOK_HIGHEST },
{ "can_send", hack_can_send, HOOK_HIGHEST },
{ "can_invite", hack_can_invite, HOOK_HIGHEST },
{ "client_exit", handle_client_exit },
{ NULL, NULL }
};

View file

@ -14,7 +14,7 @@ static const char override_kick_immunity_desc[] =
static void can_kick(void *data);
mapi_hfn_list_av1 override_kick_immunity_hfnlist[] = {
{ "can_kick", (hookfn) can_kick, HOOK_HIGHEST },
{ "can_kick", can_kick, HOOK_HIGHEST },
{ NULL, NULL }
};

View file

@ -22,7 +22,7 @@ static const char restrict_desc[] =
static void hack_channel_access(void *data);
mapi_hfn_list_av1 restrict_unauthenticated_hfnlist[] = {
{ "get_channel_access", (hookfn) hack_channel_access },
{ "get_channel_access", hack_channel_access },
{ NULL, NULL }
};

View file

@ -20,7 +20,7 @@ static void _moddeinit(void);
static void h_scc_channel_join(void *);
mapi_hfn_list_av1 scc_hfnlist[] = {
{ "channel_join", (hookfn) h_scc_channel_join },
{ "channel_join", h_scc_channel_join },
{ NULL, NULL }
};

View file

@ -20,12 +20,12 @@ static const char sno_desc[] =
static int _modinit(void);
static void _moddeinit(void);
static void h_gcn_new_remote_user(struct Client *);
static void h_gcn_client_exit(hook_data_client_exit *);
static void h_gcn_new_remote_user(void *);
static void h_gcn_client_exit(void *);
mapi_hfn_list_av1 gcn_hfnlist[] = {
{ "new_remote_user", (hookfn) h_gcn_new_remote_user },
{ "client_exit", (hookfn) h_gcn_client_exit },
{ "new_remote_user", h_gcn_new_remote_user },
{ "client_exit", h_gcn_client_exit },
{ NULL, NULL }
};
@ -51,8 +51,9 @@ _moddeinit(void)
}
static void
h_gcn_new_remote_user(struct Client *source_p)
h_gcn_new_remote_user(void *data)
{
struct Client *source_p = data;
if (!HasSentEob(source_p->servptr))
return;
@ -65,8 +66,9 @@ h_gcn_new_remote_user(struct Client *source_p)
}
static void
h_gcn_client_exit(hook_data_client_exit *hdata)
h_gcn_client_exit(void *data)
{
hook_data_client_exit *hdata = data;
struct Client *source_p;
source_p = hdata->target;

View file

@ -15,10 +15,10 @@ static const char sno_desc[] =
"Adds server notices for remote nick changes";
static int _modinit(void);
static void h_gnc_nick_change(hook_data *data);
static void h_gnc_nick_change(void *data);
mapi_hfn_list_av1 gcn_hfnlist[] = {
{ "remote_nick_change", (hookfn) h_gnc_nick_change },
{ "remote_nick_change", h_gnc_nick_change },
{ NULL, NULL }
};
@ -34,8 +34,9 @@ _modinit(void)
}
static void
h_gnc_nick_change(hook_data *data)
h_gnc_nick_change(void *data_)
{
hook_data *data = data_;
struct Client *source_p = data->client;
const char *oldnick = data->arg1;
const char *newnick = data->arg2;

View file

@ -17,7 +17,7 @@ static const char sno_desc[] =
static void h_sgo_umode_changed(void *);
mapi_hfn_list_av1 sgo_hfnlist[] = {
{ "umode_changed", (hookfn) h_sgo_umode_changed },
{ "umode_changed", h_sgo_umode_changed },
{ NULL, NULL }
};

View file

@ -33,15 +33,17 @@
static const char umode_noctcp_desc[] =
"Adds user mode +C which blocks CTCPs to the user.";
static void umode_noctcp_process(hook_data_privmsg_user *);
static void umode_noctcp_process(void *);
mapi_hfn_list_av1 umode_noctcp_hfnlist[] = {
{ "privmsg_user", (hookfn) umode_noctcp_process },
{ "privmsg_user", umode_noctcp_process },
{ NULL, NULL }
};
static void
umode_noctcp_process(hook_data_privmsg_user *data) {
umode_noctcp_process(void *data_)
{
hook_data_privmsg_user *data = data_;
if (!MyClient(data->target_p))
return;

View file

@ -37,11 +37,11 @@
static const char cap_account_tag_desc[] =
"Provides the account-tag client capability";
static void cap_account_tag_process(hook_data *);
static void cap_account_tag_process(void *);
unsigned int CLICAP_ACCOUNT_TAG = 0;
mapi_hfn_list_av1 cap_account_tag_hfnlist[] = {
{ "outbound_msgbuf", (hookfn) cap_account_tag_process },
{ "outbound_msgbuf", cap_account_tag_process },
{ NULL, NULL }
};
mapi_cap_list_av2 cap_account_tag_cap_list[] = {
@ -49,8 +49,9 @@ mapi_cap_list_av2 cap_account_tag_cap_list[] = {
{ 0, NULL, NULL, NULL },
};
static void
cap_account_tag_process(hook_data *data)
cap_account_tag_process(void *data_)
{
hook_data *data = data_;
struct MsgBuf *msgbuf = data->arg1;
if (data->client != NULL && IsPerson(data->client) && *data->client->user->suser)

View file

@ -37,11 +37,11 @@
static const char cap_server_time_desc[] =
"Provides the server-time client capability";
static void cap_server_time_process(hook_data *);
static void cap_server_time_process(void *);
unsigned int CLICAP_SERVER_TIME = 0;
mapi_hfn_list_av1 cap_server_time_hfnlist[] = {
{ "outbound_msgbuf", (hookfn) cap_server_time_process },
{ "outbound_msgbuf", cap_server_time_process },
{ NULL, NULL }
};
mapi_cap_list_av2 cap_server_time_cap_list[] = {
@ -50,8 +50,9 @@ mapi_cap_list_av2 cap_server_time_cap_list[] = {
};
static void
cap_server_time_process(hook_data *data)
cap_server_time_process(void *data_)
{
hook_data *data = data_;
static char buf[BUFSIZE];
struct MsgBuf *msgbuf = data->arg1;
struct timeval tv;

View file

@ -40,16 +40,17 @@ static const char chm_nocolour_desc[] =
static char buf[BUFSIZE];
static unsigned int mode_nocolour;
static void chm_nocolour_process(hook_data_privmsg_channel *);
static void chm_nocolour_process(void *);
mapi_hfn_list_av1 chm_nocolour_hfnlist[] = {
{ "privmsg_channel", (hookfn) chm_nocolour_process },
{ "privmsg_channel", chm_nocolour_process },
{ NULL, NULL }
};
static void
chm_nocolour_process(hook_data_privmsg_channel *data)
chm_nocolour_process(void *data_)
{
hook_data_privmsg_channel *data = data_;
/* don't waste CPU if message is already blocked */
if (data->approved)
return;

View file

@ -39,16 +39,17 @@ static const char chm_noctcp_desc[] =
static unsigned int mode_noctcp;
static void chm_noctcp_process(hook_data_privmsg_channel *);
static void chm_noctcp_process(void *);
mapi_hfn_list_av1 chm_noctcp_hfnlist[] = {
{ "privmsg_channel", (hookfn) chm_noctcp_process },
{ "privmsg_channel", chm_noctcp_process },
{ NULL, NULL }
};
static void
chm_noctcp_process(hook_data_privmsg_channel *data)
chm_noctcp_process(void *data_)
{
hook_data_privmsg_channel *data = data_;
/* don't waste CPU if message is already blocked */
if (data->approved || data->msgtype == MESSAGE_TYPE_NOTICE)
return;

View file

@ -37,11 +37,11 @@ static const char alias_desc[] = "Provides the system for services aliases";
static int _modinit(void);
static void _moddeinit(void);
static int reload_aliases(hook_data *);
static void reload_aliases(void *);
static void m_alias(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
mapi_hfn_list_av1 alias_hfnlist[] = {
{ "rehash", (hookfn)reload_aliases },
{ "rehash", reload_aliases },
{ NULL, NULL },
};
@ -100,12 +100,11 @@ _moddeinit(void)
destroy_aliases();
}
static int
reload_aliases(hook_data *data)
static void
reload_aliases(void *data)
{
destroy_aliases(); /* Clear old aliases */
create_aliases();
return 0;
}
/* The below was mostly taken from the old do_alias */

View file

@ -66,7 +66,7 @@ static void mo_list(struct MsgBuf *, struct Client *, struct Client *, int, cons
static void list_one_channel(struct Client *source_p, struct Channel *chptr, int visible);
static void safelist_one_channel(struct Client *source_p, struct Channel *chptr, struct ListClient *params);
static void safelist_check_cliexit(hook_data_client_exit * hdata);
static void safelist_check_cliexit(void *);
static void safelist_client_instantiate(struct Client *, struct ListClient *);
static void safelist_client_release(struct Client *);
static void safelist_iterate_client(struct Client *source_p);
@ -81,7 +81,7 @@ struct Message list_msgtab = {
mapi_clist_av1 list_clist[] = { &list_msgtab, NULL };
mapi_hfn_list_av1 list_hfnlist[] = {
{"client_exit", (hookfn) safelist_check_cliexit},
{"client_exit", safelist_check_cliexit},
{NULL, NULL}
};
@ -113,8 +113,9 @@ static void _moddeinit(void)
delete_isupport("ELIST");
}
static void safelist_check_cliexit(hook_data_client_exit * hdata)
static void safelist_check_cliexit(void *data)
{
hook_data_client_exit * hdata = data;
/* Cancel the safelist request if we are disconnecting
* from the server. That way it doesn't core. :P --nenolod
*/

View file

@ -49,8 +49,8 @@ static void m_authenticate(struct MsgBuf *, struct Client *, struct Client *, in
static void me_sasl(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void me_mechlist(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void abort_sasl(struct Client *);
static void abort_sasl_exit(hook_data_client_exit *);
static void abort_sasl(void *);
static void abort_sasl_exit(void *);
static unsigned int CLICAP_SASL = 0;
static char mechlist_buf[BUFSIZE];
@ -72,8 +72,8 @@ mapi_clist_av1 sasl_clist[] = {
&authenticate_msgtab, &sasl_msgtab, &mechlist_msgtab, NULL
};
mapi_hfn_list_av1 sasl_hfnlist[] = {
{ "new_local_user", (hookfn) abort_sasl },
{ "client_exit", (hookfn) abort_sasl_exit },
{ "new_local_user", abort_sasl },
{ "client_exit", abort_sasl_exit },
{ NULL, NULL }
};
@ -304,8 +304,9 @@ me_mechlist(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
* registering anyway, abort the exchange.
*/
static void
abort_sasl(struct Client *data)
abort_sasl(void *data_)
{
struct Client *data = data_;
if(data->localClient->sasl_out == 0 || data->localClient->sasl_complete)
return;
@ -331,8 +332,9 @@ abort_sasl(struct Client *data)
}
static void
abort_sasl_exit(hook_data_client_exit *data)
abort_sasl_exit(void *data_)
{
hook_data_client_exit *data = data_;
if (data->target->localClient)
abort_sasl(data->target);
}

View file

@ -59,9 +59,9 @@ static void me_login(struct MsgBuf *, struct Client *, struct Client *, int, con
static void me_rsfnc(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void me_nickdelay(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void h_svc_server_introduced(hook_data_client *);
static void h_svc_whois(hook_data_client *);
static void h_svc_stats(hook_data_int *);
static void h_svc_server_introduced(void *);
static void h_svc_whois(void *);
static void h_svc_stats(void *);
static void h_svc_conf_read_start(void *);
static void h_svc_conf_read_end(void *);
@ -86,12 +86,12 @@ mapi_clist_av1 services_clist[] = {
&su_msgtab, &login_msgtab, &rsfnc_msgtab, &nickdelay_msgtab, NULL
};
mapi_hfn_list_av1 services_hfnlist[] = {
{ "doing_stats", (hookfn) h_svc_stats },
{ "doing_whois", (hookfn) h_svc_whois },
{ "doing_whois_global", (hookfn) h_svc_whois },
{ "server_introduced", (hookfn) h_svc_server_introduced },
{ "conf_read_start", (hookfn) h_svc_conf_read_start },
{ "conf_read_end", (hookfn) h_svc_conf_read_end },
{ "doing_stats", h_svc_stats },
{ "doing_whois", h_svc_whois },
{ "doing_whois_global", h_svc_whois },
{ "server_introduced", h_svc_server_introduced },
{ "conf_read_start", h_svc_conf_read_start },
{ "conf_read_end", h_svc_conf_read_end },
{ NULL, NULL }
};
@ -300,8 +300,9 @@ me_nickdelay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
}
static void
h_svc_server_introduced(hook_data_client *hdata)
h_svc_server_introduced(void *data)
{
hook_data_client *hdata = data;
rb_dlink_node *ptr;
RB_DLINK_FOREACH(ptr, service_list.head)
@ -315,8 +316,9 @@ h_svc_server_introduced(hook_data_client *hdata)
}
static void
h_svc_whois(hook_data_client *data)
h_svc_whois(void *data_)
{
hook_data_client *data = data_;
char *p = data->target->user->suser;
if(!EmptyString(p))
{
@ -336,8 +338,9 @@ h_svc_whois(hook_data_client *data)
}
static void
h_svc_stats(hook_data_int *data)
h_svc_stats(void *data_)
{
hook_data_int *data = data_;
char statchar = (char) data->arg2;
rb_dlink_node *ptr;

View file

@ -36,12 +36,12 @@
#include "ircd.h"
#include "send.h"
static void h_nn_server_eob(struct Client *);
static void h_nn_client_exit(hook_data_client_exit *);
static void h_nn_server_eob(void *);
static void h_nn_client_exit(void *);
mapi_hfn_list_av1 nn_hfnlist[] = {
{ "server_eob", (hookfn) h_nn_server_eob },
{ "client_exit", (hookfn) h_nn_client_exit },
{ "server_eob", h_nn_server_eob },
{ "client_exit", h_nn_client_exit },
{ NULL, NULL }
};
@ -73,8 +73,9 @@ count_mark_downlinks(struct Client *server_p, int *pservcount, int *pusercount)
}
static void
h_nn_server_eob(struct Client *source_p)
h_nn_server_eob(void *data)
{
struct Client *source_p = data;
int s = 0, u = 0;
if (IsFloodDone(source_p))
@ -86,8 +87,9 @@ h_nn_server_eob(struct Client *source_p)
}
static void
h_nn_client_exit(hook_data_client_exit *hdata)
h_nn_client_exit(void *data)
{
hook_data_client_exit *hdata = data;
struct Client *source_p;
int s = 0, u = 0;
char *fromnick;