#include "handlers.h" /* m_motd and m_lusers */
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
static time_t last_too_many2;
assert(cptr == sptr);
+ assert(cli_unreg(sptr) == 0);
if (!IsIAuthed(sptr)) {
if (iauth_active)
return iauth_start_client(iauth_active, sptr);
get_client_name(sptr, SHOW_IP));
}
++ServerStats->is_ref;
- IPcheck_connect_fail(&cli_ip(sptr));
+ IPcheck_connect_fail(sptr);
return exit_client(cptr, sptr, &me,
"Sorry, your connection class is full - try "
"again later or try another server");
/* Can this ever happen? */
case ACR_BAD_SOCKET:
++ServerStats->is_ref;
- IPcheck_connect_fail(&cli_ip(sptr));
+ IPcheck_connect_fail(sptr);
return exit_client(cptr, sptr, &me, "Unknown error -- Try again");
}
ircd_strncpy(user->host, cli_sockhost(sptr), HOSTLEN);
return exit_client(cptr, sptr, &me, "USER: Bogus userid.");
if (!EmptyString(aconf->passwd)
- && !(IsDigit(*aconf->passwd) && !aconf->passwd[1])
&& strcmp(cli_passwd(sptr), aconf->passwd))
{
ServerStats->is_ref++;
*/
send_reply(sptr, RPL_YOURHOST, cli_name(&me), version);
send_reply(sptr, RPL_CREATED, creation);
- send_reply(sptr, RPL_MYINFO, cli_name(&me), infousermodes, infochanmodes,
- infochanmodeswithparams, version);
+ send_reply(sptr, RPL_MYINFO, cli_name(&me), version, infousermodes,
+ infochanmodes, infochanmodeswithparams);
send_supported(sptr);
m_lusers(sptr, sptr, 1, parv);
update_load();
SetFlag(sptr, FLAG_TS8);
/*
- * Check to see if this user is being propogated
+ * Check to see if this user is being propagated
* as part of a net.burst, or is using protocol 9.
- * FIXME: This can be speeded up - its stupid to check it for
+ * FIXME: This can be sped up - its stupid to check it for
* every NICK message in a burst again --Run.
*/
for (acptr = user->server; acptr != &me; acptr = cli_serv(acptr)->up)
}
}
tmpstr = umode_str(sptr);
- sendcmdto_serv_butone(user->server, CMD_NICK, cptr,
- "%s %d %Tu %s %s %s%s%s%s %s%s :%s",
- nick, cli_hopcount(sptr) + 1, cli_lastnick(sptr),
- user->username, user->realhost,
- *tmpstr ? "+" : "", tmpstr, *tmpstr ? " " : "",
- iptobase64(ip_base64, &cli_ip(sptr), sizeof(ip_base64)),
- NumNick(sptr), cli_info(sptr));
+ /* Send full IP address to IPv6-grokking servers. */
+ sendcmdto_flag_serv_butone(user->server, CMD_NICK, cptr,
+ FLAG_IPV6, FLAG_LAST_FLAG,
+ "%s %d %Tu %s %s %s%s%s%s %s%s :%s",
+ nick, cli_hopcount(sptr) + 1, cli_lastnick(sptr),
+ user->username, user->realhost,
+ *tmpstr ? "+" : "", tmpstr, *tmpstr ? " " : "",
+ iptobase64(ip_base64, &cli_ip(sptr), sizeof(ip_base64), 1),
+ NumNick(sptr), cli_info(sptr));
+ /* Send fake IPv6 addresses to pre-IPv6 servers. */
+ sendcmdto_flag_serv_butone(user->server, CMD_NICK, cptr,
+ FLAG_LAST_FLAG, FLAG_IPV6,
+ "%s %d %Tu %s %s %s%s%s%s %s%s :%s",
+ nick, cli_hopcount(sptr) + 1, cli_lastnick(sptr),
+ user->username, user->realhost,
+ *tmpstr ? "+" : "", tmpstr, *tmpstr ? " " : "",
+ iptobase64(ip_base64, &cli_ip(sptr), sizeof(ip_base64), 0),
+ NumNick(sptr), cli_info(sptr));
/* Send server notice mask to client */
if (MyUser(sptr) && (cli_snomask(sptr) != SNO_DEFAULT) && HasFlag(sptr, FLAG_SERVNOTICE))
}
hAddClient(sptr);
+ cli_unreg(sptr) &= ~CLIREG_NICK; /* nickname now set */
+
/*
* If the client hasn't gotten a cookie-ping yet,
* choose a cookie and send it. -record!jegelhof@cloud9.net
} while (!cli_cookie(sptr));
sendrawto_one(cptr, MSG_PING " :%u", cli_cookie(sptr));
}
- else if (*(cli_user(sptr))->host && cli_cookie(sptr) == COOKIE_VERIFIED) {
+ else if (!cli_unreg(sptr)) {
/*
* USER and PONG already received, now we have NICK.
* register_user may reject the client and call exit_client
for (chan = (cli_user(cptr))->channel; chan;
chan = chan->next_channel)
ClearBanValid(chan);
+ break;
default:
return 0;
}
{
if (IsZombie(chan))
continue;
- /* For a user with no modes in a join-delayed channel, do not show
- * the rejoin. */
- if (!IsChanOp(chan) && !HasVoice(chan)
- && (chan->channel->mode.mode & MODE_DELJOINS))
- SetDelayedJoin(chan);
- else
+ /* Send a JOIN unless the user's join has been delayed. */
+ if (!IsDelayedJoin(chan))
sendcmdto_channel_butserv_butone(cptr, CMD_JOIN, chan->channel, cptr, 0,
"%H", chan->channel);
if (IsChanOp(chan) && HasVoice(chan))
/** Check whether \a sptr is allowed to send a message to \a acptr.
* If \a sptr is a remote user, it means some server has an outdated
* SILENCE list for \a acptr, so send the missing SILENCE mask(s) back
- * in the direction of \a sptr.
+ * in the direction of \a sptr. Skip the check if \a sptr is a server.
* @param[in] sptr Client trying to send a message.
* @param[in] acptr Destination of message.
* @return Non-zero if \a sptr is SILENCEd by \a acptr, zero if not.
size_t buf_used, slen;
char buf[BUFSIZE];
- if (!(user = cli_user(acptr))
+ if (IsServer(sptr) || !(user = cli_user(acptr))
|| !(found = find_ban(sptr, user->silence)))
return 0;
assert(!(found->flags & BAN_EXCEPTION));