[IRC-Dev CVS] [CVS] Module ircd-ircdev: Change committed
Brought to you by:
zolty
From: Toni G. <zo...@us...> - 2004-11-24 16:03:03
|
CVSROOT : /cvsroot/irc-dev Module : ircd-ircdev Commit time: 2004-11-24 16:02:39 UTC Modified files: ircd/m_account.c ircd/m_admin.c ircd/m_away.c ircd/m_burst.c ircd/m_clearmode.c ircd/m_connect.c ircd/m_create.c ircd/m_endburst.c ircd/m_gline.c ircd/m_info.c ircd/m_invite.c ircd/m_join.c ircd/m_jupe.c ircd/m_kick.c ircd/m_links.c ircd/m_list.c ircd/m_lusers.c ircd/m_map.c ircd/m_mode.c ircd/m_nick.c ircd/m_oper.c ircd/m_opmode.c ircd/m_pong.c ircd/m_quit.c ircd/m_server.c ircd/m_settime.c ircd/m_silence.c ircd/m_squit.c ircd/m_stats.c ircd/m_topic.c ircd/m_trace.c ircd/m_userip.c ircd/m_version.c ircd/m_wallchops.c ircd/m_wallvoices.c ircd/m_who.c ircd/m_whois.c Log message: Author: zoltan <zo...@ir...> Log message: 2004-11-24 Toni García <zo...@ir...> 1.0.alpha13 * Comentarios para Doxygen * Excepciones de Silences * Soporte total de IPv6 * Sincronizacion Undernet ---------------------- diff included ---------------------- Index: ircd-ircdev/ircd/m_account.c diff -u ircd-ircdev/ircd/m_account.c:1.4 ircd-ircdev/ircd/m_account.c:1.5 --- ircd-ircdev/ircd/m_account.c:1.4 Fri May 21 08:39:35 2004 +++ ircd-ircdev/ircd/m_account.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_account.c,v 1.4 2004/05/21 15:39:35 zolty Exp $ + * $Id: m_account.c,v 1.5 2004/11/24 16:02:28 zolty Exp $ * */ @@ -101,7 +101,6 @@ * parv[0] = sender prefix * parv[1] = numeric of client to act on * parv[2] = account name (12 characters or less) - * */ int ms_account(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) @@ -125,9 +124,11 @@ assert(0 == cli_user(acptr)->account[0]); - if (strlen(parv[2]) > ACCOUNTLEN) { - return protocol_violation(cptr, "Received account (%s) longer than %d for %s; ignoring.", parv[2], ACCOUNTLEN, cli_name(acptr)); - } + if (strlen(parv[2]) > ACCOUNTLEN) + return protocol_violation(cptr, + "Received account (%s) longer than %d for %s; " + "ignoring.", + parv[2], ACCOUNTLEN, cli_name(acptr)); if (parc > 3) { cli_user(acptr)->acc_create = atoi(parv[3]); Index: ircd-ircdev/ircd/m_admin.c diff -u ircd-ircdev/ircd/m_admin.c:1.2 ircd-ircdev/ircd/m_admin.c:1.3 --- ircd-ircdev/ircd/m_admin.c:1.2 Sun Feb 22 08:11:42 2004 +++ ircd-ircdev/ircd/m_admin.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_admin.c,v 1.2 2004/02/22 16:11:42 zolty Exp $ + * $Id: m_admin.c,v 1.3 2004/11/24 16:02:28 zolty Exp $ * */ @@ -111,7 +111,6 @@ * * parv[0] = sender prefix * parv[1] = servername - * */ int m_admin(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { @@ -120,7 +119,7 @@ assert(0 != cptr); assert(cptr == sptr); - if (parc > 1 && (!(acptr = find_match_server(parv[1])) || !IsMe(acptr))) + if (parc > 1 && (!(acptr = find_match_server(parv[1])) || !IsMe(acptr))) return send_reply(sptr, ERR_NOPRIVILEGES); return send_admin_info(sptr); @@ -131,7 +130,6 @@ * * parv[0] = sender prefix * parv[1] = servername - * */ int mo_admin(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { @@ -139,7 +137,7 @@ assert(cptr == sptr); if (hunt_server_cmd(sptr, CMD_ADMIN, cptr, feature_int(FEAT_HIS_REMOTE), - ":%C", 1, parc, parv) != HUNTED_ISME) + ":%C", 1, parc, parv) != HUNTED_ISME) return 0; return send_admin_info(sptr); } @@ -149,7 +147,6 @@ * * parv[0] = sender prefix * parv[1] = servername - * */ int ms_admin(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { Index: ircd-ircdev/ircd/m_away.c diff -u ircd-ircdev/ircd/m_away.c:1.3 ircd-ircdev/ircd/m_away.c:1.4 --- ircd-ircdev/ircd/m_away.c:1.3 Wed Nov 17 03:45:50 2004 +++ ircd-ircdev/ircd/m_away.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_away.c,v 1.3 2004/11/17 11:45:50 zolty Exp $ + * $Id: m_away.c,v 1.4 2004/11/24 16:02:28 zolty Exp $ * */ @@ -128,9 +128,8 @@ len = AWAYLEN; } if (away) - away = (char*) MyRealloc(away, len + 1); - else - away = (char*) MyMalloc(len + 1); + MyFree(away); + away = (char*) MyMalloc(len + 1); assert(0 != away); user->away = away; @@ -158,9 +157,10 @@ assert(0 != cptr); assert(cptr == sptr); - if (user_set_away(cli_user(sptr), away_message)) { - if (!was_away) - sendcmdto_serv_butone(sptr, CMD_AWAY, cptr, ":%s", away_message); + if (user_set_away(cli_user(sptr), away_message)) + { + if (!was_away) + sendcmdto_serv_butone(sptr, CMD_AWAY, cptr, ":%s", away_message); send_reply(sptr, RPL_NOWAWAY); } else { @@ -176,7 +176,6 @@ * * parv[0] = sender prefix * parv[1] = away message - * */ int ms_away(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { Index: ircd-ircdev/ircd/m_burst.c diff -u ircd-ircdev/ircd/m_burst.c:1.4 ircd-ircdev/ircd/m_burst.c:1.5 --- ircd-ircdev/ircd/m_burst.c:1.4 Fri May 21 08:39:35 2004 +++ ircd-ircdev/ircd/m_burst.c Wed Nov 24 08:02:28 2004 @@ -19,7 +19,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_burst.c,v 1.4 2004/05/21 15:39:35 zolty Exp $ + * $Id: m_burst.c,v 1.5 2004/11/24 16:02:28 zolty Exp $ * */ @@ -99,13 +99,39 @@ #include "s_misc.h" #include "send.h" #include "struct.h" -#include "support.h" #include <assert.h> #include <ctype.h> #include <stdlib.h> #include <string.h> +static int +netride_modes(int parc, char **parv, const char *curr_key) +{ + char *modes = parv[0]; + int result = 0; + + assert(modes && modes[0] == '+'); + while (*modes) { + switch (*modes++) { + case 'i': + result |= MODE_INVITEONLY; + break; + case 'k': + if (strcmp(curr_key, *++parv)) + result |= MODE_KEY; + break; + case 'l': + ++parv; + break; + case 'r': + result |= MODE_REGONLY; + break; + } + } + return result; +} + /* * ms_burst - server message handler * @@ -190,7 +216,7 @@ struct Channel *chptr; time_t timestamp; struct Membership *member, *nmember; - struct SLink *lp, **lp_p; + struct Ban *lp, **lp_p; unsigned int parse_flags = (MODE_PARSE_FORCE | MODE_PARSE_BURST); int param, nickpos = 0, banpos = 0; char modestr[BUFSIZE], nickstr[BUFSIZE], banstr[BUFSIZE]; @@ -215,17 +241,31 @@ */ for (param = 3; param < parc; param++) { + int check_modes; if (parv[param][0] != '+') continue; - if (strchr(parv[param], 'i') || strchr(parv[param], 'k')) + check_modes = netride_modes(parc - param, parv + param, chptr->mode.key); + if (check_modes) { /* Clear any outstanding rogue invites */ mode_invite_clear(chptr); for (member = chptr->members; member; member = nmember) { - nmember=member->next_member; + nmember = member->next_member; if (!MyUser(member->user) || IsZombie(member)) continue; + /* Kick as netrider if key mismatch *or* remote channel is + * +i (unless user is an oper) *or* remote channel is +r + * (unless user has an account). + */ + if (!(check_modes & MODE_KEY) + && (!(check_modes & MODE_INVITEONLY) || IsAnOper(member->user)) +#if defined(UNDERNET) + && (!(check_modes & MODE_REGONLY) || IsAccount(member->user))) +#else + ) +#endif + continue; sendcmdto_serv_butone(&me, CMD_KICK, NULL, "%H %C :Net Rider", chptr, member->user); sendcmdto_channel_butserv_butone(&me, CMD_KICK, chptr, NULL, 0, "%H %C :Net Rider", chptr, member->user); make_zombie(member, member->user, &me, &me, chptr); @@ -257,15 +297,13 @@ modebuf_init(mbuf = &modebuf, &me, cptr, chptr, MODEBUF_DEST_CHANNEL | MODEBUF_DEST_NOKEY); modebuf_mode(mbuf, MODE_DEL | chptr->mode.mode); /* wipeout modes */ - chptr->mode.mode &= ~(MODE_ADD | MODE_DEL | MODE_PRIVATE | MODE_SECRET | - MODE_MODERATED | MODE_TOPICLIMIT | MODE_INVITEONLY | - MODE_NOPRIVMSGS | MODE_DELJOINS); + chptr->mode.mode &= MODE_BURSTADDED | MODE_WASDELJOINS; parse_flags |= (MODE_PARSE_SET | MODE_PARSE_WIPEOUT); /* wipeout keys */ /* mark bans for wipeout */ for (lp = chptr->banlist; lp; lp = lp->next) - lp->flags |= CHFL_BURST_BAN_WIPEOUT; + lp->flags |= BAN_BURST_WIPEOUT; /* clear topic set by netrider (if set) */ if (*chptr->topic) { @@ -293,7 +331,7 @@ case '%': /* parameter contains bans */ if (parse_flags & MODE_PARSE_SET) { char *banlist = parv[param] + 1, *p = 0, *ban, *ptr; - struct SLink *newban; + struct Ban *newban; for (ban = ircd_strtok(&p, banlist, " "); ban; ban = ircd_strtok(&p, 0, " ")) { @@ -308,16 +346,16 @@ * shown below *sigh* */ for (lp = chptr->banlist; lp; lp = lp->next) { - if (!ircd_strcmp(lp->value.ban.banstr, ban)) { + if (!ircd_strcmp(lp->banstr, ban)) { ban = 0; /* don't add ban */ - lp->flags &= ~CHFL_BURST_BAN_WIPEOUT; /* not wiping out */ + lp->flags &= ~BAN_BURST_WIPEOUT; /* not wiping out */ break; /* new ban already existed; don't even repropagate */ - } else if (!(lp->flags & CHFL_BURST_BAN_WIPEOUT) && - !mmatch(lp->value.ban.banstr, ban)) { + } else if (!(lp->flags & BAN_BURST_WIPEOUT) && + !mmatch(lp->banstr, ban)) { ban = 0; /* don't add ban unless wiping out bans */ break; /* new ban is encompassed by an existing one; drop */ - } else if (!mmatch(ban, lp->value.ban.banstr)) - lp->flags |= CHFL_BAN_OVERLAPPED; /* remove overlapping ban */ + } else if (!mmatch(ban, lp->banstr)) + lp->flags |= BAN_OVERLAPPED; /* remove overlapping ban */ if (!lp->next) break; @@ -334,18 +372,15 @@ for (ptr = ban; *ptr; ptr++) /* add ban to buffer */ banstr[banpos++] = *ptr; - newban = make_link(); /* create new ban */ - - DupString(newban->value.ban.banstr, ban); + newban = make_ban(ban); /* create new ban */ - DupString(newban->value.ban.who, - cli_name(feature_bool(FEAT_HIS_BANWHO) ? &me : sptr)); + DupString(newban->who, + cli_name(feature_bool(FEAT_HIS_BANWHO) ? &me : sptr)); + newban->when = TStime(); - newban->value.ban.when = TStime(); - - newban->flags = CHFL_BAN | CHFL_BURST_BAN; /* set flags */ + newban->flags = BAN_BURSTED; /* set flags */ if ((ptr = strrchr(ban, '@')) && check_if_ipmask(ptr + 1)) - newban->flags |= CHFL_BAN_IPMASK; + newban->flags |= BAN_IPMASK; newban->next = 0; if (lp) @@ -547,19 +582,18 @@ lp = *lp_p; /* remove ban from channel */ - if (lp->flags & (CHFL_BAN_OVERLAPPED | CHFL_BURST_BAN_WIPEOUT)) { + if (lp->flags & (BAN_OVERLAPPED | BAN_BURST_WIPEOUT)) { modebuf_mode_string(mbuf, MODE_DEL | MODE_BAN, - lp->value.ban.banstr, 1); /* let it free banstr */ - + lp->banstr, 1); /* let it free banstr */ + lp->banstr = NULL; /* do not free this string */ *lp_p = lp->next; /* clip out of list */ - MyFree(lp->value.ban.who); /* free who */ - free_link(lp); /* free ban */ + free_ban(lp); continue; - } else if (lp->flags & CHFL_BURST_BAN) /* add ban to channel */ + } else if (lp->flags & BAN_BURSTED) /* add ban to channel */ modebuf_mode_string(mbuf, MODE_ADD | MODE_BAN, - lp->value.ban.banstr, 0); /* don't free banstr */ + lp->banstr, 0); /* don't free banstr */ - lp->flags &= (CHFL_BAN | CHFL_BAN_IPMASK); /* reset the flag */ + lp->flags &= BAN_IPMASK; /* reset the flag */ lp_p = &(*lp_p)->next; } } Index: ircd-ircdev/ircd/m_clearmode.c diff -u ircd-ircdev/ircd/m_clearmode.c:1.4 ircd-ircdev/ircd/m_clearmode.c:1.5 --- ircd-ircdev/ircd/m_clearmode.c:1.4 Fri May 21 08:39:35 2004 +++ ircd-ircdev/ircd/m_clearmode.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_clearmode.c,v 1.4 2004/05/21 15:39:35 zolty Exp $ + * $Id: m_clearmode.c,v 1.5 2004/11/24 16:02:28 zolty Exp $ * */ @@ -95,7 +95,6 @@ #include "numnicks.h" #include "s_conf.h" #include "send.h" -#include "support.h" #include <assert.h> @@ -130,7 +129,7 @@ char control_buf[20]; int control_buf_i = 0; struct ModeBuf mbuf; - struct SLink *link, *next; + struct Ban *link, *next; struct Membership *member; /* Ok, so what are we supposed to get rid of? */ @@ -179,10 +178,10 @@ next = link->next; modebuf_mode_string(&mbuf, MODE_DEL | MODE_BAN, /* delete ban */ - link->value.ban.banstr, 1); - - MyFree(link->value.ban.who); /* free up who string */ - free_link(link); /* and of course the link itself */ + link->banstr, 1); + link->banstr = NULL; /* modebuf_mode_string() gave ownership of + * banstr to mbuf */ + free_ban(link); } chptr->banlist = 0; @@ -288,9 +287,12 @@ control = parv[2]; chname = parv[1]; - if (*chname == '!') { + if (*chname == '!') + { chname++; - if (!HasPriv(sptr, IsLocalChannel(chname) ? PRIV_FORCE_LOCAL_OPMODE : PRIV_FORCE_OPMODE)) + if (!HasPriv(sptr, IsLocalChannel(chname) ? + PRIV_FORCE_LOCAL_OPMODE : + PRIV_FORCE_OPMODE)) return send_reply(sptr, ERR_NOPRIVILEGES); force = 1; } @@ -299,7 +301,7 @@ IsLocalChannel(chname) ? PRIV_LOCAL_OPMODE : PRIV_OPMODE)) return send_reply(sptr, ERR_NOPRIVILEGES); - if (!(chptr = FindChannel(chname))) + if (('#' != *chname && '&' != *chname) || !(chptr = FindChannel(chname))) return send_reply(sptr, ERR_NOSUCHCHANNEL, chname); if (!force && (qreason = find_quarantine(chptr->chname))) Index: ircd-ircdev/ircd/m_connect.c diff -u ircd-ircdev/ircd/m_connect.c:1.3 ircd-ircdev/ircd/m_connect.c:1.4 --- ircd-ircdev/ircd/m_connect.c:1.3 Thu Apr 22 10:37:18 2004 +++ ircd-ircdev/ircd/m_connect.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_connect.c,v 1.3 2004/04/22 17:37:18 zolty Exp $ + * $Id: m_connect.c,v 1.4 2004/11/24 16:02:28 zolty Exp $ * */ @@ -184,18 +184,17 @@ /* * save the old port */ - tmpport = aconf->port; - if (port) { - aconf->port = port; - } - else { - port = aconf->port; - } + tmpport = aconf->address.port; + if (port) + aconf->address.port = port; + else + port = aconf->address.port; + /* * Notify all operators about remote connect requests */ sendwallto_group_butone(&me, WALL_WALLOPS, 0, - "Remote CONNECT %s %s from %s", parv[1], + "Remote CONNECT %s %s from %s", parv[1], parv[2] ? parv[2] : "", get_client_name(sptr, HIDE_IP)); log_write(LS_NETWORK, L_INFO, 0, "CONNECT From %C : %s %s", sptr, parv[1], @@ -209,7 +208,7 @@ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :*** Connection to %s failed", sptr, aconf->name); } - aconf->port = tmpport; + aconf->address.port = tmpport; return 0; } @@ -313,7 +312,7 @@ * use the default from configuration structure. If missing * from there, then use the precompiled default. */ - port = aconf->port; + port = aconf->address.port; if (parc > 2) { assert(0 != parv[2]); if (0 == (port = atoi(parv[2]))) { @@ -328,8 +327,8 @@ return 0; } - tmpport = aconf->port; - aconf->port = port; + tmpport = aconf->address.port; + aconf->address.port = port; if (connect_server(aconf, sptr)) { sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :*** Connecting to %s.", sptr, @@ -339,6 +338,6 @@ sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :*** Connection to %s failed", sptr, aconf->name); } - aconf->port = tmpport; + aconf->address.port = tmpport; return 0; } Index: ircd-ircdev/ircd/m_create.c diff -u ircd-ircdev/ircd/m_create.c:1.2 ircd-ircdev/ircd/m_create.c:1.3 --- ircd-ircdev/ircd/m_create.c:1.2 Thu Apr 22 10:37:18 2004 +++ ircd-ircdev/ircd/m_create.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_create.c,v 1.2 2004/04/22 17:37:18 zolty Exp $ + * $Id: m_create.c,v 1.3 2004/11/24 16:02:28 zolty Exp $ * */ @@ -129,18 +129,19 @@ cli_serv(cli_user(sptr)->server)->lag = TStime() - chanTS; /* If this server is >1 minute fast, warn */ - if (TStime() - chanTS<-60) { + if (TStime() - chanTS<-60) + { static time_t rate; sendto_opmask_butone_ratelimited(0, SNO_NETWORK, &rate, - "Timestamp drift from %C (%is); issuing " - "SETTIME to correct this", + "Timestamp drift from %C (%is); issuing " + "SETTIME to correct this", cli_user(sptr)->server, chanTS - TStime()); /* Now issue a SETTIME to resync. If we're in the wrong, our * (RELIABLE_CLOCK) hub will bounce a SETTIME back to us. */ sendcmdto_prio_one(&me, CMD_SETTIME, cli_user(sptr)->server, - "%Tu %C", TStime(), cli_user(sptr)->server); + "%Tu %C", TStime(), cli_user(sptr)->server); } joinbuf_init(&join, sptr, cptr, JOINBUF_TYPE_JOIN, 0, 0); @@ -154,7 +155,8 @@ if (IsLocalChannel(name)) continue; - if ((chptr = FindChannel(name))) { + if ((chptr = FindChannel(name))) + { name = chptr->chname; /* Check if we need to bounce a mode */ @@ -172,7 +174,7 @@ badop = 1; } - } else /* Channel doesn't exist: create it */ + } else /* Channel doesn't exist: create it */ chptr = get_channel(sptr, name, CGT_CREATE); if (!badop) /* Set/correct TS */ Index: ircd-ircdev/ircd/m_endburst.c diff -u ircd-ircdev/ircd/m_endburst.c:1.2 ircd-ircdev/ircd/m_endburst.c:1.3 --- ircd-ircdev/ircd/m_endburst.c:1.2 Thu Apr 22 10:37:18 2004 +++ ircd-ircdev/ircd/m_endburst.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_endburst.c,v 1.2 2004/04/22 17:37:18 zolty Exp $ + * $Id: m_endburst.c,v 1.3 2004/11/24 16:02:28 zolty Exp $ * */ @@ -126,11 +126,12 @@ next_chan = chan->next; if (!chan->members) { /* empty channel */ - if (!(chan->mode.mode & MODE_BURSTADDED)) + if ((chan->mode.mode & MODE_BURSTADDED)) + sub1_from_channel(chan); /* New empty channel, schedule it for removal. */ + /* FIX-ZOLTAN Añadido */ + else sendto_opmask_butone(0, SNO_OLDSNO, "Empty channel %H not added by " "BURST!", chan); - - sub1_from_channel(chan); /* ok, nuke channel now */ } chan->mode.mode &= ~MODE_BURSTADDED; Index: ircd-ircdev/ircd/m_gline.c diff -u ircd-ircdev/ircd/m_gline.c:1.2 ircd-ircdev/ircd/m_gline.c:1.3 --- ircd-ircdev/ircd/m_gline.c:1.2 Thu Apr 22 10:37:18 2004 +++ ircd-ircdev/ircd/m_gline.c Wed Nov 24 08:02:28 2004 @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_gline.c,v 1.2 2004/04/22 17:37:18 zolty Exp $ + * $Id: m_gline.c,v 1.3 2004/11/24 16:02:28 zolty Exp $ * */ @@ -96,7 +96,6 @@ #include "s_conf.h" #include "s_misc.h" #include "send.h" -#include "support.h" #include <assert.h> #include <stdlib.h> @@ -129,23 +128,27 @@ time_t expire_off, lastmod = 0; char *mask = parv[2], *target = parv[1], *reason = "No reason"; - if (*mask == '!') { + if (*mask == '!') + { mask++; - flags |= GLINE_OPERFORCE; /* assume oper had WIDE_GLINE */ } - if ((parc == 3 && *mask == '-') || parc == 5) { + if ((parc == 3 && *mask == '-') || parc == 5) + { if (!find_conf_byhost(cli_confs(cptr), cli_name(sptr), CONF_UWORLD)) return need_more_params(sptr, "GLINE"); if (parc > 4) reason = parv[4]; flags |= GLINE_FORCE; - } else if (parc > 5) { + } + else if (parc > 5) + { lastmod = atoi(parv[4]); reason = parv[5]; - } else + } + else return need_more_params(sptr, "GLINE"); if (IsServer(sptr)) @@ -267,12 +270,16 @@ } else return need_more_params(sptr, "GLINE"); - if (target) { - if (!(target[0] == '*' && target[1] == '\0')) { + if (target) + { + if (!(target[0] == '*' && target[1] == '\0')) + { if (!(acptr = find_match_server(target))) return send_reply(sptr, ERR_NOSUCHSERVER, target); - if (!IsMe(acptr)) { /* manually propagate, since we don't set it */ + /* manually propagate, since we don't set it */ + if (!IsMe(acptr)) + { if (!feature_bool(FEAT_CONFIG_OPERCMDS)) return send_reply(sptr, ERR_DISABLED, "GLINE"); @@ -285,7 +292,6 @@ TStime(), reason); return 0; } - flags |= GLINE_LOCAL; } } Index: ircd-ircdev/ircd/m_info.c diff -u ircd-ircdev/ircd/m_info.c:1.2 ircd-ircdev/ircd/m_info.c:1.3 --- ircd-ircdev/ircd/m_info.c:1.2 Thu Apr 22 10:37:18 2004 +++ ircd-ircdev/ircd/m_info.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_info.c,v 1.2 2004/04/22 17:37:18 zolty Exp $ + * $Id: m_info.c,v 1.3 2004/11/24 16:02:28 zolty Exp $ * */ @@ -109,7 +109,7 @@ HUNTED_ISME) return 0; - while (text[2]) + while (text[212]) { send_reply(sptr, RPL_INFO, *text); text++; @@ -139,7 +139,7 @@ if (hunt_server_cmd(sptr, CMD_INFO, cptr, 1, ":%C", 1, parc, parv) != HUNTED_ISME) return 0; - while (text[2]) + while (text[212]) { if (!IsOper(sptr)) send_reply(sptr, RPL_INFO, *text); @@ -172,13 +172,13 @@ if (hunt_server_cmd(sptr, CMD_INFO, cptr, 1, ":%C", 1, parc, parv) == HUNTED_ISME) { - while (text[2]) + while (text[212]) { if (!IsOper(sptr)) send_reply(sptr, RPL_INFO, *text); text++; } - if (IsOper(sptr)) + if (IsOper(sptr) && (NULL != parv[1])) { while (*text) send_reply(sptr, RPL_INFO, *text++); Index: ircd-ircdev/ircd/m_invite.c diff -u ircd-ircdev/ircd/m_invite.c:1.4 ircd-ircdev/ircd/m_invite.c:1.5 --- ircd-ircdev/ircd/m_invite.c:1.4 Fri May 21 08:39:35 2004 +++ ircd-ircdev/ircd/m_invite.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_invite.c,v 1.4 2004/05/21 15:39:35 zolty Exp $ + * $Id: m_invite.c,v 1.5 2004/11/24 16:02:28 zolty Exp $ * */ @@ -180,17 +180,17 @@ if (!IsLocalChannel(chptr->chname) || MyConnect(acptr)) { if (feature_bool(FEAT_ANNOUNCE_INVITES)) { + /* Announce to channel operators. */ sendcmdto_channel_butserv_butone(&me, get_error_numeric(RPL_ISSUEDINVITE)->str, NULL, chptr, sptr, SKIP_NONOPS, - "%C %C :%C has been invited by %C", - acptr, sptr, acptr, sptr); - sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, sptr, 0, + "%H %C %C :%C has been invited by %C", + chptr, acptr, sptr, acptr, sptr); + /* Announce to servers with channel operators, but skip acptr, + * since they will be notified below. */ + sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, acptr, SKIP_NONOPS, "%s :%H", cli_name(acptr), chptr); - if (MyConnect(acptr)) - sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%H", cli_name(acptr), chptr); } - else - sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%H", cli_name(acptr), chptr); + sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%H", cli_name(acptr), chptr); } return 0; @@ -241,27 +241,6 @@ send_reply(sptr, ERR_NOSUCHNICK, parv[1]); return 0; } - if (feature_bool(FEAT_ANNOUNCE_INVITES)) { - sendcmdto_channel_butserv_butone(&me, get_error_numeric(RPL_ISSUEDINVITE)->str, - NULL, chptr, sptr, SKIP_NONOPS, - "%C %C :%C has been invited by %C", - acptr, sptr, acptr, sptr); - sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, sptr, 0, - "%s :%H", cli_name(acptr), chptr); - if (MyConnect(acptr)) - sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%H", cli_name(acptr), chptr); - return 0; - } - if (!MyUser(acptr)) { - /* - * just relay the message - */ - sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%s", cli_name(acptr), parv[2]); - return 0; - } - - if (is_silenced(sptr, acptr)) - return 0; if (!(chptr = FindChannel(parv[2]))) { /* @@ -274,16 +253,34 @@ /* Allow remote +k users who aren't on the channel to invite people - * needed for off-channel services to work properly */ - if (!IsChannelService(sptr) && !find_channel_member(sptr, chptr)) { - send_reply(sptr, ERR_NOTONCHANNEL, chptr->chname); - return 0; - } + if (!IsChannelService(sptr) && !find_channel_member(sptr, chptr)) { + send_reply(sptr, ERR_NOTONCHANNEL, chptr->chname); + return 0; + } if (find_channel_member(acptr, chptr)) { send_reply(sptr, ERR_USERONCHANNEL, cli_name(acptr), chptr->chname); return 0; } - add_invite(acptr, chptr); + + if (is_silenced(sptr, acptr)) + return 0; + + if (MyConnect(acptr)) + add_invite(acptr, chptr); + + if (feature_bool(FEAT_ANNOUNCE_INVITES)) { + /* Announce to channel operators. */ + sendcmdto_channel_butserv_butone(&me, get_error_numeric(RPL_ISSUEDINVITE)->str, + NULL, chptr, sptr, SKIP_NONOPS, + "%H %C %C :%C has been invited by %C", + chptr, acptr, sptr, acptr, sptr); + /* Announce to servers with channel operators, but skip acptr, + * since they will be notified below. */ + sendcmdto_channel_servers_butone(sptr, NULL, TOK_INVITE, chptr, acptr, SKIP_NONOPS, + "%s :%H", cli_name(acptr), chptr); + } + sendcmdto_one(sptr, CMD_INVITE, acptr, "%s :%H", cli_name(acptr), chptr); return 0; } Index: ircd-ircdev/ircd/m_join.c diff -u ircd-ircdev/ircd/m_join.c:1.6 ircd-ircdev/ircd/m_join.c:1.7 --- ircd-ircdev/ircd/m_join.c:1.6 Fri May 21 08:39:35 2004 +++ ircd-ircdev/ircd/m_join.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_join.c,v 1.6 2004/05/21 15:39:35 zolty Exp $ + * $Id: m_join.c,v 1.7 2004/11/24 16:02:28 zolty Exp $ * */ @@ -152,8 +152,8 @@ while ((member = cli_user(sptr)->channel)) joinbuf_join(&part, member->channel, IsZombie(member) ? CHFL_ZOMBIE : - IsDelayedJoin(member) ? CHFL_DELAYED : - 0); + IsDelayedJoin(member) ? CHFL_DELAYED : + 0); joinbuf_flush(&part); @@ -196,7 +196,9 @@ if (join0(&join, cptr, sptr, name)) /* did client do a JOIN 0? */ continue; - if (!IsChannelName(name)) { /* bad channel name */ + /* bad channel name */ + if (!IsChannelName(name)) + { send_reply(sptr, ERR_NOSUCHCHANNEL, name); continue; } @@ -206,9 +208,9 @@ */ for (k = 0, j = 0; name[j]; j++) if (IsCntrl(name[j])) - k++; - - if ( k > 0 ) { + k++; + if (k > 0) + { send_reply(sptr, ERR_NOSUCHCHANNEL, name); continue; } @@ -220,7 +222,8 @@ continue; } - if ((chptr = FindChannel(name))) { + if ((chptr = FindChannel(name))) + { if (find_member_link(chptr, sptr)) continue; /* already on channel */ @@ -317,7 +320,8 @@ #endif } else if (!(chptr = get_channel(sptr, name, CGT_CREATE))) continue; /* couldn't get channel */ - else if (check_target_limit(sptr, chptr, chptr->chname, 1)) { + else if (check_target_limit(sptr, chptr, chptr->chname, 1)) + { /* Note: check_target_limit will only ever return 0 here */ #if defined(UNDERNET) /* FIXME zoltan */ @@ -327,7 +331,8 @@ sub1_from_channel(chptr); /* created it... */ #endif continue; - } else + } + else joinbuf_join(&create, chptr, flags); del_invite(sptr, chptr); @@ -361,12 +366,14 @@ char *chanlist; char *name; - if (IsServer(sptr)) { + if (IsServer(sptr)) + { return protocol_violation(cptr, - "%s tried to JOIN %s, duh!", - cli_name(sptr), - (parc < 2 || *parv[1] == '\0') ? "a channel":parv[1] - ); + "%s tried to JOIN %s, duh!", + cli_name(sptr), + (parc < 2 || *parv[1] == '\0') ? "a channel" : + parv[1] + ); } if (parc < 2 || *parv[1] == '\0') @@ -386,14 +393,17 @@ if (join0(&join, cptr, sptr, name)) /* did client do a JOIN 0? */ continue; - if (IsLocalChannel(name) || !IsChannelName(name)) { - protocol_violation(cptr,"%s tried to join %s",cli_name(sptr),name); + if (IsLocalChannel(name) || !IsChannelName(name)) + { + protocol_violation(cptr, "%s tried to join %s", cli_name(sptr), name); continue; } - if (!(chptr = FindChannel(name))) { + if (!(chptr = FindChannel(name))) + { /* No channel exists, so create one */ - if (!(chptr = get_channel(sptr, name, CGT_CREATE))) { + if (!(chptr = get_channel(sptr, name, CGT_CREATE))) + { protocol_violation(sptr,"couldn't get channel %s for %s", name,cli_name(sptr)); continue; @@ -404,15 +414,18 @@ chptr->creationtime = creation ? creation : MAGIC_REMOTE_JOIN_TS; } else { /* We have a valid channel? */ - if ((member = find_member_link(chptr, sptr))) { + if ((member = find_member_link(chptr, sptr))) + { + /* It is impossible to get here --Run */ if (!IsZombie(member)) /* already on channel */ continue; flags = member->status & (CHFL_DEOPPED | CHFL_SERVOPOK); remove_user_from_channel(sptr, chptr); chptr = FindChannel(name); - } else - flags = CHFL_DEOPPED | (HasFlag(sptr, FLAG_TS8) ? CHFL_SERVOPOK : 0); + } + else + flags = CHFL_DEOPPED | (HasFlag(sptr, FLAG_TS8) ? CHFL_SERVOPOK : 0); /* Always copy the timestamp when it is older, that is the only way to ensure network-wide synchronization of creation times. */ if (creation && creation < chptr->creationtime) Index: ircd-ircdev/ircd/m_jupe.c diff -u ircd-ircdev/ircd/m_jupe.c:1.2 ircd-ircdev/ircd/m_jupe.c:1.3 --- ircd-ircdev/ircd/m_jupe.c:1.2 Thu Apr 22 10:37:18 2004 +++ ircd-ircdev/ircd/m_jupe.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_jupe.c,v 1.2 2004/04/22 17:37:18 zolty Exp $ + * $Id: m_jupe.c,v 1.3 2004/11/24 16:02:28 zolty Exp $ * */ @@ -94,7 +94,6 @@ #include "s_conf.h" #include "s_misc.h" #include "send.h" -#include "support.h" #include <assert.h> #include <stdlib.h> Index: ircd-ircdev/ircd/m_kick.c diff -u ircd-ircdev/ircd/m_kick.c:1.4 ircd-ircdev/ircd/m_kick.c:1.5 --- ircd-ircdev/ircd/m_kick.c:1.4 Fri May 21 08:39:35 2004 +++ ircd-ircdev/ircd/m_kick.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_kick.c,v 1.4 2004/05/21 15:39:35 zolty Exp $ + * $Id: m_kick.c,v 1.5 2004/11/24 16:02:28 zolty Exp $ * */ @@ -144,8 +144,8 @@ /* Don't allow to kick member with a higher or equal op-level */ if ((OpLevel(member) <= OpLevel(member2)) && feature_bool(FEAT_OPLEVELS)) return send_reply(sptr, ERR_NOTLOWEROPLEVEL, cli_name(who), chptr->chname, - OpLevel(member2), OpLevel(member), "kick", - OpLevel(member) == OpLevel(member2) ? "the same" : "a higher"); + OpLevel(member2), OpLevel(member), "kick", + OpLevel(member) == OpLevel(member2) ? "the same" : "a higher"); #endif /* We rely on ircd_snprintf to truncate the comment */ @@ -206,9 +206,9 @@ /* Send HACK notice, but not for servers in BURST */ /* 2002-10-17: Don't send HACK if the users local server is kicking them */ - if (IsServer(sptr) - && !IsBurstOrBurstAck(sptr) - && sptr!=cli_from(who)) + if (IsServer(sptr) && + !IsBurstOrBurstAck(sptr) && + sptr!=cli_from(who)) sendto_opmask_butone(0, SNO_HACK4, "HACK: %C KICK %H %C %s", sptr, chptr, who, comment); Index: ircd-ircdev/ircd/m_links.c diff -u ircd-ircdev/ircd/m_links.c:1.3 ircd-ircdev/ircd/m_links.c:1.4 --- ircd-ircdev/ircd/m_links.c:1.3 Thu Apr 22 10:37:18 2004 +++ ircd-ircdev/ircd/m_links.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_links.c,v 1.3 2004/04/22 17:37:18 zolty Exp $ + * $Id: m_links.c,v 1.4 2004/11/24 16:02:28 zolty Exp $ * */ @@ -113,17 +113,19 @@ char *mask; struct Client *acptr; - if (feature_bool(FEAT_HIS_LINKS) && !IsAnOper(sptr)) { + if (feature_bool(FEAT_HIS_LINKS) && !IsAnOper(sptr)) + { send_reply(sptr, RPL_ENDOFLINKS, parc < 2 ? "*" : parv[1]); sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :%s %s", sptr, - "/LINKS has been disabled; visit ", - feature_str(FEAT_HIS_URLSERVERS)); + "/LINKS has been disabled; visit ", + feature_str(FEAT_HIS_URLSERVERS)); return 0; } - if (parc > 2) { - if (hunt_server_cmd(sptr, CMD_LINKS, cptr, 1, "%C :%s", 1, parc, - parv) != HUNTED_ISME) + if (parc > 2) + { + if (hunt_server_cmd(sptr, CMD_LINKS, cptr, 1, "%C :%s", 1, parc, parv) != + HUNTED_ISME) return 0; mask = parv[2]; } @@ -142,6 +144,7 @@ } send_reply(sptr, RPL_ENDOFLINKS, BadPtr(mask) ? "*" : mask); + return 0; } @@ -157,32 +160,33 @@ * parv[1] = server to query * parv[2] = servername mask */ -int ms_links(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) -{ - char *mask; - struct Client *acptr; - - if (parc > 2) - { - if (hunt_server_cmd(sptr, CMD_LINKS, cptr, 1, "%C :%s", 1, parc, parv) != - HUNTED_ISME) - return 0; - mask = parv[2]; - } - else - mask = parc < 2 ? 0 : parv[1]; - - for (acptr = GlobalClientList, collapse(mask); acptr; acptr = cli_next(acptr)) - { - if (!IsServer(acptr) && !IsMe(acptr)) - continue; - if (!BadPtr(mask) && match(mask, cli_name(acptr))) - continue; - send_reply(sptr, RPL_LINKS, cli_name(acptr), cli_name(cli_serv(acptr)->up), - cli_hopcount(acptr), cli_serv(acptr)->prot, - ((cli_info(acptr))[0] ? cli_info(acptr) : "(Unknown Location)")); - } - - send_reply(sptr, RPL_ENDOFLINKS, BadPtr(mask) ? "*" : mask); - return 0; -} +int +ms_links(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) + { + char *mask; + struct Client *acptr; + + if (parc > 2) + { + if (hunt_server_cmd(sptr, CMD_LINKS, cptr, 1, "%C :%s", 1, parc, parv) != + HUNTED_ISME) + return 0; + mask = parv[2]; + } + else + mask = parc < 2 ? 0 : parv[1]; + + for (acptr = GlobalClientList, collapse(mask); acptr; acptr = cli_next(acptr)) + { + if (!IsServer(acptr) && !IsMe(acptr)) + continue; + if (!BadPtr(mask) && match(mask, cli_name(acptr))) + continue; + send_reply(sptr, RPL_LINKS, cli_name(acptr), cli_name(cli_serv(acptr)->up), + cli_hopcount(acptr), cli_serv(acptr)->prot, + ((cli_info(acptr))[0] ? cli_info(acptr) : "(Unknown Location)")); + } + + send_reply(sptr, RPL_ENDOFLINKS, BadPtr(mask) ? "*" : mask); + return 0; + } Index: ircd-ircdev/ircd/m_list.c diff -u ircd-ircdev/ircd/m_list.c:1.2 ircd-ircdev/ircd/m_list.c:1.3 --- ircd-ircdev/ircd/m_list.c:1.2 Thu Apr 22 10:37:18 2004 +++ ircd-ircdev/ircd/m_list.c Wed Nov 24 08:02:28 2004 @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * - * $Id: m_list.c,v 1.2 2004/04/22 17:37:18 zolty Exp $ + * $Id: m_list.c,v 1.3 2004/11/24 16:02:28 zolty Exp $ * */ @@ -108,7 +108,7 @@ 0, /* min_time */ 4294967295U, /* max_users */ 0, /* min_users */ - 0, /* flags */ + 0, /* topic_limits */ 2147483647, /* max_topic_time */ 0, /* min_topic_time */ 0 /* chptr */ @@ -119,7 +119,7 @@ 0, /* min_time */ 4294967295U, /* max_users */ 0, /* min_users */ - 0, /* flags */ + 0, /* topic_limits */ 2147483647, /* max_topic_time */ 0, /* min_topic_time */ 0 /* chptr */ @@ -158,7 +158,7 @@ "set more than \037min_minutes\037 ago."); if (IsAnOper(sptr)) send_reply(sptr, RPL_LISTUSAGE, - " \002S\002 ; Show secret channels."); + " \002S\002 ; Show secret channels."); send_reply(sptr, RPL_LISTUSAGE, "Example: LIST <3,>1,C<10,T>0 ; 2 users, younger than 10 " "min., topic set."); @@ -243,7 +243,7 @@ param++; if (*param != ',' && *param != ' ' && *param != '\0') /* check syntax */ - return show_usage(sptr); + return show_usage(sptr); break; default: /* channel name? */ @@ -289,7 +289,6 @@ if (cli_listing(sptr)) /* Already listing ? */ { - cli_listing(sptr)->chptr->mode.mode &= ~MODE_LISTED; MyFree(cli_listing(sptr)); cli_listing(sptr) = 0; send_reply(sptr, RPL_LISTEND); @@ -329,14 +328,8 @@ cli_listing(sptr) = (struct ListingArgs*) MyMalloc(sizeof(struct ListingArgs)); assert(0 != cli_listing(sptr)); memcpy(cli_listing(sptr), &args, sizeof(struct ListingArgs)); - if ((cli_listing(sptr)->chptr = GlobalChannelList)) { - int m = GlobalChannelList->mode.mode & MODE_LISTED; - list_next_channels(sptr, 64); - GlobalChannelList->mode.mode |= m; - return 0; - } - MyFree(cli_listing(sptr)); - cli_listing(sptr) = 0; + list_next_channels(sptr); + return 0; } send_reply(sptr, RPL_LISTEND); return 0; Index: ircd-ircdev/ircd/m_lusers.c diff -u ircd-ircdev/ircd/m_lusers.c:1.3 ircd-ircdev/ircd/m_lusers.c:1.4 --- ircd-ircdev/ircd/m_lusers.c:1.3 Fri Apr 23 04:08:08 2004 +++ ircd-ircdev/ircd/m_lusers.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_lusers.c,v 1.3 2004/04/23 11:08:08 zolty Exp $ + * $Id: m_lusers.c,v 1.4 2004/11/24 16:02:28 zolty Exp $ */ /* @@ -108,7 +108,7 @@ int longoutput = MyUser(sptr) || IsOper(sptr); if (parc > 2) if (hunt_server_cmd(sptr, CMD_LUSERS, cptr, feature_int(FEAT_HIS_REMOTE), - "%s :%C", 2, parc, parv) != HUNTED_ISME) + "%s :%C", 2, parc, parv) != HUNTED_ISME) return 0; send_reply(sptr, RPL_LUSERCLIENT, UserStats.clients - UserStats.inv_clients, Index: ircd-ircdev/ircd/m_map.c diff -u ircd-ircdev/ircd/m_map.c:1.3 ircd-ircdev/ircd/m_map.c:1.4 --- ircd-ircdev/ircd/m_map.c:1.3 Thu Apr 22 10:37:18 2004 +++ ircd-ircdev/ircd/m_map.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_map.c,v 1.3 2004/04/22 17:37:18 zolty Exp $ + * $Id: m_map.c,v 1.4 2004/11/24 16:02:28 zolty Exp $ * */ @@ -102,26 +102,33 @@ static void dump_map(struct Client *cptr, struct Client *server, char *mask, int prompt_length) { + const char *chr; static char prompt[64]; struct DLink *lp; - char *p = &prompt[prompt_length]; + char *p = prompt + prompt_length; int cnt = 0; - + *p = '\0'; if (prompt_length > 60) send_reply(cptr, RPL_MAPMORE, prompt, cli_name(server)); - else { + else + { char lag[512]; if (cli_serv(server)->lag>10000) - lag[0]=0; + lag[0]=0; else if (cli_serv(server)->lag<0) - strcpy(lag,"(0s)"); + strcpy(lag,"(0s)"); else - sprintf(lag,"(%is)",cli_serv(server)->lag); - send_reply(cptr, RPL_MAP, prompt, ( - (IsBurst(server)) ? "*" : (IsBurstAck(server) ? "!" : "")), - cli_name(server), lag, (server == &me) ? UserStats.local_clients : - cli_serv(server)->clients); + sprintf(lag,"(%is)",cli_serv(server)->lag); + if (IsBurst(server)) + chr = "*"; + else if (IsBurstAck(server)) + chr = "!"; + else + chr = ""; + send_reply(cptr, RPL_MAP, prompt, chr, cli_name(server), + lag, (server == &me) ? UserStats.local_clients : + cli_serv(server)->clients); } if (prompt_length > 0) { @@ -162,14 +169,25 @@ */ int m_map(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { - if (feature_bool(FEAT_HIS_MAP) && !IsAnOper(sptr)) { + if (feature_bool(FEAT_HIS_MAP) && !IsAnOper(sptr)) + { sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :%s %s", sptr, - "/MAP has been disabled; visit", - feature_str(FEAT_HIS_URLSERVERS)); + "/MAP has been disabled, from CFV-165. " + "Visit ", feature_str(FEAT_HIS_URLSERVERS)); return 0; } if (parc < 2) parv[1] = "*"; + dump_map(sptr, &me, parv[1], 0); + send_reply(sptr, RPL_MAPEND); + + return 0; +} + +int mo_map(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) +{ + if (parc < 2) + parv[1] = "*"; dump_map(sptr, &me, parv[1], 0); send_reply(sptr, RPL_MAPEND); Index: ircd-ircdev/ircd/m_mode.c diff -u ircd-ircdev/ircd/m_mode.c:1.3 ircd-ircdev/ircd/m_mode.c:1.4 --- ircd-ircdev/ircd/m_mode.c:1.3 Thu Apr 22 10:37:18 2004 +++ ircd-ircdev/ircd/m_mode.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_mode.c,v 1.3 2004/04/22 17:37:18 zolty Exp $ + * $Id: m_mode.c,v 1.4 2004/11/24 16:02:28 zolty Exp $ * */ @@ -111,7 +111,7 @@ clean_channelname(parv[1]); - if (!(chptr = FindChannel(parv[1]))) + if (!IsChannelName(parv[1]) || !(chptr = FindChannel(parv[1]))) return set_user_mode(cptr, sptr, parc, parv); ClrFlag(sptr, FLAG_TS8); Index: ircd-ircdev/ircd/m_nick.c diff -u ircd-ircdev/ircd/m_nick.c:1.4 ircd-ircdev/ircd/m_nick.c:1.5 --- ircd-ircdev/ircd/m_nick.c:1.4 Fri May 21 08:39:35 2004 +++ ircd-ircdev/ircd/m_nick.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_nick.c,v 1.4 2004/05/21 15:39:35 zolty Exp $ + * $Id: m_nick.c,v 1.5 2004/11/24 16:02:28 zolty Exp $ * */ @@ -250,7 +250,7 @@ */ if (IsUnknown(acptr) && MyConnect(acptr)) { ++ServerStats->is_ref; - IPcheck_connect_fail(cli_ip(acptr)); + IPcheck_connect_fail(&cli_ip(acptr)); exit_client(cptr, acptr, &me, "Overridden by other sign on"); return set_nick_name(cptr, sptr, nick, parc, parv); } @@ -284,17 +284,18 @@ */ int ms_nick(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { - struct Client* acptr; - char nick[NICKLEN + 2]; - time_t lastnick = 0; - int differ = 1; - int samelastnick = 0; - + struct Client *acptr; + char nick[NICKLEN + 2]; + time_t lastnick = 0; + int differ = 1; + const char *type; + assert(0 != cptr); assert(0 != sptr); assert(IsServer(cptr)); - if ((IsServer(sptr) && parc < 8) || parc < 3) { + if ((IsServer(sptr) && parc < 8) || parc < 3) + { sendto_opmask_butone(0, SNO_OLDSNO, "bad NICK param count for %s from %C", parv[1], cptr); return need_more_params(sptr, "NICK"); @@ -303,12 +304,14 @@ ircd_strncpy(nick, parv[1], NICKLEN); nick[NICKLEN] = '\0'; - if (IsServer(sptr)) { + if (IsServer(sptr)) + { lastnick = atoi(parv[3]); if (lastnick > OLDEST_TS && !IsBurstOrBurstAck(sptr)) cli_serv(sptr)->lag = TStime() - lastnick; } - else { + else + { lastnick = atoi(parv[2]); if (lastnick > OLDEST_TS && !IsBurstOrBurstAck(sptr)) cli_serv(cli_user(sptr)->server)->lag = TStime() - lastnick; @@ -322,14 +325,15 @@ if (!do_nick_name(nick) || strcmp(nick, parv[1])) { send_reply(sptr, ERR_ERRONEUSNICKNAME, parv[1]); - + ++ServerStats->is_kill; sendto_opmask_butone(0, SNO_OLDSNO, "Bad Nick: %s From: %s %C", parv[1], parv[0], cptr); sendcmdto_one(&me, CMD_KILL, cptr, "%s :%s (%s <- %s[%s])", - IsServer(sptr) ? parv[parc - 2] : parv[0], - cli_name(&me), parv[1], nick, cli_name(cptr)); - if (!IsServer(sptr)) { + IsServer(sptr) ? parv[parc - 2] : parv[0], cli_name(&me), parv[1], + nick, cli_name(cptr)); + if (!IsServer(sptr)) + { /* * bad nick _change_ */ @@ -341,25 +345,10 @@ } return 0; } - /* - * Check against nick name collisions. - * - * Put this 'if' here so that the nesting goes nicely on the screen :) - * We check against server name list before determining if the nickname - * is present in the nicklist (due to the way the below for loop is - * constructed). -avalon - */ - - assert(NULL == strchr(nick,'.')); - - acptr = FindClient(nick); - if (!acptr) { - /* - * No collisions, all clear... - */ + /* Check against nick name collisions. */ + if ((acptr = FindClient(nick)) == NULL) + /* No collisions, all clear... */ return set_nick_name(cptr, sptr, nick, parc, parv); - } - assert(0 != acptr); /* * If acptr == sptr, then we have a client doing a nick @@ -367,23 +356,16 @@ * is concerned (user is changing the case of his/her * nickname or somesuch) */ - if (acptr == sptr) { - if (strcmp(cli_name(acptr), nick) == 0) - /* - * This is just ':old NICK old' type thing. - * Just forget the whole thing here. There is - * no point forwarding it to anywhere, - * especially since servers prior to this - * version would treat it as nick collision. - */ - return 0; /* NICK Message ignored */ - else - /* - * Allows change of case in his/her nick - */ + if (acptr == sptr) + { + if (strcmp(cli_name(acptr), nick) != 0) + /* Allows change of case in his/her nick */ return set_nick_name(cptr, sptr, nick, parc, parv); + else + /* Setting their nick to what it already is? Ignore it. */ + return 0; } - + /* now we know we have a real collision. */ /* * Note: From this point forward it can be assumed that * acptr != sptr (point to different client structures). @@ -395,9 +377,10 @@ * and proceed with the nick. This should take care of the * "dormant nick" way of generating collisions... */ - if (IsUnknown(acptr) && MyConnect(acptr)) { - ++ServerStats->is_ref; - IPcheck_connect_fail(cli_ip(acptr)); + if (IsUnknown(acptr) && MyConnect(acptr)) + { + ServerStats->is_ref++; + IPcheck_connect_fail(&cli_ip(acptr)); exit_client(cptr, acptr, &me, "Overridden by other sign on"); return set_nick_name(cptr, sptr, nick, parc, parv); } @@ -419,34 +402,37 @@ * --Run * */ - - - if (IsServer(sptr)) { + if (IsServer(sptr)) + { + struct irc_in_addr ip; /* * A new NICK being introduced by a neighbouring * server (e.g. message type ":server NICK new ..." received) * * compare IP address and username */ - differ = (cli_ip(acptr).s_addr != htonl(base64toint(parv[parc - 3]))) || + base64toip(parv[parc - 3], &ip); + differ = (0 != memcmp(&cli_ip(acptr), &ip, sizeof(cli_ip(acptr)))) || (0 != ircd_strcmp(cli_user(acptr)->username, parv[4])); sendto_opmask_butone(0, SNO_OLDSNO, "Nick collision on %C (%C %Tu <- " "%C %Tu (%s user@host))", acptr, cli_from(acptr), cli_lastnick(acptr), cptr, lastnick, differ ? "Different" : "Same"); } - else { + else + { /* * A NICK change has collided (e.g. message type ":old NICK new"). * * compare IP address and username */ - differ = (cli_ip(acptr).s_addr != cli_ip(sptr).s_addr) || - (0 != ircd_strcmp(cli_user(acptr)->username, cli_user(sptr)->username)); + differ = (0 != memcmp(&cli_ip(acptr), &cli_ip(sptr), sizeof(cli_ip(acptr)))) || + (0 != ircd_strcmp(cli_user(acptr)->username, cli_user(sptr)->username)); sendto_opmask_butone(0, SNO_OLDSNO, "Nick change collision from %C to " "%C (%C %Tu <- %C %Tu)", sptr, acptr, cli_from(acptr), cli_lastnick(acptr), cptr, lastnick); } + type = differ ? "older nick overruled" : "nick collision from same user@host"; /* * Now remove (kill) the nick on our side if it is the youngest. * If no timestamp was received, we ignore the incoming nick @@ -456,75 +442,66 @@ * * This exits the client sending the NICK message */ - if (cli_from(acptr) != cptr) { - if ((differ && lastnick >= cli_lastnick(acptr)) || - (!differ && lastnick <= cli_lastnick(acptr))) { - if (!IsServer(sptr)) { - ++ServerStats->is_kill; - sendcmdto_serv_butone(&me, CMD_KILL, NULL, "%C :%s (Nick collision)", - sptr, cli_name(&me)); - assert(!MyConnect(sptr)); - - SetFlag(sptr, FLAG_KILLED); - - exit_client_msg(cptr, sptr, &me, - "Killed (%s (Nick collision))", - feature_str(FEAT_HIS_SERVERNAME)); - - sptr = 0; /* Make sure we don't use the dead client */ - - } else { - /* We need to kill this incoming client, which hasn't been properly registered yet. - * Send a KILL message upstream to the server it came from */ - sendcmdto_one(&me, CMD_KILL, sptr, "%s :%s (Nick collision)", parv[parc-2], cli_name(&me)); - } - /* If the two have the same TS then we want to kill both sides, so - * don't leave yet! + if ((differ && lastnick >= cli_lastnick(acptr)) || + (!differ && lastnick <= cli_lastnick(acptr))) + { + /* We need to bounce this kill straight back... Although the nick message + * for acptr is probably waiting in their recvq from me, its also possible + * that sptr will change their nick on cptr before cptr receives the + * nick message for acptr, which would leave acptr and sptr both alive + * on cptr, but only acptr alive on me, i.e. desync. This extra kill + * message has been absent for a while in ircu although it was a major + * problem when it was tried on efnet, so I don't know how big an issue it + * is. Probably best that this be left here, anyway... + */ + ServerStats->is_kill++; + sendcmdto_one(&me, CMD_KILL, cptr, "%s :%s (%s)", + nick, cli_name(&me), type); + /* But if this was a nick change and not a nick introduction, + * we also need to ensure that we remove our local state + * record of the original client... Also, the rest of the + * net should be informed... + */ + if (!IsServer(sptr)) + { + assert(!MyConnect(sptr)); + /* Inform the rest of the net... */ + sendcmdto_serv_butone(&me, CMD_KILL, cptr, "%s :%s (%s)", + nick, cli_name(&me), type); + /* Don't go sending off a QUIT message... */ + SetFlag(sptr, FLAG_KILLED); + /* Remove them locally. */ + exit_client_msg(cptr, sptr, &me, + "Killed (%s (%s))", + feature_str(FEAT_HIS_SERVERNAME), type); + /* + * We have killed sptr off, zero out it's pointer so if it's used + * again we'll know about it --Bleep */ - if (lastnick != cli_lastnick(acptr)) - return 0; /* Ignore the NICK */ + sptr = NULL; } - send_reply(acptr, ERR_NICKCOLLISION, nick); + /* If the timestamps differ and we just killed sptr, we don't need to kill + * acptr as well. + */ + if (lastnick != cli_lastnick(acptr)) + return 0; } + /* Tell acptr why we are killing it. */ + send_reply(acptr, ERR_NICKCOLLISION, nick); - ++ServerStats->is_kill; + ServerStats->is_kill++; SetFlag(acptr, FLAG_KILLED); - - if (lastnick == cli_lastnick(acptr)) - samelastnick = 1; - /* * This exits the client we had before getting the NICK message */ - if (differ) { - sendcmdto_serv_butone(&me, CMD_KILL, NULL, "%C :%s (older nick " - "overruled)", acptr, cli_name(&me)); - if (MyConnect(acptr)) { - sendcmdto_one(acptr, CMD_QUIT, cptr, ":Killed (%s (older " - "nick overruled))", feature_str(FEAT_HIS_SERVERNAME)); - sendcmdto_one(&me, CMD_KILL, acptr, "%C :%s (older nick " - "overruled)", acptr, feature_str(FEAT_HIS_SERVERNAME)); - } - - exit_client_msg(cptr, acptr, &me, "Killed (%s (older nick " - "overruled))", feature_str(FEAT_HIS_SERVERNAME)); - } - else { - sendcmdto_serv_butone(&me, CMD_KILL, NULL, "%C :%s (nick collision from " - "same user@host)", acptr, cli_name(&me)); - if (MyConnect(acptr)) { - sendcmdto_one(acptr, CMD_QUIT, cptr, ":Killed (%s (nick " - "collision from same user@host))", - feature_str(FEAT_HIS_SERVERNAME)); - sendcmdto_one(&me, CMD_KILL, acptr, "%C :%s (older nick " - "overruled)", acptr, feature_str(FEAT_HIS_SERVERNAME)); - } - exit_client_msg(cptr, acptr, &me, "Killed (%s (nick collision from " - "same user@host))", feature_str(FEAT_HIS_SERVERNAME)); - } - if (samelastnick) + sendcmdto_serv_butone(&me, CMD_KILL, NULL, "%C :%s" + " (%s)", acptr, feature_str(FEAT_HIS_SERVERNAME), + type); + exit_client_msg(cptr, acptr, &me, "Killed (%s (%s))", + feature_str(FEAT_HIS_SERVERNAME), type); + if (lastnick == cli_lastnick(acptr)) + return 0; + if (sptr == NULL) return 0; - - assert(0 != sptr); return set_nick_name(cptr, sptr, nick, parc, parv); } Index: ircd-ircdev/ircd/m_oper.c diff -u ircd-ircdev/ircd/m_oper.c:1.4 ircd-ircdev/ircd/m_oper.c:1.5 --- ircd-ircdev/ircd/m_oper.c:1.4 Fri May 21 08:39:35 2004 +++ ircd-ircdev/ircd/m_oper.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_oper.c,v 1.4 2004/05/21 15:39:35 zolty Exp $ + * $Id: m_oper.c,v 1.5 2004/11/24 16:02:28 zolty Exp $ */ /* @@ -82,11 +82,12 @@ #include "client.h" #include "hash.h" #include "ircd.h" +#include "ircd_alloc.h" +#include "ircd_crypt.h" #include "ircd_features.h" #include "ircd_log.h" #include "ircd_reply.h" #include "ircd_string.h" -#include "ircd_xopen.h" #include "msg.h" #include "numeric.h" #include "numnicks.h" @@ -96,7 +97,6 @@ #include "s_user.h" #include "s_misc.h" #include "send.h" -#include "support.h" #include <assert.h> #include <stdlib.h> @@ -104,6 +104,8 @@ int oper_password_match(const char* to_match, const char* passwd) { + char *crypted; + int res; /* * use first two chars of the password they send in as salt * @@ -112,10 +114,16 @@ if (!to_match || !passwd) return 0; - if (feature_bool(FEAT_CRYPT_OPER_PASSWORD)) - to_match = ircd_crypt(to_match, passwd); - - return (0 == strcmp(to_match, passwd)); + /* we no longer do a CRYPT_OPER_PASSWORD check because a clear + text passwords just handled by a fallback mechanism called + crypt_clear if it's enabled -- hikari */ + crypted = ircd_crypt(to_match, passwd); + + if (to_match == NULL) + return 0; + res = strcmp(crypted, passwd); + MyFree(crypted); + return 0 == res; } /* @@ -136,12 +144,9 @@ if (EmptyString(name) || EmptyString(password)) return need_more_params(sptr, "OPER"); - aconf = find_conf_exact(name, cli_username(sptr), cli_sockhost(sptr), CONF_OPERATOR); - if (!aconf) - aconf = find_conf_exact(name, cli_username(sptr), - ircd_ntoa((const char*) &(cli_ip(cptr))), CONF_OPERATOR); - - if (!aconf || IsIllegal(aconf)) { + aconf = find_conf_exact(name, sptr, CONF_OPERATOR); + if (!aconf || IsIllegal(aconf)) + { send_reply(sptr, ERR_NOOPERHOST); sendto_opmask_butone(0, SNO_OLDREALOP, "Failed OPER attempt by %s (%s@%s)", parv[0], cli_user(sptr)->username, cli_sockhost(sptr)); @@ -149,7 +154,8 @@ } assert(0 != (aconf->status & CONF_OPERATOR)); - if (oper_password_match(password, aconf->passwd)) { + if (oper_password_match(password, aconf->passwd)) + { struct Flags old_mode = cli_flags(sptr); if (ACR_OK != attach_conf(sptr, aconf)) { @@ -184,7 +190,8 @@ log_write(LS_OPER, L_INFO, 0, "OPER (%s) by (%#C)", name, sptr); } - else { + else + { send_reply(sptr, ERR_PASSWDMISMATCH); sendto_opmask_butone(0, SNO_OLDREALOP, "Failed OPER attempt by %s (%s@%s)", parv[0], cli_user(sptr)->username, cli_sockhost(sptr)); @@ -202,7 +209,8 @@ /* * if message arrived from server, trust it, and set to oper */ - if (!IsServer(sptr) && !IsOper(sptr)) { + if (!IsServer(sptr) && !IsOper(sptr)) + { ++UserStats.opers; SetFlag(sptr, FLAG_OPER); sendcmdto_serv_butone(sptr, CMD_MODE, cptr, "%s :+o", parv[0]); Index: ircd-ircdev/ircd/m_opmode.c diff -u ircd-ircdev/ircd/m_opmode.c:1.3 ircd-ircdev/ircd/m_opmode.c:1.4 --- ircd-ircdev/ircd/m_opmode.c:1.3 Thu Apr 22 10:37:18 2004 +++ ircd-ircdev/ircd/m_opmode.c Wed Nov 24 08:02:28 2004 @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: m_opmode.c,v 1.3 2004/04/22 17:37:18 zolty Exp $ + * $Id: m_opmode.c,v 1.4 2004/11/24 16:02:28 zolty Exp $ * */ @@ -109,7 +109,7 @@ if (IsLocalChannel(parv[1])) return 0; - if (!(chptr = FindChannel(parv[1]))) + if ('#' != *parv[1] || !(chptr = FindChannel(parv[1]))) return send_reply(sptr, ERR_NOSUCHCHANNEL, parv[1]); modebuf_init(&mbuf, sptr, cptr, chptr, @@ -148,9 +148,11 @@ return need_more_params(sptr, "OPMODE"); chname = parv[1]; - if (*chname == '!') { + if (*chname == '!') + { chname++; - if (!HasPriv(sptr, IsLocalChannel(chname) ? PRIV_FORCE_LOCAL_OPMODE : PRIV_FORCE_OPMODE)) + if (!HasPriv(sptr, IsLocalChannel(chname) ? PRIV_FORCE_LOCAL_OPMODE + : PRIV_FORCE_OPMODE)) return send_reply(sptr, ERR_NOPRIVILEGES); force = 1; } @@ -160,7 +162,7 @@ IsLoca... [truncated message content] |