summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/actions.c17
-rw-r--r--src/base64.c18
-rw-r--r--src/botserv.c41
-rw-r--r--src/channels.c72
-rw-r--r--src/chanserv.c41
-rw-r--r--src/core/cs_ban.c14
-rw-r--r--src/core/cs_clear.c96
-rw-r--r--src/core/cs_modes.c22
-rw-r--r--src/core/os_clearmodes.c66
-rw-r--r--src/core/os_mode.c6
-rw-r--r--src/events.c22
-rw-r--r--src/messages.c38
-rw-r--r--src/misc.c18
-rw-r--r--src/modules.c98
-rw-r--r--src/operserv.c16
-rw-r--r--src/process.c332
-rw-r--r--src/protocol/bahamut.c222
-rw-r--r--src/protocol/bahamut.h128
-rw-r--r--src/protocol/charybdis.c230
-rw-r--r--src/protocol/charybdis.h128
-rw-r--r--src/protocol/dreamforge.c192
-rw-r--r--src/protocol/dreamforge.h128
-rw-r--r--src/protocol/hybrid.c214
-rw-r--r--src/protocol/hybrid.h128
-rw-r--r--src/protocol/inspircd10.c250
-rw-r--r--src/protocol/inspircd10.h148
-rw-r--r--src/protocol/inspircd11.c253
-rwxr-xr-xsrc/protocol/inspircd11.h150
-rw-r--r--src/protocol/plexus2.c218
-rw-r--r--src/protocol/plexus2.h128
-rw-r--r--src/protocol/plexus3.c218
-rw-r--r--src/protocol/plexus3.h128
-rw-r--r--src/protocol/ptlink.c216
-rw-r--r--src/protocol/ptlink.h128
-rw-r--r--src/protocol/rageircd.c234
-rw-r--r--src/protocol/rageircd.h128
-rw-r--r--src/protocol/ratbox.c223
-rw-r--r--src/protocol/ratbox.h128
-rw-r--r--src/protocol/shadowircd.c219
-rw-r--r--src/protocol/shadowircd.h128
-rw-r--r--src/protocol/solidircd.c226
-rw-r--r--src/protocol/solidircd.h128
-rw-r--r--src/protocol/ultimate2.c232
-rw-r--r--src/protocol/ultimate2.h128
-rw-r--r--src/protocol/ultimate3.c250
-rw-r--r--src/protocol/ultimate3.h128
-rw-r--r--src/protocol/unreal31.c220
-rw-r--r--src/protocol/unreal31.h128
-rw-r--r--src/protocol/unreal32.c256
-rw-r--r--src/protocol/unreal32.h128
-rw-r--r--src/protocol/viagra.c252
-rw-r--r--src/protocol/viagra.h128
-rw-r--r--src/send.c8
-rw-r--r--src/servers.c20
-rw-r--r--src/sessions.c50
-rw-r--r--src/users.c12
56 files changed, 3688 insertions, 3790 deletions
diff --git a/src/actions.c b/src/actions.c
index 9da4f60d4..dcccf0131 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -6,9 +6,9 @@
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
- * Based on the original code of Services by Andy Church.
- *
- * $Id$
+ * Based on the original code of Services by Andy Church.
+ *
+ * $Id$
*
*/
@@ -130,7 +130,7 @@ void sqline(char *mask, char *reason)
*/
void common_unban(ChannelInfo * ci, char *nick)
{
- char *av[4];
+ const char *av[4];
char *host = NULL;
char buf[BUFSIZE];
int ac;
@@ -170,11 +170,11 @@ void common_unban(ChannelInfo * ci, char *nick)
snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
av[0] = ci->name;
av[1] = buf;
- av[2] = sstrdup("-b");
+ av[2] = "-b";
ac = 4;
} else {
av[0] = ci->name;
- av[1] = sstrdup("-b");
+ av[1] = "-b";
ac = 3;
}
@@ -191,11 +191,6 @@ void common_unban(ChannelInfo * ci, char *nick)
do_cmode(whosends(ci), ac, av);
}
}
-
- if (ircdcap->tsmode)
- free(av[2]);
- else
- free(av[1]);
}
/* host_resolve() sstrdup us this info so we gotta free it */
if (host) {
diff --git a/src/base64.c b/src/base64.c
index 10b2f0254..2c78a9703 100644
--- a/src/base64.c
+++ b/src/base64.c
@@ -6,8 +6,8 @@
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
- * Based on the original code of Services by Andy Church.
- *
+ * Based on the original code of Services by Andy Church.
+ *
*
*/
@@ -88,9 +88,9 @@ static const char Pad64 = '=';
end of the data is performed using the '=' character.
Since all base64 input is an integral number of octets, only the
- -------------------------------------------------
+ -------------------------------------------------
following cases can arise:
-
+
(1) the final quantum of encoding input is an integral
multiple of 24 bits; here, the final unit of encoded
output will be an integral multiple of 4 characters
@@ -162,7 +162,7 @@ int b64_encode(char *src, size_t srclength, char *target, size_t targsize)
it returns the number of data bytes stored at the target, or -1 on error.
*/
-int b64_decode(char *src, char *target, size_t targsize)
+int b64_decode(const char *src, char *target, size_t targsize)
{
int tarindex, state, ch;
char *pos;
@@ -301,7 +301,7 @@ char *encode_ip(unsigned char *ip)
return buf;
}
-int decode_ip(char *buf)
+int decode_ip(const char *buf)
{
int len = strlen(buf);
char targ[25];
@@ -351,8 +351,8 @@ char base64_to_int6_map[] = {
static char *int_to_base64(long val)
{
- /* 32/6 == max 6 bytes for representation,
- * +1 for the null, +1 for byte boundaries
+ /* 32/6 == max 6 bytes for representation,
+ * +1 for the null, +1 for byte boundaries
*/
static char base64buf[8];
long i = 7;
@@ -391,7 +391,7 @@ static long base64_to_int(char *b64)
return v;
}
-long base64dects(char *ts)
+long base64dects(const char *ts)
{
char *token;
long value;
diff --git a/src/botserv.c b/src/botserv.c
index 556994b0e..19fff43e7 100644
--- a/src/botserv.c
+++ b/src/botserv.c
@@ -7,7 +7,7 @@
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
- *
+ *
* $Id$
*
*/
@@ -613,7 +613,7 @@ BotInfo *makebot(char *nick)
/*************************************************************************/
-BotInfo *findbot(char *nick)
+BotInfo *findbot(const char *nick)
{
BotInfo *bi;
Uid *ud;
@@ -762,7 +762,7 @@ void bot_join(ChannelInfo * ci)
/* We check for bans */
if (ci->c->bans && ci->c->bans->count) {
char buf[BUFSIZE];
- char *av[4];
+ const char *av[4];
Entry *ban, *next;
int ac;
@@ -770,11 +770,11 @@ void bot_join(ChannelInfo * ci)
snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
av[0] = ci->c->name;
av[1] = buf;
- av[2] = sstrdup("-b");
+ av[2] = "-b";
ac = 4;
} else {
av[0] = ci->c->name;
- av[1] = sstrdup("-b");
+ av[1] = "-b";
ac = 3;
}
@@ -792,11 +792,6 @@ void bot_join(ChannelInfo * ci)
do_cmode(whosends(ci), ac, av);
}
}
-
- if (ircdcap->tsmode)
- free(av[2]);
- else
- free(av[1]);
}
/* Should we be invited? */
@@ -842,7 +837,7 @@ static void check_ban(ChannelInfo * ci, User * u, int ttbtype)
bd->ttb[ttbtype]++;
if (bd->ttb[ttbtype] == ci->ttb[ttbtype]) {
- char *av[4];
+ const char *av[4];
int ac;
char mask[BUFSIZE];
char buf[BUFSIZE];
@@ -855,12 +850,12 @@ static void check_ban(ChannelInfo * ci, User * u, int ttbtype)
snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
av[0] = ci->name;
av[1] = buf;
- av[2] = sstrdup("+b");
+ av[2] = "+b";
av[3] = mask;
ac = 4;
} else {
av[0] = ci->name;
- av[1] = sstrdup("+b");
+ av[1] = "+b";
av[2] = mask;
ac = 3;
}
@@ -868,10 +863,6 @@ static void check_ban(ChannelInfo * ci, User * u, int ttbtype)
anope_cmd_mode(ci->bi->nick, ci->name, "+b %s", mask);
do_cmode(ci->bi->nick, ac, av);
send_event(EVENT_BOT_BAN, 3, u->nick, ci->name, mask);
- if (ircdcap->tsmode)
- free(av[2]);
- else
- free(av[1]);
}
}
@@ -912,7 +903,7 @@ void bot_raw_ban(User * requester, ChannelInfo * ci, char *nick,
char *reason)
{
int ac;
- char *av[4];
+ const char *av[4];
const char *kav[4]; // seperate as not everything is constified XXX -- w00t
char mask[BUFSIZE];
char buf[BUFSIZE];
@@ -947,12 +938,12 @@ void bot_raw_ban(User * requester, ChannelInfo * ci, char *nick,
snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
av[0] = ci->name;
av[1] = buf;
- av[2] = sstrdup("+b");
+ av[2] = "+b";
av[3] = mask;
ac = 4;
} else {
av[0] = ci->name;
- av[1] = sstrdup("+b");
+ av[1] = "+b";
av[2] = mask;
ac = 3;
}
@@ -960,12 +951,6 @@ void bot_raw_ban(User * requester, ChannelInfo * ci, char *nick,
anope_cmd_mode(ci->bi->nick, ci->name, "+b %s", mask);
do_cmode(ci->bi->nick, ac, av);
- /* We need to free our sstrdup'd "+b" -GD */
- if (ircdcap->tsmode)
- free(av[2]);
- else
- free(av[1]);
-
kav[0] = ci->name;
kav[1] = nick;
@@ -1044,7 +1029,7 @@ void bot_raw_kick(User * requester, ChannelInfo * ci, char *nick,
void bot_raw_mode(User * requester, ChannelInfo * ci, char *mode,
char *nick)
{
- char *av[4];
+ const char *av[4];
int ac;
char buf[BUFSIZE];
User *u;
@@ -1094,7 +1079,7 @@ void bot_raw_mode(User * requester, ChannelInfo * ci, char *mode,
* @param A string to be parsed for control and color codes
* @return A string stripped of control and color codes
*/
-char *normalizeBuffer(char *buf)
+char *normalizeBuffer(const char *buf)
{
char *newbuf;
int i, len, j = 0;
diff --git a/src/channels.c b/src/channels.c
index 41909c1ba..e7ac7940d 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -6,8 +6,8 @@
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
- * Based on the original code of Services by Andy Church.
- *
+ * Based on the original code of Services by Andy Church.
+ *
* $Id$
*
*/
@@ -155,11 +155,12 @@ void chan_remove_user_status(Channel * chan, User * user, int16 status)
/*************************************************************************/
-void chan_set_modes(const char *source, Channel * chan, int ac, char **av,
+void chan_set_modes(const char *source, Channel * chan, int ac, const char **av,
int check)
{
int add = 1;
- char *modes = av[0], mode;
+ const char *modes = av[0];
+ char mode;
CBMode *cbm;
CMMode *cmm;
CUMode *cum;
@@ -167,7 +168,7 @@ void chan_set_modes(const char *source, Channel * chan, int ac, char **av,
BotInfo *bi;
User *u, *user;
int i, real_ac = ac;
- char **real_av = av;
+ const char **real_av = av;
if (debug)
alog("debug: Changing modes for %s to %s", chan->name,
@@ -181,7 +182,7 @@ void chan_set_modes(const char *source, Channel * chan, int ac, char **av,
alog("debug: Removing instead of setting due to DEOPPED flag");
/* Swap adding and removing of the modes */
- for (s = av[0]; *s; s++) {
+ for (s = (char *)av[0]; *s; s++) { // XXX Unsafe cast, this needs reviewing -- CyberBotX
if (*s == '+')
*s = '-';
else if (*s == '-')
@@ -514,7 +515,7 @@ User *nc_on_chan(Channel * c, NickCore * nc)
* av[0] = channels to join
*/
-void do_join(const char *source, int ac, char **av)
+void do_join(const char *source, int ac, const char **av)
{
User *user;
Channel *chan;
@@ -538,7 +539,7 @@ void do_join(const char *source, int ac, char **av)
return;
}
- t = av[0];
+ t = (char *)av[0]; // XXX Unsafe cast, this needs reviewing -- CyberBotX
while (*(s = t)) {
t = s + strcspn(s, ",");
if (*t)
@@ -660,7 +661,7 @@ void do_kick(const char *source, int ac, const char **av)
* av[1] = reason (optional)
*/
-void do_part(const char *source, int ac, char **av)
+void do_part(const char *source, int ac, const char **av)
{
User *user;
char *s, *t;
@@ -681,7 +682,7 @@ void do_part(const char *source, int ac, char **av)
}
return;
}
- t = av[0];
+ t = (char *)av[0]; // XXX Unsafe cast, this needs reviewing -- CyberBotX
while (*(s = t)) {
t = s + strcspn(s, ",");
if (*t)
@@ -753,14 +754,15 @@ void do_part(const char *source, int ac, char **av)
*/
-void do_sjoin(const char *source, int ac, char **av)
+void do_sjoin(const char *source, int ac, const char **av)
{
Channel *c;
User *user;
Server *serv;
struct c_userlist *cu;
- char *s = NULL;
- char *end, cubuf[7], *end2, *cumodes[6];
+ const char *s = NULL;
+ char *end, cubuf[7], *end2;
+ const char *cumodes[6];
int is_sqlined = 0;
int ts = 0;
int is_created = 0;
@@ -1025,7 +1027,7 @@ void do_sjoin(const char *source, int ac, char **av)
alog("debug: SJOIN for nonexistent user %s on %s", s,
av[1]);
}
- free(s);
+ free((char *)s);
return;
}
@@ -1065,7 +1067,7 @@ void do_sjoin(const char *source, int ac, char **av)
break;
s = end + 1;
}
- free(s);
+ free((char *)s);
} else if (ac == 2) {
if (UseTS6 && ircd->ts6) {
user = find_byuid(source);
@@ -1112,12 +1114,12 @@ void do_sjoin(const char *source, int ac, char **av)
/* Handle a channel MODE command. */
-void do_cmode(const char *source, int ac, char **av)
+void do_cmode(const char *source, int ac, const char **av)
{
Channel *chan;
ChannelInfo *ci = NULL;
int i;
- char *t;
+ const char *t;
if (ircdcap->tsmode) {
/* TSMODE for bahamut - leave this code out to break MODEs. -GD */
@@ -1178,7 +1180,7 @@ void do_cmode(const char *source, int ac, char **av)
/* Handle a TOPIC command. */
-void do_topic(const char *source, int ac, char **av)
+void do_topic(const char *source, int ac, const char **av)
{
Channel *c = findchan(av[0]);
ChannelInfo *ci;
@@ -1256,7 +1258,7 @@ void do_topic(const char *source, int ac, char **av)
/**************************** Internal Calls *****************************/
/*************************************************************************/
-void add_ban(Channel * chan, char *mask)
+void add_ban(Channel * chan, const char *mask)
{
Entry *ban;
/* check for NULL values otherwise we will segfault */
@@ -1295,7 +1297,7 @@ void add_ban(Channel * chan, char *mask)
/*************************************************************************/
-void add_exception(Channel * chan, char *mask)
+void add_exception(Channel * chan, const char *mask)
{
Entry *exception;
@@ -1320,7 +1322,7 @@ void add_exception(Channel * chan, char *mask)
/*************************************************************************/
-void add_invite(Channel * chan, char *mask)
+void add_invite(Channel * chan, const char *mask)
{
Entry *invite;
@@ -1551,9 +1553,9 @@ void chan_adduser2(User * user, Channel * c)
}
/**
- * We let the bot join even if it was an ignored user, as if we don't,
+ * We let the bot join even if it was an ignored user, as if we don't,
* and the ignored user dosnt just leave, the bot will never
- * make it into the channel, leaving the channel botless even for
+ * make it into the channel, leaving the channel botless even for
* legit users - Rob
**/
if (s_BotServ && c->ci && c->ci->bi) {
@@ -1581,7 +1583,7 @@ void chan_adduser2(User * user, Channel * c)
chan_adduser, but splitted to make it more efficient to use for
SJOINs). */
-Channel *chan_create(char *chan, time_t ts)
+Channel *chan_create(const char *chan, time_t ts)
{
Channel *c;
Channel **list;
@@ -1683,7 +1685,7 @@ void chan_delete(Channel * c)
/*************************************************************************/
-void del_ban(Channel * chan, char *mask)
+void del_ban(Channel * chan, const char *mask)
{
AutoKick *akick;
Entry *ban;
@@ -1708,7 +1710,7 @@ void del_ban(Channel * chan, char *mask)
/*************************************************************************/
-void del_exception(Channel * chan, char *mask)
+void del_exception(Channel * chan, const char *mask)
{
Entry *exception;
@@ -1729,7 +1731,7 @@ void del_exception(Channel * chan, char *mask)
/*************************************************************************/
-void del_invite(Channel * chan, char *mask)
+void del_invite(Channel * chan, const char *mask)
{
Entry *invite;
@@ -1786,7 +1788,7 @@ char *get_redirect(Channel * chan)
/*************************************************************************/
-Channel *join_user_update(User * user, Channel * chan, char *name,
+Channel *join_user_update(User * user, Channel * chan, const char *name,
time_t chants)
{
struct u_chanlist *c;
@@ -1812,7 +1814,7 @@ Channel *join_user_update(User * user, Channel * chan, char *name,
/*************************************************************************/
-void set_flood(Channel * chan, char *value)
+void set_flood(Channel * chan, const char *value)
{
if (chan->flood)
free(chan->flood);
@@ -1825,7 +1827,7 @@ void set_flood(Channel * chan, char *value)
/*************************************************************************/
-void chan_set_key(Channel * chan, char *value)
+void chan_set_key(Channel * chan, const char *value)
{
if (chan->key)
free(chan->key);
@@ -1838,7 +1840,7 @@ void chan_set_key(Channel * chan, char *value)
/*************************************************************************/
-void set_limit(Channel * chan, char *value)
+void set_limit(Channel * chan, const char *value)
{
chan->limit = value ? strtoul(value, NULL, 10) : 0;
@@ -1849,7 +1851,7 @@ void set_limit(Channel * chan, char *value)
/*************************************************************************/
-void set_redirect(Channel * chan, char *value)
+void set_redirect(Channel * chan, const char *value)
{
if (chan->redirect)
free(chan->redirect);
@@ -1863,7 +1865,7 @@ void set_redirect(Channel * chan, char *value)
void do_mass_mode(char *modes)
{
int ac;
- char **av;
+ const char **av;
Channel *c;
char *myModes;
@@ -2011,7 +2013,7 @@ Entry *entry_create(char *mask)
* @param mask The mask to parse and add to the list
* @return Pointer to newly added entry. NULL if it fails.
*/
-Entry *entry_add(EList * list, char *mask)
+Entry *entry_add(EList * list, const char *mask)
{
Entry *e;
char *hostmask;
@@ -2275,7 +2277,7 @@ Entry *elist_match_user(EList * list, User * u)
* @param mask The *!*@* mask to match
* @return Returns the first matching entry, if none, NULL is returned.
*/
-Entry *elist_find_mask(EList * list, char *mask)
+Entry *elist_find_mask(EList * list, const char *mask)
{
Entry *e;
diff --git a/src/chanserv.c b/src/chanserv.c
index 4c64dd64e..8e700077b 100644
--- a/src/chanserv.c
+++ b/src/chanserv.c
@@ -6,9 +6,9 @@
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
- * Based on the original code of Services by Andy Church.
- *
- * $Id$
+ * Based on the original code of Services by Andy Church.
+ *
+ * $Id$
*
*/
@@ -1368,14 +1368,14 @@ static void timeout_leave(Timeout * to)
* not called). The channel TS must be given for a new channel.
*/
-int check_kick(User * user, char *chan, time_t chants)
+int check_kick(User * user, const char *chan, time_t chants)
{
ChannelInfo *ci = cs_findchan(chan);
Channel *c;
AutoKick *akick;
int i;
NickCore *nc;
- char *av[4];
+ const char *av[4];
int ac;
char buf[BUFSIZE];
char mask[BUFSIZE];
@@ -1479,22 +1479,17 @@ int check_kick(User * user, char *chan, time_t chants)
snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
av[0] = chan;
av[1] = buf;
- av[2] = sstrdup("+b");
+ av[2] = "+b";
av[3] = mask;
ac = 4;
} else {
av[0] = chan;
- av[1] = sstrdup("+b");
+ av[1] = "+b";
av[2] = mask;
ac = 3;
}
do_cmode(whosends(ci), ac, av);
-
- if (ircdcap->tsmode)
- free(av[2]);
- else
- free(av[1]);
}
anope_cmd_mode(whosends(ci), chan, "+b %s", mask);
@@ -1535,7 +1530,7 @@ void record_topic(const char *chan)
/* Restore the topic in a channel when it's created, if we should. */
-void restore_topic(char *chan)
+void restore_topic(const char *chan)
{
Channel *c = findchan(chan);
ChannelInfo *ci;
@@ -2282,7 +2277,7 @@ char *cs_get_redirect(ChannelInfo * ci)
/*************************************************************************/
-void cs_set_flood(ChannelInfo * ci, char *value)
+void cs_set_flood(ChannelInfo * ci, const char *value)
{
if (!ci) {
return;
@@ -2302,7 +2297,7 @@ void cs_set_flood(ChannelInfo * ci, char *value)
/*************************************************************************/
-void cs_set_key(ChannelInfo * ci, char *value)
+void cs_set_key(ChannelInfo * ci, const char *value)
{
if (!ci) {
return;
@@ -2322,7 +2317,7 @@ void cs_set_key(ChannelInfo * ci, char *value)
/*************************************************************************/
-void cs_set_limit(ChannelInfo * ci, char *value)
+void cs_set_limit(ChannelInfo * ci, const char *value)
{
if (!ci) {
return;
@@ -2336,7 +2331,7 @@ void cs_set_limit(ChannelInfo * ci, char *value)
/*************************************************************************/
-void cs_set_redirect(ChannelInfo * ci, char *value)
+void cs_set_redirect(ChannelInfo * ci, const char *value)
{
if (!ci) {
return;
@@ -2419,7 +2414,7 @@ const char *get_xop_level(int level)
/* Is the mask stuck? */
-AutoKick *is_stuck(ChannelInfo * ci, char *mask)
+AutoKick *is_stuck(ChannelInfo * ci, const char *mask)
{
int i;
AutoKick *akick;
@@ -2449,7 +2444,7 @@ AutoKick *is_stuck(ChannelInfo * ci, char *mask)
void stick_mask(ChannelInfo * ci, AutoKick * akick)
{
- char *av[2];
+ const char *av[2];
Entry *ban;
if (!ci) {
@@ -2473,11 +2468,10 @@ void stick_mask(ChannelInfo * ci, AutoKick * akick)
}
/* Falling there means set the ban */
- av[0] = sstrdup("+b");
+ av[0] = "+b";
av[1] = akick->u.mask;
anope_cmd_mode(whosends(ci), ci->c->name, "+b %s", akick->u.mask);
chan_set_modes(s_ChanServ, ci->c, 2, av, 1);
- free(av[0]);
}
/* Ban the stuck mask in a safe manner. */
@@ -2485,7 +2479,7 @@ void stick_mask(ChannelInfo * ci, AutoKick * akick)
void stick_all(ChannelInfo * ci)
{
int i;
- char *av[2];
+ const char *av[2];
AutoKick *akick;
if (!ci) {
@@ -2497,10 +2491,9 @@ void st