From 545c2560e638c615cd4e4b8f933b60e0c1c51eff Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sun, 13 Oct 2019 09:24:26 +0200 Subject: [PATCH] Rip out support for servers lacking SIDs/UIDs. More cleanups will follow later for this one. --- include/struct.h | 2 -- src/misc.c | 3 +-- src/modules/join.c | 8 +------ src/modules/kick.c | 4 +--- src/modules/kill.c | 6 ++--- src/modules/md.c | 46 +++++++++++--------------------------- src/modules/message.c | 2 +- src/modules/nick.c | 26 +++++----------------- src/modules/part.c | 4 +--- src/modules/protoctl.c | 1 - src/modules/server.c | 50 ++++++++++++++---------------------------- src/modules/sjoin.c | 47 +++++---------------------------------- src/modules/topic.c | 5 +---- src/send.c | 29 +++++------------------- 14 files changed, 54 insertions(+), 179 deletions(-) diff --git a/include/struct.h b/include/struct.h index cefb91301..05ce60e2c 100644 --- a/include/struct.h +++ b/include/struct.h @@ -336,7 +336,6 @@ typedef enum ClientStatus { #define PROTO_VL 0x000040 /* Negotiated VL protocol */ #define PROTO_SJ3 0x000080 /* Negotiated SJ3 protocol */ #define PROTO_VHP 0x000100 /* Send hostnames in NICKv2 even if not sethosted */ -#define PROTO_SID 0x000200 /* SID/UID mode */ #define PROTO_TKLEXT 0x000400 /* TKL extension: 10 parameters instead of 8 (3.2RC2) */ #define PROTO_CLK 0x001000 /* Send cloaked host in the NICK command (regardless of +x/-x) */ #define PROTO_MLOCK 0x002000 /* server supports MLOCK */ @@ -512,7 +511,6 @@ typedef enum ClientStatus { #define SupportTKLEXT(x) (CHECKPROTO(x, PROTO_TKLEXT)) #define SupportTKLEXT2(x) (CHECKPROTO(x, PROTO_TKLEXT2)) #define SupportCLK(x) (CHECKPROTO(x, PROTO_CLK)) -#define SupportSID(x) (CHECKPROTO(x, PROTO_SID)) #define SupportMTAGS(x) (CHECKPROTO(x, PROTO_MTAGS)) #define SetUMODE2(x) ((x)->local->proto |= PROTO_UMODE2) diff --git a/src/misc.c b/src/misc.c index 1a3e8294e..71ff8fc00 100644 --- a/src/misc.c +++ b/src/misc.c @@ -627,8 +627,7 @@ void exit_client(Client *client, MessageTag *recv_mtags, char *comment) } else if (IsUser(client) && !IsKilled(client)) { - sendto_server(client, PROTO_SID, 0, recv_mtags, ":%s QUIT :%s", ID(client), comment); - sendto_server(client, 0, PROTO_SID, recv_mtags, ":%s QUIT :%s", client->name, comment); + sendto_server(client, 0, 0, recv_mtags, ":%s QUIT :%s", ID(client), comment); } /* Finally, the client/server itself exits.. */ diff --git a/src/modules/join.c b/src/modules/join.c index 1b2556c3f..b48f12d49 100644 --- a/src/modules/join.c +++ b/src/modules/join.c @@ -249,15 +249,9 @@ void _join_channel(Channel *channel, Client *client, MessageTag *recv_mtags, int /* old non-SJOINv3 servers */ sendto_server(client, 0, PROTO_SJ3, mtags, ":%s JOIN :%s", client->name, channel->chname); - /* I _know_ that the "@%s " look a bit wierd - with the space and all .. but its to get around - a SJOIN bug --stskeeps */ - sendto_server(client, PROTO_SID | PROTO_SJ3, 0, mtags_sjoin, ":%s SJOIN %lld %s :%s%s ", + sendto_server(client, 0, 0, mtags_sjoin, ":%s SJOIN %lld %s :%s%s ", me.id, (long long)channel->creationtime, channel->chname, chfl_to_sjoin_symbol(flags), ID(client)); - sendto_server(client, PROTO_SJ3, PROTO_SID, mtags_sjoin, ":%s SJOIN %lld %s :%s%s ", - me.name, (long long)channel->creationtime, - channel->chname, chfl_to_sjoin_symbol(flags), client->name); if (MyUser(client)) { diff --git a/src/modules/kick.c b/src/modules/kick.c index 3c2104dd9..a85bf9a86 100644 --- a/src/modules/kick.c +++ b/src/modules/kick.c @@ -314,10 +314,8 @@ CMD_FUNC(cmd_kick) client->name, channel->chname, who->name, comment); } } - sendto_server(client, PROTO_SID, 0, mtags, ":%s KICK %s %s :%s", + sendto_server(client, 0, 0, mtags, ":%s KICK %s %s :%s", ID(client), channel->chname, ID(who), comment); - sendto_server(client, 0, PROTO_SID, mtags, ":%s KICK %s %s :%s", - client->name, channel->chname, who->name, comment); free_message_tags(mtags); if (lp) { diff --git a/src/modules/kill.c b/src/modules/kill.c index 6d78a4098..67b441494 100644 --- a/src/modules/kill.c +++ b/src/modules/kill.c @@ -230,11 +230,9 @@ CMD_FUNC(cmd_kill) { /* Kill from one server to another (we may be src, victim or something in-between) */ - /* Broadcast it to other SID and non-SID servers (may be a NOOP, obviously) */ - sendto_server(client, PROTO_SID, 0, mtags, ":%s KILL %s :%s!%s", + /* Broadcast it to other servers */ + sendto_server(client, 0, 0, mtags, ":%s KILL %s :%s!%s", client->name, ID(target), inpath, path); - sendto_server(client, 0, PROTO_SID, mtags, ":%s KILL %s :%s!%s", - client->name, target->name, inpath, path); /* Don't send a QUIT for this */ SetKilled(target); diff --git a/src/modules/md.c b/src/modules/md.c index ba5fe7ed4..9925a7e9d 100644 --- a/src/modules/md.c +++ b/src/modules/md.c @@ -236,17 +236,13 @@ void _broadcast_md_client_cmd(Client *except, Client *sender, Client *client, ch { if (value) { - sendto_server(except, PROTO_SID, 0, NULL, ":%s MD %s %s %s :%s", + sendto_server(except, 0, 0, NULL, ":%s MD %s %s %s :%s", sender->name, "client", ID(client), varname, value); - sendto_server(except, 0, PROTO_SID, NULL, ":%s MD %s %s %s :%s", - sender->name, "client", client->name, varname, value); } else { - sendto_server(except, PROTO_SID, 0, NULL, ":%s MD %s %s %s", + sendto_server(except, 0, 0, NULL, ":%s MD %s %s %s", sender->name, "client", ID(client), varname); - sendto_server(except, 0, PROTO_SID, NULL, ":%s MD %s %s %s", - sender->name, "client", client->name, varname); } } @@ -264,17 +260,13 @@ void _broadcast_md_member_cmd(Client *except, Client *sender, Channel *channel, { if (value) { - sendto_server(except, PROTO_SID, 0, NULL, ":%s MD %s %s:%s %s :%s", + sendto_server(except, 0, 0, NULL, ":%s MD %s %s:%s %s :%s", sender->name, "member", channel->chname, ID(client), varname, value); - sendto_server(except, 0, PROTO_SID, NULL, ":%s MD %s %s:%s %s :%s", - sender->name, "member", channel->chname, client->name, varname, value); } else { - sendto_server(except, PROTO_SID, 0, NULL, ":%s MD %s %s:%s %s", + sendto_server(except, 0, 0, NULL, ":%s MD %s %s:%s %s", sender->name, "member", channel->chname, ID(client), varname); - sendto_server(except, 0, PROTO_SID, NULL, ":%s MD %s %s:%s %s", - sender->name, "member", channel->chname, client->name, varname); } } @@ -282,17 +274,13 @@ void _broadcast_md_membership_cmd(Client *except, Client *sender, Client *client { if (value) { - sendto_server(except, PROTO_SID, 0, NULL, ":%s MD %s %s:%s %s :%s", + sendto_server(except, 0, 0, NULL, ":%s MD %s %s:%s %s :%s", sender->name, "membership", ID(client), channel->chname, varname, value); - sendto_server(except, 0, PROTO_SID, NULL, ":%s MD %s %s:%s %s :%s", - sender->name, "membership", client->name, channel->chname, varname, value); } else { - sendto_server(except, PROTO_SID, 0, NULL, ":%s MD %s %s:%s %s", + sendto_server(except, 0, 0, NULL, ":%s MD %s %s:%s %s", sender->name, "membership", ID(client), channel->chname, varname); - sendto_server(except, 0, PROTO_SID, NULL, ":%s MD %s %s:%s %s", - sender->name, "membership", client->name, channel->chname, varname); } } @@ -300,16 +288,12 @@ void _broadcast_md_globalvar_cmd(Client *except, Client *sender, char *varname, { if (value) { - sendto_server(except, PROTO_SID, 0, NULL, ":%s MD %s %s :%s", - sender->name, "globalvar", varname, value); - sendto_server(except, 0, PROTO_SID, NULL, ":%s MD %s %s :%s", + sendto_server(except, 0, 0, NULL, ":%s MD %s %s :%s", sender->name, "globalvar", varname, value); } else { - sendto_server(except, PROTO_SID, 0, NULL, ":%s MD %s %s", - sender->name, "globalvar", varname); - sendto_server(except, 0, PROTO_SID, NULL, ":%s MD %s %s", + sendto_server(except, 0, 0, NULL, ":%s MD %s %s", sender->name, "globalvar", varname); } } @@ -359,7 +343,6 @@ void _broadcast_md_globalvar(ModDataInfo *mdi, ModData *md) void _send_moddata_client(Client *srv, Client *client) { ModDataInfo *mdi; - char *user = CHECKPROTO(srv, PROTO_SID) ? ID(client) : client->name; for (mdi = MDInfo; mdi; mdi = mdi->next) { @@ -368,7 +351,7 @@ void _send_moddata_client(Client *srv, Client *client) char *value = mdi->serialize(&moddata_client(client, mdi)); if (value) sendto_one(srv, NULL, ":%s MD %s %s %s :%s", - me.name, "client", user, mdi->name, value); + me.name, "client", ID(client), mdi->name, value); } } } @@ -402,9 +385,8 @@ void _send_moddata_members(Client *srv) Member *m; for (m = channel->members; m; m = m->next) { - char *user = CHECKPROTO(srv, PROTO_SID) ? ID(m->client) : m->client->name; - - if (m->client->direction == srv) + client = m->client; + if (client->direction == srv) continue; /* from srv's direction */ for (mdi = MDInfo; mdi; mdi = mdi->next) { @@ -413,7 +395,7 @@ void _send_moddata_members(Client *srv) char *value = mdi->serialize(&moddata_member(m, mdi)); if (value) sendto_one(srv, NULL, ":%s MD %s %s:%s %s :%s", - me.name, "member", channel->chname, user, mdi->name, value); + me.name, "member", channel->chname, ID(client), mdi->name, value); } } } @@ -430,8 +412,6 @@ void _send_moddata_members(Client *srv) for (m = client->user->channel; m; m = m->next) { - char *user = CHECKPROTO(srv, PROTO_SID) ? ID(client) : client->name; - for (mdi = MDInfo; mdi; mdi = mdi->next) { if ((mdi->type == MODDATATYPE_MEMBERSHIP) && mdi->sync && mdi->serialize) @@ -439,7 +419,7 @@ void _send_moddata_members(Client *srv) char *value = mdi->serialize(&moddata_membership(m, mdi)); if (value) sendto_one(srv, NULL, ":%s MD %s %s:%s %s :%s", - me.name, "membership", user, m->channel->chname, mdi->name, value); + me.name, "membership", ID(client), m->channel->chname, mdi->name, value); } } } diff --git a/src/modules/message.c b/src/modules/message.c index 2930b251f..9df7ad1be 100644 --- a/src/modules/message.c +++ b/src/modules/message.c @@ -446,7 +446,7 @@ void cmd_message(Client *client, MessageTag *recv_mtags, int parc, char *parv[], new_message(client, recv_mtags, &mtags); labeled_response_inhibit = 1; sendto_prefix_one(target, client, mtags, ":%s %s %s :%s", - CHECKPROTO(target->direction, PROTO_SID) ? ID(client) : client->name, + ID(client), cmd, (MyUser(target) ? target->name : nick), text); diff --git a/src/modules/nick.c b/src/modules/nick.c index 166290556..872627d71 100644 --- a/src/modules/nick.c +++ b/src/modules/nick.c @@ -115,12 +115,13 @@ void nick_collision(Client *cptr, char *newnick, char *newid, Client *new, Clien */ /* cptr case first... this side knows the user by newnick/newid */ - if (CHECKPROTO(cptr, PROTO_SID) && !BadPtr(newid)) + if (!BadPtr(newid)) { /* SID server can kill 'new' by ID */ sendto_one(cptr, NULL, ":%s KILL %s :%s (%s)", me.name, newid, me.name, comment); } else { + // FIXME: this never happens, right? after the old proto ripout... #ifndef ASSUME_NICK_IN_FLIGHT /* cptr is not SID-capable or user has no UID */ sendto_one(cptr, NULL, ":%s KILL %s :%s (%s)", @@ -146,14 +147,10 @@ void nick_collision(Client *cptr, char *newnick, char *newid, Client *new, Clien new_message(new, NULL, &mtags); /* non-cptr side knows this user by their old nick name */ - sendto_server(cptr, PROTO_SID, 0, mtags, + sendto_server(cptr, 0, 0, mtags, ":%s KILL %s :%s (%s)", me.name, ID(new), me.name, comment); - sendto_server(cptr, 0, PROTO_SID, mtags, - ":%s KILL %s :%s (%s)", - me.name, new->name, me.name, comment); - /* Exit the client */ ircstats.is_kill++; SetKilled(new); @@ -170,21 +167,10 @@ void nick_collision(Client *cptr, char *newnick, char *newid, Client *new, Clien new_message(existing, NULL, &mtags); /* Now let's kill 'existing' */ - sendto_server(NULL, PROTO_SID, 0, mtags, + sendto_server(NULL, 0, 0, mtags, ":%s KILL %s :%s (%s)", me.name, ID(existing), me.name, comment); -#ifndef ASSUME_NICK_IN_FLIGHT - /* This is not ideal on non-SID servers, may kill the wrong person. */ - sendto_server(NULL, 0, PROTO_SID, mtags, - ":%s KILL %s :%s (%s)", - me.name, existing->name, me.name, comment); -#else - sendto_server(cptr, 0, PROTO_SID, mtags, - ":%s KILL %s :%s (%s)", - me.name, existing->name, me.name, comment); -#endif - /* NOTE: we may have sent two KILLs on the same nick in some cases. * Should be acceptable and only happens in a non-100% UID network. */ @@ -959,10 +945,8 @@ CMD_FUNC(cmd_nick) } add_history(client, 1); new_message(client, recv_mtags, &mtags); - sendto_server(client, PROTO_SID, 0, mtags, ":%s NICK %s %lld", + sendto_server(client, 0, 0, mtags, ":%s NICK %s %lld", ID(client), nick, (long long)client->lastnick); - sendto_server(client, 0, PROTO_SID, mtags, ":%s NICK %s %lld", - client->name, nick, (long long)client->lastnick); sendto_local_common_channels(client, client, 0, mtags, ":%s NICK :%s", client->name, nick); sendto_one(client, mtags, ":%s NICK :%s", client->name, nick); free_message_tags(mtags); diff --git a/src/modules/part.c b/src/modules/part.c index 140b75e23..6738eb6b0 100644 --- a/src/modules/part.c +++ b/src/modules/part.c @@ -158,10 +158,8 @@ CMD_FUNC(cmd_part) new_message_special(client, recv_mtags, &mtags, ":%s PART %s", client->name, channel->chname); /* Send to other servers... */ - sendto_server(client, PROTO_SID, 0, mtags, ":%s PART %s :%s", + sendto_server(client, 0, 0, mtags, ":%s PART %s :%s", ID(client), channel->chname, comment ? comment : ""); - sendto_server(client, 0, PROTO_SID, mtags, ":%s PART %s :%s", - client->name, channel->chname, comment ? comment : ""); if (invisible_user_in_channel(client, channel)) { diff --git a/src/modules/protoctl.c b/src/modules/protoctl.c index 2e36b3d42..599297c28 100644 --- a/src/modules/protoctl.c +++ b/src/modules/protoctl.c @@ -220,7 +220,6 @@ CMD_FUNC(cmd_protoctl) del_from_id_hash_table(client->id, client); /* delete old UID entry (created on connect) */ strlcpy(client->id, sid, IDLEN); add_to_id_hash_table(client->id, client); /* add SID */ - client->local->proto |= PROTO_SID; } else if (!strcmp(name, "EAUTH") && value && NEW_LINKING_PROTOCOL) { diff --git a/src/modules/server.c b/src/modules/server.c index 6394b3f92..a3f48cc3a 100644 --- a/src/modules/server.c +++ b/src/modules/server.c @@ -750,12 +750,10 @@ CMD_FUNC(cmd_server_remote) if (*acptr->id) { - sendto_server(client, PROTO_SID, 0, NULL, ":%s SID %s %d %s :%s", + sendto_server(client, 0, 0, NULL, ":%s SID %s %d %s :%s", acptr->srvptr->id, acptr->name, hop + 1, acptr->id, acptr->info); - sendto_server(client, 0, PROTO_SID, NULL, ":%s SERVER %s %d :%s", - acptr->srvptr->name, - acptr->name, hop + 1, acptr->info); } else { + // FIXME: this should never happen sendto_server(client, 0, 0, NULL, ":%s SERVER %s %d :%s", acptr->srvptr->name, acptr->name, hop + 1, acptr->info); @@ -773,8 +771,7 @@ void _introduce_user(Client *to, Client *acptr) send_moddata_client(to, acptr); if (acptr->user->away) - sendto_one(to, NULL, ":%s AWAY :%s", CHECKPROTO(to, PROTO_SID) ? ID(acptr) : acptr->name, - acptr->user->away); + sendto_one(to, NULL, ":%s AWAY :%s", ID(acptr), acptr->user->away); if (acptr->user->swhois) { @@ -993,15 +990,8 @@ int server_sync(Client *cptr, ConfigItem_link *aconf) RunHook(HOOKTYPE_SERVER_CONNECT, cptr); /* Broadcast new server to the rest of the network */ - if (*cptr->id) - { - sendto_server(cptr, PROTO_SID, 0, NULL, ":%s SID %s 2 %s :%s", - cptr->srvptr->id, cptr->name, cptr->id, cptr->info); - } - - sendto_server(cptr, 0, *cptr->id ? PROTO_SID : 0, NULL, ":%s SERVER %s 2 :%s", - cptr->serv->up, - cptr->name, cptr->info); + sendto_server(cptr, 0, 0, NULL, ":%s SID %s 2 %s :%s", + cptr->srvptr->id, cptr->name, cptr->id, cptr->info); /* Broadcast the just-linked-in featureset to other servers on our side */ broadcast_sinfo(cptr, NULL, cptr); @@ -1017,18 +1007,10 @@ int server_sync(Client *cptr, ConfigItem_link *aconf) if (IsServer(acptr)) { - if (SupportSID(cptr) && *acptr->id) - { - sendto_one(cptr, NULL, ":%s SID %s %d %s :%s", - acptr->srvptr->id, - acptr->name, acptr->hopcount + 1, - acptr->id, acptr->info); - } - else - sendto_one(cptr, NULL, ":%s SERVER %s %d :%s", - acptr->serv->up, - acptr->name, acptr->hopcount + 1, - acptr->info); + sendto_one(cptr, NULL, ":%s SID %s %d %s :%s", + acptr->srvptr->id, + acptr->name, acptr->hopcount + 1, + acptr->id, acptr->info); /* Also signal to the just-linked server which * servers are fully linked. @@ -1041,7 +1023,7 @@ int server_sync(Client *cptr, ConfigItem_link *aconf) */ if (acptr->serv->flags.synced) { - sendto_one(cptr, NULL, ":%s EOS", CHECKPROTO(cptr, PROTO_SID) ? ID(acptr) : acptr->name); + sendto_one(cptr, NULL, ":%s EOS", ID(acptr)); #ifdef DEBUGMODE ircd_log(LOG_ERROR, "[EOSDBG] server_sync: sending to uplink '%s' with src %s...", cptr->name, acptr->name); @@ -1093,7 +1075,7 @@ int server_sync(Client *cptr, ConfigItem_link *aconf) ircnetwork); /* Send EOS (End Of Sync) to the just linked server... */ - sendto_one(cptr, NULL, ":%s EOS", CHECKPROTO(cptr, PROTO_SID) ? me.id : me.name); + sendto_one(cptr, NULL, ":%s EOS", me.id); #ifdef DEBUGMODE ircd_log(LOG_ERROR, "[EOSDBG] server_sync: sending to justlinked '%s' with src ME...", cptr->name); @@ -1446,7 +1428,7 @@ void send_channel_modes_sjoin(Client *to, Channel *channel) - name = CHECKPROTO(to, PROTO_SID) ? ID(lp->client) : lp->client->name; + name = ID(lp->client); strcpy(bufptr, name); bufptr += strlen(bufptr); @@ -1538,19 +1520,19 @@ void send_channel_modes_sjoin3(Client *to, Channel *channel) if (nomode && nopara) { ircsnprintf(buf, sizeof(buf), - ":%s SJOIN %lld %s :", CHECKPROTO(to, PROTO_SID) ? me.id : me.name, + ":%s SJOIN %lld %s :", me.id, (long long)channel->creationtime, channel->chname); } if (nopara && !nomode) { ircsnprintf(buf, sizeof(buf), - ":%s SJOIN %lld %s %s :", CHECKPROTO(to, PROTO_SID) ? me.id : me.name, + ":%s SJOIN %lld %s %s :", me.id, (long long)channel->creationtime, channel->chname, modebuf); } if (!nopara && !nomode) { ircsnprintf(buf, sizeof(buf), - ":%s SJOIN %lld %s %s %s :", CHECKPROTO(to, PROTO_SID) ? me.id : me.name, + ":%s SJOIN %lld %s %s %s :", me.id, (long long)channel->creationtime, channel->chname, modebuf, parabuf); } @@ -1593,7 +1575,7 @@ void send_channel_modes_sjoin3(Client *to, Channel *channel) if (lp->flags & MODE_CHANADMIN) *p++ = '~'; - p = mystpcpy(p, CHECKPROTO(to, PROTO_SID) ? ID(lp->client) : lp->client->name); + p = mystpcpy(p, ID(lp->client)); *p++ = ' '; *p = '\0'; diff --git a/src/modules/sjoin.c b/src/modules/sjoin.c index 1e97f75b7..ada592b13 100644 --- a/src/modules/sjoin.c +++ b/src/modules/sjoin.c @@ -140,7 +140,6 @@ CMD_FUNC(cmd_sjoin) char nick[1024]; /**< nick or ban/invex/exempt being processed */ char scratch_buf[1024]; /**< scratch buffer */ char prefix[16]; /**< prefix of nick for server to server traffic (eg: @) */ - char nick_buf[BUFSIZE]; /**< Buffer for server-to-server traffic which will be broadcasted to others (using nick names) */ char uid_buf[BUFSIZE]; /**< Buffer for server-to-server traffic which will be broadcasted to others (servers supporting SID/UID) */ char uid_sjsby_buf[BUFSIZE]; /**< Buffer for server-to-server traffic which will be broadcasted to others (servers supporting SID/UID and SJSBY) */ char sj3_parabuf[BUFSIZE]; /**< Prefix for the above SJOIN buffers (":xxx SJOIN #channel +mode :") */ @@ -352,7 +351,6 @@ CMD_FUNC(cmd_sjoin) /* Now process adding of users & adding of list modes (bans/exempt/invex) */ - snprintf(nick_buf, sizeof nick_buf, ":%s SJOIN %lld %s :", client->name, (long long)ts, sj3_parabuf); snprintf(uid_buf, sizeof uid_buf, ":%s SJOIN %lld %s :", ID(client), (long long)ts, sj3_parabuf); snprintf(uid_sjsby_buf, sizeof uid_sjsby_buf, ":%s SJOIN %lld %s :", ID(client), (long long)ts, sj3_parabuf); @@ -533,26 +531,10 @@ getnick: CheckStatus('h', CHFL_HALFOP); CheckStatus('v', CHFL_VOICE); - if (strlen(nick_buf) + strlen(prefix) + strlen(acptr->name) > BUFSIZE - 10) - { - /* Send what we have and start a new buffer */ - sendto_server(client, PROTO_SJ3, PROTO_SID, recv_mtags, "%s", nick_buf); - snprintf(nick_buf, sizeof(nick_buf), ":%s SJOIN %lld %s :", client->name, (long long)ts, sj3_parabuf); - /* Double-check the new buffer is sufficient to concat the data */ - if (strlen(nick_buf) + strlen(prefix) + strlen(acptr->name) > BUFSIZE - 5) - { - ircd_log(LOG_ERROR, "Oversized SJOIN: '%s' + '%s%s'", - nick_buf, prefix, acptr->name); - sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->chname); - continue; - } - } - sprintf(nick_buf+strlen(nick_buf), "%s%s ", prefix, acptr->name); - if (strlen(uid_buf) + strlen(prefix) + IDLEN > BUFSIZE - 10) { /* Send what we have and start a new buffer */ - sendto_server(client, PROTO_SJ3 | PROTO_SID, PROTO_SJSBY, recv_mtags, "%s", uid_buf); + sendto_server(client, PROTO_SJ3, PROTO_SJSBY, recv_mtags, "%s", uid_buf); snprintf(uid_buf, sizeof(uid_buf), ":%s SJOIN %lld %s :", ID(client), (long long)ts, sj3_parabuf); /* Double-check the new buffer is sufficient to concat the data */ if (strlen(uid_buf) + strlen(prefix) + strlen(ID(acptr)) > BUFSIZE - 5) @@ -568,7 +550,7 @@ getnick: if (strlen(uid_sjsby_buf) + strlen(prefix) + IDLEN > BUFSIZE - 10) { /* Send what we have and start a new buffer */ - sendto_server(client, PROTO_SJ3 | PROTO_SID, PROTO_SJSBY, recv_mtags, "%s", uid_sjsby_buf); + sendto_server(client, PROTO_SJ3, PROTO_SJSBY, recv_mtags, "%s", uid_sjsby_buf); snprintf(uid_sjsby_buf, sizeof(uid_sjsby_buf), ":%s SJOIN %lld %s :", ID(client), (long long)ts, sj3_parabuf); /* Double-check the new buffer is sufficient to concat the data */ if (strlen(uid_sjsby_buf) + strlen(prefix) + strlen(ID(acptr)) > BUFSIZE - 5) @@ -624,26 +606,10 @@ getnick: } } - if (strlen(nick_buf) + strlen(prefix) + strlen(nick) > BUFSIZE - 10) - { - /* Send what we have and start a new buffer */ - sendto_server(client, PROTO_SJ3, PROTO_SID, recv_mtags, "%s", nick_buf); - snprintf(nick_buf, sizeof(nick_buf), ":%s SJOIN %lld %s :", client->name, (long long)ts, sj3_parabuf); - /* Double-check the new buffer is sufficient to concat the data */ - if (strlen(nick_buf) + strlen(prefix) + strlen(nick) > BUFSIZE - 5) - { - ircd_log(LOG_ERROR, "Oversized SJOIN: '%s' + '%s%s'", - nick_buf, prefix, nick); - sendto_realops("Oversized SJOIN for %s -- see ircd log", channel->chname); - continue; - } - } - sprintf(nick_buf+strlen(nick_buf), "%s%s ", prefix, nick); - if (strlen(uid_buf) + strlen(prefix) + strlen(nick) > BUFSIZE - 10) { /* Send what we have and start a new buffer */ - sendto_server(client, PROTO_SJ3 | PROTO_SID, PROTO_SJSBY, recv_mtags, "%s", uid_buf); + sendto_server(client, PROTO_SJ3, PROTO_SJSBY, recv_mtags, "%s", uid_buf); snprintf(uid_buf, sizeof(uid_buf), ":%s SJOIN %lld %s :", ID(client), (long long)ts, sj3_parabuf); /* Double-check the new buffer is sufficient to concat the data */ if (strlen(uid_buf) + strlen(prefix) + strlen(nick) > BUFSIZE - 5) @@ -665,7 +631,7 @@ getnick: if (strlen(uid_sjsby_buf) + strlen(scratch_buf) > BUFSIZE - 10) { /* Send what we have and start a new buffer */ - sendto_server(client, PROTO_SJ3 | PROTO_SID | PROTO_SJSBY, 0, recv_mtags, "%s", uid_sjsby_buf); + sendto_server(client, PROTO_SJ3 | PROTO_SJSBY, 0, recv_mtags, "%s", uid_sjsby_buf); snprintf(uid_sjsby_buf, sizeof(uid_sjsby_buf), ":%s SJOIN %lld %s :", ID(client), (long long)ts, sj3_parabuf); /* Double-check the new buffer is sufficient to concat the data */ if (strlen(uid_sjsby_buf) + strlen(scratch_buf) > BUFSIZE - 5) @@ -682,9 +648,8 @@ getnick: /* Send out any possible remainder.. */ Debug((DEBUG_DEBUG, "Sending '%li %s :%s' to sj3", ts, parabuf, parv[parc - 1])); - sendto_server(client, PROTO_SJ3, PROTO_SID, recv_mtags, "%s", nick_buf); - sendto_server(client, PROTO_SID | PROTO_SJ3, PROTO_SJSBY, recv_mtags, "%s", uid_buf); - sendto_server(client, PROTO_SID | PROTO_SJ3 | PROTO_SJSBY, 0, recv_mtags, "%s", uid_sjsby_buf); + sendto_server(client, PROTO_SJ3, PROTO_SJSBY, recv_mtags, "%s", uid_buf); + sendto_server(client, PROTO_SJ3 | PROTO_SJSBY, 0, recv_mtags, "%s", uid_sjsby_buf); if (modebuf[1]) { diff --git a/src/modules/topic.c b/src/modules/topic.c index 377390b28..ab2bd2f73 100644 --- a/src/modules/topic.c +++ b/src/modules/topic.c @@ -174,12 +174,9 @@ CMD_FUNC(cmd_topic) new_message(client, recv_mtags, &mtags); RunHook4(HOOKTYPE_TOPIC, client, channel, mtags, topic); - sendto_server(client, PROTO_SID, 0, mtags, ":%s TOPIC %s %s %lld :%s", + sendto_server(client, 0, 0, mtags, ":%s TOPIC %s %s %lld :%s", ID(client), channel->chname, channel->topic_nick, (long long)channel->topic_time, channel->topic); - sendto_server(client, 0, PROTO_SID, mtags, ":%s TOPIC %s %s %lld :%s", - client->name, channel->chname, channel->topic_nick, - (long long)channel->topic_time, channel->topic); sendto_channel(channel, client, NULL, 0, 0, SEND_LOCAL, mtags, ":%s TOPIC %s :%s", client->name, channel->chname, channel->topic); diff --git a/src/send.c b/src/send.c index e92cbe534..facd4e894 100644 --- a/src/send.c +++ b/src/send.c @@ -1081,30 +1081,13 @@ void sendto_one_nickcmd(Client *server, Client *client, char *umodes) vhost = "*"; } - if (CHECKPROTO(server, PROTO_SID) && *client->id) - { - sendto_one(server, NULL, - ":%s UID %s %d %lld %s %s %s %s %s %s %s %s :%s", - client->srvptr->id, client->name, client->hopcount, - (long long)client->lastnick, - client->user->username, client->user->realhost, client->id, - client->user->svid, umodes, vhost, getcloak(client), - encode_ip(client->ip), client->info); - return; - } - sendto_one(server, NULL, - "NICK %s %d %lld %s %s %s %s %s %s %s%s %s:%s", - client->name, client->hopcount+1, - (long long)client->lastnick, client->user->username, - client->user->realhost, client->srvptr->name, - client->user->svid, umodes, vhost, - CHECKPROTO(server, PROTO_CLK) ? getcloak(client) : "", - CHECKPROTO(server, PROTO_CLK) ? " " : "", - encode_ip(client->ip), - client->info); - - return; + ":%s UID %s %d %lld %s %s %s %s %s %s %s %s :%s", + client->srvptr->id, client->name, client->hopcount, + (long long)client->lastnick, + client->user->username, client->user->realhost, client->id, + client->user->svid, umodes, vhost, getcloak(client), + encode_ip(client->ip), client->info); } /* sidenote: sendnotice() and sendtxtnumeric() assume no client or server