mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-10 02:43:13 +02:00
split all the local client stuff to acptr->local. makes it a lot easier to catch bugs.
If the IRCd crashes then it's likely not by this change but rather an existing issue that was previously gone unnoticed.
This commit is contained in:
@@ -81,10 +81,10 @@ char *get_fingerprint_for_client(aClient *cptr)
|
||||
const EVP_MD *digest = EVP_sha256();
|
||||
X509 *x509_clientcert = NULL;
|
||||
|
||||
if (!MyConnect(cptr) || !cptr->ssl)
|
||||
if (!MyConnect(cptr) || !cptr->local->ssl)
|
||||
return NULL;
|
||||
|
||||
x509_clientcert = SSL_get_peer_certificate(cptr->ssl);
|
||||
x509_clientcert = SSL_get_peer_certificate(cptr->local->ssl);
|
||||
|
||||
if (x509_clientcert)
|
||||
{
|
||||
@@ -105,7 +105,7 @@ char *get_fingerprint_for_client(aClient *cptr)
|
||||
|
||||
int certfp_handshake(aClient *acptr)
|
||||
{
|
||||
if (acptr->ssl)
|
||||
if (acptr->local->ssl)
|
||||
{
|
||||
char *fp = get_fingerprint_for_client(acptr);
|
||||
|
||||
|
||||
+11
-11
@@ -240,16 +240,16 @@ static int cap_ack(aClient *sptr, const char *arg)
|
||||
capadd |= cap->cap;
|
||||
}
|
||||
|
||||
sptr->proto |= capadd;
|
||||
sptr->proto &= ~capdel;
|
||||
sptr->local->proto |= capadd;
|
||||
sptr->local->proto &= ~capdel;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cap_clear(aClient *sptr, const char *arg)
|
||||
{
|
||||
clicap_generate(sptr, "ACK", sptr->proto ? sptr->proto : -1, 1);
|
||||
clicap_generate(sptr, "ACK", sptr->local->proto ? sptr->local->proto : -1, 1);
|
||||
|
||||
sptr->proto = 0;
|
||||
sptr->local->proto = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -258,9 +258,9 @@ static int cap_end(aClient *sptr, const char *arg)
|
||||
if (IsRegisteredUser(sptr))
|
||||
return 0;
|
||||
|
||||
sptr->proto &= ~PROTO_CLICAP;
|
||||
sptr->local->proto &= ~PROTO_CLICAP;
|
||||
|
||||
if (sptr->name[0] && sptr->user != NULL && sptr->nospoof == 0)
|
||||
if (sptr->name[0] && sptr->user != NULL && sptr->local->nospoof == 0)
|
||||
return register_user(sptr, sptr, sptr->name, sptr->user->username, NULL, NULL, NULL);
|
||||
|
||||
return 0;
|
||||
@@ -268,14 +268,14 @@ static int cap_end(aClient *sptr, const char *arg)
|
||||
|
||||
static int cap_list(aClient *sptr, const char *arg)
|
||||
{
|
||||
clicap_generate(sptr, "LIST", sptr->proto ? sptr->proto : -1, 0);
|
||||
clicap_generate(sptr, "LIST", sptr->local->proto ? sptr->local->proto : -1, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cap_ls(aClient *sptr, const char *arg)
|
||||
{
|
||||
if (!IsRegisteredUser(sptr))
|
||||
sptr->proto |= PROTO_CLICAP;
|
||||
sptr->local->proto |= PROTO_CLICAP;
|
||||
|
||||
clicap_generate(sptr, "LS", 0, 0);
|
||||
return 0;
|
||||
@@ -292,7 +292,7 @@ static int cap_req(aClient *sptr, const char *arg)
|
||||
int finished = 0, negate;
|
||||
|
||||
if (!IsRegisteredUser(sptr))
|
||||
sptr->proto |= PROTO_CLICAP;
|
||||
sptr->local->proto |= PROTO_CLICAP;
|
||||
|
||||
if (BadPtr(arg))
|
||||
return 0;
|
||||
@@ -366,8 +366,8 @@ static int cap_req(aClient *sptr, const char *arg)
|
||||
else
|
||||
sendto_one(sptr, "%s :%s", buf, pbuf[0]);
|
||||
|
||||
sptr->proto |= capadd;
|
||||
sptr->proto &= ~capdel;
|
||||
sptr->local->proto |= capadd;
|
||||
sptr->local->proto &= ~capdel;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ DLLFUNC CMD_FUNC(m_list)
|
||||
|
||||
lopt->showall = 1;
|
||||
|
||||
if (DBufLength(&cptr->sendQ) < 2048)
|
||||
if (DBufLength(&cptr->local->sendQ) < 2048)
|
||||
send_list(cptr, 64);
|
||||
|
||||
return 0;
|
||||
@@ -285,7 +285,7 @@ DLLFUNC CMD_FUNC(m_list)
|
||||
lopt->nolist = nolist;
|
||||
lopt->yeslist = yeslist;
|
||||
|
||||
if (DBufLength(&cptr->sendQ) < 2048)
|
||||
if (DBufLength(&cptr->local->sendQ) < 2048)
|
||||
send_list(cptr, 64);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ int m_mkpasswd(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
/* Non-opers /mkpasswd usage: lag them up, and send a notice to eyes snomask.
|
||||
* This notice is always sent, even in case of bad usage/bad auth methods/etc.
|
||||
*/
|
||||
sptr->since += 7;
|
||||
sptr->local->since += 7;
|
||||
sendto_snomask(SNO_EYES, "*** /mkpasswd used by %s (%s@%s)",
|
||||
sptr->name, sptr->user->username, GetHost(sptr));
|
||||
}
|
||||
|
||||
@@ -1785,7 +1785,7 @@ DLLFUNC CMD_FUNC(_m_umode)
|
||||
sptr->umodes |= UMODE_HIDE;
|
||||
rejoin_joinandmode(sptr);
|
||||
if (MyClient(sptr))
|
||||
sptr->since += 7; /* Add fake lag */
|
||||
sptr->local->since += 7; /* Add fake lag */
|
||||
}
|
||||
if (MyClient(sptr))
|
||||
sendto_one(sptr, err_str(RPL_HOSTHIDDEN), me.name, sptr->name, sptr->user->virthost);
|
||||
@@ -1802,7 +1802,7 @@ DLLFUNC CMD_FUNC(_m_umode)
|
||||
sptr->umodes &= ~UMODE_HIDE;
|
||||
rejoin_joinandmode(sptr);
|
||||
if (MyClient(sptr))
|
||||
sptr->since += 7; /* Add fake lag */
|
||||
sptr->local->since += 7; /* Add fake lag */
|
||||
}
|
||||
/* (Re)create the cloaked virthost, because it will be used
|
||||
* for ban-checking... free+recreate here because it could have
|
||||
|
||||
@@ -128,13 +128,13 @@ DLLFUNC CMD_FUNC(m_netinfo)
|
||||
}
|
||||
sendto_realops
|
||||
("Link %s -> %s is now synced [secs: %li recv: %ld.%hu sent: %ld.%hu]",
|
||||
cptr->name, me.name, (TStime() - endsync), sptr->receiveK,
|
||||
sptr->receiveB, sptr->sendK, sptr->sendB);
|
||||
cptr->name, me.name, (TStime() - endsync), sptr->local->receiveK,
|
||||
sptr->local->receiveB, sptr->local->sendK, sptr->local->sendB);
|
||||
|
||||
sendto_server(&me, 0, 0,
|
||||
":%s SMO o :\2(sync)\2 Link %s -> %s is now synced [secs: %li recv: %ld.%hu sent: %ld.%hu]",
|
||||
me.name, cptr->name, me.name, (TStime() - endsync), sptr->receiveK,
|
||||
sptr->receiveB, sptr->sendK, sptr->sendB);
|
||||
me.name, cptr->name, me.name, (TStime() - endsync), sptr->local->receiveK,
|
||||
sptr->local->receiveB, sptr->local->sendK, sptr->local->sendB);
|
||||
|
||||
if (!(strcmp(ircnetwork, parv[8]) == 0))
|
||||
{
|
||||
|
||||
+22
-22
@@ -564,7 +564,7 @@ DLLFUNC CMD_FUNC(m_nick)
|
||||
}
|
||||
if (!ValidatePermissionsForPath("override:nick:qline",sptr,NULL,NULL,nick))
|
||||
{
|
||||
sptr->since += 4; /* lag them up */
|
||||
sptr->local->since += 4; /* lag them up */
|
||||
sendto_one(sptr, err_str(ERR_ERRONEUSNICKNAME),
|
||||
me.name, *sptr->name ? sptr->name : "*",
|
||||
nick, tklban->reason);
|
||||
@@ -603,7 +603,7 @@ DLLFUNC CMD_FUNC(m_nick)
|
||||
}
|
||||
|
||||
if (MyClient(cptr) && ValidatePermissionsForPath("override:nick:flood",sptr,NULL,NULL,NULL))
|
||||
cptr->since += 3; /* Nick-flood prot. -Donwulff */
|
||||
cptr->local->since += 3; /* Nick-flood prot. -Donwulff */
|
||||
|
||||
if (!(acptr = find_client(nick, NULL)))
|
||||
goto nickkilldone; /* No collisions, all clear... */
|
||||
@@ -960,9 +960,9 @@ DLLFUNC CMD_FUNC(m_nick)
|
||||
*
|
||||
* Generate a random string for them to pong with.
|
||||
*/
|
||||
sptr->nospoof = getrandom32();
|
||||
sptr->local->nospoof = getrandom32();
|
||||
|
||||
sendto_one(sptr, "PING :%X", sptr->nospoof);
|
||||
sendto_one(sptr, "PING :%X", sptr->local->nospoof);
|
||||
}
|
||||
|
||||
#ifdef CONTACT_EMAIL
|
||||
@@ -985,8 +985,8 @@ DLLFUNC CMD_FUNC(m_nick)
|
||||
*/
|
||||
if ((parc > 2) && (strlen(parv[2]) <= PASSWDLEN))
|
||||
{
|
||||
safefree(sptr->passwd);
|
||||
sptr->passwd = strdup(parv[2]);
|
||||
safefree(sptr->local->passwd);
|
||||
sptr->local->passwd = strdup(parv[2]);
|
||||
}
|
||||
/* This had to be copied here to avoid problems.. */
|
||||
strlcpy(sptr->name, nick, sizeof(sptr->name));
|
||||
@@ -1103,7 +1103,7 @@ int _register_user(aClient *cptr, aClient *sptr, char *nick, char *username, cha
|
||||
};
|
||||
aTKline *savetkl = NULL;
|
||||
ConfigItem_tld *tlds;
|
||||
cptr->last = TStime();
|
||||
cptr->local->last = TStime();
|
||||
nick = sptr->name; /* <- The data is always the same, but the pointer is sometimes not,
|
||||
* I need this for one of my modules, so do not remove! ;) -- Syzop */
|
||||
|
||||
@@ -1129,19 +1129,19 @@ int _register_user(aClient *cptr, aClient *sptr, char *nick, char *username, cha
|
||||
"You are not authorized to connect to this server");
|
||||
}
|
||||
|
||||
if (sptr->hostp)
|
||||
if (sptr->local->hostp)
|
||||
{
|
||||
/* reject ASCII < 32 and ASCII >= 127 (note: upper resolver might be even more strict). */
|
||||
for (tmpstr = sptr->sockhost; *tmpstr > ' ' && *tmpstr < 127; tmpstr++);
|
||||
for (tmpstr = sptr->local->sockhost; *tmpstr > ' ' && *tmpstr < 127; tmpstr++);
|
||||
|
||||
/* if host contained invalid ASCII _OR_ the DNS reply is an IP-like reply
|
||||
* (like: 1.2.3.4 or ::ffff:1.2.3.4), then reject it and use IP instead.
|
||||
*/
|
||||
if (*tmpstr || !*user->realhost || (isdigit(*sptr->sockhost) && (sptr->sockhost > tmpstr && isdigit(*(tmpstr - 1))) )
|
||||
|| (sptr->sockhost[0] == ':'))
|
||||
strlcpy(sptr->sockhost, Inet_ia2p(&sptr->ip), sizeof(sptr->sockhost));
|
||||
if (*tmpstr || !*user->realhost || (isdigit(*sptr->local->sockhost) && (sptr->local->sockhost > tmpstr && isdigit(*(tmpstr - 1))) )
|
||||
|| (sptr->local->sockhost[0] == ':'))
|
||||
strlcpy(sptr->local->sockhost, Inet_ia2p(&sptr->local->ip), sizeof(sptr->local->sockhost));
|
||||
}
|
||||
strlcpy(user->realhost, sptr->sockhost, sizeof(sptr->sockhost)); /* SET HOSTNAME */
|
||||
strlcpy(user->realhost, sptr->local->sockhost, sizeof(sptr->local->sockhost)); /* SET HOSTNAME */
|
||||
|
||||
/*
|
||||
* I do not consider *, ~ or ! 'hostile' in usernames,
|
||||
@@ -1334,12 +1334,12 @@ int _register_user(aClient *cptr, aClient *sptr, char *nick, char *username, cha
|
||||
|
||||
if (sptr->flags & FLAGS_SSL)
|
||||
{
|
||||
if (sptr->ssl)
|
||||
if (sptr->local->ssl)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** You are connected to %s with %s",
|
||||
me.name, sptr->name, me.name,
|
||||
ssl_get_cipher(sptr->ssl));
|
||||
ssl_get_cipher(sptr->local->ssl));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1391,7 +1391,7 @@ int _register_user(aClient *cptr, aClient *sptr, char *nick, char *username, cha
|
||||
acptr->name, acptr->from->name);
|
||||
sendto_one(cptr, ":%s KILL %s :%s (%s != %s[%s])",
|
||||
me.name, sptr->name, me.name, user->server,
|
||||
acptr->from->name, acptr->from->sockhost);
|
||||
acptr->from->name, acptr->from->local->sockhost);
|
||||
sptr->flags |= FLAGS_KILLED;
|
||||
return exit_client(sptr, sptr, &me,
|
||||
"USER server wrong direction");
|
||||
@@ -1446,11 +1446,11 @@ int _register_user(aClient *cptr, aClient *sptr, char *nick, char *username, cha
|
||||
|
||||
sendto_connectnotice(nick, user, sptr, 0, NULL); /* moved down, for modules. */
|
||||
|
||||
/* Send password from sptr->passwd to NickServ for identification,
|
||||
/* Send password from sptr->local->passwd to NickServ for identification,
|
||||
* if passwd given and if NickServ is online.
|
||||
* - by taz, modified by Wizzu
|
||||
*/
|
||||
if (sptr->passwd && (nsptr = find_person(NickServ, NULL)))
|
||||
if (sptr->local->passwd && (nsptr = find_person(NickServ, NULL)))
|
||||
{
|
||||
int do_identify = 1;
|
||||
Hook *h;
|
||||
@@ -1466,7 +1466,7 @@ int _register_user(aClient *cptr, aClient *sptr, char *nick, char *username, cha
|
||||
if (do_identify)
|
||||
sendto_one(nsptr, ":%s PRIVMSG %s@%s :IDENTIFY %s",
|
||||
sptr->name,
|
||||
NickServ, SERVICES_NAME, sptr->passwd);
|
||||
NickServ, SERVICES_NAME, sptr->local->passwd);
|
||||
}
|
||||
if (buf[0] != '\0' && buf[1] != '\0')
|
||||
sendto_one(cptr, ":%s MODE %s :%s", cptr->name,
|
||||
@@ -1507,10 +1507,10 @@ int _register_user(aClient *cptr, aClient *sptr, char *nick, char *username, cha
|
||||
/* NOTE: If you add something here.. be sure to check the 'if (savetkl)' note above */
|
||||
}
|
||||
|
||||
if (MyConnect(sptr) && !BadPtr(sptr->passwd))
|
||||
if (MyConnect(sptr) && !BadPtr(sptr->local->passwd))
|
||||
{
|
||||
MyFree(sptr->passwd);
|
||||
sptr->passwd = NULL;
|
||||
MyFree(sptr->local->passwd);
|
||||
sptr->local->passwd = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
+21
-21
@@ -138,10 +138,10 @@ DLLFUNC int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
sendto_one(sptr, err_str(ERR_NOOPERHOST), me.name, sptr->name);
|
||||
sendto_snomask_global
|
||||
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) [unknown oper]",
|
||||
sptr->name, sptr->user->username, sptr->sockhost);
|
||||
sptr->name, sptr->user->username, sptr->local->sockhost);
|
||||
ircd_log(LOG_OPER, "OPER UNKNOWNOPER (%s) by (%s!%s@%s)", name, sptr->name,
|
||||
sptr->user->username, sptr->sockhost);
|
||||
sptr->since += 7;
|
||||
sptr->user->username, sptr->local->sockhost);
|
||||
sptr->local->since += 7;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -150,10 +150,10 @@ DLLFUNC int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
sendto_one(sptr, err_str(ERR_NOOPERHOST), me.name, sptr->name);
|
||||
sendto_snomask_global
|
||||
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) using UID %s [host doesnt match]",
|
||||
sptr->name, sptr->user->username, sptr->sockhost, name);
|
||||
sptr->name, sptr->user->username, sptr->local->sockhost, name);
|
||||
ircd_log(LOG_OPER, "OPER NOHOSTMATCH (%s) by (%s!%s@%s)", name, sptr->name,
|
||||
sptr->user->username, sptr->sockhost);
|
||||
sptr->since += 7;
|
||||
sptr->user->username, sptr->local->sockhost);
|
||||
sptr->local->since += 7;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -165,11 +165,11 @@ DLLFUNC int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
sendnotice(sptr,
|
||||
"*** Your attempt has been logged.");
|
||||
ircd_log(LOG_OPER, "OPER FAILEDAUTH (%s) by (%s!%s@%s)", name, sptr->name,
|
||||
sptr->user->username, sptr->sockhost);
|
||||
sptr->user->username, sptr->local->sockhost);
|
||||
sendto_snomask_global
|
||||
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) using UID %s [FAILEDAUTH]",
|
||||
sptr->name, sptr->user->username, sptr->sockhost, name);
|
||||
sptr->since += 7;
|
||||
sptr->name, sptr->user->username, sptr->local->sockhost, name);
|
||||
sptr->local->since += 7;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -187,11 +187,11 @@ DLLFUNC int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
sendto_one(sptr, ":%s %d %s :You are missing user modes required to OPER", me.name, ERR_NOOPERHOST, sptr->name);
|
||||
sendto_snomask_global
|
||||
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) [lacking modes '%s' in oper::require-modes]",
|
||||
sptr->name, sptr->user->username, sptr->sockhost, get_modestr(aconf->require_modes & ~sptr->umodes));
|
||||
sptr->name, sptr->user->username, sptr->local->sockhost, get_modestr(aconf->require_modes & ~sptr->umodes));
|
||||
ircd_log(LOG_OPER, "OPER MISSINGMODES (%s) by (%s!%s@%s), needs modes=%s",
|
||||
name, sptr->name, sptr->user->username, sptr->sockhost,
|
||||
name, sptr->name, sptr->user->username, sptr->local->sockhost,
|
||||
get_modestr(aconf->require_modes & ~sptr->umodes));
|
||||
sptr->since += 7;
|
||||
sptr->local->since += 7;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -202,10 +202,10 @@ DLLFUNC int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
me.name, sptr->name, aconf->maxlogins);
|
||||
sendto_snomask_global
|
||||
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) using UID %s [maxlogins reached]",
|
||||
sptr->name, sptr->user->username, sptr->sockhost, name);
|
||||
sptr->name, sptr->user->username, sptr->local->sockhost, name);
|
||||
ircd_log(LOG_OPER, "OPER TOOMANYLOGINS (%s) by (%s!%s@%s)", name, sptr->name,
|
||||
sptr->user->username, sptr->sockhost);
|
||||
sptr->since += 4;
|
||||
sptr->user->username, sptr->local->sockhost);
|
||||
sptr->local->since += 4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -216,10 +216,10 @@ DLLFUNC int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
sptr->user->operlogin = strdup(aconf->name);
|
||||
|
||||
/* Put in the right class */
|
||||
if (sptr->class)
|
||||
sptr->class->clients--;
|
||||
sptr->class = aconf->class;
|
||||
sptr->class->clients++;
|
||||
if (sptr->local->class)
|
||||
sptr->local->class->clients--;
|
||||
sptr->local->class = aconf->class;
|
||||
sptr->local->class->clients++;
|
||||
|
||||
/* oper::swhois */
|
||||
if (aconf->swhois)
|
||||
@@ -249,11 +249,11 @@ DLLFUNC int m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
|
||||
sendto_snomask_global(SNO_OPER,
|
||||
"%s (%s@%s) [%s] is now an operator",
|
||||
sptr->name, sptr->user->username, sptr->sockhost,
|
||||
sptr->name, sptr->user->username, sptr->local->sockhost,
|
||||
parv[1]);
|
||||
|
||||
ircd_log(LOG_OPER, "OPER (%s) by (%s!%s@%s)", name, sptr->name, sptr->user->username,
|
||||
sptr->sockhost);
|
||||
sptr->local->sockhost);
|
||||
|
||||
/* set oper snomasks */
|
||||
if (aconf->snomask)
|
||||
|
||||
@@ -103,9 +103,9 @@ ConfigItem_ban *bconf;
|
||||
{
|
||||
if (IsUnknown(acptr) &&
|
||||
#ifndef INET6
|
||||
acptr->ip.S_ADDR == cptr->ip.S_ADDR)
|
||||
acptr->local->ip.S_ADDR == cptr->local->ip.S_ADDR)
|
||||
#else
|
||||
!bcmp(acptr->ip.S_ADDR, cptr->ip.S_ADDR, sizeof(cptr->ip.S_ADDR)))
|
||||
!bcmp(acptr->local->ip.S_ADDR, cptr->local->ip.S_ADDR, sizeof(cptr->local->ip.S_ADDR)))
|
||||
#endif
|
||||
{
|
||||
j++;
|
||||
@@ -114,7 +114,7 @@ ConfigItem_ban *bconf;
|
||||
}
|
||||
}
|
||||
|
||||
if ((bconf = Find_ban(cptr, Inet_ia2p(&cptr->ip), CONF_BAN_IP)))
|
||||
if ((bconf = Find_ban(cptr, Inet_ia2p(&cptr->local->ip), CONF_BAN_IP)))
|
||||
{
|
||||
ircsnprintf(zlinebuf, BUFSIZE,
|
||||
"You are not welcome on this server: %s. Email %s for more information.",
|
||||
@@ -129,14 +129,14 @@ ConfigItem_ban *bconf;
|
||||
else
|
||||
{
|
||||
int val;
|
||||
if (!(val = throttle_can_connect(cptr, &cptr->ip)))
|
||||
if (!(val = throttle_can_connect(cptr, &cptr->local->ip)))
|
||||
{
|
||||
ircsnprintf(zlinebuf, BUFSIZE, "Throttled: Reconnecting too fast - Email %s for more information.",
|
||||
KLINE_ADDRESS);
|
||||
return exit_client(cptr, cptr, &me, zlinebuf);
|
||||
}
|
||||
else if (val == 1)
|
||||
add_throttling_bucket(&cptr->ip);
|
||||
add_throttling_bucket(&cptr->local->ip);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -167,12 +167,12 @@ DLLFUNC CMD_FUNC(m_pass)
|
||||
}
|
||||
|
||||
PassLen = strlen(password);
|
||||
if (cptr->passwd)
|
||||
MyFree(cptr->passwd);
|
||||
if (cptr->local->passwd)
|
||||
MyFree(cptr->local->passwd);
|
||||
if (PassLen > (PASSWDLEN))
|
||||
PassLen = PASSWDLEN;
|
||||
cptr->passwd = MyMalloc(PassLen + 1);
|
||||
strlcpy(cptr->passwd, password, PassLen + 1);
|
||||
cptr->local->passwd = MyMalloc(PassLen + 1);
|
||||
strlcpy(cptr->local->passwd, password, PassLen + 1);
|
||||
|
||||
/* note: the original non-truncated password is supplied as 2nd parameter. */
|
||||
RunHookReturnInt2(HOOKTYPE_LOCAL_PASS, sptr, password, !=0);
|
||||
|
||||
@@ -144,15 +144,15 @@ DLLFUNC int m_nospoof(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
goto temp;
|
||||
result = strtoul(parv[1], NULL, 16);
|
||||
/* Accept code in second parameter (ircserv) */
|
||||
if (result != sptr->nospoof)
|
||||
if (result != sptr->local->nospoof)
|
||||
{
|
||||
if (BadPtr(parv[2]))
|
||||
goto temp;
|
||||
result = strtoul(parv[2], NULL, 16);
|
||||
if (result != sptr->nospoof)
|
||||
if (result != sptr->local->nospoof)
|
||||
goto temp;
|
||||
}
|
||||
sptr->nospoof = 0;
|
||||
sptr->local->nospoof = 0;
|
||||
if (USE_BAN_VERSION && MyConnect(sptr))
|
||||
sendto_one(sptr, ":IRC!IRC@%s PRIVMSG %s :\1VERSION\1",
|
||||
me.name, sptr->name);
|
||||
@@ -164,7 +164,7 @@ DLLFUNC int m_nospoof(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
temp:
|
||||
/* Homer compatibility */
|
||||
sendto_one(cptr, ":%X!nospoof@%s PRIVMSG %s :\1VERSION\1",
|
||||
cptr->nospoof, me.name, cptr->name);
|
||||
cptr->local->nospoof, me.name, cptr->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ CMD_FUNC(m_protoctl)
|
||||
else if (strcmp(s, "NICKIP") == 0)
|
||||
{
|
||||
Debug((DEBUG_ERROR, "Chose protocol %s for link %s", proto, cptr->name));
|
||||
cptr->proto |= PROTO_NICKIP;
|
||||
cptr->local->proto |= PROTO_NICKIP;
|
||||
}
|
||||
else if (strncmp(s, "NICKCHARS=", 10) == 0)
|
||||
{
|
||||
@@ -310,7 +310,7 @@ CMD_FUNC(m_protoctl)
|
||||
|
||||
strlcpy(cptr->id, sid, IDLEN);
|
||||
add_to_id_hash_table(cptr->id, cptr);
|
||||
cptr->proto |= PROTO_SID;
|
||||
cptr->local->proto |= PROTO_SID;
|
||||
}
|
||||
else if ((strncmp(s, "EAUTH=", 6) == 0) && NEW_LINKING_PROTOCOL)
|
||||
{
|
||||
@@ -442,12 +442,12 @@ CMD_FUNC(m_protoctl)
|
||||
#ifdef PROTOCTL_MADNESS
|
||||
if (remove)
|
||||
{
|
||||
cptr->proto &= ~PROTO_MLOCK;
|
||||
cptr->local->proto &= ~PROTO_MLOCK;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
Debug((DEBUG_ERROR, "Chose protocol %s for link %s", proto, cptr->name));
|
||||
cptr->proto |= PROTO_MLOCK;
|
||||
cptr->local->proto |= PROTO_MLOCK;
|
||||
}
|
||||
else if ((strncmp(s, "CHANMODES=", 10) == 0) && sptr->serv)
|
||||
{
|
||||
@@ -483,12 +483,12 @@ CMD_FUNC(m_protoctl)
|
||||
#ifdef PROTOCTL_MADNESS
|
||||
if (remove)
|
||||
{
|
||||
cptr->proto &= ~PROTO_EXTSWHOIS;
|
||||
cptr->local->proto &= ~PROTO_EXTSWHOIS;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
Debug((DEBUG_ERROR, "Chose protocol %s for link %s", proto, cptr->name));
|
||||
cptr->proto |= PROTO_EXTSWHOIS;
|
||||
cptr->local->proto |= PROTO_EXTSWHOIS;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -105,7 +105,7 @@ DLLFUNC int m_quit(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
ocomment = sptr->name;
|
||||
|
||||
if (!ValidatePermissionsForPath("immune:antispamtimer",sptr,NULL,NULL,NULL) && ANTI_SPAM_QUIT_MSG_TIME)
|
||||
if (sptr->firsttime+ANTI_SPAM_QUIT_MSG_TIME > TStime())
|
||||
if (sptr->local->firsttime+ANTI_SPAM_QUIT_MSG_TIME > TStime())
|
||||
ocomment = sptr->name;
|
||||
|
||||
for (tmphook = Hooks[HOOKTYPE_PRE_LOCAL_QUIT]; tmphook; tmphook = tmphook->next)
|
||||
|
||||
+16
-16
@@ -107,7 +107,7 @@ static aClient *decode_puid(char *puid)
|
||||
return NULL;
|
||||
|
||||
list_for_each_entry(cptr, &unknown_list, lclient_node)
|
||||
if (cptr->sasl_cookie == cookie)
|
||||
if (cptr->local->sasl_cookie == cookie)
|
||||
return cptr;
|
||||
|
||||
return NULL;
|
||||
@@ -123,10 +123,10 @@ static const char *encode_puid(aClient *client)
|
||||
static char buf[HOSTLEN + 20];
|
||||
|
||||
/* create a cookie if necessary (and in case getrandom16 returns 0, then run again) */
|
||||
while (!client->sasl_cookie)
|
||||
client->sasl_cookie = getrandom16();
|
||||
while (!client->local->sasl_cookie)
|
||||
client->local->sasl_cookie = getrandom16();
|
||||
|
||||
snprintf(buf, sizeof buf, "%s!0.%d", me.name, client->sasl_cookie);
|
||||
snprintf(buf, sizeof buf, "%s!0.%d", me.name, client->local->sasl_cookie);
|
||||
|
||||
return buf;
|
||||
}
|
||||
@@ -199,10 +199,10 @@ static int m_sasl(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
make_user(target_p);
|
||||
|
||||
/* reject if another SASL agent is answering */
|
||||
if (*target_p->sasl_agent && stricmp(sptr->name, target_p->sasl_agent))
|
||||
if (*target_p->local->sasl_agent && stricmp(sptr->name, target_p->local->sasl_agent))
|
||||
return 0;
|
||||
else
|
||||
strlcpy(target_p->sasl_agent, sptr->name, sizeof(target_p->sasl_agent));
|
||||
strlcpy(target_p->local->sasl_agent, sptr->name, sizeof(target_p->local->sasl_agent));
|
||||
|
||||
if (*parv[3] == 'C')
|
||||
sendto_one(target_p, "AUTHENTICATE %s", parv[4]);
|
||||
@@ -212,11 +212,11 @@ static int m_sasl(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
sendto_one(target_p, err_str(ERR_SASLFAIL), me.name, BadPtr(target_p->name) ? "*" : target_p->name);
|
||||
else if (*parv[4] == 'S')
|
||||
{
|
||||
target_p->sasl_complete++;
|
||||
target_p->local->sasl_complete++;
|
||||
sendto_one(target_p, err_str(RPL_SASLSUCCESS), me.name, BadPtr(target_p->name) ? "*" : target_p->name);
|
||||
}
|
||||
|
||||
*target_p->sasl_agent = '\0';
|
||||
*target_p->local->sasl_agent = '\0';
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -242,7 +242,7 @@ static int m_authenticate(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
if (!SASL_SERVER || !MyConnect(sptr) || BadPtr(parv[1]) || !CHECKPROTO(sptr, PROTO_SASL))
|
||||
return 0;
|
||||
|
||||
if (sptr->sasl_complete)
|
||||
if (sptr->local->sasl_complete)
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_SASLALREADY), me.name, BadPtr(sptr->name) ? "*" : sptr->name);
|
||||
return 0;
|
||||
@@ -254,8 +254,8 @@ static int m_authenticate(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (*sptr->sasl_agent)
|
||||
agent_p = find_client(sptr->sasl_agent, NULL);
|
||||
if (*sptr->local->sasl_agent)
|
||||
agent_p = find_client(sptr->local->sasl_agent, NULL);
|
||||
|
||||
if (agent_p == NULL)
|
||||
sendto_server(NULL, 0, 0, ":%s SASL %s %s S %s",
|
||||
@@ -264,22 +264,22 @@ static int m_authenticate(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
sendto_server(NULL, 0, 0, ":%s SASL %s %s C %s",
|
||||
me.name, AGENT_SID(agent_p), encode_puid(sptr), parv[1]);
|
||||
|
||||
sptr->sasl_out++;
|
||||
sptr->local->sasl_out++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int abort_sasl(struct Client *cptr)
|
||||
{
|
||||
if (cptr->sasl_out == 0 || cptr->sasl_complete)
|
||||
if (cptr->local->sasl_out == 0 || cptr->local->sasl_complete)
|
||||
return 0;
|
||||
|
||||
cptr->sasl_out = cptr->sasl_complete = 0;
|
||||
cptr->local->sasl_out = cptr->local->sasl_complete = 0;
|
||||
sendto_one(cptr, err_str(ERR_SASLABORTED), me.name, BadPtr(cptr->name) ? "*" : cptr->name);
|
||||
|
||||
if (*cptr->sasl_agent)
|
||||
if (*cptr->local->sasl_agent)
|
||||
{
|
||||
aClient *agent_p = find_client(cptr->sasl_agent, NULL);
|
||||
aClient *agent_p = find_client(cptr->local->sasl_agent, NULL);
|
||||
|
||||
if (agent_p != NULL)
|
||||
{
|
||||
|
||||
+16
-16
@@ -160,7 +160,7 @@ ConfigItem_ban *bconf;
|
||||
|
||||
strcpy(xerrmsg, "No matching link configuration");
|
||||
|
||||
if (!cptr->passwd)
|
||||
if (!cptr->local->passwd)
|
||||
{
|
||||
sendto_one(cptr, "ERROR :Missing password");
|
||||
return exit_client(cptr, sptr, &me, "Missing password");
|
||||
@@ -210,14 +210,14 @@ errlink:
|
||||
servername, GetIP(cptr), inpath);
|
||||
/* And send the "verbose" error msg only to locally connected ircops */
|
||||
sendto_umode(UMODE_OPER, "Link denied for %s(%s@%s) (%s) %s",
|
||||
servername, cptr->username, cptr->sockhost, xerrmsg, inpath);
|
||||
servername, cptr->username, cptr->local->sockhost, xerrmsg, inpath);
|
||||
return exit_client(cptr, sptr, &me,
|
||||
"Link denied (No link block found with your server name or link::incoming::mask did not match)");
|
||||
}
|
||||
|
||||
skip_host_check:
|
||||
/* Now for checking passwords */
|
||||
if (Auth_Check(cptr, link->auth, cptr->passwd) == -1)
|
||||
if (Auth_Check(cptr, link->auth, cptr->local->passwd) == -1)
|
||||
{
|
||||
sendto_one(cptr,
|
||||
"ERROR :Link '%s' denied (Authentication failed) %s",
|
||||
@@ -237,9 +237,9 @@ skip_host_check:
|
||||
/* Found. Bad. Quit. */
|
||||
acptr = acptr->from;
|
||||
ocptr =
|
||||
(cptr->firsttime > acptr->firsttime) ? acptr : cptr;
|
||||
(cptr->local->firsttime > acptr->local->firsttime) ? acptr : cptr;
|
||||
acptr =
|
||||
(cptr->firsttime > acptr->firsttime) ? cptr : acptr;
|
||||
(cptr->local->firsttime > acptr->local->firsttime) ? cptr : acptr;
|
||||
sendto_one(acptr,
|
||||
"ERROR :Server %s already exists from %s",
|
||||
servername,
|
||||
@@ -311,7 +311,7 @@ DLLFUNC CMD_FUNC(m_server)
|
||||
me.name, sptr->name);
|
||||
sendnotice(cptr,
|
||||
"*** Sorry, but your IRC program doesn't appear to support changing servers.");
|
||||
sptr->since += 7;
|
||||
sptr->local->since += 7;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ DLLFUNC CMD_FUNC(m_server)
|
||||
"Not enough parameters");
|
||||
}
|
||||
|
||||
if (IsUnknown(cptr) && (cptr->listener->options & LISTENER_CLIENTSONLY))
|
||||
if (IsUnknown(cptr) && (cptr->local->listener->options & LISTENER_CLIENTSONLY))
|
||||
{
|
||||
return exit_client(cptr, sptr, &me,
|
||||
"This port is for clients only");
|
||||
@@ -355,7 +355,7 @@ DLLFUNC CMD_FUNC(m_server)
|
||||
return exit_client(cptr, sptr, &me, "Bogus server name");
|
||||
}
|
||||
|
||||
if ((IsUnknown(cptr) || IsHandshake(cptr)) && !cptr->passwd)
|
||||
if ((IsUnknown(cptr) || IsHandshake(cptr)) && !cptr->local->passwd)
|
||||
{
|
||||
sendto_one(sptr, "ERROR :Missing password");
|
||||
return exit_client(cptr, sptr, &me, "Missing password");
|
||||
@@ -511,9 +511,9 @@ CMD_FUNC(m_server_remote)
|
||||
/* Found. Bad. Quit. */
|
||||
acptr = acptr->from;
|
||||
ocptr =
|
||||
(cptr->firsttime > acptr->firsttime) ? acptr : cptr;
|
||||
(cptr->local->firsttime > acptr->local->firsttime) ? acptr : cptr;
|
||||
acptr =
|
||||
(cptr->firsttime > acptr->firsttime) ? cptr : acptr;
|
||||
(cptr->local->firsttime > acptr->local->firsttime) ? cptr : acptr;
|
||||
sendto_one(acptr,
|
||||
"ERROR :Server %s already exists from %s",
|
||||
servername,
|
||||
@@ -634,10 +634,10 @@ int m_server_synch(aClient *cptr, ConfigItem_link *aconf)
|
||||
|
||||
ircd_log(LOG_SERVER, "SERVER %s", cptr->name);
|
||||
|
||||
if (cptr->passwd)
|
||||
if (cptr->local->passwd)
|
||||
{
|
||||
MyFree(cptr->passwd);
|
||||
cptr->passwd = NULL;
|
||||
MyFree(cptr->local->passwd);
|
||||
cptr->local->passwd = NULL;
|
||||
}
|
||||
if (incoming)
|
||||
{
|
||||
@@ -666,9 +666,9 @@ int m_server_synch(aClient *cptr, ConfigItem_link *aconf)
|
||||
{
|
||||
sendto_server(&me, 0, 0, ":%s SMO o :(\2link\2) Secure link %s -> %s established (%s)",
|
||||
me.name,
|
||||
me.name, inpath, (char *) ssl_get_cipher(cptr->ssl));
|
||||
me.name, inpath, (char *) ssl_get_cipher(cptr->local->ssl));
|
||||
sendto_realops("(\2link\2) Secure link %s -> %s established (%s)",
|
||||
me.name, inpath, (char *) ssl_get_cipher(cptr->ssl));
|
||||
me.name, inpath, (char *) ssl_get_cipher(cptr->local->ssl));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -701,7 +701,7 @@ int m_server_synch(aClient *cptr, ConfigItem_link *aconf)
|
||||
cptr->name, cptr->serv->conf->servername, cptr->serv->conf->refcount));
|
||||
}
|
||||
cptr->serv->conf->class->clients++;
|
||||
cptr->class = cptr->serv->conf->class;
|
||||
cptr->local->class = cptr->serv->conf->class;
|
||||
RunHook(HOOKTYPE_SERVER_CONNECT, cptr);
|
||||
|
||||
if (*cptr->id)
|
||||
|
||||
@@ -96,7 +96,7 @@ CMD_FUNC(m_squit)
|
||||
if (acptr && IsMe(acptr))
|
||||
{
|
||||
acptr = cptr;
|
||||
server = cptr->sockhost;
|
||||
server = cptr->local->sockhost;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -105,7 +105,7 @@ CMD_FUNC(m_squit)
|
||||
** This is actually protocol error. But, well, closing
|
||||
** the link is very proper answer to that...
|
||||
*/
|
||||
server = cptr->sockhost;
|
||||
server = cptr->local->sockhost;
|
||||
acptr = cptr;
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -102,22 +102,22 @@ DLLFUNC CMD_FUNC(m_starttls)
|
||||
return 0;
|
||||
}
|
||||
|
||||
dbuf_delete(&sptr->recvQ, DBufLength(&sptr->recvQ)); /* Clear up any remaining plaintext commands */
|
||||
dbuf_delete(&sptr->local->recvQ, DBufLength(&sptr->local->recvQ)); /* Clear up any remaining plaintext commands */
|
||||
sendto_one(sptr, rpl_str(RPL_STARTTLS), me.name, !BadPtr(sptr->name) ? sptr->name : "*");
|
||||
send_queued(sptr);
|
||||
|
||||
SetSSLStartTLSHandshake(sptr);
|
||||
Debug((DEBUG_DEBUG, "Starting SSL handshake (due to STARTTLS) for %s", sptr->sockhost));
|
||||
if ((sptr->ssl = SSL_new(ctx_server)) == NULL)
|
||||
Debug((DEBUG_DEBUG, "Starting SSL handshake (due to STARTTLS) for %s", sptr->local->sockhost));
|
||||
if ((sptr->local->ssl = SSL_new(ctx_server)) == NULL)
|
||||
goto fail;
|
||||
sptr->flags |= FLAGS_SSL;
|
||||
SSL_set_fd(sptr->ssl, sptr->fd);
|
||||
SSL_set_nonblocking(sptr->ssl);
|
||||
SSL_set_fd(sptr->local->ssl, sptr->fd);
|
||||
SSL_set_nonblocking(sptr->local->ssl);
|
||||
if (!ircd_SSL_accept(sptr, sptr->fd)) {
|
||||
Debug((DEBUG_DEBUG, "Failed SSL accept handshake in instance 1: %s", sptr->sockhost));
|
||||
SSL_set_shutdown(sptr->ssl, SSL_RECEIVED_SHUTDOWN);
|
||||
SSL_smart_shutdown(sptr->ssl);
|
||||
SSL_free(sptr->ssl);
|
||||
Debug((DEBUG_DEBUG, "Failed SSL accept handshake in instance 1: %s", sptr->local->sockhost));
|
||||
SSL_set_shutdown(sptr->local->ssl, SSL_RECEIVED_SHUTDOWN);
|
||||
SSL_smart_shutdown(sptr->local->ssl);
|
||||
SSL_free(sptr->local->ssl);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ DLLFUNC CMD_FUNC(m_starttls)
|
||||
fail:
|
||||
/* Failure */
|
||||
sendto_one(sptr, err_str(ERR_STARTTLS), me.name, !BadPtr(sptr->name) ? sptr->name : "*", "STARTTLS failed");
|
||||
sptr->ssl = NULL;
|
||||
sptr->local->ssl = NULL;
|
||||
sptr->flags &= ~FLAGS_SSL;
|
||||
SetUnknown(sptr);
|
||||
return 0;
|
||||
|
||||
+25
-25
@@ -684,11 +684,11 @@ int stats_traffic(aClient *sptr, char *para)
|
||||
{
|
||||
if (IsServer(acptr))
|
||||
{
|
||||
sp->is_sbs += acptr->sendB;
|
||||
sp->is_sbr += acptr->receiveB;
|
||||
sp->is_sks += acptr->sendK;
|
||||
sp->is_skr += acptr->receiveK;
|
||||
sp->is_sti += now - acptr->firsttime;
|
||||
sp->is_sbs += acptr->local->sendB;
|
||||
sp->is_sbr += acptr->local->receiveB;
|
||||
sp->is_sks += acptr->local->sendK;
|
||||
sp->is_skr += acptr->local->receiveK;
|
||||
sp->is_sti += now - acptr->local->firsttime;
|
||||
sp->is_sv++;
|
||||
if (sp->is_sbs > 1023)
|
||||
{
|
||||
@@ -703,11 +703,11 @@ int stats_traffic(aClient *sptr, char *para)
|
||||
}
|
||||
else if (IsClient(acptr))
|
||||
{
|
||||
sp->is_cbs += acptr->sendB;
|
||||
sp->is_cbr += acptr->receiveB;
|
||||
sp->is_cks += acptr->sendK;
|
||||
sp->is_ckr += acptr->receiveK;
|
||||
sp->is_cti += now - acptr->firsttime;
|
||||
sp->is_cbs += acptr->local->sendB;
|
||||
sp->is_cbr += acptr->local->receiveB;
|
||||
sp->is_cks += acptr->local->sendK;
|
||||
sp->is_ckr += acptr->local->receiveK;
|
||||
sp->is_cti += now - acptr->local->firsttime;
|
||||
sp->is_cl++;
|
||||
if (sp->is_cbs > 1023)
|
||||
{
|
||||
@@ -1338,7 +1338,7 @@ int stats_uptime(aClient *sptr, char *para)
|
||||
{
|
||||
time_t tmpnow;
|
||||
|
||||
tmpnow = TStime() - me.since;
|
||||
tmpnow = TStime() - me.local->since;
|
||||
sendto_one(sptr, rpl_str(RPL_STATSUPTIME), me.name, sptr->name,
|
||||
tmpnow / 86400, (tmpnow / 3600) % 24, (tmpnow / 60) % 60,
|
||||
tmpnow % 60);
|
||||
@@ -1456,8 +1456,8 @@ int stats_linkinfoint(aClient *sptr, char *para, int all)
|
||||
continue;
|
||||
|
||||
#ifdef DEBUGMODE
|
||||
ircsnprintf(pbuf, sizeof(pbuf), "%ld :%ld", (long)acptr->cputime,
|
||||
(long)(acptr->user && MyConnect(acptr)) ? TStime() - acptr->last : 0);
|
||||
ircsnprintf(pbuf, sizeof(pbuf), "%ld :%ld", (long)acptr->local->cputime,
|
||||
(long)(acptr->user && MyConnect(acptr)) ? TStime() - acptr->local->last : 0);
|
||||
#endif
|
||||
if (ValidatePermissionsForPath("server:info",sptr,NULL,NULL,NULL))
|
||||
{
|
||||
@@ -1467,14 +1467,14 @@ int stats_linkinfoint(aClient *sptr, char *para, int all)
|
||||
(get_client_name2(acptr, showports)) :
|
||||
(get_client_name(acptr, FALSE)),
|
||||
get_cptr_status(acptr),
|
||||
(int)DBufLength(&acptr->sendQ),
|
||||
(int)acptr->sendM, (int)acptr->sendK,
|
||||
(int)acptr->receiveM,
|
||||
(int)acptr->receiveK,
|
||||
TStime() - acptr->firsttime,
|
||||
(int)DBufLength(&acptr->local->sendQ),
|
||||
(int)acptr->local->sendM, (int)acptr->local->sendK,
|
||||
(int)acptr->local->receiveM,
|
||||
(int)acptr->local->receiveK,
|
||||
TStime() - acptr->local->firsttime,
|
||||
#ifndef DEBUGMODE
|
||||
(acptr->user && MyConnect(acptr)) ?
|
||||
TStime() - acptr->last : 0);
|
||||
TStime() - acptr->local->last : 0);
|
||||
#else
|
||||
pbuf);
|
||||
#endif
|
||||
@@ -1491,14 +1491,14 @@ int stats_linkinfoint(aClient *sptr, char *para, int all)
|
||||
get_client_name2(acptr, showports) :
|
||||
get_client_name(acptr, FALSE),
|
||||
get_cptr_status(acptr),
|
||||
(int)DBufLength(&acptr->sendQ),
|
||||
(int)acptr->sendM, (int)acptr->sendK,
|
||||
(int)acptr->receiveM,
|
||||
(int)acptr->receiveK,
|
||||
TStime() - acptr->firsttime,
|
||||
(int)DBufLength(&acptr->local->sendQ),
|
||||
(int)acptr->local->sendM, (int)acptr->local->sendK,
|
||||
(int)acptr->local->receiveM,
|
||||
(int)acptr->local->receiveK,
|
||||
TStime() - acptr->local->firsttime,
|
||||
#ifndef DEBUGMODE
|
||||
(acptr->user && MyConnect(acptr)) ?
|
||||
TStime() - acptr->last : 0);
|
||||
TStime() - acptr->local->last : 0);
|
||||
#else
|
||||
pbuf);
|
||||
#endif
|
||||
|
||||
@@ -297,7 +297,7 @@ int channel_svsmode(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
if (ts && ts != acptr->since) {
|
||||
if (ts && ts != acptr->local->since) {
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
@@ -318,7 +318,7 @@ int channel_svsmode(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
if (ts && ts != acptr->since) {
|
||||
if (ts && ts != acptr->local->since) {
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
@@ -338,7 +338,7 @@ int channel_svsmode(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
if (ts && ts != acptr->since) {
|
||||
if (ts && ts != acptr->local->since) {
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
|
||||
+14
-14
@@ -1071,7 +1071,7 @@ void _tkl_check_local_remove_shun(aTKline *tmp)
|
||||
list_for_each_entry(acptr, &lclient_list, lclient_node)
|
||||
if (MyClient(acptr) && IsShunned(acptr))
|
||||
{
|
||||
chost = acptr->sockhost;
|
||||
chost = acptr->local->sockhost;
|
||||
cname = acptr->user->username;
|
||||
|
||||
cip = GetIP(acptr);
|
||||
@@ -1231,7 +1231,7 @@ int _find_tkline_match(aClient *cptr, int xx)
|
||||
return -1;
|
||||
|
||||
nowtime = TStime();
|
||||
chost = cptr->sockhost;
|
||||
chost = cptr->local->sockhost;
|
||||
cname = cptr->user ? cptr->user->username : "unknown";
|
||||
cip = GetIP(cptr);
|
||||
|
||||
@@ -1246,7 +1246,7 @@ int _find_tkline_match(aClient *cptr, int xx)
|
||||
/* If it's tangy and brown, you're in CIDR town! */
|
||||
if (lp->ptr.netmask)
|
||||
{
|
||||
if (match_ip(cptr->ip, NULL, NULL, lp->ptr.netmask) &&
|
||||
if (match_ip(cptr->local->ip, NULL, NULL, lp->ptr.netmask) &&
|
||||
!match(lp->usermask, cname))
|
||||
{
|
||||
points = 1;
|
||||
@@ -1284,7 +1284,7 @@ int _find_tkline_match(aClient *cptr, int xx)
|
||||
|
||||
if (excepts->netmask)
|
||||
{
|
||||
if (match_ip(cptr->ip, host2, excepts->mask, excepts->netmask))
|
||||
if (match_ip(cptr->local->ip, host2, excepts->mask, excepts->netmask))
|
||||
return 1;
|
||||
} else
|
||||
if (!match(excepts->mask, host) || !match(excepts->mask, host2))
|
||||
@@ -1359,7 +1359,7 @@ int _find_shun(aClient *cptr)
|
||||
return 1;
|
||||
|
||||
nowtime = TStime();
|
||||
chost = cptr->sockhost;
|
||||
chost = cptr->local->sockhost;
|
||||
cname = cptr->user ? cptr->user->username : "unknown";
|
||||
cip = GetIP(cptr);
|
||||
|
||||
@@ -1373,7 +1373,7 @@ int _find_shun(aClient *cptr)
|
||||
/* CIDR */
|
||||
if (lp->ptr.netmask)
|
||||
{
|
||||
if (match_ip(cptr->ip, NULL, NULL, lp->ptr.netmask) &&
|
||||
if (match_ip(cptr->local->ip, NULL, NULL, lp->ptr.netmask) &&
|
||||
!match(lp->usermask, cname))
|
||||
{
|
||||
points = 1;
|
||||
@@ -1408,7 +1408,7 @@ int _find_shun(aClient *cptr)
|
||||
continue;
|
||||
if (excepts->netmask)
|
||||
{
|
||||
if (match_ip(cptr->ip, NULL, NULL, excepts->netmask))
|
||||
if (match_ip(cptr->local->ip, NULL, NULL, excepts->netmask))
|
||||
return 1;
|
||||
}
|
||||
else if (!match(excepts->mask, host) || !match(excepts->mask, host2))
|
||||
@@ -1548,7 +1548,7 @@ aTKline *_find_qline(aClient *cptr, char *nick, int *ishold)
|
||||
return lp;
|
||||
}
|
||||
|
||||
chost = cptr->user ? cptr->user->realhost : (MyConnect(cptr) ? cptr->sockhost : "unknown");
|
||||
chost = cptr->user ? cptr->user->realhost : (MyConnect(cptr) ? cptr->local->sockhost : "unknown");
|
||||
cname = cptr->user ? cptr->user->username : "unknown";
|
||||
strlcpy(host, make_user_host(cname, chost), sizeof(host));
|
||||
|
||||
@@ -1565,7 +1565,7 @@ aTKline *_find_qline(aClient *cptr, char *nick, int *ishold)
|
||||
continue;
|
||||
if (excepts->netmask)
|
||||
{
|
||||
if (MyConnect(cptr) && match_ip(cptr->ip, NULL, NULL, excepts->netmask))
|
||||
if (MyConnect(cptr) && match_ip(cptr->local->ip, NULL, NULL, excepts->netmask))
|
||||
return NULL;
|
||||
} else
|
||||
if (!match(excepts->mask, host) || (host2 && !match(excepts->mask, host2)))
|
||||
@@ -1597,7 +1597,7 @@ int _find_tkline_match_zap_ex(aClient *cptr, aTKline **rettk)
|
||||
{
|
||||
if (lp->type & TKL_ZAP)
|
||||
{
|
||||
if ((lp->ptr.netmask && match_ip(cptr->ip, NULL, NULL, lp->ptr.netmask))
|
||||
if ((lp->ptr.netmask && match_ip(cptr->local->ip, NULL, NULL, lp->ptr.netmask))
|
||||
|| !match(lp->hostmask, cip))
|
||||
{
|
||||
|
||||
@@ -1612,7 +1612,7 @@ int _find_tkline_match_zap_ex(aClient *cptr, aTKline **rettk)
|
||||
continue;
|
||||
if (excepts->netmask)
|
||||
{
|
||||
if (match_ip(cptr->ip, NULL, NULL, excepts->netmask))
|
||||
if (match_ip(cptr->local->ip, NULL, NULL, excepts->netmask))
|
||||
return -1;
|
||||
} else if (!match(excepts->mask, cip))
|
||||
return -1;
|
||||
@@ -1625,9 +1625,9 @@ int _find_tkline_match_zap_ex(aClient *cptr, aTKline **rettk)
|
||||
ircsnprintf(msge, sizeof(msge),
|
||||
"ERROR :Closing Link: [%s] Z:Lined (%s)\r\n",
|
||||
#ifndef INET6
|
||||
inetntoa((char *)&cptr->ip), lp->reason);
|
||||
inetntoa((char *)&cptr->local->ip), lp->reason);
|
||||
#else
|
||||
inet_ntop(AF_INET6, (char *)&cptr->ip,
|
||||
inet_ntop(AF_INET6, (char *)&cptr->local->ip,
|
||||
mydummy, MYDUMMY_SIZE), lp->reason);
|
||||
#endif
|
||||
strlcpy(zlinebuf, msge, sizeof zlinebuf);
|
||||
@@ -1853,7 +1853,7 @@ void _tkl_synch(aClient *sptr)
|
||||
typ = 'F';
|
||||
if (tk->type & TKL_NICK)
|
||||
typ = 'Q';
|
||||
if ((tk->type & TKL_SPAMF) && (sptr->proto & PROTO_TKLEXT))
|
||||
if ((tk->type & TKL_SPAMF) && (sptr->local->proto & PROTO_TKLEXT))
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s TKL + %c %s %s %s %li %li %li %s :%s", me.name,
|
||||
|
||||
@@ -170,7 +170,7 @@ DLLFUNC CMD_FUNC(m_trace)
|
||||
if (!dow && mycmp(tname, acptr->name))
|
||||
continue;
|
||||
name = get_client_name(acptr, FALSE);
|
||||
class = acptr->class ? acptr->class->name : "default";
|
||||
class = acptr->local->class ? acptr->local->class->name : "default";
|
||||
switch (acptr->status)
|
||||
{
|
||||
case STAT_CONNECTING:
|
||||
@@ -203,13 +203,13 @@ DLLFUNC CMD_FUNC(m_trace)
|
||||
me.name,
|
||||
sptr->name, class, acptr->name,
|
||||
GetHost(acptr),
|
||||
now - acptr->lasttime);
|
||||
now - acptr->local->lasttime);
|
||||
else
|
||||
sendto_one(sptr,
|
||||
rpl_str(RPL_TRACEUSER), me.name,
|
||||
sptr->name, class, acptr->name,
|
||||
acptr->user->realhost,
|
||||
now - acptr->lasttime);
|
||||
now - acptr->local->lasttime);
|
||||
cnt++;
|
||||
}
|
||||
break;
|
||||
@@ -220,18 +220,18 @@ DLLFUNC CMD_FUNC(m_trace)
|
||||
acptr->fd >= 0 ? link_u[acptr->fd] : -1, name, acptr->serv->by,
|
||||
acptr->serv->user->username,
|
||||
acptr->serv->user->realhost,
|
||||
now - acptr->lasttime);
|
||||
now - acptr->local->lasttime);
|
||||
else
|
||||
sendto_one(sptr, rpl_str(RPL_TRACESERVER),
|
||||
me.name, sptr->name, class, acptr->fd >= 0 ? link_s[acptr->fd] : -1,
|
||||
acptr->fd >= 0 ? link_u[acptr->fd] : -1, name, *(acptr->serv->by) ?
|
||||
acptr->serv->by : "*", "*", me.name,
|
||||
now - acptr->lasttime);
|
||||
now - acptr->local->lasttime);
|
||||
cnt++;
|
||||
break;
|
||||
case STAT_LOG:
|
||||
sendto_one(sptr, rpl_str(RPL_TRACELOG), me.name,
|
||||
sptr->name, LOGFILE, acptr->port);
|
||||
sptr->name, LOGFILE, acptr->local->port);
|
||||
cnt++;
|
||||
break;
|
||||
#ifdef USE_SSL
|
||||
|
||||
@@ -93,7 +93,7 @@ DLLFUNC CMD_FUNC(m_user)
|
||||
if (IsServer(cptr) && !IsUnknown(sptr))
|
||||
return 0;
|
||||
|
||||
if (MyConnect(sptr) && (sptr->listener->options & LISTENER_SERVERSONLY))
|
||||
if (MyConnect(sptr) && (sptr->local->listener->options & LISTENER_SERVERSONLY))
|
||||
{
|
||||
return exit_client(cptr, sptr, sptr,
|
||||
"This port is for servers only");
|
||||
@@ -188,9 +188,9 @@ DLLFUNC CMD_FUNC(m_user)
|
||||
* this was copying user supplied data directly into user->realhost
|
||||
* which seemed bad. Not to say this is much better ;p. -- Syzop
|
||||
*/
|
||||
strlcpy(user->realhost, Inet_ia2p(&sptr->ip), sizeof(user->realhost));
|
||||
strlcpy(user->realhost, Inet_ia2p(&sptr->local->ip), sizeof(user->realhost));
|
||||
if (!user->ip_str)
|
||||
user->ip_str = strdup(Inet_ia2p(&sptr->ip));
|
||||
user->ip_str = strdup(Inet_ia2p(&sptr->local->ip));
|
||||
user->server = me_hash;
|
||||
user_finish:
|
||||
if (sstamp != NULL && *sstamp != '*')
|
||||
|
||||
@@ -131,7 +131,7 @@ DLLFUNC CMD_FUNC(m_userip)
|
||||
(acptr->user->away) ? '-' : '+',
|
||||
acptr->user->username, ip);
|
||||
/* add extra fakelag (penalty) because of all the work we need to do: 1s per entry: */
|
||||
sptr->since += 1;
|
||||
sptr->local->since += 1;
|
||||
}
|
||||
if (p)
|
||||
p++;
|
||||
|
||||
@@ -146,7 +146,7 @@ DLLFUNC CMD_FUNC(m_watch)
|
||||
continue;
|
||||
if (do_nick_name(s + 1))
|
||||
{
|
||||
if (sptr->watches >= MAXWATCH)
|
||||
if (sptr->local->watches >= MAXWATCH)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
err_str(ERR_TOOMANYWATCH), me.name,
|
||||
@@ -210,13 +210,13 @@ DLLFUNC CMD_FUNC(m_watch)
|
||||
(lp = lp->next); count++)
|
||||
;
|
||||
sendto_one(sptr, rpl_str(RPL_WATCHSTAT), me.name,
|
||||
sptr->name, sptr->watches, count);
|
||||
sptr->name, sptr->local->watches, count);
|
||||
|
||||
/*
|
||||
* Send a list of everybody in their WATCH list. Be careful
|
||||
* not to buffer overflow.
|
||||
*/
|
||||
if ((lp = sptr->watch) == NULL)
|
||||
if ((lp = sptr->local->watch) == NULL)
|
||||
{
|
||||
sendto_one(sptr, rpl_str(RPL_ENDOFWATCHLIST),
|
||||
me.name, sptr->name, *s);
|
||||
@@ -258,7 +258,7 @@ DLLFUNC CMD_FUNC(m_watch)
|
||||
*/
|
||||
if ((*s == 'L' || *s == 'l') && !did_l)
|
||||
{
|
||||
Link *lp = sptr->watch;
|
||||
Link *lp = sptr->local->watch;
|
||||
|
||||
did_l = 1;
|
||||
|
||||
|
||||
+1
-1
@@ -505,7 +505,7 @@ char has_common_chan = 0;
|
||||
if (!MyClient(acptr))
|
||||
return WHO_CANTSEE;
|
||||
|
||||
port = acptr->listener->port;
|
||||
port = acptr->local->listener->port;
|
||||
|
||||
if (((wfl.want_port == WHO_WANT) && wfl.port != port) ||
|
||||
((wfl.want_port == WHO_DONTWANT) && wfl.port == port))
|
||||
|
||||
@@ -367,7 +367,7 @@ DLLFUNC int m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
{
|
||||
sendto_one(sptr, rpl_str(RPL_WHOISIDLE),
|
||||
me.name, sptr->name, name,
|
||||
TStime() - acptr->last, acptr->firsttime);
|
||||
TStime() - acptr->local->last, acptr->local->firsttime);
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
|
||||
@@ -95,12 +95,12 @@ void ssl_info_callback(const SSL *ssl, int where, int ret)
|
||||
*/
|
||||
int ssl_antidos_handshake(aClient *acptr)
|
||||
{
|
||||
if (acptr->ssl)
|
||||
if (acptr->local->ssl)
|
||||
{
|
||||
SAD *sad = MyMallocEx(sizeof(SAD));
|
||||
sad->acptr = acptr;
|
||||
SSL_set_info_callback(acptr->ssl, ssl_info_callback);
|
||||
SSL_set_ex_data(acptr->ssl, ssl_antidos_index, sad);
|
||||
SSL_set_info_callback(acptr->local->ssl, ssl_info_callback);
|
||||
SSL_set_ex_data(acptr->local->ssl, ssl_antidos_index, sad);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
+10
-10
@@ -317,9 +317,9 @@ int dowebirc(aClient *cptr, char *ip, char *host)
|
||||
if (host && !strcmp(ip, host))
|
||||
host = NULL; /* host did not resolve, make it NULL */
|
||||
|
||||
/* STEP 1: Update cptr->ip
|
||||
/* STEP 1: Update cptr->local->ip
|
||||
inet_pton() returns 1 on success, 0 on bad input, -1 on bad AF */
|
||||
if(inet_pton(AFINET, ip, &cptr->ip) != 1)
|
||||
if(inet_pton(AFINET, ip, &cptr->local->ip) != 1)
|
||||
{
|
||||
#ifndef INET6
|
||||
/* then we have an invalid IP */
|
||||
@@ -327,7 +327,7 @@ int dowebirc(aClient *cptr, char *ip, char *host)
|
||||
#else
|
||||
/* The address may be IPv4. We have to try ::ffff:ipv4 */
|
||||
snprintf(ipbuf, sizeof(ipbuf), "::ffff:%s", ip);
|
||||
if(inet_pton(AFINET, ipbuf, &cptr->ip) != 1)
|
||||
if(inet_pton(AFINET, ipbuf, &cptr->local->ip) != 1)
|
||||
return exit_client(cptr, cptr, &me, "Invalid IP address");
|
||||
#endif
|
||||
}
|
||||
@@ -341,27 +341,27 @@ int dowebirc(aClient *cptr, char *ip, char *host)
|
||||
cptr->user->ip_str = strdup(ip);
|
||||
}
|
||||
|
||||
/* STEP 3: Update cptr->hostp */
|
||||
/* STEP 3: Update cptr->local->hostp */
|
||||
/* (free old) */
|
||||
if (cptr->hostp)
|
||||
if (cptr->local->hostp)
|
||||
{
|
||||
unreal_free_hostent(cptr->hostp);
|
||||
cptr->hostp = NULL;
|
||||
unreal_free_hostent(cptr->local->hostp);
|
||||
cptr->local->hostp = NULL;
|
||||
}
|
||||
/* (create new) */
|
||||
if (host && verify_hostname(host))
|
||||
cptr->hostp = unreal_create_hostent(host, &cptr->ip);
|
||||
cptr->local->hostp = unreal_create_hostent(host, &cptr->local->ip);
|
||||
|
||||
/* STEP 4: Update sockhost
|
||||
Make sure that if this any IPv4 address is _not_ prefixed with
|
||||
"::ffff:" by using Inet_ia2p().
|
||||
*/
|
||||
sockhost = Inet_ia2p(&cptr->ip);
|
||||
sockhost = Inet_ia2p(&cptr->local->ip);
|
||||
if(!sockhost)
|
||||
{
|
||||
return exit_client(cptr, cptr, &me, "Error processing CGI:IRC IP address.");
|
||||
}
|
||||
strlcpy(cptr->sockhost, sockhost, sizeof(cptr->sockhost));
|
||||
strlcpy(cptr->local->sockhost, sockhost, sizeof(cptr->local->sockhost));
|
||||
|
||||
SetWEBIRC(cptr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user