+2000-04-27 Kevin L. Mitchell <klmitch@mit.edu>
+
+ * ircd/s_misc.c: *sigh* 2.10.10 doesn't support squitting by
+ numeric nick; therefore, we have to use the server name
+
+ * ircd/m_squit.c (ms_squit): allow to squit by server numeric nick
+
+ * ircd/send.c: fix minor bugs
+
+ * ircd/s_user.c (check_target_limit): mark dead code so I filter
+ it when I grep
+
+ * ircd/s_serv.c (exit_new_server): mark dead code so I filter it
+ when I grep
+
+ * ircd/parse.c: mark dead code so I filter it when I grep
+
+ * ircd/map.c: mark dead code so I filter it when I grep
+
+ * ircd/ircd.c: mark dead code so I filter it when I grep
+
+ * ircd/ircd_relay.c: convert over to new sendcmdto_*, send_reply
+ functions
+
+ * ircd/channel.c: mark dead code so I filter it when I grep
+
+ * ircd/s_stats.c: use send_reply instead of sendto_one w/rpl_str;
+ hope I'm not stepping on toes...
+
+ * ircd/s_conf.c: more sendto_opmask_butone / send_reply
+ conversions; use ircd_snprintf in a couple of cases to negate the
+ possibility of buffer overflow
+
2000-04-26 Kevin L. Mitchell <klmitch@mit.edu>
* ircd/channel.c: convert as much as possible to new send
#
# ChangeLog for ircu2.10.11
#
-# $Id: ChangeLog,v 1.105 2000-04-27 02:08:37 kev Exp $
+# $Id: ChangeLog,v 1.106 2000-04-27 20:24:11 kev Exp $
#
# Insert new changes at beginning of the change list.
#
const char* param, time_t creationtime)
{
if (IsServer(cptr) && DoesOp(mode) && creationtime)
- sendto_one(cptr, ":%s MODE %s %s %s " TIME_T_FMT,
+ sendto_one(cptr, ":%s MODE %s %s %s " TIME_T_FMT, /* XXX DEAD */
from, name, mode, param, creationtime);
else
- sendto_one(cptr, ":%s MODE %s %s %s", from, name, mode, param);
+ sendto_one(cptr, ":%s MODE %s %s %s", from, name, mode, param); /* XXX DEAD */
}
#endif /* 0 */
if (cnt)
{
buf[len - 1] = '\0';
- sendto_one(cptr, "%s", buf);
+ sendto_one(cptr, "%s", buf); /* XXX Possibly DEAD */
}
*buf = ':';
strcpy(buf + 1, user->name);
}
}
if (*buf && cnt)
- sendto_one(cptr, "%s", buf);
+ sendto_one(cptr, "%s", buf); /* XXX Possibly DEAD */
}
/*
":%s NOTICE * :*** Notice -- %sHACK(%d): %s MODE %s %s%s ["
TIME_T_FMT "]", me.name, (badop == 3) ? "BOUNCE or " : "", badop,
parv[0], parv[1], parv[2], params, chptr->creationtime);
- sendbufto_op_mask((badop == 3) ? SNO_HACK3 : (badop ==
+ sendbufto_op_mask((badop == 3) ? SNO_HACK3 : (badop == /* XXX DYING */
4) ? SNO_HACK4 : SNO_HACK2);
if ((IsServer(sptr)) && (badop == 2))
{
sprintf_irc(sendbuf, ":%s DESYNCH :HACK: %s MODE %s %s%s",
me.name, parv[0], parv[1], parv[2], params);
- sendbufto_serv_butone(cptr);
+ sendbufto_serv_butone(cptr); /* XXX DYING */
}
break;
}
case 2: /* No conversion is needed for CREATE; the only numnick is sptr */
{
- sendto_serv_butone(cptr, ":%s DESYNCH :HACK: %s CREATE %s %s",
+ sendto_serv_butone(cptr, ":%s DESYNCH :HACK: %s CREATE %s %s", /* XXX DYING */
me.name, sptr->name, chptr->chname, parv[2]);
- sendto_op_mask(SNO_HACK2, "HACK(2): %s CREATE %s %s",
+ sendto_op_mask(SNO_HACK2, "HACK(2): %s CREATE %s %s", /* XXX DYING */
sptr->name, chptr->chname, parv[2]);
break;
}
sprintf_irc(sendbuf,
":%s NOTICE * :*** Notice -- HACK: %s KICK %s <%s> :%s",
me.name, sptr->name, parv[1], parv[2], parv[3]);
- sendbufto_op_mask(SNO_HACK4);
+ sendbufto_op_mask(SNO_HACK4); /* XXX DYING */
break;
}
}
{
if (IsServer(cptr) || IsConnecting(cptr) || IsHandshake(cptr))
{
- sendto_ops("No response from %s, closing link", cptr->name);
+ sendto_ops("No response from %s, closing link", cptr->name); /* XXX DEAD */
exit_client(cptr, cptr, &me, "Ping timeout");
continue;
}
else {
if (!IsRegistered(cptr) && *cptr->name && *cptr->user->username) {
- sendto_one(cptr,
+ sendto_one(cptr, /* XXX DEAD */
":%s %d %s :Your client may not be compatible with this server.",
me.name, ERR_BADPING, cptr->name);
- sendto_one(cptr,
+ sendto_one(cptr, /* XXX DEAD */
":%s %d %s :Compatible clients are available at "
"ftp://ftp.undernet.org/pub/irc/clients",
me.name, ERR_BADPING, cptr->name);
*/
cptr->lasttime = CurrentTime - ping;
if (IsUser(cptr))
- sendto_one(cptr, "PING :%s", me.name);
+ sendto_one(cptr, "PING :%s", me.name); /* XXX DEAD */
else
- sendto_one(cptr, "%s " TOK_PING " :%s", NumServ(&me), me.name);
+ sendto_one(cptr, "%s " TOK_PING " :%s", NumServ(&me), me.name); /* XXX DEAD */
}
ping_timeout:
timeout = cptr->lasttime + max_ping;
assert(0 != text);
if (0 == (chptr = FindChannel(name))) {
- send_error_to_client(sptr, ERR_NOSUCHCHANNEL, name);
+ send_reply(sptr, ERR_NOSUCHCHANNEL, name);
return;
}
/*
* This first: Almost never a server/service
*/
if (!client_can_send_to_channel(sptr, chptr)) {
- send_error_to_client(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname);
+ send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname);
return;
}
if ((chptr->mode.mode & MODE_NOPRIVMSGS) &&
check_target_limit(sptr, chptr, chptr->chname, 0))
return;
- sendmsgto_channel_butone(sptr->from, sptr, chptr, sptr->name,
- TOK_PRIVATE, chptr->chname, text);
+ sendcmdto_channel_butone(sptr, CMD_PRIVATE, chptr, sptr->from,
+ SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text);
}
void relay_channel_notice(struct Client* sptr, const char* name, const char* text)
check_target_limit(sptr, chptr, chptr->chname, 0))
return;
- sendmsgto_channel_butone(sptr->from, sptr, chptr, sptr->name,
- TOK_NOTICE, chptr->chname, text);
+ sendcmdto_channel_butone(sptr, CMD_NOTICE, chptr, sptr->from,
+ SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text);
}
void server_relay_channel_message(struct Client* sptr, const char* name, const char* text)
/*
* XXX - do we need to send this back from a remote server?
*/
- send_error_to_client(sptr, ERR_NOSUCHCHANNEL, name);
+ send_reply(sptr, ERR_NOSUCHCHANNEL, name);
return;
}
/*
* Servers may have channel services, need to check for it here
*/
if (client_can_send_to_channel(sptr, chptr) || IsChannelService(sptr)) {
- sendmsgto_channel_butone(sptr->from, sptr, chptr, sptr->name,
- TOK_PRIVATE, chptr->chname, text);
+ sendcmdto_channel_butone(sptr, CMD_PRIVATE, chptr, sptr->from,
+ SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text);
}
else
- send_error_to_client(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname);
+ send_reply(sptr, ERR_CANNOTSENDTOCHAN, chptr->chname);
}
void server_relay_channel_notice(struct Client* sptr, const char* name, const char* text)
* Servers may have channel services, need to check for it here
*/
if (client_can_send_to_channel(sptr, chptr) || IsChannelService(sptr)) {
- sendmsgto_channel_butone(sptr->from, sptr, chptr, sptr->name,
- TOK_NOTICE, chptr->chname, text);
+ sendcmdto_channel_butone(sptr, CMD_NOTICE, chptr, sptr->from,
+ SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text);
}
}
assert(0 != server);
if (0 == (acptr = FindServer(server + 1))) {
- send_error_to_client(sptr, ERR_NOSUCHNICK, name);
+ send_reply(sptr, ERR_NOSUCHNICK, name);
return;
}
/*
* NICK[%host]@server addressed? See if <server> is me first
*/
if (!IsMe(acptr)) {
- sendto_one(acptr, ":%s %s %s :%s", sptr->name, MSG_PRIVATE, name, text);
+ sendcmdto_one(sptr, CMD_PRIVATE, acptr, "%s :%s", name, text);
return;
}
/*
if (!(acptr = FindUser(name)) || !MyUser(acptr) ||
(!EmptyString(host) && 0 != match(host, acptr->user->host))) {
- send_error_to_client(sptr, ERR_NOSUCHNICK, name);
+ send_reply(sptr, ERR_NOSUCHNICK, name);
return;
}
*--host = '%';
if (!(is_silenced(sptr, acptr)))
- sendto_prefix_one(acptr, sptr, ":%s %s %s :%s",
- sptr->name, MSG_PRIVATE, name, text);
+ sendcmdto_one(sptr, CMD_PRIVATE, acptr, "%s :%s", name, text);
}
void relay_directed_notice(struct Client* sptr, char* name, char* server, const char* text)
* NICK[%host]@server addressed? See if <server> is me first
*/
if (!IsMe(acptr)) {
- sendto_one(acptr, ":%s %s %s :%s", sptr->name, MSG_NOTICE, name, text);
+ sendcmdto_one(sptr, CMD_NOTICE, acptr, "%s :%s", name, text);
return;
}
/*
*--host = '%';
if (!(is_silenced(sptr, acptr)))
- sendto_prefix_one(acptr, sptr, ":%s %s %s :%s",
- sptr->name, MSG_NOTICE, name, text);
+ sendcmdto_one(sptr, CMD_NOTICE, acptr, "%s :%s", name, text);
}
void relay_private_message(struct Client* sptr, const char* name, const char* text)
assert(0 != text);
if (0 == (acptr = FindUser(name))) {
- send_error_to_client(sptr, ERR_NOSUCHNICK, name);
+ send_reply(sptr, ERR_NOSUCHNICK, name);
return;
}
if (check_target_limit(sptr, acptr, acptr->name, 0) ||
* send away message if user away
*/
if (acptr->user && acptr->user->away)
- sendto_one(sptr, rpl_str(RPL_AWAY),
- me.name, sptr->name, acptr->name, acptr->user->away);
+ send_reply(sptr, RPL_AWAY, acptr->name, acptr->user->away);
/*
* deliver the message
*/
- if (MyUser(acptr)) {
+ if (MyUser(acptr))
add_target(acptr, sptr);
- sendto_prefix_one(acptr, sptr, ":%s %s %s :%s",
- sptr->name, MSG_PRIVATE, acptr->name, text);
- }
- else
- sendto_one(acptr, "%s%s %s %s%s :%s", NumNick(sptr),
- TOK_PRIVATE, NumNick(acptr), text);
+
+ sendcmdto_one(sptr, CMD_PRIVATE, acptr, "%C :%s", acptr, text);
}
void relay_private_notice(struct Client* sptr, const char* name, const char* text)
/*
* deliver the message
*/
- if (MyUser(acptr)) {
+ if (MyUser(acptr))
add_target(acptr, sptr);
- sendto_prefix_one(acptr, sptr, ":%s %s %s :%s",
- sptr->name, MSG_NOTICE, acptr->name, text);
- }
- else
- sendto_one(acptr, "%s%s %s %s%s :%s", NumNick(sptr),
- TOK_NOTICE, NumNick(acptr), text);
+
+ sendcmdto_one(sptr, CMD_NOTICE, acptr, "%C :%s", acptr, text);
}
void server_relay_private_message(struct Client* sptr, const char* name, const char* text)
* nickname addressed?
*/
if (0 == (acptr = findNUser(name)) || !IsUser(acptr)) {
- sendto_one(sptr,
- ":%s %d %s * :Target left UnderNet. Failed to deliver: [%.20s]",
- me.name, ERR_NOSUCHNICK, sptr->name, text);
+ send_reply(sptr, RPL_EXPLICIT | ERR_NOSUCHNICK, "* :Target left UnderNet. "
+ "Failed to deliver: [%.20s]", text);
return;
}
if (is_silenced(sptr, acptr))
return;
- if (MyUser(acptr)) {
+ if (MyUser(acptr))
add_target(acptr, sptr);
- sendto_prefix_one(acptr, sptr, ":%s %s %s :%s",
- sptr->name, MSG_PRIVATE, acptr->name, text);
- }
- else {
- if (IsServer(sptr))
- sendto_one(acptr, "%s %s %s%s :%s", NumServ(sptr),
- TOK_PRIVATE, NumNick(acptr), text);
- else
- sendto_one(acptr, "%s%s %s %s%s :%s", NumNick(sptr),
- TOK_PRIVATE, NumNick(acptr), text);
- }
+
+ sendcmdto_one(sptr, CMD_PRIVATE, acptr, "%C :%s", acptr, text);
}
if (is_silenced(sptr, acptr))
return;
- if (MyUser(acptr)) {
+ if (MyUser(acptr))
add_target(acptr, sptr);
- sendto_prefix_one(acptr, sptr, ":%s %s %s :%s",
- sptr->name, MSG_NOTICE, acptr->name, text);
- }
- else {
- if (IsServer(sptr))
- sendto_one(acptr, "%s %s %s%s :%s", NumServ(sptr),
- TOK_NOTICE, NumNick(acptr), text);
- else
- sendto_one(acptr, "%s%s %s %s%s :%s", NumNick(sptr),
- TOK_NOTICE, NumNick(acptr), text);
- }
+
+ sendcmdto_one(sptr, CMD_NOTICE, acptr, "%C :%s", acptr, text);
}
void relay_masked_message(struct Client* sptr, const char* mask, const char* text)
* look for the last '.' in mask and scan forward
*/
if (0 == (s = strrchr(mask, '.'))) {
- send_error_to_client(sptr, ERR_NOTOPLEVEL, mask);
+ send_reply(sptr, ERR_NOTOPLEVEL, mask);
return;
}
while (*++s) {
break;
}
if (*s == '*' || *s == '?') {
- send_error_to_client(sptr, ERR_WILDTOPLEVEL, mask);
+ send_reply(sptr, ERR_WILDTOPLEVEL, mask);
return;
}
s = mask;
host_mask = 1;
++s;
}
- sendto_match_butone(IsServer(sptr->from) ? sptr->from : 0,
- sptr, s, host_mask ? MATCH_HOST : MATCH_SERVER,
- ":%s %s %s :%s", sptr->name, MSG_PRIVATE, mask, text);
+
+ sendcmdto_match_butone(sptr, CMD_PRIVATE, s,
+ IsServer(sptr->from) ? sptr->from : 0,
+ host_mask ? MATCH_HOST : MATCH_SERVER,
+ "%s :%s", mask, text);
}
void relay_masked_notice(struct Client* sptr, const char* mask, const char* text)
* look for the last '.' in mask and scan forward
*/
if (0 == (s = strrchr(mask, '.'))) {
- send_error_to_client(sptr, ERR_NOTOPLEVEL, mask);
+ send_reply(sptr, ERR_NOTOPLEVEL, mask);
return;
}
while (*++s) {
break;
}
if (*s == '*' || *s == '?') {
- send_error_to_client(sptr, ERR_WILDTOPLEVEL, mask);
+ send_reply(sptr, ERR_WILDTOPLEVEL, mask);
return;
}
s = mask;
host_mask = 1;
++s;
}
- sendto_match_butone(IsServer(sptr->from) ? sptr->from : 0,
- sptr, s, host_mask ? MATCH_HOST : MATCH_SERVER,
- ":%s %s %s :%s", sptr->name, MSG_NOTICE, mask, text);
+
+ sendcmdto_match_butone(sptr, CMD_NOTICE, s,
+ IsServer(sptr->from) ? sptr->from : 0,
+ host_mask ? MATCH_HOST : MATCH_SERVER,
+ "%s :%s", mask, text);
}
void server_relay_masked_message(struct Client* sptr, const char* mask, const char* text)
host_mask = 1;
++s;
}
- sendto_match_butone(sptr->from, sptr, s, host_mask ? MATCH_HOST : MATCH_SERVER,
- ":%s %s %s :%s", sptr->name, MSG_PRIVATE, mask, text);
+ sendcmdto_match_butone(sptr, CMD_PRIVATE, s,
+ IsServer(sptr->from) ? sptr->from : 0,
+ host_mask ? MATCH_HOST : MATCH_SERVER,
+ "%s :%s", mask, text);
}
void server_relay_masked_notice(struct Client* sptr, const char* mask, const char* text)
host_mask = 1;
++s;
}
- sendto_match_butone(sptr->from, sptr, s, host_mask ? MATCH_HOST : MATCH_SERVER,
- ":%s %s %s :%s", sptr->name, MSG_NOTICE, mask, text);
+ sendcmdto_match_butone(sptr, CMD_NOTICE, s,
+ IsServer(sptr->from) ? sptr->from : 0,
+ host_mask ? MATCH_HOST : MATCH_SERVER,
+ "%s :%s", mask, text);
}
if (BadPtr(parv[parc - 1]))
comment=sptr->name;
- acptr = FindServer(server);
-
+ acptr = FindNServer(server);
+
+ if (!acptr)
+ acptr = FindServer(server);
+
if (!acptr) {
Debug((DEBUG_NOTICE, "Ignoring SQUIT to an unknown server"));
return 0;
parv[1] = "*";
dump_map(sptr, &me, parv[1], 0);
- sendto_one(sptr, rpl_str(RPL_MAPEND), me.name, parv[0]);
+ sendto_one(sptr, rpl_str(RPL_MAPEND), me.name, parv[0]); /* XXX DEAD */
return 0;
}
*/
if (!IsUser(cptr) && 0 == (mptr->flags & MFLG_UNREG)) {
if (0 == (mptr->flags & MFLG_IGNORE))
- sendto_one(from, ":%s %d * %s :Register first.",
+ sendto_one(from, ":%s %d * %s :Register first.", /* XXX DEAD */
me.name, ERR_NOTREGISTERED, ch);
return -1;
}
#include "ircd_alloc.h"
#include "ircd_chattr.h"
#include "ircd_log.h"
+#include "ircd_reply.h"
+#include "ircd_snprintf.h"
#include "ircd_string.h"
#include "list.h"
#include "listener.h"
/*
* check against a set of time intervals
*/
-static int check_time_interval(char *interval, char *reply)
+static int check_time_interval(char *interval, char *reply, size_t reply_size)
{
struct tm* tptr;
char* p;
? (perm_min <= nowm && nowm <= perm_max)
: (perm_min <= nowm || nowm <= perm_max))
{
- sprintf_irc(reply, ":%%s %%d %%s :%s %d:%02d to %d:%02d.",
- "You are not allowed to connect from",
- perm_min_hours, perm_min_minutes,
- perm_max_hours, perm_max_minutes);
+ ircd_snprintf(0, reply, reply_size, ":You are not allowed to connect "
+ "from %d:%02d to %d:%02d.", perm_min_hours,
+ perm_min_minutes, perm_max_hours, perm_max_minutes);
return (ERR_YOUREBANNEDCREEP);
}
if ((perm_min < perm_max)
? (perm_min <= nowm + 5 && nowm + 5 <= perm_max)
: (perm_min <= nowm + 5 || nowm + 5 <= perm_max))
{
- sprintf_irc(reply, ":%%s %%d %%s :%d minute%s%s",
- perm_min - nowm, (perm_min - nowm) > 1 ? "s " : " ",
- "and you will be denied for further access");
+ ircd_snprintf(0, reply, reply_size, ":%d minute%s and you will be "
+ "denied for further access", perm_min - nowm,
+ (perm_min - nowm) > 1 ? "s" : "");
return (ERR_YOUWILLBEBANNED);
}
interval = p;
struct tm* tm;
if (NULL == (file = fbopen(filename, "r"))) {
- sendto_one(sptr, err_str(ERR_NOMOTD), me.name, parv);
- sendto_one(sptr,
- ":%s %d %s :Connection from your host is refused on this server.",
- me.name, ERR_YOUREBANNEDCREEP, parv);
+ send_reply(sptr, ERR_NOMOTD);
+ send_reply(sptr, RPL_EXPLICIT | ERR_YOUREBANNEDCREEP,
+ ":Connection from your host is refused on this server.");
return;
}
fbstat(&sb, file);
*tmp = '\0';
if ((tmp = strchr(line, '\r')))
*tmp = '\0';
- /* sendto_one(sptr,
- * ":%s %d %s : %s.",
- * me.name, ERR_YOUREBANNEDCREEP, parv,line); */
- sendto_one(sptr, rpl_str(RPL_MOTD), me.name, parv, line);
+ send_reply(sptr, RPL_MOTD, line);
}
- sendto_one(sptr,
- ":%s %d %s :Connection from your host is refused on this server.",
- me.name, ERR_YOUREBANNEDCREEP, parv);
+ send_reply(sptr, RPL_EXPLICIT | ERR_YOUREBANNEDCREEP,
+ ":Connection from your host is refused on this server.");
fbclose(file);
}
struct ConfItem *tmp;
char userhost[USERLEN + HOSTLEN + 3];
- /*
- * XXX - buffer overflow possible, unchecked variables
- */
if (user)
- sprintf_irc(userhost, "%s@%s", user, host);
+ ircd_snprintf(0, userhost, sizeof(userhost), "%s@%s", user, host);
else
ircd_strncpy(userhost, host, sizeof(userhost) - 1);
int found_g = 0;
if (1 == sig)
- sendto_ops("Got signal SIGHUP, reloading ircd conf. file");
+ sendto_opmask_butone(0, SNO_OLDSNO,
+ "Got signal SIGHUP, reloading ircd conf. file");
while ((tmp2 = *tmp)) {
if (tmp2->clients) {
CONF_HUB | CONF_LEAF | CONF_UWORLD);
}
if ((found_g = find_kill(acptr))) {
- sendto_op_mask(found_g == -2 ? SNO_GLINE : SNO_OPERKILL,
- found_g == -2 ? "G-line active for %s" : "K-line active for %s",
- get_client_name(acptr, HIDE_IP));
+ sendto_opmask_butone(0, found_g == -2 ? SNO_GLINE : SNO_OPERKILL,
+ found_g == -2 ? "G-line active for %s" :
+ "K-line active for %s",
+ get_client_name(acptr, HIDE_IP));
if (exit_client(cptr, acptr, &me, found_g == -2 ? "G-lined" :
"K-lined") == CPTR_KILLED)
ret = CPTR_KILLED;
len += strlen(aconf->host);
newhost = (char*) MyMalloc(len);
assert(0 != newhost);
- sprintf_irc(newhost, "*@%s", aconf->host);
+ ircd_snprintf(0, newhost, len, "*@%s", aconf->host);
MyFree(aconf->host);
aconf->host = newhost;
}
break;
else if (is_comment(tmp->passwd))
break;
- else if (check_time_interval(tmp->passwd, reply))
+ else if (check_time_interval(tmp->passwd, reply, sizeof(reply)))
break;
}
}
if (reply[0])
- sendto_one(cptr, reply, me.name, ERR_YOUREBANNEDCREEP, cptr->name);
+ send_reply(cptr, RPL_EXPLICIT | ERR_YOUREBANNEDCREEP, reply);
else if (tmp) {
if (EmptyString(tmp->passwd))
- sendto_one(cptr,
- ":%s %d %s :Connection from your host is refused on this server.",
- me.name, ERR_YOUREBANNEDCREEP, cptr->name);
+ send_reply(cptr, RPL_EXPLICIT | ERR_YOUREBANNEDCREEP,
+ ":Connection from your host is refused on this server.");
else {
if (*tmp->passwd == '"') {
- char *sbuf =
- sprintf_irc(sendbuf, ":%s %d %s :%s", me.name, ERR_YOUREBANNEDCREEP,
- cptr->name, &tmp->passwd[1]);
- sbuf[-1] = '.'; /* Overwrite last quote with a dot */
- sendbufto_one(cptr);
+ send_reply(cptr, RPL_EXPLICIT | ERR_YOUREBANNEDCREEP, ":%*s.",
+ strlen(tmp->passwd + 1) - 1, tmp->passwd + 1);
}
else if (*tmp->passwd == '!')
killcomment(cptr, cptr->name, &tmp->passwd[1]);
#ifdef COMMENT_IS_FILE
killcomment(cptr, cptr->name, tmp->passwd);
#else
- sendto_one(cptr, ":%s %d %s :%s.", me.name, ERR_YOUREBANNEDCREEP,
- cptr->name, tmp->passwd);
+ send_reply(cptr, RPL_EXPLICIT | ERR_YOUREBANNEDCREEP, ":%s.",
+ tmp->passwd);
#endif
}
}
/* find active glines */
/* added a check against the user's IP address to find_gline() -Kev */
else if ((agline = gline_lookup(cptr)) && GlineIsActive(agline))
- sendto_one(cptr, ":%s %d %s :%s.", me.name, ERR_YOUREBANNEDCREEP,
- cptr->name, GlineReason(agline));
+ send_reply(cptr, RPL_EXPLICIT | ERR_YOUREBANNEDCREEP, ":%s.",
+ GlineReason(agline));
else
agline = NULL; /* if a gline was found, it was inactive */
if (IsConnecting(cptr) || IsHandshake(cptr)) {
c_conf = find_conf_byname(lp, cptr->name, CONF_SERVER);
if (!c_conf) {
- sendto_ops("Connect Error: lost C:line for %s", cptr->name);
+ sendto_opmask_butone(0, SNO_OLDSNO, "Connect Error: lost C:line for %s",
+ cptr->name);
det_confs_butmask(cptr, 0);
return -1;
}
&& IsClient(victim)) /* Not a Ping struct or Log file */
{
if (IsServer(victim) || IsHandshake(victim))
- sendcmdto_one(killer, CMD_SQUIT, victim, "%C 0 :%s", &me, comment);
+ sendcmdto_one(killer, CMD_SQUIT, victim, "%s 0 :%s", me.name, comment);
else if (!IsConnecting(victim)) {
if (!IsDead(victim))
sendrawto_one(victim, MSG_ERROR " :Closing Link: %s by %s (%s)",
for (dlp = me.serv->down; dlp; dlp = dlp->next) {
if (dlp->value.cptr != killer->from && dlp->value.cptr != victim) {
if (IsServer(victim))
- sendcmdto_one(killer, CMD_SQUIT, dlp->value.cptr, "%C %Tu :%s",
- victim, victim->serv->timestamp, comment);
+ sendcmdto_one(killer, CMD_SQUIT, dlp->value.cptr, "%s %Tu :%s",
+ victim->name, victim->serv->timestamp, comment);
else if (IsUser(victim) && 0 == (victim->flags & FLAGS_KILLED))
sendcmdto_one(victim, CMD_QUIT, dlp->value.cptr, ":%s", comment);
}
return vexit_client_msg(cptr, cptr, &me, fmt, vl);
sprintf_irc(buf, ":%s " TOK_SQUIT " %s " TIME_T_FMT " :", me.name, host, timestamp);
strcat(buf, fmt);
- vsendto_one(cptr, buf, vl);
+ vsendto_one(cptr, buf, vl); /* XXX DEAD */
va_end(vl);
MyFree(buf);
return 0;
*/
/* Special-case 'k' or 'K' lines as appropriate... -Kev */
if ((tmp->status & CONF_KLINE))
- sendto_one(sptr, rpl_str(p[1]), me.name,
- sptr->name, c, host, pass, name, port, get_conf_class(tmp));
+ send_reply(sptr, p[1], c, host, pass, name, port, get_conf_class(tmp));
/*
* connect rules are classless
*/
else if ((tmp->status & CONF_CRULE))
- sendto_one(sptr, rpl_str(p[1]), me.name, sptr->name, c, host, name);
+ send_reply(sptr, p[1], c, host, name);
else if ((tmp->status & CONF_TLINES))
- sendto_one(sptr, rpl_str(p[1]), me.name, sptr->name, c, host, pass);
+ send_reply(sptr, p[1], c, host, pass);
else if ((tmp->status & CONF_UWORLD))
- sendto_one(sptr, rpl_str(p[1]),
- me.name, sptr->name, c, host, pass, name, port,
- get_conf_class(tmp));
+ send_reply(sptr, p[1], c, host, pass, name, port, get_conf_class(tmp));
else if ((tmp->status & (CONF_SERVER | CONF_HUB)))
- sendto_one(sptr, rpl_str(p[1]), me.name, sptr->name, c, "*", name,
- port, get_conf_class(tmp));
+ send_reply(sptr, p[1], c, "*", name, port, get_conf_class(tmp));
else
- sendto_one(sptr, rpl_str(p[1]), me.name, sptr->name, c, host, name,
- port, get_conf_class(tmp));
+ send_reply(sptr, p[1], c, host, name, port, get_conf_class(tmp));
}
}
}
else {
#ifdef GODMODE
/* XXX Let's get rid of GODMODE */
- sendto_one(sptr, ":%s NOTICE %s :New target: %s; ft " TIME_T_FMT,
+ sendto_one(sptr, ":%s NOTICE %s :New target: %s; ft " TIME_T_FMT, /* XXX Possibly DEAD */
me.name, sptr->name, name, (CurrentTime - sptr->nexttarget) / TARGET_DELAY);
#endif
sptr->nexttarget += TARGET_DELAY;
ircd_strncpy(to->info, notice, REALLEN);
if (!IsUser(to) && !IsUnknown(to) && !(to->flags & FLAGS_CLOSING))
- sendto_ops("%s for %s", to->info, to->name);
+ sendto_opmask_butone(0, SNO_OLDSNO, "%s for %s", to->info, to->name);
Debug((DEBUG_ERROR, to->info));
}
if (DBufLength(&to->sendQ) > get_sendq(to)) {
if (IsServer(to))
- sendto_ops("Max SendQ limit exceeded for %s: " SIZE_T_FMT " > " SIZE_T_FMT,
- to->name, DBufLength(&to->sendQ), get_sendq(to));
+ sendto_opmask_butone(0, SNO_OLDSNO, "Max SendQ limit exceeded for %C: "
+ "%zu > %zu", to, DBufLength(&to->sendQ),
+ get_sendq(to));
dead_link(to, "Max sendQ exceeded");
return;
}
struct VarData vd;
char sndbuf[IRC_BUFSIZE];
+ to = to->from;
+
vd.vd_format = pattern; /* set up the struct VarData for %v */
vd.vd_args = vl;
(skip & SKIP_DEAF && IsDeaf(member->user)) ||
(skip & SKIP_NONOPS && !IsChanOp(member)) ||
(skip & SKIP_BURST && IsBurstOrBurstAck(member->user->from)) ||
- member->user->from->fd < -1 ||
+ member->user->from->fd < 0 ||
sentalong[member->user->from->fd] == sentalong_marker)
continue;
+ sentalong[member->user->from->fd] = sentalong_marker;
if (MyConnect(member->user)) /* pick right buffer to send */
send_buffer(member->user, userbuf);
if (cptr->from == one || IsServer(cptr) || !(cptr->flags & flag) ||
cptr->from->fd < 0 || sentalong[cptr->from->fd] == sentalong_marker)
continue; /* skip it */
+ sentalong[cptr->from->fd] = sentalong_marker;
if (MyConnect(cptr)) /* send right buffer */
send_buffer(cptr, userbuf);
/* send buffer along */
sentalong_marker++;
for (cptr = GlobalClientList; cptr; cptr = cptr->next) {
- if (cptr->from == one || IsServer(cptr) || !match_it(cptr, to, who) ||
- cptr->from->fd < 0 || sentalong[cptr->from->fd] == sentalong_marker)
+ if (cptr->from == one || IsServer(cptr) || IsMe(cptr) ||
+ !match_it(cptr, to, who) || cptr->from->fd < 0 ||
+ sentalong[cptr->from->fd] == sentalong_marker)
continue; /* skip it */
+ sentalong[cptr->from->fd] = sentalong_marker;
if (MyConnect(cptr)) /* send right buffer */
send_buffer(cptr, userbuf);