Compare commits

..

3 commits

96 changed files with 398 additions and 828 deletions

View file

@ -5,10 +5,6 @@ and OFTC:
dwfreed, Doug Freed <dwfreed@mtu.edu> dwfreed, Doug Freed <dwfreed@mtu.edu>
edk, Ed Kellett <edk@libera.chat> edk, Ed Kellett <edk@libera.chat>
glguy, Eric Mertens <glguy@libera.chat>
ilbelkyr, Nicole Kleinhoff <ilbelkyr@libera.chat>
mcintosh, Richie McIntosh <richiemcintosh@gmail.com>
Myon, Christoph Berg <myon@oftc.net>
tomaw, Tom Wesley <tom@tomaw.net> tomaw, Tom Wesley <tom@tomaw.net>
The Charybdis team was: The Charybdis team was:

View file

@ -46,7 +46,6 @@ These are known issues and workarounds for various platforms.
# building # building
```bash ```bash
sudo apt install build-essential pkg-config libsqlite3-dev # or equivalent for your distribution
./autogen.sh ./autogen.sh
./configure --prefix=/path/to/installation ./configure --prefix=/path/to/installation
make make
@ -76,7 +75,7 @@ See `./configure --help` for build options.
* To report bugs in Solanum, visit us at `#solanum` on [Libera Chat](https://libera.chat) * To report bugs in Solanum, visit us at `#solanum` on [Libera Chat](https://libera.chat)
* Please read [doc/readme.txt](doc/readme.txt) to get an overview of the current documentation. * Please read [doc/index.txt](doc/index.txt) to get an overview of the current documentation.
* Read the [NEWS.md](NEWS.md) file for what's new in this release. * Read the [NEWS.md](NEWS.md) file for what's new in this release.

View file

@ -26,8 +26,6 @@
#include "notice.h" #include "notice.h"
#include "provider.h" #include "provider.h"
#include <netinet/tcp.h> // TCP_NODELAY
#define SELF_PID (opm_provider.id) #define SELF_PID (opm_provider.id)
#define OPM_READSIZE 128 #define OPM_READSIZE 128

View file

@ -514,7 +514,7 @@ static void do_query_number(struct DNSQuery *query, const struct rb_sockaddr_sto
request->name = (char *)rb_malloc(IRCD_RES_HOSTLEN + 1); request->name = (char *)rb_malloc(IRCD_RES_HOSTLEN + 1);
} }
build_rdns(request->queryname, sizeof request->queryname, addr, NULL); build_rdns(request->queryname, IRCD_RES_HOSTLEN + 1, addr, NULL);
request->type = T_PTR; request->type = T_PTR;
query_name(request); query_name(request);

View file

@ -42,10 +42,6 @@ exists and is not +s or +p. (The ops of the channel the ban is on cannot
necessarily see whether the user is in the target channel, so it should not necessarily see whether the user is in the target channel, so it should not
influence whether they can join either.) influence whether they can join either.)
extb_canjoin.so
$j:<channel>
matches users who are or are not banned from a specified channel
extb_oper.so extb_oper.so
$o $o
matches opers (most useful with +I) matches opers (most useful with +I)
@ -60,14 +56,6 @@ extb_server.so
matches users connected to a server matching the mask (* and ? wildcards); matches users connected to a server matching the mask (* and ? wildcards);
this can only be used with +b and +q this can only be used with +b and +q
extb_extgecos.so
$x:<mask>
bans all users with matching nick!user@host#gecos
extb_ssl.so
$z
matches all SSL users
Comparisons: Comparisons:
+b $~a is similar to +r but also prevents not logged in users talking or +b $~a is similar to +r but also prevents not logged in users talking or

View file

@ -306,7 +306,7 @@ operator "god" {
privset = "admin"; privset = "admin";
}; };
/* See connecting-servers.rst for an introduction to using these files. */ // See connecting-servers.rst for an introduction to using these files.
connect "irc.uplink.com" { connect "irc.uplink.com" {
host = "203.0.113.3"; host = "203.0.113.3";
@ -579,7 +579,7 @@ general {
kline_with_reason = yes; kline_with_reason = yes;
hide_tkdline_duration = no; hide_tkdline_duration = no;
kline_reason = "K-Lined"; kline_reason = "K-Lined";
sasl_only_client_message = "You need to identify via SASL to use this server."; sasl_only_client_message = "You need to identify via SASL to use to use this server.";
identd_only_client_message = "You need to install identd to use this server."; identd_only_client_message = "You need to install identd to use this server.";
sctp_forbidden_client_message = "You are not allowed to use SCTP on this server."; sctp_forbidden_client_message = "You are not allowed to use SCTP on this server.";
ssltls_only_client_message = "You need to use SSL/TLS to use this server."; ssltls_only_client_message = "You need to use SSL/TLS to use this server.";

View file

@ -76,6 +76,7 @@
* Far connection notices (snomask +F) -- sno_farconnect * Far connection notices (snomask +F) -- sno_farconnect
* Remote oper up notices -- sno_globaloper * Remote oper up notices -- sno_globaloper
* Global nick-change notices -- sno_globalnickchange * Global nick-change notices -- sno_globalnickchange
* /whois notifications (snomask +W) -- sno_whois
* Oper-override (modehacking only) -- override * Oper-override (modehacking only) -- override
* Stop services kills -- no_kill_services * Stop services kills -- no_kill_services
*/ */
@ -108,6 +109,7 @@
#loadmodule "extensions/sno_farconnect"; #loadmodule "extensions/sno_farconnect";
#loadmodule "extensions/sno_globalnickchange"; #loadmodule "extensions/sno_globalnickchange";
#loadmodule "extensions/sno_globaloper"; #loadmodule "extensions/sno_globaloper";
#loadmodule "extensions/sno_whois";
#loadmodule "extensions/override"; #loadmodule "extensions/override";
#loadmodule "extensions/no_kill_services"; #loadmodule "extensions/no_kill_services";
@ -344,11 +346,6 @@ listen {
/* auth {}: allow users to connect to the ircd (OLD I:) */ /* auth {}: allow users to connect to the ircd (OLD I:) */
auth { auth {
/* description: descriptive text to help recognize this auth block in
* stats i output.
*/
description = "example oper";
/* user: the user@host allowed to connect. Multiple IPv4/IPv6 user /* user: the user@host allowed to connect. Multiple IPv4/IPv6 user
* lines are permitted per auth block. This is matched against the * lines are permitted per auth block. This is matched against the
* hostname and IP address (using :: shortening for IPv6 and * hostname and IP address (using :: shortening for IPv6 and
@ -1165,7 +1162,7 @@ general {
/* SASL access only client message: give users a message that /* SASL access only client message: give users a message that
* informs them * informs them
*/ */
sasl_only_client_message = "You need to identify via SASL to use this server."; sasl_only_client_message = "You need to identify via SASL to use to use this server.";
/* Identd access only client message: give users a message that /* Identd access only client message: give users a message that
* informs them * informs them

View file

@ -13,10 +13,10 @@
static const char chm_adminonly_desc[] = static const char chm_adminonly_desc[] =
"Enables channel mode +A that blocks non-admins from joining a channel"; "Enables channel mode +A that blocks non-admins from joining a channel";
static void h_can_join(void *); static void h_can_join(hook_data_channel *);
mapi_hfn_list_av1 adminonly_hfnlist[] = { mapi_hfn_list_av1 adminonly_hfnlist[] = {
{ "can_join", h_can_join }, { "can_join", (hookfn) h_can_join },
{ NULL, NULL } { NULL, NULL }
}; };
@ -41,9 +41,8 @@ _moddeinit(void)
DECLARE_MODULE_AV2(chm_adminonly, _modinit, _moddeinit, NULL, NULL, adminonly_hfnlist, NULL, NULL, chm_adminonly_desc); DECLARE_MODULE_AV2(chm_adminonly, _modinit, _moddeinit, NULL, NULL, adminonly_hfnlist, NULL, NULL, chm_adminonly_desc);
static void static void
h_can_join(void *data_) h_can_join(hook_data_channel *data)
{ {
hook_data_channel *data = data_;
struct Client *source_p = data->client; struct Client *source_p = data->client;
struct Channel *chptr = data->chptr; 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, " "Adds channel mode +U that allows non-SSL users to join a channel, "
"disallowing them by default"; "disallowing them by default";
static void h_can_join(void *); static void h_can_join(hook_data_channel *);
mapi_hfn_list_av1 sslonly_hfnlist[] = { mapi_hfn_list_av1 sslonly_hfnlist[] = {
{ "can_join", h_can_join }, { "can_join", (hookfn) h_can_join },
{ NULL, NULL } { NULL, NULL }
}; };
@ -43,9 +43,8 @@ _moddeinit(void)
DECLARE_MODULE_AV2(chm_insecure, _modinit, _moddeinit, NULL, NULL, sslonly_hfnlist, NULL, NULL, chm_insecure_desc); DECLARE_MODULE_AV2(chm_insecure, _modinit, _moddeinit, NULL, NULL, sslonly_hfnlist, NULL, NULL, chm_insecure_desc);
static void static void
h_can_join(void *data_) h_can_join(hook_data_channel *data)
{ {
hook_data_channel *data = data_;
struct Client *source_p = data->client; struct Client *source_p = data->client;
struct Channel *chptr = data->chptr; struct Channel *chptr = data->chptr;

View file

@ -40,23 +40,18 @@ static const char chm_nonotice_desc[] =
static unsigned int mode_nonotice; static unsigned int mode_nonotice;
static void chm_nonotice_process(void *); static void chm_nonotice_process(hook_data_privmsg_channel *);
mapi_hfn_list_av1 chm_nonotice_hfnlist[] = { mapi_hfn_list_av1 chm_nonotice_hfnlist[] = {
{ "privmsg_channel", chm_nonotice_process }, { "privmsg_channel", (hookfn) chm_nonotice_process },
{ NULL, NULL } { NULL, NULL }
}; };
static void static void
chm_nonotice_process(void *data_) chm_nonotice_process(hook_data_privmsg_channel *data)
{ {
hook_data_privmsg_channel *data = data_; /* don't waste CPU if message is already blocked */
if (data->approved || data->msgtype != MESSAGE_TYPE_NOTICE)
/*
* don't waste CPU if message is already blocked, only block notices,
* only check messages sourced from local clients (so we don't block services notices)
*/
if (data->approved || data->msgtype != MESSAGE_TYPE_NOTICE || !MyClient(data->source_p))
return; return;
/* block all notices except CTCPs; use chm_noctcp to block CTCPs. */ /* block all notices except CTCPs; use chm_noctcp to block CTCPs. */

View file

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

View file

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

View file

@ -43,7 +43,7 @@ static unsigned int mode_regmsg;
static void chm_regmsg_process(void *); static void chm_regmsg_process(void *);
mapi_hfn_list_av1 chm_regmsg_hfnlist[] = { mapi_hfn_list_av1 chm_regmsg_hfnlist[] = {
{ "privmsg_channel", chm_regmsg_process }, { "privmsg_channel", (hookfn) chm_regmsg_process },
{ NULL, NULL } { NULL, NULL }
}; };
@ -57,10 +57,6 @@ chm_regmsg_process(void *data_)
if (data->approved) if (data->approved)
return; return;
/* mode is unset, accept */
if (!(data->chptr->mode.mode & mode_regmsg))
return;
/* user is identified, accept */ /* user is identified, accept */
if (!EmptyString(data->source_p->user->suser)) if (!EmptyString(data->source_p->user->suser))
return; return;

View file

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

View file

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

View file

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

View file

@ -6,7 +6,7 @@
static void check_new_user(void *data); static void check_new_user(void *data);
mapi_hfn_list_av1 drain_hfnlist[] = { mapi_hfn_list_av1 drain_hfnlist[] = {
{ "new_local_user", check_new_user }, { "new_local_user", (hookfn) check_new_user },
{ NULL, NULL } { NULL, NULL }
}; };
@ -22,13 +22,10 @@ check_new_user(void *vdata)
struct Client *source_p = vdata; struct Client *source_p = vdata;
const char *drain_reason = ConfigFileEntry.drain_reason; const char *drain_reason = ConfigFileEntry.drain_reason;
if (IsAnyDead(source_p))
return;
if (drain_reason == NULL) if (drain_reason == NULL)
drain_reason = "This server is not accepting connections."; drain_reason = "This server is not accepting connections.";
if (IsExemptKline(source_p)) if(IsExemptKline(source_p))
return; return;
exit_client(source_p, source_p, &me, drain_reason); exit_client(source_p, source_p, &me, drain_reason);

View file

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

View file

@ -63,7 +63,7 @@ static int eb_canjoin(const char *data, struct Client *client_p,
return EXTBAN_INVALID; return EXTBAN_INVALID;
#endif #endif
recurse = 1; recurse = 1;
ret = is_banned(chptr2, client_p, NULL, NULL, NULL) != 0 ? EXTBAN_MATCH : EXTBAN_NOMATCH; ret = is_banned(chptr2, client_p, NULL, NULL, NULL) == CHFL_BAN ? EXTBAN_MATCH : EXTBAN_NOMATCH;
recurse = 0; recurse = 0;
return ret; return ret;
} }

View file

@ -41,7 +41,7 @@ static int eb_extended(const char *data, struct Client *client_p,
if (data == NULL) if (data == NULL)
return EXTBAN_INVALID; return EXTBAN_INVALID;
snprintf(buf, sizeof buf, "%s!%s@%s#%s", snprintf(buf, BUFSIZE, "%s!%s@%s#%s",
client_p->name, client_p->username, client_p->host, client_p->info); client_p->name, client_p->username, client_p->host, client_p->info);
return match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH; return match(data, buf) ? EXTBAN_MATCH : EXTBAN_NOMATCH;

View file

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

View file

@ -18,19 +18,18 @@
static const char noi_desc[] = static const char noi_desc[] =
"Do not allow users to remove user mode +i unless they are operators"; "Do not allow users to remove user mode +i unless they are operators";
static void h_noi_umode_changed(void *); static void h_noi_umode_changed(hook_data_umode_changed *);
mapi_hfn_list_av1 noi_hfnlist[] = { mapi_hfn_list_av1 noi_hfnlist[] = {
{ "umode_changed", h_noi_umode_changed }, { "umode_changed", (hookfn) h_noi_umode_changed },
{ NULL, NULL } { NULL, NULL }
}; };
DECLARE_MODULE_AV2(force_user_invis, NULL, NULL, NULL, NULL, noi_hfnlist, NULL, NULL, noi_desc); DECLARE_MODULE_AV2(force_user_invis, NULL, NULL, NULL, NULL, noi_hfnlist, NULL, NULL, noi_desc);
static void static void
h_noi_umode_changed(void *data) h_noi_umode_changed(hook_data_umode_changed *hdata)
{ {
hook_data_umode_changed *hdata = data;
struct Client *source_p = hdata->client; struct Client *source_p = hdata->client;
if (MyClient(source_p) && !IsOperGeneral(source_p) && !IsInvisible(source_p)) { 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 const char helpops_desc[] = "The helpops system as used by freenode";
static rb_dlink_list helper_list = { NULL, NULL, 0 }; static rb_dlink_list helper_list = { NULL, NULL, 0 };
static void h_hdl_stats_request(void *hdata); static void h_hdl_stats_request(hook_data_int *hdata);
static void h_hdl_new_remote_user(void *client_p); static void h_hdl_new_remote_user(struct Client *client_p);
static void h_hdl_client_exit(void *hdata); static void h_hdl_client_exit(hook_data_client_exit *hdata);
static void h_hdl_umode_changed(void *hdata); static void h_hdl_umode_changed(hook_data_umode_changed *hdata);
static void h_hdl_whois(void *hdata); static void h_hdl_whois(hook_data_client *hdata);
static void recurse_client_exit(struct Client *client_p); static void recurse_client_exit(struct Client *client_p);
static void helper_add(struct Client *client_p); static void helper_add(struct Client *client_p);
static void helper_delete(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); static void do_dehelper(struct Client *source_p, struct Client *target_p);
mapi_hfn_list_av1 helpops_hfnlist[] = { mapi_hfn_list_av1 helpops_hfnlist[] = {
{ "doing_stats", h_hdl_stats_request }, { "doing_stats", (hookfn) h_hdl_stats_request },
{ "new_remote_user", h_hdl_new_remote_user }, { "new_remote_user", (hookfn) h_hdl_new_remote_user },
{ "client_exit", h_hdl_client_exit }, { "client_exit", (hookfn) h_hdl_client_exit },
{ "umode_changed", h_hdl_umode_changed }, { "umode_changed", (hookfn) h_hdl_umode_changed },
{ "doing_whois", h_hdl_whois }, { "doing_whois", (hookfn) h_hdl_whois },
{ "doing_whois_global", h_hdl_whois }, { "doing_whois_global", (hookfn) h_hdl_whois },
{ NULL, NULL } { NULL, NULL }
}; };
@ -137,9 +137,8 @@ _moddeinit(void)
} }
static void static void
h_hdl_stats_request(void *data) h_hdl_stats_request(hook_data_int *hdata)
{ {
hook_data_int *hdata = data;
struct Client *target_p; struct Client *target_p;
rb_dlink_node *helper_ptr; rb_dlink_node *helper_ptr;
unsigned int count = 0; unsigned int count = 0;
@ -156,16 +155,10 @@ h_hdl_stats_request(void *data)
count++; count++;
if (IsOper(hdata->client) && SeesOper(target_p, hdata->client)
&& !EmptyString(target_p->user->opername))
sendto_one_numeric(hdata->client, RPL_STATSDEBUG,
"p :%s (%s@%s) {%s}",
target_p->name, target_p->username, target_p->host,
target_p->user->opername);
else
sendto_one_numeric(hdata->client, RPL_STATSDEBUG, sendto_one_numeric(hdata->client, RPL_STATSDEBUG,
"p :%s (%s@%s)", "p :%s (%s@%s)",
target_p->name, target_p->username, target_p->host); target_p->name, target_p->username,
target_p->host);
} }
sendto_one_numeric(hdata->client, RPL_STATSDEBUG, sendto_one_numeric(hdata->client, RPL_STATSDEBUG,
@ -190,9 +183,8 @@ helper_delete(struct Client *client_p)
} }
static void static void
h_hdl_new_remote_user(void *data) h_hdl_new_remote_user(struct Client *client_p)
{ {
struct Client *client_p = data;
if (client_p->umodes & user_modes[UMODECHAR_HELPOPS]) if (client_p->umodes & user_modes[UMODECHAR_HELPOPS])
helper_add(client_p); helper_add(client_p);
} }
@ -218,16 +210,14 @@ recurse_client_exit(struct Client *client_p)
} }
static void static void
h_hdl_client_exit(void *data) h_hdl_client_exit(hook_data_client_exit *hdata)
{ {
hook_data_client_exit *hdata = data;
recurse_client_exit(hdata->target); recurse_client_exit(hdata->target);
} }
static void static void
h_hdl_umode_changed(void *data) h_hdl_umode_changed(hook_data_umode_changed *hdata)
{ {
hook_data_umode_changed *hdata = data;
struct Client *source_p = hdata->client; struct Client *source_p = hdata->client;
/* didn't change +h umode, we don't need to do anything */ /* didn't change +h umode, we don't need to do anything */
@ -255,9 +245,8 @@ h_hdl_umode_changed(void *data)
} }
static void static void
h_hdl_whois(void *data) h_hdl_whois(hook_data_client *hdata)
{ {
hook_data_client *hdata = data;
struct Client *source_p = hdata->client; struct Client *source_p = hdata->client;
struct Client *target_p = hdata->target; 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 *); static void h_huc_doing_whois_channel_visibility(void *);
mapi_hfn_list_av1 huc_hfnlist[] = { mapi_hfn_list_av1 huc_hfnlist[] = {
{ "doing_whois_channel_visibility", h_huc_doing_whois_channel_visibility }, { "doing_whois_channel_visibility", (hookfn) h_huc_doing_whois_channel_visibility },
{ NULL, NULL } { 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 int modinit(void);
static void modfini(void); static void modfini(void);
static void client_exit_hook(void *); static void client_exit_hook(hook_data_client_exit *);
static void new_local_user_hook(void *); static void new_local_user_hook(struct Client *);
static void doing_stats_hook(void *); static void doing_stats_hook(hook_data_int *hdata);
static void hurt_check_event(void *); static void hurt_check_event(void *);
static void hurt_expire_event(void *); static void hurt_expire_event(void *);
@ -98,9 +98,9 @@ struct Message heal_msgtab = {
/* {{{ Misc module stuff */ /* {{{ Misc module stuff */
mapi_hfn_list_av1 hurt_hfnlist[] = { mapi_hfn_list_av1 hurt_hfnlist[] = {
{"client_exit", client_exit_hook}, {"client_exit", (hookfn) client_exit_hook},
{"new_local_user", new_local_user_hook}, {"new_local_user", (hookfn) new_local_user_hook},
{"doing_stats", doing_stats_hook}, {"doing_stats", (hookfn) doing_stats_hook},
{NULL, NULL}, {NULL, NULL},
}; };
@ -429,9 +429,8 @@ hurt_expire_event(void *unused)
/* {{{ static void client_exit_hook() */ /* {{{ static void client_exit_hook() */
static void static void
client_exit_hook(void *data_) client_exit_hook(hook_data_client_exit *data)
{ {
hook_data_client_exit *data = data_;
s_assert(data != NULL); s_assert(data != NULL);
s_assert(data->target != NULL); s_assert(data->target != NULL);
@ -441,9 +440,8 @@ client_exit_hook(void *data_)
/* {{{ static void new_local_user_hook() */ /* {{{ static void new_local_user_hook() */
static void static void
new_local_user_hook(void *data) new_local_user_hook(struct Client *source_p)
{ {
struct Client *source_p = data;
if (IsAnyDead(source_p) || !EmptyString(source_p->user->suser) || if (IsAnyDead(source_p) || !EmptyString(source_p->user->suser) ||
IsExemptKline(source_p)) IsExemptKline(source_p))
return; return;
@ -460,9 +458,8 @@ new_local_user_hook(void *data)
/* {{{ static void doing_stats_hook() */ /* {{{ static void doing_stats_hook() */
static void static void
doing_stats_hook(void *data) doing_stats_hook(hook_data_int *hdata)
{ {
hook_data_int *hdata = data;
rb_dlink_node *ptr; rb_dlink_node *ptr;
hurt_t *hurt; hurt_t *hurt;
struct Client *source_p; struct Client *source_p;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -134,7 +134,7 @@ mo_ojoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
sendto_one(source_p, form_str(RPL_TOPIC), me.name, sendto_one(source_p, form_str(RPL_TOPIC), me.name,
source_p->name, chptr->chname, chptr->topic); source_p->name, chptr->chname, chptr->topic);
sendto_one(source_p, form_str(RPL_TOPICWHOTIME), me.name, sendto_one(source_p, form_str(RPL_TOPICWHOTIME), me.name,
source_p->name, chptr->chname, chptr->topic_info, (long long)chptr->topic_time); source_p->name, chptr->chname, chptr->topic_info, chptr->topic_time);
} }
source_p->localClient->last_join_time = rb_current_time(); source_p->localClient->last_join_time = rb_current_time();

View file

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

View file

@ -67,7 +67,7 @@ mapi_clist_av1 webirc_clist[] = { &webirc_msgtab, NULL };
static void new_local_user(void *data); static void new_local_user(void *data);
mapi_hfn_list_av1 webirc_hfnlist[] = { mapi_hfn_list_av1 webirc_hfnlist[] = {
/* unintuitive but correct--we want to be called first */ /* unintuitive but correct--we want to be called first */
{ "new_local_user", new_local_user, HOOK_LOWEST }, { "new_local_user", (hookfn) new_local_user, HOOK_LOWEST },
{ NULL, NULL } { NULL, NULL }
}; };
@ -106,17 +106,17 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
if (!IsConfDoSpoofIp(aconf) || irccmp(aconf->info.name, "webirc.")) if (!IsConfDoSpoofIp(aconf) || irccmp(aconf->info.name, "webirc."))
{ {
/* XXX */ /* XXX */
exit_client(client_p, source_p, &me, "Not a CGI:IRC auth block"); sendto_one(source_p, "NOTICE * :Not a CGI:IRC auth block");
return; return;
} }
if (EmptyString(aconf->passwd)) if (EmptyString(aconf->passwd))
{ {
exit_client(client_p, source_p, &me, "CGI:IRC auth blocks must have a password"); sendto_one(source_p, "NOTICE * :CGI:IRC auth blocks must have a password");
return; return;
} }
if (!IsSecure(source_p) && aconf->flags & CONF_FLAGS_NEED_SSL) if (!IsSecure(source_p) && aconf->flags & CONF_FLAGS_NEED_SSL)
{ {
exit_client(client_p, source_p, &me, "Your CGI:IRC block requires TLS"); sendto_one(source_p, "NOTICE * :Your CGI:IRC block requires TLS");
return; return;
} }
@ -129,13 +129,13 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
if (encr == NULL || strcmp(encr, aconf->passwd)) if (encr == NULL || strcmp(encr, aconf->passwd))
{ {
exit_client(client_p, source_p, &me, "CGI:IRC password incorrect"); sendto_one(source_p, "NOTICE * :CGI:IRC password incorrect");
return; return;
} }
if (rb_inet_pton_sock(parv[4], &addr) <= 0) if (rb_inet_pton_sock(parv[4], &addr) <= 0)
{ {
exit_client(client_p, source_p, &me, "Invalid IP"); sendto_one(source_p, "NOTICE * :Invalid IP");
return; return;
} }
@ -191,9 +191,6 @@ new_local_user(void *data)
struct Client *source_p = data; struct Client *source_p = data;
struct ConfItem *aconf = source_p->localClient->att_conf; struct ConfItem *aconf = source_p->localClient->att_conf;
if (aconf == NULL)
return;
if (!irccmp(aconf->info.name, "webirc.")) if (!irccmp(aconf->info.name, "webirc."))
exit_client(source_p, source_p, &me, "Cannot log in using a WEBIRC block"); exit_client(source_p, source_p, &me, "Cannot log in using a WEBIRC block");
} }

View file

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

View file

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

View file

@ -16,19 +16,18 @@
static const char noi_desc[] = static const char noi_desc[] =
"Disallow operators from setting user mode +i on themselves"; "Disallow operators from setting user mode +i on themselves";
static void h_noi_umode_changed(void *); static void h_noi_umode_changed(hook_data_umode_changed *);
mapi_hfn_list_av1 noi_hfnlist[] = { mapi_hfn_list_av1 noi_hfnlist[] = {
{ "umode_changed", h_noi_umode_changed }, { "umode_changed", (hookfn) h_noi_umode_changed },
{ NULL, NULL } { NULL, NULL }
}; };
DECLARE_MODULE_AV2(no_oper_invis, NULL, NULL, NULL, NULL, noi_hfnlist, NULL, NULL, noi_desc); DECLARE_MODULE_AV2(no_oper_invis, NULL, NULL, NULL, NULL, noi_hfnlist, NULL, NULL, noi_desc);
static void static void
h_noi_umode_changed(void *data) h_noi_umode_changed(hook_data_umode_changed *hdata)
{ {
hook_data_umode_changed *hdata = data;
struct Client *source_p = hdata->client; struct Client *source_p = hdata->client;
if (MyClient(source_p) && IsOper(source_p) && !IsOperInvis(source_p) && 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); static void handle_client_exit(void *data);
mapi_hfn_list_av1 override_hfnlist[] = { mapi_hfn_list_av1 override_hfnlist[] = {
{ "umode_changed", check_umode_change }, { "umode_changed", (hookfn) check_umode_change },
{ "get_channel_access", hack_channel_access, HOOK_HIGHEST }, { "get_channel_access", (hookfn) hack_channel_access, HOOK_HIGHEST },
{ "can_join", hack_can_join, HOOK_HIGHEST }, { "can_join", (hookfn) hack_can_join, HOOK_HIGHEST },
{ "can_kick", hack_can_kick, HOOK_HIGHEST }, { "can_kick", (hookfn) hack_can_kick, HOOK_HIGHEST },
{ "can_send", hack_can_send, HOOK_HIGHEST }, { "can_send", (hookfn) hack_can_send, HOOK_HIGHEST },
{ "can_invite", hack_can_invite, HOOK_HIGHEST }, { "can_invite", (hookfn) hack_can_invite, HOOK_HIGHEST },
{ "client_exit", handle_client_exit }, { "client_exit", (hookfn) handle_client_exit },
{ NULL, NULL } { NULL, NULL }
}; };

View file

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

View file

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

View file

@ -40,9 +40,6 @@ check_new_user(void *vdata)
{ {
struct Client *source_p = vdata; struct Client *source_p = vdata;
if (IsAnyDead(source_p))
return;
if (!IsIPSpoof(source_p)) if (!IsIPSpoof(source_p))
return; return;
@ -128,9 +125,9 @@ check_new_user(void *vdata)
return; return;
} }
sendto_realops_snomask(SNO_BANNED, L_NETWIDE, sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
"Rejecting K-Lined user %s [%s] (%s@%s)", get_client_name(source_p, HIDE_IP), "KLINE active for %s",
show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255", aconf->user, aconf->host); get_client_name(source_p, HIDE_IP));
notify_banned_client(source_p, aconf, K_LINED); notify_banned_client(source_p, aconf, K_LINED);
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -20,8 +20,8 @@ NO PARAMETERS:
messages is stripped. messages is stripped.
+g - Free invite. Everyone may invite users. Significantly +g - Free invite. Everyone may invite users. Significantly
weakens +i control. weakens +i control.
? +u - Unfiltered. Receive messages that would otherwise be filtered ? +u - Unfiltered. Receive messages that are filtered server side based
server side based on content. on content
+z - Op moderated. Messages blocked by +m, +b and +q are instead +z - Op moderated. Messages blocked by +m, +b and +q are instead
sent to ops. sent to ops.
+L - Large ban list. Increase maximum number of +beIq entries. +L - Large ban list. Increase maximum number of +beIq entries.

View file

@ -18,7 +18,5 @@ Modifiers are also supported, seperated by a comma:
last n minutes last n minutes
T>n - List channels whose topics were last changed T>n - List channels whose topics were last changed
more than n minutes ago more than n minutes ago
*mask* - List channels matching a wildcard mask
!*mask* - List channels that do not match the mask
eg LIST <100,>20 eg LIST <100,>20

View file

@ -16,8 +16,8 @@ User modes: (* designates that the umode is oper only)
* +a - Is marked as a server admin in whois. * +a - Is marked as a server admin in whois.
* +l - Can see oper locops (local wallops). * +l - Can see oper locops (local wallops).
* +s - Can see server notices (see /quote help snomask). * +s - Can see server notices (see /quote help snomask).
? +u - Receive messages that would otherwise be filtered server side ? +u - Receive messages that are filtered server side based
based on content. on content
* +z - Can see operwalls. * +z - Can see operwalls.
? +C - Prevents you from receiving CTCPs other than ACTION. ? +C - Prevents you from receiving CTCPs other than ACTION.
+D - Deaf - ignores all channel messages. +D - Deaf - ignores all channel messages.

View file

@ -11,8 +11,8 @@ User modes: (? designates that the umode is provided by an extension
? +h - Has a cloaked host. May be +x depending on cloaking module ? +h - Has a cloaked host. May be +x depending on cloaking module
+g - Deny users not on your /ACCEPT list from messaging you and +g - Deny users not on your /ACCEPT list from messaging you and
inviting you to channels. inviting you to channels.
? +u - Receive messages that would otherwise be filtered server side ? +u - Receive messages that are filtered server side based
based on content. on content.
+w - Can see oper wallops. +w - Can see oper wallops.
? +C - Prevents you from receiving CTCPs other than ACTION. ? +C - Prevents you from receiving CTCPs other than ACTION.
+D - Deaf - ignores all channel messages. +D - Deaf - ignores all channel messages.

View file

@ -308,7 +308,7 @@ struct PreClient
struct ListClient struct ListClient
{ {
char *chname, *mask, *nomask; char *chname;
unsigned int users_min, users_max; unsigned int users_min, users_max;
time_t created_min, created_max, topic_min, topic_max; time_t created_min, created_max, topic_min, topic_max;
int operspy; int operspy;

View file

@ -49,7 +49,7 @@
#define NUMERIC_STR_209 "Class %s %d" #define NUMERIC_STR_209 "Class %s %d"
#define NUMERIC_STR_212 "%s %u %lu :%u" #define NUMERIC_STR_212 "%s %u %lu :%u"
#define NUMERIC_STR_213 "C %s %s %s %d %s %s" #define NUMERIC_STR_213 "C %s %s %s %d %s %s"
#define NUMERIC_STR_215 "I %s %s %s@%s %d %s :%s" #define NUMERIC_STR_215 "I %s %s %s@%s %d %s"
#define NUMERIC_STR_216 "%c %s * %s :%s%s%s" #define NUMERIC_STR_216 "%c %s * %s :%s%s%s"
#define NUMERIC_STR_217 "%c %d %s :%s" #define NUMERIC_STR_217 "%c %d %s :%s"
#define NUMERIC_STR_218 "Y %s %d %d %d %u %d.%d %d.%d %u" #define NUMERIC_STR_218 "Y %s %d %d %d %u %d.%d %d.%d %u"
@ -101,11 +101,11 @@
#define NUMERIC_STR_323 ":%s 323 %s :End of /LIST" #define NUMERIC_STR_323 ":%s 323 %s :End of /LIST"
#define NUMERIC_STR_324 ":%s 324 %s %s %s" #define NUMERIC_STR_324 ":%s 324 %s %s %s"
#define NUMERIC_STR_325 ":%s 325 %s %s %s :is the current channel mode-lock" #define NUMERIC_STR_325 ":%s 325 %s %s %s :is the current channel mode-lock"
#define NUMERIC_STR_329 ":%s 329 %s %s %lld" #define NUMERIC_STR_329 ":%s 329 %s %s %lu"
#define NUMERIC_STR_330 "%s %s :is logged in as" #define NUMERIC_STR_330 "%s %s :is logged in as"
#define NUMERIC_STR_331 ":%s 331 %s %s :No topic is set." #define NUMERIC_STR_331 ":%s 331 %s %s :No topic is set."
#define NUMERIC_STR_332 ":%s 332 %s %s :%s" #define NUMERIC_STR_332 ":%s 332 %s %s :%s"
#define NUMERIC_STR_333 ":%s 333 %s %s %s %lld" #define NUMERIC_STR_333 ":%s 333 %s %s %s %lu"
#define NUMERIC_STR_337 "%s :%s" #define NUMERIC_STR_337 "%s :%s"
#define NUMERIC_STR_338 "%s %s :actually using host" #define NUMERIC_STR_338 "%s %s :actually using host"
#define NUMERIC_STR_341 ":%s 341 %s %s %s" #define NUMERIC_STR_341 ":%s 341 %s %s %s"
@ -144,7 +144,7 @@
#define NUMERIC_STR_403 "%s :No such channel" #define NUMERIC_STR_403 "%s :No such channel"
#define NUMERIC_STR_404 "%s :Cannot send to nick/channel" #define NUMERIC_STR_404 "%s :Cannot send to nick/channel"
#define NUMERIC_STR_405 ":%s 405 %s %s :You have joined too many channels" #define NUMERIC_STR_405 ":%s 405 %s %s :You have joined too many channels"
#define NUMERIC_STR_406 "%s :There was no such nickname" #define NUMERIC_STR_406 ":%s :There was no such nickname"
#define NUMERIC_STR_407 ":%s 407 %s %s :Too many recipients." #define NUMERIC_STR_407 ":%s 407 %s %s :Too many recipients."
#define NUMERIC_STR_409 ":%s 409 %s :No origin specified" #define NUMERIC_STR_409 ":%s 409 %s :No origin specified"
#define NUMERIC_STR_410 ":%s 410 %s %s :Invalid CAP subcommand" #define NUMERIC_STR_410 ":%s 410 %s %s :Invalid CAP subcommand"

View file

@ -43,8 +43,6 @@
#include "stdinc.h" #include "stdinc.h"
struct Client;
enum { enum {
PRIV_NEEDOPER = 1 PRIV_NEEDOPER = 1
}; };

View file

@ -65,7 +65,6 @@ struct ConfItem
char *passwd; /* doubles as kline reason *ugh* */ char *passwd; /* doubles as kline reason *ugh* */
char *spasswd; /* Password to send. */ char *spasswd; /* Password to send. */
char *user; /* user part of user@host */ char *user; /* user part of user@host */
char *desc; /* description */
int port; int port;
time_t hold; /* Hold action until this time (calendar time) */ time_t hold; /* Hold action until this time (calendar time) */
time_t created; /* Creation time (for klines etc) */ time_t created; /* Creation time (for klines etc) */
@ -385,7 +384,7 @@ extern int detach_conf(struct Client *);
extern struct ConfItem *find_tkline(const char *, const char *, struct sockaddr *); extern struct ConfItem *find_tkline(const char *, const char *, struct sockaddr *);
extern char *show_iline_prefix(struct Client *, struct ConfItem *, char *); extern char *show_iline_prefix(struct Client *, struct ConfItem *, char *);
extern void get_printable_conf(struct ConfItem *, extern void get_printable_conf(struct ConfItem *,
char **, char **, const char **, char **, int *, char **, char **); char **, char **, const char **, char **, int *, char **);
extern char *get_user_ban_reason(struct ConfItem *aconf); extern char *get_user_ban_reason(struct ConfItem *aconf);
extern void get_printable_kline(struct Client *, struct ConfItem *, extern void get_printable_kline(struct Client *, struct ConfItem *,
char **, char **, char **, char **); char **, char **, char **, char **);

View file

@ -40,9 +40,6 @@
#include <openssl/rsa.h> #include <openssl/rsa.h>
#endif #endif
#define MAX_TEMP_TIME (52 * 7 * 24 * 60 * 60)
struct Client;
struct ConfItem; struct ConfItem;
extern rb_dlink_list cluster_conf_list; extern rb_dlink_list cluster_conf_list;

View file

@ -1141,7 +1141,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p)
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {
if(chmode_table[i].set_func == chm_hidden && !HasPrivilege(client_p, "auspex:cmodes") && IsClient(client_p)) if(chmode_table[i].set_func == chm_hidden && (!HasPrivilege(client_p, "auspex:cmodes") || !IsClient(client_p)))
continue; continue;
if(chptr->mode.mode & chmode_flags[i]) if(chptr->mode.mode & chmode_flags[i])
*mbuf++ = i; *mbuf++ = i;

View file

@ -249,7 +249,9 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const
char *realban = LOCAL_COPY(banid); char *realban = LOCAL_COPY(banid);
rb_dlink_node *ptr; rb_dlink_node *ptr;
/* dont let local clients overflow the banlist */ /* dont let local clients overflow the banlist, or set redundant
* bans
*/
if(MyClient(source_p)) if(MyClient(source_p))
{ {
if((rb_dlink_list_length(&chptr->banlist) + rb_dlink_list_length(&chptr->exceptlist) + rb_dlink_list_length(&chptr->invexlist) + rb_dlink_list_length(&chptr->quietlist)) >= (unsigned long)((chptr->mode.mode & MODE_EXLIMIT) ? ConfigChannel.max_bans_large : ConfigChannel.max_bans)) if((rb_dlink_list_length(&chptr->banlist) + rb_dlink_list_length(&chptr->exceptlist) + rb_dlink_list_length(&chptr->invexlist) + rb_dlink_list_length(&chptr->quietlist)) >= (unsigned long)((chptr->mode.mode & MODE_EXLIMIT) ? ConfigChannel.max_bans_large : ConfigChannel.max_bans))
@ -258,15 +260,25 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const
me.name, source_p->name, chptr->chname, realban); me.name, source_p->name, chptr->chname, realban);
return false; return false;
} }
}
/* don't let anyone set duplicate bans */ RB_DLINK_FOREACH(ptr, list->head)
{
actualBan = ptr->data;
if(mask_match(actualBan->banstr, realban))
return false;
}
}
/* dont let remotes set duplicates */
else
{
RB_DLINK_FOREACH(ptr, list->head) RB_DLINK_FOREACH(ptr, list->head)
{ {
actualBan = ptr->data; actualBan = ptr->data;
if(!irccmp(actualBan->banstr, realban)) if(!irccmp(actualBan->banstr, realban))
return false; return false;
} }
}
if(IsPerson(source_p)) if(IsPerson(source_p))
sprintf(who, "%s!%s@%s", source_p->name, source_p->username, source_p->host); sprintf(who, "%s!%s@%s", source_p->name, source_p->username, source_p->host);
@ -925,9 +937,9 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
} }
if (removed && removed->forward) if (removed && removed->forward)
removed_mask_pos += snprintf(buf + old_removed_mask_pos, sizeof(buf) - old_removed_mask_pos, "%s$%s", removed->banstr, removed->forward) + 1; removed_mask_pos += snprintf(buf + old_removed_mask_pos, sizeof(buf), "%s$%s", removed->banstr, removed->forward) + 1;
else else
removed_mask_pos += rb_strlcpy(buf + old_removed_mask_pos, removed ? removed->banstr : mask, sizeof(buf)) + 1; removed_mask_pos += rb_strlcpy(buf + old_removed_mask_pos, mask, sizeof(buf)) + 1;
if (removed) if (removed)
{ {
free_ban(removed); free_ban(removed);

View file

@ -551,7 +551,7 @@ check_klines(void)
} }
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
"Disconnecting K-Lined user %s (%s@%s)", "KLINE active for %s (%s@%s)",
get_client_name(client_p, HIDE_IP), aconf->user, aconf->host); get_client_name(client_p, HIDE_IP), aconf->user, aconf->host);
notify_banned_client(client_p, aconf, K_LINED); notify_banned_client(client_p, aconf, K_LINED);
@ -600,7 +600,7 @@ check_one_kline(struct ConfItem *kline)
case HM_IPV6: case HM_IPV6:
if (IsConfDoSpoofIp(client_p->localClient->att_conf) && if (IsConfDoSpoofIp(client_p->localClient->att_conf) &&
IsConfKlineSpoof(client_p->localClient->att_conf)) IsConfKlineSpoof(client_p->localClient->att_conf))
break; continue;
if (client_p->localClient->ip.ss_family == AF_INET6 && sockaddr.ss_family == AF_INET && if (client_p->localClient->ip.ss_family == AF_INET6 && sockaddr.ss_family == AF_INET &&
rb_ipv4_from_ipv6((struct sockaddr_in6 *)&client_p->localClient->ip, &ip4) rb_ipv4_from_ipv6((struct sockaddr_in6 *)&client_p->localClient->ip, &ip4)
&& comp_with_mask_sock((struct sockaddr *)&ip4, (struct sockaddr *)&sockaddr, bits)) && comp_with_mask_sock((struct sockaddr *)&ip4, (struct sockaddr *)&sockaddr, bits))
@ -615,7 +615,7 @@ check_one_kline(struct ConfItem *kline)
matched = 1; matched = 1;
if (IsConfDoSpoofIp(client_p->localClient->att_conf) && if (IsConfDoSpoofIp(client_p->localClient->att_conf) &&
IsConfKlineSpoof(client_p->localClient->att_conf)) IsConfKlineSpoof(client_p->localClient->att_conf))
break; continue;
if (match(kline->host, client_p->sockhost)) if (match(kline->host, client_p->sockhost))
matched = 1; matched = 1;
break; break;
@ -634,7 +634,7 @@ check_one_kline(struct ConfItem *kline)
} }
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
"Disconnecting K-Lined user %s (%s@%s)", "KLINE active for %s (%s@%s)",
get_client_name(client_p, HIDE_IP), kline->user, kline->host); get_client_name(client_p, HIDE_IP), kline->user, kline->host);
notify_banned_client(client_p, kline, K_LINED); notify_banned_client(client_p, kline, K_LINED);
@ -669,7 +669,7 @@ check_dlines(void)
continue; continue;
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
"Disconnecting D-Lined user %s (%s)", "DLINE active for %s (%s)",
get_client_name(client_p, HIDE_IP), aconf->host); get_client_name(client_p, HIDE_IP), aconf->host);
notify_banned_client(client_p, aconf, D_LINED); notify_banned_client(client_p, aconf, D_LINED);
@ -725,7 +725,7 @@ check_xlines(void)
} }
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
"Disconnecting X-Lined user %s (%s)", "XLINE active for %s (%s)",
get_client_name(client_p, HIDE_IP), aconf->host); get_client_name(client_p, HIDE_IP), aconf->host);
(void) exit_client(client_p, client_p, &me, "Bad user info"); (void) exit_client(client_p, client_p, &me, "Bad user info");
@ -1573,11 +1573,11 @@ exit_local_server(struct Client *client_p, struct Client *source_p, struct Clien
remove_dependents(client_p, source_p, from, IsPerson(from) ? newcomment : comment, comment1); remove_dependents(client_p, source_p, from, IsPerson(from) ? newcomment : comment, comment1);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s was connected" sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s was connected"
" for %lld seconds. %d/%d sendK/recvK.", " for %ld seconds. %d/%d sendK/recvK.",
source_p->name, (long long)(rb_current_time() - source_p->localClient->firsttime), sendk, recvk); source_p->name, (long) rb_current_time() - source_p->localClient->firsttime, sendk, recvk);
ilog(L_SERVER, "%s was connected for %lld seconds. %d/%d sendK/recvK.", ilog(L_SERVER, "%s was connected for %ld seconds. %d/%d sendK/recvK.",
source_p->name, (long long)(rb_current_time() - source_p->localClient->firsttime), sendk, recvk); source_p->name, (long) rb_current_time() - source_p->localClient->firsttime, sendk, recvk);
if(has_id(source_p)) if(has_id(source_p))
del_from_id_hash(source_p->id, source_p); del_from_id_hash(source_p->id, source_p);
@ -1844,7 +1844,7 @@ show_ip_conf(struct ConfItem *aconf, struct Client *source_p)
{ {
if(IsConfDoSpoofIp(aconf)) if(IsConfDoSpoofIp(aconf))
{ {
if(!ConfigFileEntry.hide_spoof_ips && IsOper(source_p)) if(!ConfigFileEntry.hide_spoof_ips && MyOper(source_p))
return 1; return 1;
return 0; return 0;
@ -1857,7 +1857,7 @@ int
show_ip_whowas(struct Whowas *whowas, struct Client *source_p) show_ip_whowas(struct Whowas *whowas, struct Client *source_p)
{ {
if(whowas->flags & WHOWAS_IP_SPOOFING) if(whowas->flags & WHOWAS_IP_SPOOFING)
if(ConfigFileEntry.hide_spoof_ips || !IsOper(source_p)) if(ConfigFileEntry.hide_spoof_ips || !MyOper(source_p))
return 0; return 0;
if(whowas->flags & WHOWAS_DYNSPOOF) if(whowas->flags & WHOWAS_DYNSPOOF)
if(!IsOper(source_p)) if(!IsOper(source_p))

View file

@ -710,7 +710,8 @@ show_iline_prefix(struct Client *sptr, struct ConfItem *aconf, char *name)
*prefix_ptr++ = '^'; *prefix_ptr++ = '^';
if(IsOper(sptr) && IsConfExemptLimits(aconf)) if(IsOper(sptr) && IsConfExemptLimits(aconf))
*prefix_ptr++ = '>'; *prefix_ptr++ = '>';
rb_strlcpy(prefix_ptr, name, USERLEN + 1); *prefix_ptr = '\0';
strncpy(prefix_ptr, name, USERLEN);
return (prefix_of_host); return (prefix_of_host);
} }
@ -723,7 +724,7 @@ show_iline_prefix(struct Client *sptr, struct ConfItem *aconf, char *name)
void void
report_auth(struct Client *client_p) report_auth(struct Client *client_p)
{ {
char *name, *host, *user, *classname, *desc; char *name, *host, *user, *classname;
const char *pass; const char *pass;
struct AddressRec *arec; struct AddressRec *arec;
struct ConfItem *aconf; struct ConfItem *aconf;
@ -739,7 +740,7 @@ report_auth(struct Client *client_p)
continue; continue;
get_printable_conf(aconf, &name, &host, &pass, &user, &port, get_printable_conf(aconf, &name, &host, &pass, &user, &port,
&classname, &desc); &classname);
if(!EmptyString(aconf->spasswd)) if(!EmptyString(aconf->spasswd))
pass = aconf->spasswd; pass = aconf->spasswd;
@ -748,7 +749,7 @@ report_auth(struct Client *client_p)
form_str(RPL_STATSILINE), form_str(RPL_STATSILINE),
name, pass, show_iline_prefix(client_p, aconf, user), name, pass, show_iline_prefix(client_p, aconf, user),
show_ip_conf(aconf, client_p) ? host : "255.255.255.255", show_ip_conf(aconf, client_p) ? host : "255.255.255.255",
port, classname, desc); port, classname);
} }
} }

View file

@ -756,8 +756,8 @@ solanum_main(int argc, char * const argv[])
check_splitmode_ev = rb_event_add("check_splitmode", check_splitmode, NULL, 5); check_splitmode_ev = rb_event_add("check_splitmode", check_splitmode, NULL, 5);
if(server_state_foreground) if(server_state_foreground)
inotice("now running in foreground mode from %s as pid %ld ...", inotice("now running in foreground mode from %s as pid %d ...",
ConfigFileEntry.dpath, (long)getpid()); ConfigFileEntry.dpath, getpid());
rb_lib_loop(0); rb_lib_loop(0);

View file

@ -572,6 +572,8 @@ accept_sslcallback(struct Client *client_p, int status)
return 0; /* use default handler if status != RB_OK */ return 0; /* use default handler if status != RB_OK */
} }
static const char *toofast = "ERROR :Reconnecting too fast, throttled.\r\n";
static int static int
accept_precallback(rb_fde_t *F, struct sockaddr *addr, rb_socklen_t addrlen, void *data) accept_precallback(rb_fde_t *F, struct sockaddr *addr, rb_socklen_t addrlen, void *data)
{ {
@ -581,13 +583,6 @@ accept_precallback(rb_fde_t *F, struct sockaddr *addr, rb_socklen_t addrlen, voi
static time_t last_oper_notice = 0; static time_t last_oper_notice = 0;
int len; int len;
static const char *toofast = "ERROR :Reconnecting too fast, throttled.\r\n";
static const unsigned char sslerrcode[] = {
// SSLv3.0 Fatal Alert: Access Denied
0x15, 0x03, 0x00, 0x00, 0x02, 0x02, 0x31
};
if(listener->ssl && (!ircd_ssl_ok || !get_ssld_count())) if(listener->ssl && (!ircd_ssl_ok || !get_ssld_count()))
{ {
rb_close(F); rb_close(F);
@ -623,11 +618,7 @@ accept_precallback(rb_fde_t *F, struct sockaddr *addr, rb_socklen_t addrlen, voi
{ {
ServerStats.is_ref++; ServerStats.is_ref++;
if(listener->ssl) if(ConfigFileEntry.dline_with_reason)
{
rb_write(F, sslerrcode, sizeof(sslerrcode));
}
else if(ConfigFileEntry.dline_with_reason)
{ {
len = snprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", get_user_ban_reason(aconf)); len = snprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", get_user_ban_reason(aconf));
if (len >= (int)(sizeof(buf)-1)) if (len >= (int)(sizeof(buf)-1))
@ -636,14 +627,11 @@ accept_precallback(rb_fde_t *F, struct sockaddr *addr, rb_socklen_t addrlen, voi
buf[sizeof(buf) - 2] = '\n'; buf[sizeof(buf) - 2] = '\n';
buf[sizeof(buf) - 1] = '\0'; buf[sizeof(buf) - 1] = '\0';
} }
rb_write(F, buf, strlen(buf));
} }
else else
{
strcpy(buf, "ERROR :You have been D-lined.\r\n"); strcpy(buf, "ERROR :You have been D-lined.\r\n");
rb_write(F, buf, strlen(buf));
}
rb_write(F, buf, strlen(buf));
rb_close(F); rb_close(F);
return 0; return 0;
} }

View file

@ -1037,9 +1037,6 @@ conf_end_auth(struct TopConf *tc)
if(yy_aconf->className) if(yy_aconf->className)
yy_tmp->className = rb_strdup(yy_aconf->className); yy_tmp->className = rb_strdup(yy_aconf->className);
if(yy_aconf->desc)
yy_tmp->desc = rb_strdup(yy_aconf->desc);
yy_tmp->flags = yy_aconf->flags; yy_tmp->flags = yy_aconf->flags;
yy_tmp->port = yy_aconf->port; yy_tmp->port = yy_aconf->port;
@ -1175,13 +1172,6 @@ conf_set_auth_spoof(void *data)
yy_aconf->flags |= CONF_FLAGS_SPOOF_IP; yy_aconf->flags |= CONF_FLAGS_SPOOF_IP;
} }
static void
conf_set_auth_desc(void *data)
{
rb_free(yy_aconf->desc);
yy_aconf->desc = rb_strdup(data);
}
static void static void
conf_set_auth_flags(void *data) conf_set_auth_flags(void *data)
{ {
@ -2328,7 +2318,7 @@ conf_report_error(const char *fmt, ...)
char msg[BUFSIZE + 1] = { 0 }; char msg[BUFSIZE + 1] = { 0 };
va_start(ap, fmt); va_start(ap, fmt);
vsnprintf(msg, sizeof msg, fmt, ap); vsnprintf(msg, BUFSIZE, fmt, ap);
va_end(ap); va_end(ap);
if (testing_conf) if (testing_conf)
@ -2348,7 +2338,7 @@ conf_report_warning(const char *fmt, ...)
char msg[BUFSIZE + 1] = { 0 }; char msg[BUFSIZE + 1] = { 0 };
va_start(ap, fmt); va_start(ap, fmt);
vsnprintf(msg, sizeof msg, fmt, ap); vsnprintf(msg, BUFSIZE, fmt, ap);
va_end(ap); va_end(ap);
if (testing_conf) if (testing_conf)
@ -2650,7 +2640,6 @@ static struct ConfEntry conf_auth_table[] =
{ "redirport", CF_INT, conf_set_auth_redir_port, 0, NULL }, { "redirport", CF_INT, conf_set_auth_redir_port, 0, NULL },
{ "flags", CF_STRING | CF_FLIST, conf_set_auth_flags, 0, NULL }, { "flags", CF_STRING | CF_FLIST, conf_set_auth_flags, 0, NULL },
{ "umodes", CF_QSTRING, conf_set_auth_umodes, 0, NULL}, { "umodes", CF_QSTRING, conf_set_auth_umodes, 0, NULL},
{ "description",CF_QSTRING, conf_set_auth_desc, 0, NULL},
{ "\0", 0, NULL, 0, NULL } { "\0", 0, NULL, 0, NULL }
}; };

View file

@ -322,7 +322,7 @@ read_packet(rb_fde_t * F, void *data)
* with client_p of "local" variation, which contains all the * with client_p of "local" variation, which contains all the
* necessary fields (buffer etc..) * necessary fields (buffer etc..)
*/ */
static void void
client_dopacket(struct Client *client_p, char *buffer, size_t length) client_dopacket(struct Client *client_p, char *buffer, size_t length)
{ {
s_assert(client_p != NULL); s_assert(client_p != NULL);

View file

@ -100,7 +100,7 @@ reject_exit(void *unused)
if (ddata->aconf) if (ddata->aconf)
{ {
snprintf(dynamic_reason, sizeof dynamic_reason, form_str(ERR_YOUREBANNEDCREEP) "\r\n", snprintf(dynamic_reason, BUFSIZE, form_str(ERR_YOUREBANNEDCREEP) "\r\n",
me.name, "*", get_user_ban_reason(ddata->aconf)); me.name, "*", get_user_ban_reason(ddata->aconf));
rb_write(ddata->F, dynamic_reason, strlen(dynamic_reason)); rb_write(ddata->F, dynamic_reason, strlen(dynamic_reason));
@ -108,7 +108,7 @@ reject_exit(void *unused)
} }
else if (ddata->reason) else if (ddata->reason)
{ {
snprintf(dynamic_reason, sizeof dynamic_reason, ":%s 465 %s :%s\r\n", snprintf(dynamic_reason, BUFSIZE, ":%s 465 %s :%s\r\n",
me.name, "*", ddata->reason); me.name, "*", ddata->reason);
rb_write(ddata->F, dynamic_reason, strlen(dynamic_reason)); rb_write(ddata->F, dynamic_reason, strlen(dynamic_reason));
} }

View file

@ -154,7 +154,6 @@ free_conf(struct ConfItem *aconf)
rb_free(aconf->className); rb_free(aconf->className);
rb_free(aconf->user); rb_free(aconf->user);
rb_free(aconf->host); rb_free(aconf->host);
rb_free(aconf->desc);
if(IsConfBan(aconf)) if(IsConfBan(aconf))
operhash_delete(aconf->info.oper); operhash_delete(aconf->info.oper);
@ -201,10 +200,10 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern
* see the IP, we still cannot send it. * see the IP, we still cannot send it.
*/ */
sendto_realops_snomask(SNO_FULL, L_NETWIDE, sendto_realops_snomask(SNO_FULL, L_NETWIDE,
"Too many local connections for %s[%s%s@%s] [%s]", "Too many local connections for %s!%s%s@%s",
source_p->name, IsGotId(source_p) ? "" : "~", source_p->name, IsGotId(source_p) ? "" : "~",
source_p->username, source_p->host, source_p->username,
show_ip(NULL, source_p) && !IsIPSpoof(source_p) ? source_p->sockhost : "0"); show_ip(NULL, source_p) && !IsIPSpoof(source_p) ? source_p->sockhost : source_p->host);
ilog(L_FUSER, "Too many local connections from %s!%s%s@%s", ilog(L_FUSER, "Too many local connections from %s!%s%s@%s",
source_p->name, IsGotId(source_p) ? "" : "~", source_p->name, IsGotId(source_p) ? "" : "~",
@ -216,10 +215,10 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern
case TOO_MANY_GLOBAL: case TOO_MANY_GLOBAL:
sendto_realops_snomask(SNO_FULL, L_NETWIDE, sendto_realops_snomask(SNO_FULL, L_NETWIDE,
"Too many global connections for %s[%s%s@%s] [%s]", "Too many global connections for %s!%s%s@%s",
source_p->name, IsGotId(source_p) ? "" : "~", source_p->name, IsGotId(source_p) ? "" : "~",
source_p->username, source_p->host, source_p->username,
show_ip(NULL, source_p) && !IsIPSpoof(source_p) ? source_p->sockhost : "0"); show_ip(NULL, source_p) && !IsIPSpoof(source_p) ? source_p->sockhost : source_p->host);
ilog(L_FUSER, "Too many global connections from %s!%s%s@%s", ilog(L_FUSER, "Too many global connections from %s!%s%s@%s",
source_p->name, IsGotId(source_p) ? "" : "~", source_p->name, IsGotId(source_p) ? "" : "~",
source_p->username, source_p->sockhost); source_p->username, source_p->sockhost);
@ -230,10 +229,10 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern
case TOO_MANY_IDENT: case TOO_MANY_IDENT:
sendto_realops_snomask(SNO_FULL, L_NETWIDE, sendto_realops_snomask(SNO_FULL, L_NETWIDE,
"Too many user connections for %s[%s%s@%s] [%s]", "Too many user connections for %s!%s%s@%s",
source_p->name, IsGotId(source_p) ? "" : "~", source_p->name, IsGotId(source_p) ? "" : "~",
source_p->username, source_p->host, source_p->username,
show_ip(NULL, source_p) && !IsIPSpoof(source_p) ? source_p->sockhost : "0"); show_ip(NULL, source_p) && !IsIPSpoof(source_p) ? source_p->sockhost : source_p->host);
ilog(L_FUSER, "Too many user connections from %s!%s%s@%s", ilog(L_FUSER, "Too many user connections from %s!%s%s@%s",
source_p->name, IsGotId(source_p) ? "" : "~", source_p->name, IsGotId(source_p) ? "" : "~",
source_p->username, source_p->sockhost); source_p->username, source_p->sockhost);
@ -244,10 +243,10 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern
case I_LINE_FULL: case I_LINE_FULL:
sendto_realops_snomask(SNO_FULL, L_NETWIDE, sendto_realops_snomask(SNO_FULL, L_NETWIDE,
"I-line is full for %s[%s%s@%s] [%s]", "I-line is full for %s!%s%s@%s (%s).",
source_p->name, IsGotId(source_p) ? "" : "~", source_p->name, IsGotId(source_p) ? "" : "~",
source_p->username, source_p->host, source_p->username, source_p->host,
show_ip(NULL, source_p) && !IsIPSpoof(source_p) ? source_p->sockhost : "0"); show_ip(NULL, source_p) && !IsIPSpoof(source_p) ? source_p->sockhost : "255.255.255.255");
ilog(L_FUSER, "Too many connections from %s!%s%s@%s.", ilog(L_FUSER, "Too many connections from %s!%s%s@%s.",
source_p->name, IsGotId(source_p) ? "" : "~", source_p->name, IsGotId(source_p) ? "" : "~",
@ -369,8 +368,8 @@ verify_access(struct Client *client_p, const char *username)
get_user_ban_reason(aconf)); get_user_ban_reason(aconf));
sendto_realops_snomask(SNO_BANNED, L_NETWIDE, sendto_realops_snomask(SNO_BANNED, L_NETWIDE,
"Rejecting K-Lined user %s [%s] (%s@%s)", get_client_name(client_p, HIDE_IP), "Rejecting K-Lined user %s [%s@%s]",
show_ip(NULL, client_p) ? client_p->sockhost : "255.255.255.255", aconf->user, aconf->host); get_client_name(client_p, HIDE_IP), aconf->user, aconf->host);
add_reject(client_p, aconf->user, aconf->host, aconf, NULL); add_reject(client_p, aconf->user, aconf->host, aconf, NULL);
return (BANNED_CLIENT); return (BANNED_CLIENT);
} }
@ -1347,8 +1346,7 @@ get_oper_name(struct Client *client_p)
*/ */
void void
get_printable_conf(struct ConfItem *aconf, char **name, char **host, get_printable_conf(struct ConfItem *aconf, char **name, char **host,
const char **pass, char **user, int *port, const char **pass, char **user, int *port, char **classname)
char **classname, char **desc)
{ {
static char null[] = "<NULL>"; static char null[] = "<NULL>";
static char zero[] = "default"; static char zero[] = "default";
@ -1358,7 +1356,6 @@ get_printable_conf(struct ConfItem *aconf, char **name, char **host,
*pass = EmptyString(aconf->passwd) ? null : aconf->passwd; *pass = EmptyString(aconf->passwd) ? null : aconf->passwd;
*user = EmptyString(aconf->user) ? null : aconf->user; *user = EmptyString(aconf->user) ? null : aconf->user;
*classname = EmptyString(aconf->className) ? zero : aconf->className; *classname = EmptyString(aconf->className) ? zero : aconf->className;
*desc = CheckEmpty(aconf->desc);
*port = (int) aconf->port; *port = (int) aconf->port;
} }

View file

@ -685,55 +685,23 @@ time_t
valid_temp_time(const char *p) valid_temp_time(const char *p)
{ {
time_t result = 0; time_t result = 0;
long current = 0;
while (*p) { while(*p)
char *endp; {
int mul; if(IsDigit(*p))
{
errno = 0; result *= 10;
current = strtol(p, &endp, 10); result += ((*p) & 0xF);
p++;
if (endp == p) }
return -1; else
if (current < 0)
return -1;
switch (*endp) {
case '\0': /* No unit was given so send it back as minutes */
case 'm':
mul = 60;
break;
case 'h':
mul = 3600;
break;
case 'd':
mul = 86400;
break;
case 'w':
mul = 604800;
break;
default:
return -1; return -1;
} }
if (current > LONG_MAX / mul) if(result > (60 * 24 * 7 * 52))
return MAX_TEMP_TIME; result = (60 * 24 * 7 * 52);
current *= mul; return(result * 60);
if (current > MAX_TEMP_TIME - result)
return MAX_TEMP_TIME;
result += current;
if (*endp == '\0')
break;
p = endp + 1;
}
return MIN(result, MAX_TEMP_TIME);
} }
/* Propagated bans are expired elsewhere. */ /* Propagated bans are expired elsewhere. */

View file

@ -1017,16 +1017,12 @@ serv_connect(struct server_conf *server_p, struct Client *by)
else if(server_p->aftype == AF_INET || GET_SS_FAMILY(&server_p->connect4) == AF_INET) else if(server_p->aftype == AF_INET || GET_SS_FAMILY(&server_p->connect4) == AF_INET)
{ {
sa_connect[0] = server_p->connect4; sa_connect[0] = server_p->connect4;
sa_connect[1] = server_p->connect6;
sa_bind[0] = server_p->bind4; sa_bind[0] = server_p->bind4;
sa_bind[1] = server_p->bind6;
} }
else if(server_p->aftype == AF_INET6 || GET_SS_FAMILY(&server_p->connect6) == AF_INET6) else if(server_p->aftype == AF_INET6 || GET_SS_FAMILY(&server_p->connect6) == AF_INET6)
{ {
sa_connect[0] = server_p->connect6; sa_connect[0] = server_p->connect6;
sa_connect[1] = server_p->connect4;
sa_bind[0] = server_p->bind6; sa_bind[0] = server_p->bind6;
sa_bind[1] = server_p->bind4;
} }
/* log */ /* log */

View file

@ -524,7 +524,7 @@ register_local_user(struct Client *client_p, struct Client *source_p)
const char *sasl_only_client_message = ConfigFileEntry.sasl_only_client_message; const char *sasl_only_client_message = ConfigFileEntry.sasl_only_client_message;
if (sasl_only_client_message == NULL) if (sasl_only_client_message == NULL)
sasl_only_client_message = "You need to identify via SASL to use this server."; sasl_only_client_message = "You need to identify via SASL to use to use this server.";
ServerStats.is_ref++; ServerStats.is_ref++;
sendto_one_notice(source_p, ":*** Notice -- %s", sasl_only_client_message); sendto_one_notice(source_p, ":*** Notice -- %s", sasl_only_client_message);
@ -597,8 +597,8 @@ register_local_user(struct Client *client_p, struct Client *source_p)
{ {
ServerStats.is_ref++; ServerStats.is_ref++;
sendto_realops_snomask(SNO_BANNED, L_NETWIDE, sendto_realops_snomask(SNO_BANNED, L_NETWIDE,
"Rejecting X-Lined user %s [%s] (%s)", get_client_name(source_p, HIDE_IP), "Rejecting X-Lined user %s [%s]",
show_ip(NULL, source_p) ? source_p->sockhost : "255.255.255.255", xconf->host); get_client_name(client_p, HIDE_IP), xconf->host);
add_reject(source_p, xconf->host, NULL, NULL, NULL); add_reject(source_p, xconf->host, NULL, NULL, NULL);
exit_client(client_p, source_p, &me, "Bad user info"); exit_client(client_p, source_p, &me, "Bad user info");
@ -1640,7 +1640,7 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use
if(do_qjm) if(do_qjm)
{ {
va_start(ap, format); va_start(ap, format);
vsnprintf(reason, sizeof reason, format, ap); vsnprintf(reason, 255, format, ap);
va_end(ap); va_end(ap);
sendto_common_channels_local_butone(target_p, NOCAPS, CLICAP_CHGHOST, ":%s!%s@%s QUIT :%s", sendto_common_channels_local_butone(target_p, NOCAPS, CLICAP_CHGHOST, ":%s!%s@%s QUIT :%s",

View file

@ -26,7 +26,6 @@ else \
{ print $1 " " $2 " " $3 " " $7 " at " $4 " " $5 " " $6 }}'` { print $1 " " $2 " " $3 " " $7 " at " $4 " " $5 " " $6 }}'`
else else
creation="$EXTERNAL_BUILD_TIMESTAMP" creation="$EXTERNAL_BUILD_TIMESTAMP"
generation=1
fi fi
$spitshell >version.c <<!SUB!THIS! $spitshell >version.c <<!SUB!THIS!

View file

@ -112,7 +112,6 @@ whowas_add_history(struct Client *client_p, int online)
rb_strlcpy(who->hostname, client_p->host, sizeof(who->hostname)); rb_strlcpy(who->hostname, client_p->host, sizeof(who->hostname));
rb_strlcpy(who->realname, client_p->info, sizeof(who->realname)); rb_strlcpy(who->realname, client_p->info, sizeof(who->realname));
rb_strlcpy(who->sockhost, client_p->sockhost, sizeof(who->sockhost)); rb_strlcpy(who->sockhost, client_p->sockhost, sizeof(who->sockhost));
rb_strlcpy(who->suser, client_p->user->suser, sizeof(who->suser));
who->flags = (IsIPSpoof(client_p) ? WHOWAS_IP_SPOOFING : 0) | who->flags = (IsIPSpoof(client_p) ? WHOWAS_IP_SPOOFING : 0) |
(IsDynSpoof(client_p) ? WHOWAS_DYNSPOOF : 0); (IsDynSpoof(client_p) ? WHOWAS_DYNSPOOF : 0);

View file

@ -52,7 +52,7 @@ rb_crypt(const char *key, const char *salt)
return rb_sha512_crypt(key, salt); return rb_sha512_crypt(key, salt);
default: default:
return NULL; return NULL;
} };
} }
else else
return rb_des_crypt(key, salt); return rb_des_crypt(key, salt);

View file

@ -294,21 +294,23 @@ rb_event_init(void)
void void
rb_dump_events(void (*func) (char *, void *), void *ptr) rb_dump_events(void (*func) (char *, void *), void *ptr)
{ {
int len;
char buf[512]; char buf[512];
rb_dlink_node *dptr; rb_dlink_node *dptr;
struct ev_entry *ev; struct ev_entry *ev;
len = sizeof(buf);
snprintf(buf, sizeof buf, "Last event to run: %s", last_event_ran); snprintf(buf, len, "Last event to run: %s", last_event_ran);
func(buf, ptr); func(buf, ptr);
rb_strlcpy(buf, "Operation Next Execution", sizeof buf); rb_strlcpy(buf, "Operation Next Execution", len);
func(buf, ptr); func(buf, ptr);
RB_DLINK_FOREACH(dptr, event_list.head) RB_DLINK_FOREACH(dptr, event_list.head)
{ {
ev = dptr->data; ev = dptr->data;
snprintf(buf, sizeof buf, "%-28s %-4lld seconds (frequency=%d)", ev->name, snprintf(buf, len, "%-28s %-4ld seconds (frequency=%d)", ev->name,
(long long)(ev->when - rb_current_time()), (int)ev->frequency); ev->when - (long)rb_current_time(), (int)ev->frequency);
func(buf, ptr); func(buf, ptr);
} }
} }

View file

@ -172,7 +172,7 @@ int
rb_ports_supports_event(void) rb_ports_supports_event(void)
{ {
return 1; return 1;
} };
void void
rb_ports_init_event(void) rb_ports_init_event(void)

View file

@ -162,7 +162,7 @@ rb_path_to_self(void)
{ {
static char path_buf[4096]; static char path_buf[4096];
#if defined(HAVE_GETEXECNAME) #if defined(HAVE_GETEXECNAME)
const char *s = getexecname(); char *s = getexecname();
if (s == NULL) if (s == NULL)
return NULL; return NULL;
realpath(s, path_buf); realpath(s, path_buf);

View file

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

View file

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

View file

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

View file

@ -39,24 +39,21 @@ static const char chm_noctcp_desc[] =
static unsigned int mode_noctcp; static unsigned int mode_noctcp;
static void chm_noctcp_process(void *); static void chm_noctcp_process(hook_data_privmsg_channel *);
mapi_hfn_list_av1 chm_noctcp_hfnlist[] = { mapi_hfn_list_av1 chm_noctcp_hfnlist[] = {
{ "privmsg_channel", chm_noctcp_process }, { "privmsg_channel", (hookfn) chm_noctcp_process },
{ NULL, NULL } { NULL, NULL }
}; };
static void static void
chm_noctcp_process(void *data_) chm_noctcp_process(hook_data_privmsg_channel *data)
{ {
hook_data_privmsg_channel *data = data_;
/* don't waste CPU if message is already blocked */ /* don't waste CPU if message is already blocked */
if (data->approved) if (data->approved || data->msgtype == MESSAGE_TYPE_NOTICE)
return; return;
if (*data->text == '\001' && if (*data->text == '\001' && rb_strncasecmp(data->text + 1, "ACTION ", 7) && data->chptr->mode.mode & mode_noctcp)
data->chptr->mode.mode & mode_noctcp &&
!(data->msgtype == MESSAGE_TYPE_PRIVMSG && !rb_strncasecmp(data->text + 1, "ACTION ", 7)))
{ {
sendto_one_numeric(data->source_p, ERR_CANNOTSENDTOCHAN, form_str(ERR_CANNOTSENDTOCHAN), data->chptr->chname); sendto_one_numeric(data->source_p, ERR_CANNOTSENDTOCHAN, form_str(ERR_CANNOTSENDTOCHAN), data->chptr->chname);
data->approved = ERR_CANNOTSENDTOCHAN; data->approved = ERR_CANNOTSENDTOCHAN;

View file

@ -374,7 +374,7 @@ m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
sendto_one(source_p, form_str(RPL_TOPICWHOTIME), sendto_one(source_p, form_str(RPL_TOPICWHOTIME),
me.name, source_p->name, chptr->chname, me.name, source_p->name, chptr->chname,
chptr->topic_info, chptr->topic_info,
(long long)chptr->topic_time); (unsigned long)chptr->topic_time);
} }
channel_member_names(chptr, source_p, 1); channel_member_names(chptr, source_p, 1);

View file

@ -132,7 +132,7 @@ m_mode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
operspy ? channel_modes(chptr, &me) : channel_modes(chptr, source_p)); operspy ? channel_modes(chptr, &me) : channel_modes(chptr, source_p));
sendto_one(source_p, form_str(RPL_CREATIONTIME), sendto_one(source_p, form_str(RPL_CREATIONTIME),
me.name, source_p->name, parv[1], (long long)chptr->channelts); me.name, source_p->name, parv[1], chptr->channelts);
} }
else else
{ {

View file

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

View file

@ -123,10 +123,7 @@ mo_etrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
target_p->servptr->name, target_p->servptr->name,
get_id(target_p, target_p)); get_id(target_p, target_p));
else else
{
do_single_etrace(source_p, target_p); do_single_etrace(source_p, target_p);
sendto_one_numeric(source_p, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE), target_p->name);
}
} }
else else
sendto_one_numeric(source_p, ERR_NOSUCHNICK, sendto_one_numeric(source_p, ERR_NOSUCHNICK,
@ -340,10 +337,20 @@ mo_masktrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
const char *parv[]) const char *parv[])
{ {
char *name, *username, *hostname, *gecos; char *name, *username, *hostname, *gecos;
const char *mask;
int operspy = 0;
mask = parv[1];
name = LOCAL_COPY(parv[1]); name = LOCAL_COPY(parv[1]);
collapse(name); collapse(name);
if(IsOperSpy(source_p) && parv[1][0] == '!')
{
name++;
mask++;
operspy = 1;
}
if(parc > 2 && !EmptyString(parv[2])) if(parc > 2 && !EmptyString(parv[2]))
{ {
gecos = LOCAL_COPY(parv[2]); gecos = LOCAL_COPY(parv[2]);
@ -373,6 +380,21 @@ mo_masktrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
return; return;
} }
if(operspy) {
if (!ConfigFileEntry.operspy_dont_care_user_info)
{
char buf[512];
rb_strlcpy(buf, mask, sizeof(buf));
if(!EmptyString(gecos)) {
rb_strlcat(buf, " ", sizeof(buf));
rb_strlcat(buf, gecos, sizeof(buf));
}
report_operspy(source_p, "MASKTRACE", buf);
}
match_masktrace(source_p, &global_client_list, username, hostname, name, gecos); match_masktrace(source_p, &global_client_list, username, hostname, name, gecos);
} else
match_masktrace(source_p, &lclient_list, username, hostname, name, gecos);
sendto_one_numeric(source_p, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE), me.name); sendto_one_numeric(source_p, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE), me.name);
} }

View file

@ -165,11 +165,6 @@ mo_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
} }
reason = LOCAL_COPY(parv[loc]); reason = LOCAL_COPY(parv[loc]);
if(strlen(reason) > BANREASONLEN)
{
sendto_one_notice(source_p, ":K-Line reason exceeds %d characters", BANREASONLEN);
return;
}
if(parse_netmask_strict(host, NULL, NULL) == HM_ERROR) if(parse_netmask_strict(host, NULL, NULL) == HM_ERROR)
{ {
@ -239,6 +234,9 @@ mo_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
aconf->port = 0; aconf->port = 0;
aconf->info.oper = operhash_add(get_oper_name(source_p)); aconf->info.oper = operhash_add(get_oper_name(source_p));
if(strlen(reason) > BANREASONLEN)
reason[BANREASONLEN] = '\0';
/* Look for an oper reason */ /* Look for an oper reason */
if((oper_reason = strchr(reason, '|')) != NULL) if((oper_reason = strchr(reason, '|')) != NULL)
{ {

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 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_one_channel(struct Client *source_p, struct Channel *chptr, struct ListClient *params);
static void safelist_check_cliexit(void *); static void safelist_check_cliexit(hook_data_client_exit * hdata);
static void safelist_client_instantiate(struct Client *, struct ListClient *); static void safelist_client_instantiate(struct Client *, struct ListClient *);
static void safelist_client_release(struct Client *); static void safelist_client_release(struct Client *);
static void safelist_iterate_client(struct Client *source_p); 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_clist_av1 list_clist[] = { &list_msgtab, NULL };
mapi_hfn_list_av1 list_hfnlist[] = { mapi_hfn_list_av1 list_hfnlist[] = {
{"client_exit", safelist_check_cliexit}, {"client_exit", (hookfn) safelist_check_cliexit},
{NULL, NULL} {NULL, NULL}
}; };
@ -100,7 +100,7 @@ static int _modinit(void)
* T = topic search (T> T<) * T = topic search (T> T<)
*/ */
add_isupport("SAFELIST", isupport_string, ""); add_isupport("SAFELIST", isupport_string, "");
add_isupport("ELIST", isupport_string, "CMNTU"); add_isupport("ELIST", isupport_string, "CTU");
return 0; return 0;
} }
@ -113,9 +113,8 @@ static void _moddeinit(void)
delete_isupport("ELIST"); delete_isupport("ELIST");
} }
static void safelist_check_cliexit(void *data) static void safelist_check_cliexit(hook_data_client_exit * hdata)
{ {
hook_data_client_exit * hdata = data;
/* Cancel the safelist request if we are disconnecting /* Cancel the safelist request if we are disconnecting
* from the server. That way it doesn't core. :P --nenolod * from the server. That way it doesn't core. :P --nenolod
*/ */
@ -191,7 +190,7 @@ mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
} }
/* Single channel. */ /* Single channel. */
if (args && IsChannelName(args) && !strpbrk(args, "*?, ")) if (args && IsChannelName(args))
{ {
safelist_channel_named(source_p, args, operspy); safelist_channel_named(source_p, args, operspy);
return; return;
@ -205,8 +204,6 @@ mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
params->operspy = operspy; params->operspy = operspy;
params->created_min = params->topic_min = params->created_min = params->topic_min =
params->created_max = params->topic_max = 0; params->created_max = params->topic_max = 0;
params->mask = NULL;
params->nomask = NULL;
if (args && !EmptyString(args)) if (args && !EmptyString(args))
{ {
@ -221,23 +218,22 @@ mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if (*args == '<') if (*args == '<')
{ {
args++; args++;
if (!IsDigit(*args)) goto fail; if (IsDigit(*args))
{
params->users_max = atoi(args); params->users_max = atoi(args);
if (params->users_max == 0) if (params->users_max == 0)
params->users_max = INT_MAX; params->users_max = INT_MAX;
else else
params->users_max--; params->users_max--;
} }
}
else if (*args == '>') else if (*args == '>')
{ {
args++; args++;
if (IsDigit(*args)) if (IsDigit(*args))
params->users_min = atoi(args) + 1; params->users_min = atoi(args) + 1;
else if (args[0] == '-' && IsDigit(args[1]))
params->users_min = 0;
else else
goto fail; params->users_min = 0;
} }
else if (*args == 'C' || *args == 'c') else if (*args == 'C' || *args == 'c')
{ {
@ -246,19 +242,19 @@ mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
/* Creation time earlier than last x minutes. */ /* Creation time earlier than last x minutes. */
args++; args++;
if (!IsDigit(*args)) goto fail; if (IsDigit(*args))
{
params->created_max = rb_current_time() - (60 * atoi(args)); params->created_max = rb_current_time() - (60 * atoi(args));
} }
}
else if (*args == '<') else if (*args == '<')
{ {
/* Creation time within last x minutes. */ /* Creation time within last x minutes. */
args++; args++;
if (!IsDigit(*args)) goto fail; if (IsDigit(*args))
{
params->created_min = rb_current_time() - (60 * atoi(args)); params->created_min = rb_current_time() - (60 * atoi(args));
} }
else
{
goto fail;
} }
} }
else if (*args == 'T' || *args == 't') else if (*args == 'T' || *args == 't')
@ -268,36 +264,21 @@ mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{ {
/* Topic change time earlier than last x minutes. */ /* Topic change time earlier than last x minutes. */
args++; args++;
if (!IsDigit(*args)) goto fail; if (IsDigit(*args))
{
params->topic_max = rb_current_time() - (60 * atoi(args)); params->topic_max = rb_current_time() - (60 * atoi(args));
} }
}
else if (*args == '<') else if (*args == '<')
{ {
/* Topic change time within last x minutes. */ /* Topic change time within last x minutes. */
args++; args++;
if (!IsDigit(*args)) goto fail; if (IsDigit(*args))
{
params->topic_min = rb_current_time() - (60 * atoi(args)); params->topic_min = rb_current_time() - (60 * atoi(args));
} }
else
{
goto fail;
} }
} }
else if (*args == '!')
{
args++;
rb_free(params->nomask);
params->nomask = rb_strdup(args);
}
else if (*args == '?' || *args == '*' || IsChanPrefix(*args))
{
rb_free(params->mask);
params->mask = rb_strdup(args);
}
else
{
goto fail;
}
if (EmptyString(p)) if (EmptyString(p))
break; break;
@ -307,13 +288,6 @@ mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
} }
safelist_client_instantiate(source_p, params); safelist_client_instantiate(source_p, params);
return;
fail:
rb_free(params);
sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name);
sendto_one_notice(source_p, ":Invalid parameters for /LIST");
sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
} }
/* /*
@ -369,8 +343,6 @@ static bool safelist_sendq_exceeded(struct Client *client_p)
*/ */
static void safelist_client_instantiate(struct Client *client_p, struct ListClient *params) static void safelist_client_instantiate(struct Client *client_p, struct ListClient *params)
{ {
struct Channel *chptr;
s_assert(MyClient(client_p)); s_assert(MyClient(client_p));
s_assert(params != NULL); s_assert(params != NULL);
@ -382,12 +354,6 @@ static void safelist_client_instantiate(struct Client *client_p, struct ListClie
rb_dlinkAddAlloc(client_p, &safelisting_clients); rb_dlinkAddAlloc(client_p, &safelisting_clients);
/* give the user some initial data to work with */ /* give the user some initial data to work with */
if (params->mask && (chptr = find_channel(params->mask)))
{
bool visible = !SecretChannel(chptr) || IsMember(client_p, chptr);
if (visible || params->operspy)
list_one_channel(client_p, chptr, visible);
}
safelist_iterate_client(client_p); safelist_iterate_client(client_p);
} }
@ -409,8 +375,6 @@ static void safelist_client_release(struct Client *client_p)
rb_dlinkFindDestroy(client_p, &safelisting_clients); rb_dlinkFindDestroy(client_p, &safelisting_clients);
rb_free(client_p->localClient->safelist_data->chname); rb_free(client_p->localClient->safelist_data->chname);
rb_free(client_p->localClient->safelist_data->mask);
rb_free(client_p->localClient->safelist_data->nomask);
rb_free(client_p->localClient->safelist_data); rb_free(client_p->localClient->safelist_data);
client_p->localClient->safelist_data = NULL; client_p->localClient->safelist_data = NULL;
@ -494,12 +458,6 @@ static void safelist_one_channel(struct Client *source_p, struct Channel *chptr,
if (params->created_max && chptr->channelts > params->created_max) if (params->created_max && chptr->channelts > params->created_max)
return; return;
if (params->mask && (!irccmp(params->mask, chptr->chname) || !match(params->mask, chptr->chname)))
return;
if (params->nomask && match(params->nomask, chptr->chname))
return;
list_one_channel(source_p, chptr, visible); list_one_channel(source_p, chptr, visible);
} }

View file

@ -108,7 +108,7 @@ dump_map(struct Client *client_p, struct Client *root_p, char *pbuf)
} }
frac = (1000 * rb_dlink_list_length(&root_p->serv->users) + Count.total / 2) / Count.total; frac = (1000 * rb_dlink_list_length(&root_p->serv->users) + Count.total / 2) / Count.total;
snprintf(buf + USER_COL, sizeof buf - USER_COL, snprintf(buf + USER_COL, BUFSIZE - USER_COL,
" | Users: %5lu (%2d.%1d%%)", rb_dlink_list_length(&root_p->serv->users), " | Users: %5lu (%2d.%1d%%)", rb_dlink_list_length(&root_p->serv->users),
frac / 10, frac % 10); frac / 10, frac % 10);
@ -172,7 +172,7 @@ flattened_map(struct Client *client_p)
} }
} }
snprintf(buf + USER_COL, sizeof buf - USER_COL, snprintf(buf + USER_COL, BUFSIZE - USER_COL,
" | Users: %5lu (%4.1f%%)", rb_dlink_list_length(&me.serv->users), " | Users: %5lu (%4.1f%%)", rb_dlink_list_length(&me.serv->users),
100 * (float) rb_dlink_list_length(&me.serv->users) / (float) Count.total); 100 * (float) rb_dlink_list_length(&me.serv->users) / (float) Count.total);
@ -210,7 +210,7 @@ flattened_map(struct Client *client_p)
} }
} }
snprintf(buf + USER_COL, sizeof buf - USER_COL, snprintf(buf + USER_COL, BUFSIZE - USER_COL,
" | Users: %5lu (%4.1f%%)", rb_dlink_list_length(&target_p->serv->users), " | Users: %5lu (%4.1f%%)", rb_dlink_list_length(&target_p->serv->users),
100 * (float) rb_dlink_list_length(&target_p->serv->users) / (float) Count.total); 100 * (float) rb_dlink_list_length(&target_p->serv->users) / (float) Count.total);

View file

@ -120,9 +120,10 @@ static void
names_global(struct Client *source_p) names_global(struct Client *source_p)
{ {
bool dont_show = false; bool dont_show = false;
rb_dlink_node *ptr; rb_dlink_node *lp, *ptr;
struct Client *target_p; struct Client *target_p;
struct Channel *chptr = NULL; struct Channel *chptr = NULL;
struct membership *msptr;
/* first do all visible channels */ /* first do all visible channels */
RB_DLINK_FOREACH(ptr, global_channel_list.head) RB_DLINK_FOREACH(ptr, global_channel_list.head)
@ -140,9 +141,6 @@ names_global(struct Client *source_p)
/* Second, do all clients in one big sweep */ /* Second, do all clients in one big sweep */
RB_DLINK_FOREACH(ptr, global_client_list.head) RB_DLINK_FOREACH(ptr, global_client_list.head)
{ {
rb_dlink_node *ps, *pt;
struct membership *ms, *mt;
target_p = ptr->data; target_p = ptr->data;
dont_show = false; dont_show = false;
@ -156,11 +154,13 @@ names_global(struct Client *source_p)
* both were missed out above. if the target is on a * both were missed out above. if the target is on a
* common channel with source, its already been shown. * common channel with source, its already been shown.
*/ */
ITER_COMM_CHANNELS(ps, pt, source_p->user->channel.head, target_p->user->channel.head, ms, mt, chptr) RB_DLINK_FOREACH(lp, target_p->user->channel.head)
{ {
if (!mt) continue; msptr = lp->data;
chptr = msptr->chptr;
if (PubChannel(chptr) || SecretChannel(chptr) || ms) if(PubChannel(chptr) || IsMember(source_p, chptr) ||
SecretChannel(chptr))
{ {
dont_show = true; dont_show = true;
break; break;

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

View file

@ -237,7 +237,7 @@ scan_umodes(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
if (mask != NULL) if (mask != NULL)
{ {
snprintf(maskbuf, sizeof maskbuf, "%s!%s@%s", snprintf(maskbuf, BUFSIZE, "%s!%s@%s",
target_p->name, target_p->username, target_p->host); target_p->name, target_p->username, target_p->host);
if (!match(mask, maskbuf)) if (!match(mask, maskbuf))

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

View file

@ -453,7 +453,7 @@ stats_deny (struct Client *source_p)
static void static void
stats_exempt(struct Client *source_p) stats_exempt(struct Client *source_p)
{ {
char *name, *host, *user, *classname, *desc; char *name, *host, *user, *classname;
const char *pass; const char *pass;
struct AddressRec *arec; struct AddressRec *arec;
struct ConfItem *aconf; struct ConfItem *aconf;
@ -474,7 +474,7 @@ stats_exempt(struct Client *source_p)
{ {
aconf = arec->aconf; aconf = arec->aconf;
get_printable_conf (aconf, &name, &host, &pass, get_printable_conf (aconf, &name, &host, &pass,
&user, &port, &classname, &desc); &user, &port, &classname);
sendto_one_numeric(source_p, RPL_STATSDLINE, sendto_one_numeric(source_p, RPL_STATSDLINE,
form_str(RPL_STATSDLINE), form_str(RPL_STATSDLINE),
@ -533,7 +533,7 @@ stats_auth (struct Client *source_p)
else if((ConfigFileEntry.stats_i_oper_only == 1) && !IsOperGeneral (source_p)) else if((ConfigFileEntry.stats_i_oper_only == 1) && !IsOperGeneral (source_p))
{ {
struct ConfItem *aconf; struct ConfItem *aconf;
char *name, *host, *user, *classname, *desc; char *name, *host, *user, *classname;
const char *pass = "*"; const char *pass = "*";
int port; int port;
@ -550,13 +550,13 @@ stats_auth (struct Client *source_p)
if(aconf == NULL) if(aconf == NULL)
return; return;
get_printable_conf (aconf, &name, &host, &pass, &user, &port, &classname, &desc); get_printable_conf (aconf, &name, &host, &pass, &user, &port, &classname);
if(!EmptyString(aconf->spasswd)) if(!EmptyString(aconf->spasswd))
pass = aconf->spasswd; pass = aconf->spasswd;
sendto_one_numeric(source_p, RPL_STATSILINE, form_str(RPL_STATSILINE), sendto_one_numeric(source_p, RPL_STATSILINE, form_str(RPL_STATSILINE),
name, pass, show_iline_prefix(source_p, aconf, user), name, pass, show_iline_prefix(source_p, aconf, user),
host, port, classname, desc); host, port, classname);
} }
/* Theyre opered, or allowed to see all auth blocks */ /* Theyre opered, or allowed to see all auth blocks */
@ -908,8 +908,8 @@ stats_ssld_foreach(void *data, pid_t pid, int cli_count, enum ssld_status status
struct Client *source_p = data; struct Client *source_p = data;
sendto_one_numeric(source_p, RPL_STATSDEBUG, sendto_one_numeric(source_p, RPL_STATSDEBUG,
"S :%ld %c %u :%s", "S :%u %c %u :%s",
(long)pid, pid,
status == SSLD_DEAD ? 'D' : (status == SSLD_SHUTDOWN ? 'S' : 'A'), status == SSLD_DEAD ? 'D' : (status == SSLD_SHUTDOWN ? 'S' : 'A'),
cli_count, cli_count,
version); version);
@ -960,8 +960,8 @@ stats_usage (struct Client *source_p)
(int) (rus.ru_stime.tv_sec % 60)); (int) (rus.ru_stime.tv_sec % 60));
sendto_one_numeric(source_p, RPL_STATSDEBUG, sendto_one_numeric(source_p, RPL_STATSDEBUG,
"R :RSS %ld ShMem %ld Data %ld Stack %ld", "R :RSS %ld ShMem %ld Data %ld Stack %ld",
rus.ru_maxrss, (long)(rus.ru_ixrss / rup), rus.ru_maxrss, (rus.ru_ixrss / rup),
(long)(rus.ru_idrss / rup), (long)(rus.ru_isrss / rup)); (rus.ru_idrss / rup), (rus.ru_isrss / rup));
sendto_one_numeric(source_p, RPL_STATSDEBUG, sendto_one_numeric(source_p, RPL_STATSDEBUG,
"R :Swaps %d Reclaims %d Faults %d", "R :Swaps %d Reclaims %d Faults %d",
(int) rus.ru_nswap, (int) rus.ru_minflt, (int) rus.ru_majflt); (int) rus.ru_nswap, (int) rus.ru_minflt, (int) rus.ru_majflt);

View file

@ -235,8 +235,7 @@ mo_testline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
sendto_one_numeric(source_p, RPL_STATSILINE, form_str(RPL_STATSILINE), sendto_one_numeric(source_p, RPL_STATSILINE, form_str(RPL_STATSILINE),
aconf->info.name, EmptyString(aconf->spasswd) ? "<NULL>" : aconf->spasswd, aconf->info.name, EmptyString(aconf->spasswd) ? "<NULL>" : aconf->spasswd,
show_iline_prefix(source_p, aconf, aconf->user), show_iline_prefix(source_p, aconf, aconf->user),
aconf->host, aconf->port, aconf->className, aconf->host, aconf->port, aconf->className);
CheckEmpty(aconf->desc));
return; return;
} }

View file

@ -173,7 +173,7 @@ m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
sendto_one(source_p, form_str(RPL_TOPICWHOTIME), sendto_one(source_p, form_str(RPL_TOPICWHOTIME),
me.name, source_p->name, chptr->chname, me.name, source_p->name, chptr->chname,
chptr->topic_info, chptr->topic_info,
(long long)chptr->topic_time); (unsigned long)chptr->topic_time);
} }
} }
} }

View file

@ -367,12 +367,8 @@ who_global(struct Client *source_p, const char *mask, int server_oper, int opers
who_common_channel(source_p, msptr->chptr, mask, server_oper, &maxmatches, fmt); who_common_channel(source_p, msptr->chptr, mask, server_oper, &maxmatches, fmt);
} }
} }
else else if (!ConfigFileEntry.operspy_dont_care_user_info)
{
maxmatches = INT_MAX;
if (!ConfigFileEntry.operspy_dont_care_user_info)
report_operspy(source_p, "WHO", mask); report_operspy(source_p, "WHO", mask);
}
/* second, list all matching visible clients and clear all marks /* second, list all matching visible clients and clear all marks
* on invisible clients * on invisible clients

View file

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

View file

@ -44,78 +44,49 @@
#include "supported.h" #include "supported.h"
#include "logger.h" #include "logger.h"
static int
um_callerid_modinit(void)
{
user_modes['g'] = find_umode_slot();
if (!user_modes['g'])
{
ierror("um_callerid: unable to allocate usermode slot for +g; unloading module.");
return -1;
}
user_modes['G'] = find_umode_slot();
if (!user_modes['G'])
{
user_modes['g'] = 0;
ierror("um_callerid: unable to allocate usermode slot for +G; unloading module.");
return -1;
}
construct_umodebuf();
add_isupport("CALLERID", isupport_umode, "g");
return 0;
}
static void
um_callerid_moddeinit(void)
{
user_modes['g'] = 0;
user_modes['G'] = 0;
construct_umodebuf();
delete_isupport("CALLERID");
}
#define IsSetStrictCallerID(c) ((c->umodes & user_modes['g']) == user_modes['g']) #define IsSetStrictCallerID(c) ((c->umodes & user_modes['g']) == user_modes['g'])
#define IsSetRelaxedCallerID(c) ((c->umodes & user_modes['G']) == user_modes['G']) #define IsSetRelaxedCallerID(c) ((c->umodes & user_modes['G']) == user_modes['G'])
#define IsSetAnyCallerID(c) (IsSetStrictCallerID(c) || IsSetRelaxedCallerID(c)) #define IsSetAnyCallerID(c) (IsSetStrictCallerID(c) || IsSetRelaxedCallerID(c))
#define IsSetTalkThroughCallerID(c) ((c->umodes & user_modes['M']) == user_modes['M'])
static const char um_callerid_desc[] = static const char um_callerid_desc[] =
"Provides usermodes +g and +G which restrict messages from unauthorized users."; "Provides usermodes +g and +G which restrict messages from unauthorized users.";
struct CallerIDOverrideSession {
rb_dlink_node node;
struct Client *client;
time_t deadline;
};
static rb_dlink_list callerid_overriding_opers = { NULL, NULL, 0 };
struct ev_entry *expire_callerid_override_deadlines_ev = NULL;
static void
update_session_deadline(struct Client *source_p)
{
struct CallerIDOverrideSession *session_p = NULL;
rb_dlink_node *n;
RB_DLINK_FOREACH(n, callerid_overriding_opers.head)
{
struct CallerIDOverrideSession *s = n->data;
if (s->client == source_p)
{
session_p = s;
break;
}
}
if (session_p != NULL)
{
rb_dlinkDelete(&session_p->node, &callerid_overriding_opers);
}
else
{
session_p = rb_malloc(sizeof(struct CallerIDOverrideSession));
session_p->client = source_p;
}
session_p->deadline = rb_current_time() + 1800;
rb_dlinkAddTail(session_p, &session_p->node, &callerid_overriding_opers);
}
static void
expire_callerid_override_deadlines(void *unused)
{
rb_dlink_node *n, *tn;
RB_DLINK_FOREACH_SAFE(n, tn, callerid_overriding_opers.head)
{
struct CallerIDOverrideSession *session_p = n->data;
if (session_p->deadline >= rb_current_time())
{
break;
}
else
{
const char *parv[4] = {session_p->client->name, session_p->client->name, "-M", NULL};
user_mode(session_p->client, session_p->client, 3, parv);
}
}
}
static bool static bool
allow_message(struct Client *source_p, struct Client *target_p) allow_message(struct Client *source_p, struct Client *target_p)
{ {
@ -134,7 +105,7 @@ allow_message(struct Client *source_p, struct Client *target_p)
return true; return true;
/* XXX: controversial? allow opers to send through +g */ /* XXX: controversial? allow opers to send through +g */
if (IsSetTalkThroughCallerID(source_p) || MayHavePrivilege(source_p, "oper:always_message")) if (MayHavePrivilege(source_p, "oper:message"))
return true; return true;
if (accept_message(source_p, target_p)) if (accept_message(source_p, target_p))
@ -256,156 +227,11 @@ h_hdl_privmsg_user(void *vdata)
data->approved = ERR_TARGUMODEG; data->approved = ERR_TARGUMODEG;
} }
static void
check_umode_change(void *vdata)
{
hook_data_umode_changed *data = (hook_data_umode_changed *)vdata;
bool changed = false;
struct Client *source_p = data->client;
if (!MyClient(source_p))
return;
if (data->oldumodes & UMODE_OPER && !IsOper(source_p))
source_p->umodes &= ~user_modes['M'];
changed = ((data->oldumodes ^ source_p->umodes) & user_modes['M']);
if (changed && source_p->umodes & user_modes['M'])
{
if (!HasPrivilege(source_p, "oper:message"))
{
sendto_one_notice(source_p, ":*** You need oper:message privilege for +M");
source_p->umodes &= ~user_modes['M'];
return;
}
update_session_deadline(source_p);
}
else if (changed)
{
// Unsetting +M; remove the timeout session
rb_dlink_node *n, *tn;
RB_DLINK_FOREACH_SAFE(n, tn, callerid_overriding_opers.head)
{
struct CallerIDOverrideSession *session_p = n->data;
if (session_p->client != source_p)
continue;
rb_dlinkDelete(n, &callerid_overriding_opers);
rb_free(session_p);
}
}
}
static void check_priv_change(void *vdata)
{
hook_data_priv_change *data = (hook_data_priv_change*)vdata;
struct Client *source_p = data->client;
const char *fakeparv[4];
if (!MyClient(source_p))
return;
if (source_p->umodes & user_modes['M'] && !HasPrivilege(source_p, "oper:message"))
{
sendto_one_notice(source_p, ":*** You need oper:message privilege for +M");
fakeparv[0] = fakeparv[1] = source_p->name;
fakeparv[2] = "-M";
fakeparv[3] = NULL;
user_mode(source_p, source_p, 3, fakeparv);
}
}
static void
handle_client_exit(void *vdata)
{
hook_data_client_exit *data = (hook_data_client_exit *) vdata;
rb_dlink_node *n, *tn;
struct Client *source_p = data->target;
RB_DLINK_FOREACH_SAFE(n, tn, callerid_overriding_opers.head)
{
struct CallerIDOverrideSession *session_p = n->data;
if (session_p->client != source_p)
continue;
rb_dlinkDelete(n, &callerid_overriding_opers);
rb_free(session_p);
}
}
static mapi_hfn_list_av1 um_callerid_hfnlist[] = { static mapi_hfn_list_av1 um_callerid_hfnlist[] = {
{ "umode_changed", check_umode_change },
{ "priv_change", check_priv_change },
{ "invite", h_hdl_invite }, { "invite", h_hdl_invite },
{ "privmsg_user", h_hdl_privmsg_user }, { "privmsg_user", h_hdl_privmsg_user },
{ "client_exit", handle_client_exit },
{ NULL, NULL } { NULL, NULL }
}; };
static int
um_callerid_modinit(void)
{
rb_dlink_node *ptr;
user_modes['g'] = find_umode_slot();
if (!user_modes['g'])
{
ierror("um_callerid: unable to allocate usermode slot for +g; unloading module.");
return -1;
}
user_modes['G'] = find_umode_slot();
if (!user_modes['G'])
{
user_modes['g'] = 0;
ierror("um_callerid: unable to allocate usermode slot for +G; unloading module.");
return -1;
}
user_modes['M'] = find_umode_slot();
if (!user_modes['M'])
{
user_modes['g'] = 0;
user_modes['G'] = 0;
ierror("um_callerid: unable to allocate usermode slot for +M; unloading module.");
return -1;
}
construct_umodebuf();
add_isupport("CALLERID", isupport_umode, "g");
RB_DLINK_FOREACH(ptr, lclient_list.head)
{
struct Client *client_p = ptr->data;
if (IsPerson(client_p) && (client_p->umodes & user_modes['M']))
update_session_deadline(client_p);
}
expire_callerid_override_deadlines_ev = rb_event_add("expire_callerid_override_deadlines", expire_callerid_override_deadlines, NULL, 60);
return 0;
}
static void
um_callerid_moddeinit(void)
{
user_modes['g'] = 0;
user_modes['G'] = 0;
user_modes['M'] = 0;
construct_umodebuf();
delete_isupport("CALLERID");
rb_event_delete(expire_callerid_override_deadlines_ev);
}
DECLARE_MODULE_AV2(um_callerid, um_callerid_modinit, um_callerid_moddeinit, DECLARE_MODULE_AV2(um_callerid, um_callerid_modinit, um_callerid_moddeinit,
NULL, NULL, um_callerid_hfnlist, NULL, NULL, um_callerid_desc); NULL, NULL, um_callerid_hfnlist, NULL, NULL, um_callerid_desc);

View file

@ -1,7 +1,6 @@
check_PROGRAMS = runtests \ check_PROGRAMS = runtests \
chmode1 \ chmode1 \
match1 \ match1 \
misc \
msgbuf_parse1 \ msgbuf_parse1 \
msgbuf_unparse1 \ msgbuf_unparse1 \
hostmask1 \ hostmask1 \

View file

@ -1,88 +0,0 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "tap/basic.h"
#include "s_newconf.h"
#define MSG "%s:%d (%s)", __FILE__, __LINE__, __FUNCTION__
#define MINUTE (60)
#define HOUR (MINUTE * 60)
#define DAY (HOUR * 24)
#define WEEK (DAY * 7)
static void valid_temp_time1(void)
{
time_t t;
t = valid_temp_time("1");
is_int(MINUTE, t, MSG);
t = valid_temp_time("1m");
is_int(MINUTE, t, MSG);
t = valid_temp_time("1h");
is_int(HOUR, t, MSG);
t = valid_temp_time("1d");
is_int(DAY, t, MSG);
t = valid_temp_time("1w");
is_int(WEEK, t, MSG);
t = valid_temp_time("2d");
is_int(2 * DAY, t, MSG);
t = valid_temp_time("1w2d3h4m");
is_int(1 * WEEK + 2 * DAY + 3 * HOUR + 4 * MINUTE, t, MSG);
t = valid_temp_time("1w2d3h4");
is_int(1 * WEEK + 2 * DAY + 3 * HOUR + 4 * MINUTE, t, MSG);
t = valid_temp_time("4m3h2d1w");
is_int(1 * WEEK + 2 * DAY + 3 * HOUR + 4 * MINUTE, t, MSG);
t = valid_temp_time("7000w");
is_int(52 * WEEK, t, MSG);
}
static void valid_temp_time_invalid(void)
{
time_t t;
t = valid_temp_time("-2w");
is_int(-1, t, MSG);
t = valid_temp_time("hello");
is_int(-1, t, MSG);
t = valid_temp_time("m");
is_int(-1, t, MSG);
t = valid_temp_time("1w-1w");
is_int(-1, t, MSG);
}
static void valid_temp_time_overflow(void)
{
char s[100];
time_t t;
snprintf(s, sizeof s, "%" PRIuMAX "m", UINTMAX_MAX / 60 + 2);
t = valid_temp_time(s);
is_int(52 * WEEK, t, MSG);
snprintf(s, sizeof s, "%ldm", LONG_MAX / 60 + 2);
t = valid_temp_time(s);
is_int(52 * WEEK, t, MSG);
snprintf(s, sizeof s, "%ldm%ldm", LONG_MAX / 60 - 1, LONG_MAX / 60 - 1);
t = valid_temp_time(s);
is_int(52 * WEEK, t, MSG);
}
int main(int argc, char *argv[])
{
plan_lazy();
valid_temp_time1();
valid_temp_time_invalid();
valid_temp_time_overflow();
return 0;
}