mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-06-26 13:56:37 +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:
+2
-2
@@ -44,9 +44,9 @@ extern MODVAR int bootopt;
|
||||
extern MODVAR time_t TSoffset;
|
||||
extern MODVAR time_t timeofday;
|
||||
/* newconf */
|
||||
#define get_sendq(x) ((x)->class ? (x)->class->sendq : MAXSENDQLENGTH)
|
||||
#define get_sendq(x) ((x)->local->class ? (x)->local->class->sendq : MAXSENDQLENGTH)
|
||||
/* get_recvq is only called in send.c for local connections */
|
||||
#define get_recvq(x) ((x)->class->recvq ? (x)->class->recvq : CLIENT_FLOOD)
|
||||
#define get_recvq(x) ((x)->local->class->recvq ? (x)->local->class->recvq : CLIENT_FLOOD)
|
||||
|
||||
#define CMD_FUNC(x) int (x) (aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
|
||||
|
||||
+26
-30
@@ -400,10 +400,10 @@ typedef OperPermission (*OperClassEntryEvalCallback)(OperClassACLEntryVar* varia
|
||||
#define IsSetHost(x) ((x)->umodes & UMODE_SETHOST)
|
||||
#define IsHideOper(x) ((x)->umodes & UMODE_HIDEOPER)
|
||||
#define IsSSL(x) IsSecure(x)
|
||||
#define IsNotSpoof(x) ((x)->nospoof == 0)
|
||||
#define IsNotSpoof(x) ((x)->local->nospoof == 0)
|
||||
|
||||
#define GetHost(x) (IsHidden(x) ? (x)->user->virthost : (x)->user->realhost)
|
||||
#define GetIP(x) ((x->user && x->user->ip_str) ? x->user->ip_str : (MyConnect(x) ? Inet_ia2p(&x->ip) : "255.255.255.255"))
|
||||
#define GetIP(x) ((x->user && x->user->ip_str) ? x->user->ip_str : (MyConnect(x) ? Inet_ia2p(&x->local->ip) : "255.255.255.255"))
|
||||
|
||||
#define SetKillsF(x) ((x)->user->snomask |= SNO_KILLS)
|
||||
#define SetClientF(x) ((x)->user->snomask |= SNO_CLIENT)
|
||||
@@ -441,7 +441,7 @@ typedef OperPermission (*OperClassEntryEvalCallback)(OperClassACLEntryVar* varia
|
||||
* ProtoCtl options
|
||||
*/
|
||||
#ifndef DEBUGMODE
|
||||
#define CHECKPROTO(x,y) ((x)->proto & y)
|
||||
#define CHECKPROTO(x,y) ((x)->local->proto & y)
|
||||
#else
|
||||
#define CHECKPROTO(x,y) (checkprotoflags(x, y, __FILE__, __LINE__))
|
||||
#endif
|
||||
@@ -462,30 +462,30 @@ typedef OperPermission (*OperClassEntryEvalCallback)(OperClassACLEntryVar* varia
|
||||
#define SupportUHNAMES(x) (CHECKPROTO(x, PROTO_UHNAMES))
|
||||
#define SupportSID(x) (CHECKPROTO(x, PROTO_SID))
|
||||
|
||||
#define SetSJOIN(x) ((x)->proto |= PROTO_SJOIN)
|
||||
#define SetNoQuit(x) ((x)->proto |= PROTO_NOQUIT)
|
||||
#define SetNICKv2(x) ((x)->proto |= PROTO_NICKv2)
|
||||
#define SetSJOIN2(x) ((x)->proto |= PROTO_SJOIN2)
|
||||
#define SetUMODE2(x) ((x)->proto |= PROTO_UMODE2)
|
||||
#define SetVL(x) ((x)->proto |= PROTO_VL)
|
||||
#define SetSJ3(x) ((x)->proto |= PROTO_SJ3)
|
||||
#define SetVHP(x) ((x)->proto |= PROTO_VHP)
|
||||
#define SetTKLEXT(x) ((x)->proto |= PROTO_TKLEXT)
|
||||
#define SetTKLEXT2(x) ((x)->proto |= PROTO_TKLEXT2)
|
||||
#define SetNAMESX(x) ((x)->proto |= PROTO_NAMESX)
|
||||
#define SetCLK(x) ((x)->proto |= PROTO_CLK)
|
||||
#define SetUHNAMES(x) ((x)->proto |= PROTO_UHNAMES)
|
||||
#define SetSJOIN(x) ((x)->local->proto |= PROTO_SJOIN)
|
||||
#define SetNoQuit(x) ((x)->local->proto |= PROTO_NOQUIT)
|
||||
#define SetNICKv2(x) ((x)->local->proto |= PROTO_NICKv2)
|
||||
#define SetSJOIN2(x) ((x)->local->proto |= PROTO_SJOIN2)
|
||||
#define SetUMODE2(x) ((x)->local->proto |= PROTO_UMODE2)
|
||||
#define SetVL(x) ((x)->local->proto |= PROTO_VL)
|
||||
#define SetSJ3(x) ((x)->local->proto |= PROTO_SJ3)
|
||||
#define SetVHP(x) ((x)->local->proto |= PROTO_VHP)
|
||||
#define SetTKLEXT(x) ((x)->local->proto |= PROTO_TKLEXT)
|
||||
#define SetTKLEXT2(x) ((x)->local->proto |= PROTO_TKLEXT2)
|
||||
#define SetNAMESX(x) ((x)->local->proto |= PROTO_NAMESX)
|
||||
#define SetCLK(x) ((x)->local->proto |= PROTO_CLK)
|
||||
#define SetUHNAMES(x) ((x)->local->proto |= PROTO_UHNAMES)
|
||||
|
||||
#define ClearSJOIN(x) ((x)->proto &= ~PROTO_SJOIN)
|
||||
#define ClearNoQuit(x) ((x)->proto &= ~PROTO_NOQUIT)
|
||||
#define ClearNICKv2(x) ((x)->proto &= ~PROTO_NICKv2)
|
||||
#define ClearSJOIN2(x) ((x)->proto &= ~PROTO_SJOIN2)
|
||||
#define ClearUMODE2(x) ((x)->proto &= ~PROTO_UMODE2)
|
||||
#define ClearVL(x) ((x)->proto &= ~PROTO_VL)
|
||||
#define ClearVHP(x) ((x)->proto &= ~PROTO_VHP)
|
||||
#define ClearSJ3(x) ((x)->proto &= ~PROTO_SJ3)
|
||||
#define ClearTKLEXT(x) ((x)->proto &= ~PROTO_TKLEXT)
|
||||
#define ClearTKLEXT2(x) ((x)->proto &= ~PROTO_TKLEXT2)
|
||||
#define ClearSJOIN(x) ((x)->local->proto &= ~PROTO_SJOIN)
|
||||
#define ClearNoQuit(x) ((x)->local->proto &= ~PROTO_NOQUIT)
|
||||
#define ClearNICKv2(x) ((x)->local->proto &= ~PROTO_NICKv2)
|
||||
#define ClearSJOIN2(x) ((x)->local->proto &= ~PROTO_SJOIN2)
|
||||
#define ClearUMODE2(x) ((x)->local->proto &= ~PROTO_UMODE2)
|
||||
#define ClearVL(x) ((x)->local->proto &= ~PROTO_VL)
|
||||
#define ClearVHP(x) ((x)->local->proto &= ~PROTO_VHP)
|
||||
#define ClearSJ3(x) ((x)->local->proto &= ~PROTO_SJ3)
|
||||
#define ClearTKLEXT(x) ((x)->local->proto &= ~PROTO_TKLEXT)
|
||||
#define ClearTKLEXT2(x) ((x)->local->proto &= ~PROTO_TKLEXT2)
|
||||
|
||||
/*
|
||||
* defined debugging levels
|
||||
@@ -888,10 +888,6 @@ struct LocalClient {
|
||||
long sendK; /* Statistics: total k-bytes send */
|
||||
long receiveM; /* Statistics: protocol messages received */
|
||||
SSL *ssl;
|
||||
#ifndef NO_FDLIST
|
||||
long lastrecvM; /* to check for activity --Mika */
|
||||
int priority;
|
||||
#endif
|
||||
long receiveK; /* Statistics: total k-bytes received */
|
||||
u_short sendB; /* counters to count upto 1-k lots of bytes */
|
||||
u_short receiveB; /* sent and received. */
|
||||
|
||||
+3
-3
@@ -527,9 +527,9 @@ int Auth_Check(aClient *cptr, anAuthStruct *as, char *para)
|
||||
X509 *x509_filecert = NULL;
|
||||
FILE *x509_f = NULL;
|
||||
|
||||
if (!cptr->ssl)
|
||||
if (!cptr->local->ssl)
|
||||
return -1;
|
||||
x509_clientcert = SSL_get_peer_certificate(cptr->ssl);
|
||||
x509_clientcert = SSL_get_peer_certificate(cptr->local->ssl);
|
||||
if (!x509_clientcert)
|
||||
return -1;
|
||||
if (!(x509_f = fopen(as->data, "r")))
|
||||
@@ -561,7 +561,7 @@ int Auth_Check(aClient *cptr, anAuthStruct *as, char *para)
|
||||
char hexcolon[EVP_MAX_MD_SIZE * 3 + 1];
|
||||
char *fp;
|
||||
|
||||
if (!cptr->ssl)
|
||||
if (!cptr->local->ssl)
|
||||
return -1;
|
||||
|
||||
fp = moddata_client_get(cptr, "certfp");
|
||||
|
||||
+9
-9
@@ -479,11 +479,11 @@ int add_to_watch_hash_table(char *nick, aClient *cptr, int awaynotify)
|
||||
anptr->watch->next = lp;
|
||||
|
||||
lp = make_link();
|
||||
lp->next = cptr->watch;
|
||||
lp->next = cptr->local->watch;
|
||||
lp->value.wptr = anptr;
|
||||
lp->flags = awaynotify;
|
||||
cptr->watch = lp;
|
||||
cptr->watches++;
|
||||
cptr->local->watch = lp;
|
||||
cptr->local->watches++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -612,7 +612,7 @@ int del_from_watch_hash_table(char *nick, aClient *cptr)
|
||||
|
||||
/* Do the same regarding the links in client-record... */
|
||||
last = NULL;
|
||||
if ((lp = cptr->watch))
|
||||
if ((lp = cptr->local->watch))
|
||||
while (lp && (lp->value.wptr != anptr)) {
|
||||
last = lp;
|
||||
lp = lp->next;
|
||||
@@ -629,7 +629,7 @@ int del_from_watch_hash_table(char *nick, aClient *cptr)
|
||||
nick, cptr->user);
|
||||
else {
|
||||
if (!last) /* First one matched */
|
||||
cptr->watch = lp->next;
|
||||
cptr->local->watch = lp->next;
|
||||
else
|
||||
last->next = lp->next;
|
||||
free_link(lp);
|
||||
@@ -644,7 +644,7 @@ int del_from_watch_hash_table(char *nick, aClient *cptr)
|
||||
}
|
||||
|
||||
/* Update count of notifies on nick */
|
||||
cptr->watches--;
|
||||
cptr->local->watches--;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -659,10 +659,10 @@ int hash_del_watch_list(aClient *cptr)
|
||||
Link *np, *lp, *last;
|
||||
|
||||
|
||||
if (!(np = cptr->watch))
|
||||
if (!(np = cptr->local->watch))
|
||||
return 0; /* Nothing to do */
|
||||
|
||||
cptr->watch = NULL; /* Break the watch-list for client */
|
||||
cptr->local->watch = NULL; /* Break the watch-list for client */
|
||||
while (np) {
|
||||
/* Find the watch-record from hash-table... */
|
||||
anptr = np->value.wptr;
|
||||
@@ -714,7 +714,7 @@ int hash_del_watch_list(aClient *cptr)
|
||||
free_link(lp); /* Free the previous */
|
||||
}
|
||||
|
||||
cptr->watches = 0;
|
||||
cptr->local->watches = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+46
-49
@@ -452,11 +452,9 @@ int check_tkls(aClient *cptr)
|
||||
{
|
||||
/* Check ban user { } and ban realname { } */
|
||||
|
||||
bconf = Find_ban(cptr, make_user_host(cptr->
|
||||
user ? cptr->user->username : cptr->
|
||||
username,
|
||||
cptr->user ? cptr->user->realhost : cptr->
|
||||
sockhost), CONF_BAN_USER);
|
||||
bconf = Find_ban(cptr, make_user_host(cptr->user ? cptr->user->username : cptr->username,
|
||||
cptr->user ? cptr->user->realhost : cptr->local->sockhost),
|
||||
CONF_BAN_USER);
|
||||
|
||||
if (bconf)
|
||||
killflag++;
|
||||
@@ -465,7 +463,7 @@ int check_tkls(aClient *cptr)
|
||||
}
|
||||
|
||||
/* If still no match, check ban ip { } */
|
||||
if (!killflag && (bconf = Find_ban(cptr, Inet_ia2p(&cptr->ip), CONF_BAN_IP)))
|
||||
if (!killflag && (bconf = Find_ban(cptr, Inet_ia2p(&cptr->local->ip), CONF_BAN_IP)))
|
||||
killflag++;
|
||||
|
||||
/* If user is meant to be killed, take action: */
|
||||
@@ -531,7 +529,7 @@ EVENT(check_unknowns)
|
||||
|
||||
list_for_each_entry_safe(cptr, cptr2, &unknown_list, lclient_node)
|
||||
{
|
||||
if (cptr->firsttime && ((TStime() - cptr->firsttime) > CONNECTTIMEOUT))
|
||||
if (cptr->local->firsttime && ((TStime() - cptr->local->firsttime) > CONNECTTIMEOUT))
|
||||
(void)exit_client(cptr, cptr, &me, "Registration Timeout");
|
||||
}
|
||||
}
|
||||
@@ -542,34 +540,34 @@ int check_ping(aClient *cptr)
|
||||
char scratch[64];
|
||||
int ping = 0;
|
||||
|
||||
ping = cptr->class ? cptr->class->pingfreq : CONNECTTIMEOUT;
|
||||
ping = cptr->local->class ? cptr->local->class->pingfreq : CONNECTTIMEOUT;
|
||||
Debug((DEBUG_DEBUG, "c(%s)=%d p %d a %d", cptr->name,
|
||||
cptr->status, ping,
|
||||
TStime() - cptr->lasttime));
|
||||
TStime() - cptr->local->lasttime));
|
||||
|
||||
/* If ping is less than or equal to the last time we received a command from them */
|
||||
if (ping > (TStime() - cptr->lasttime))
|
||||
if (ping > (TStime() - cptr->local->lasttime))
|
||||
return 0; /* some recent command was executed */
|
||||
|
||||
if (
|
||||
/* If we have sent a ping */
|
||||
((cptr->flags & FLAGS_PINGSENT)
|
||||
/* And they had 2x ping frequency to respond */
|
||||
&& ((TStime() - cptr->lasttime) >= (2 * ping)))
|
||||
&& ((TStime() - cptr->local->lasttime) >= (2 * ping)))
|
||||
||
|
||||
/* Or isn't registered and time spent is larger than ping .. */
|
||||
(!IsRegistered(cptr) && (TStime() - cptr->since >= ping))
|
||||
(!IsRegistered(cptr) && (TStime() - cptr->local->since >= ping))
|
||||
)
|
||||
{
|
||||
/* if it's registered and doing dns/auth, timeout */
|
||||
if (!IsRegistered(cptr) && (DoingDNS(cptr) || DoingAuth(cptr)))
|
||||
{
|
||||
if (cptr->authfd >= 0) {
|
||||
fd_close(cptr->authfd);
|
||||
if (cptr->local->authfd >= 0) {
|
||||
fd_close(cptr->local->authfd);
|
||||
--OpenFiles;
|
||||
cptr->authfd = -1;
|
||||
cptr->local->authfd = -1;
|
||||
cptr->count = 0;
|
||||
*cptr->buffer = '\0';
|
||||
*cptr->local->buffer = '\0';
|
||||
}
|
||||
if (SHOWCONNECTINFO && !cptr->serv) {
|
||||
if (DoingDNS(cptr))
|
||||
@@ -584,8 +582,8 @@ int check_ping(aClient *cptr)
|
||||
ClearAuth(cptr);
|
||||
ClearDNS(cptr);
|
||||
SetAccess(cptr);
|
||||
cptr->firsttime = TStime();
|
||||
cptr->lasttime = TStime();
|
||||
cptr->local->firsttime = TStime();
|
||||
cptr->local->lasttime = TStime();
|
||||
return -5;
|
||||
}
|
||||
if (IsServer(cptr) || IsConnecting(cptr) ||
|
||||
@@ -601,10 +599,10 @@ int check_ping(aClient *cptr)
|
||||
FALSE));
|
||||
}
|
||||
if (IsSSLAcceptHandshake(cptr))
|
||||
Debug((DEBUG_DEBUG, "ssl accept handshake timeout: %s (%li-%li > %li)", cptr->sockhost,
|
||||
TStime(), cptr->since, ping));
|
||||
Debug((DEBUG_DEBUG, "ssl accept handshake timeout: %s (%li-%li > %li)", cptr->local->sockhost,
|
||||
TStime(), cptr->local->since, ping));
|
||||
(void)ircsnprintf(scratch, sizeof(scratch), "Ping timeout: %ld seconds",
|
||||
(long) (TStime() - cptr->lasttime));
|
||||
(long) (TStime() - cptr->local->lasttime));
|
||||
return exit_client(cptr, cptr, &me, scratch);
|
||||
}
|
||||
else if (IsRegistered(cptr) &&
|
||||
@@ -618,7 +616,7 @@ int check_ping(aClient *cptr)
|
||||
/*
|
||||
* not nice but does the job
|
||||
*/
|
||||
cptr->lasttime = TStime() - ping;
|
||||
cptr->local->lasttime = TStime() - ping;
|
||||
sendto_one(cptr, "PING :%s", me.name);
|
||||
}
|
||||
|
||||
@@ -663,7 +661,7 @@ EVENT(check_deadsockets)
|
||||
#ifdef DEBUGMODE
|
||||
ircd_log(LOG_ERROR, "Closing deadsock: %d/%s", cptr->fd, cptr->name);
|
||||
#endif
|
||||
(void)exit_client(cptr, cptr, &me, cptr->error_str ? cptr->error_str : "Dead socket");
|
||||
(void)exit_client(cptr, cptr, &me, cptr->local->error_str ? cptr->local->error_str : "Dead socket");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -675,7 +673,7 @@ EVENT(check_deadsockets)
|
||||
#ifdef DEBUGMODE
|
||||
ircd_log(LOG_ERROR, "Closing deadsock: %d/%s", cptr->fd, cptr->name);
|
||||
#endif
|
||||
(void)exit_client(cptr, cptr, &me, cptr->error_str ? cptr->error_str : "Dead socket");
|
||||
(void)exit_client(cptr, cptr, &me, cptr->local->error_str ? cptr->local->error_str : "Dead socket");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -823,23 +821,23 @@ struct ThrottlingBucket z = { NULL, NULL, {0}, 0, 0};
|
||||
|
||||
list_for_each_entry(acptr, &lclient_list, lclient_node)
|
||||
{
|
||||
if (acptr->since > TStime())
|
||||
if (acptr->local->since > TStime())
|
||||
{
|
||||
Debug((DEBUG_DEBUG, "fix_timers(): %s: acptr->since %ld -> %ld",
|
||||
acptr->name, acptr->since, TStime()));
|
||||
acptr->since = TStime();
|
||||
Debug((DEBUG_DEBUG, "fix_timers(): %s: acptr->local->since %ld -> %ld",
|
||||
acptr->name, acptr->local->since, TStime()));
|
||||
acptr->local->since = TStime();
|
||||
}
|
||||
if (acptr->lasttime > TStime())
|
||||
if (acptr->local->lasttime > TStime())
|
||||
{
|
||||
Debug((DEBUG_DEBUG, "fix_timers(): %s: acptr->lasttime %ld -> %ld",
|
||||
acptr->name, acptr->lasttime, TStime()));
|
||||
acptr->lasttime = TStime();
|
||||
Debug((DEBUG_DEBUG, "fix_timers(): %s: acptr->local->lasttime %ld -> %ld",
|
||||
acptr->name, acptr->local->lasttime, TStime()));
|
||||
acptr->local->lasttime = TStime();
|
||||
}
|
||||
if (acptr->last > TStime())
|
||||
if (acptr->local->last > TStime())
|
||||
{
|
||||
Debug((DEBUG_DEBUG, "fix_timers(): %s: acptr->last %ld -> %ld",
|
||||
acptr->name, acptr->last, TStime()));
|
||||
acptr->last = TStime();
|
||||
Debug((DEBUG_DEBUG, "fix_timers(): %s: acptr->local->last %ld -> %ld",
|
||||
acptr->name, acptr->local->last, TStime()));
|
||||
acptr->local->last = TStime();
|
||||
}
|
||||
|
||||
/* users */
|
||||
@@ -851,11 +849,11 @@ struct ThrottlingBucket z = { NULL, NULL, {0}, 0, 0};
|
||||
acptr->name, acptr->local->nextnick, TStime()));
|
||||
acptr->local->nextnick = TStime();
|
||||
}
|
||||
if (acptr->nexttarget > TStime())
|
||||
if (acptr->local->nexttarget > TStime())
|
||||
{
|
||||
Debug((DEBUG_DEBUG, "fix_timers(): %s: acptr->nexttarget %ld -> %ld",
|
||||
acptr->name, acptr->nexttarget, TStime()));
|
||||
acptr->nexttarget = TStime();
|
||||
Debug((DEBUG_DEBUG, "fix_timers(): %s: acptr->local->nexttarget %ld -> %ld",
|
||||
acptr->name, acptr->local->nexttarget, TStime()));
|
||||
acptr->local->nexttarget = TStime();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -976,6 +974,8 @@ int InitwIRCD(int argc, char *argv[])
|
||||
memset(&motd, '\0', sizeof(aMotdFile));
|
||||
memset(&smotd, '\0', sizeof(aMotdFile));
|
||||
memset(&svsmotd, '\0', sizeof(aMotdFile));
|
||||
memset(&me, 0, sizeof(me));
|
||||
me.local = MyMallocEx(sizeof(aLocalClient));
|
||||
|
||||
SetupEvents();
|
||||
|
||||
@@ -1133,7 +1133,6 @@ int InitwIRCD(int argc, char *argv[])
|
||||
#else
|
||||
WSAStartup(wVersionRequested, &wsaData);
|
||||
#endif
|
||||
bzero((char *)&me, sizeof(me));
|
||||
bzero(&StatsZ, sizeof(StatsZ));
|
||||
setup_signals();
|
||||
charsys_reset();
|
||||
@@ -1449,8 +1448,7 @@ int InitwIRCD(int argc, char *argv[])
|
||||
open_debugfile();
|
||||
if (portnum < 0)
|
||||
portnum = PORTNUM;
|
||||
memset(&me, 0, sizeof(me));
|
||||
me.port = portnum;
|
||||
me.local->port = portnum;
|
||||
(void)init_sys();
|
||||
me.flags = FLAGS_LISTEN;
|
||||
me.fd = -1;
|
||||
@@ -1472,7 +1470,7 @@ int InitwIRCD(int argc, char *argv[])
|
||||
read_motd(conf_files->svsmotd_file, &svsmotd);
|
||||
|
||||
me.hopcount = 0;
|
||||
me.authfd = -1;
|
||||
me.local->authfd = -1;
|
||||
me.user = NULL;
|
||||
me.from = &me;
|
||||
|
||||
@@ -1482,7 +1480,7 @@ int InitwIRCD(int argc, char *argv[])
|
||||
me_hash = find_or_add(me.name);
|
||||
me.serv->up = me_hash;
|
||||
timeofday = time(NULL);
|
||||
me.lasttime = me.since = me.firsttime = TStime();
|
||||
me.local->lasttime = me.local->since = me.local->firsttime = TStime();
|
||||
(void)add_to_client_hash_table(me.name, &me);
|
||||
(void)add_to_id_hash_table(me.id, &me);
|
||||
list_add(&me.client_node, &global_server_list);
|
||||
@@ -1673,11 +1671,10 @@ static void open_debugfile(void)
|
||||
cptr = make_client(NULL, NULL);
|
||||
cptr->fd = 2;
|
||||
SetLog(cptr);
|
||||
cptr->port = debuglevel;
|
||||
cptr->local->port = debuglevel;
|
||||
cptr->flags = 0;
|
||||
|
||||
(void)strlcpy(cptr->sockhost, me.sockhost,
|
||||
sizeof cptr->sockhost);
|
||||
(void)strlcpy(cptr->local->sockhost, me.local->sockhost, sizeof cptr->local->sockhost);
|
||||
# ifndef _WIN32
|
||||
/*(void)printf("isatty = %d ttyname = %#x\n",
|
||||
isatty(2), (u_int)ttyname(2)); */
|
||||
@@ -1698,7 +1695,7 @@ static void open_debugfile(void)
|
||||
strlcpy(cptr->name, "FD2-Pipe", sizeof(cptr->name));
|
||||
Debug((DEBUG_FATAL,
|
||||
"Debug: File <%s> Level: %d at %s", cptr->name,
|
||||
cptr->port, myctime(time(NULL))));
|
||||
cptr->local->port, myctime(time(NULL))));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+2
-2
@@ -145,13 +145,13 @@ aClient *make_client(aClient *from, aClient *servr)
|
||||
{
|
||||
/* Local client */
|
||||
|
||||
cptr->local = MyMallocEx(sizeof(LocalClient));
|
||||
cptr->local = MyMallocEx(sizeof(aLocalClient));
|
||||
|
||||
INIT_LIST_HEAD(&cptr->lclient_node);
|
||||
INIT_LIST_HEAD(&cptr->special_node);
|
||||
|
||||
cptr->local->since = cptr->local->lasttime =
|
||||
cptr->local->lastnick = cptr->local->firsttime = TStime();
|
||||
cptr->lastnick = cptr->local->firsttime = TStime();
|
||||
cptr->local->class = NULL;
|
||||
cptr->local->passwd = NULL;
|
||||
cptr->local->sockhost[0] = '\0';
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
+10
-10
@@ -46,21 +46,21 @@ aCommand *CommandHash[256]; /* one per letter */
|
||||
*/
|
||||
int dopacket(aClient *cptr, char *buffer, int length)
|
||||
{
|
||||
me.receiveB += length; /* Update bytes received */
|
||||
cptr->receiveB += length;
|
||||
if (cptr->receiveB > 1023)
|
||||
me.local->receiveB += length; /* Update bytes received */
|
||||
cptr->local->receiveB += length;
|
||||
if (cptr->local->receiveB > 1023)
|
||||
{
|
||||
cptr->receiveK += (cptr->receiveB >> 10);
|
||||
cptr->receiveB &= 0x03ff; /* 2^10 = 1024, 3ff = 1023 */
|
||||
cptr->local->receiveK += (cptr->local->receiveB >> 10);
|
||||
cptr->local->receiveB &= 0x03ff; /* 2^10 = 1024, 3ff = 1023 */
|
||||
}
|
||||
if (me.receiveB > 1023)
|
||||
if (me.local->receiveB > 1023)
|
||||
{
|
||||
me.receiveK += (me.receiveB >> 10);
|
||||
me.receiveB &= 0x03ff;
|
||||
me.local->receiveK += (me.local->receiveB >> 10);
|
||||
me.local->receiveB &= 0x03ff;
|
||||
}
|
||||
|
||||
me.receiveM += 1; /* Update messages received */
|
||||
cptr->receiveM += 1;
|
||||
me.local->receiveM += 1; /* Update messages received */
|
||||
cptr->local->receiveM += 1;
|
||||
|
||||
return parse(cptr, buffer, buffer + length);
|
||||
}
|
||||
|
||||
+7
-7
@@ -159,11 +159,11 @@ inline void parse_addlag(aClient *cptr, int cmdbytes)
|
||||
{
|
||||
if (!IsServer(cptr) && !IsNoFakeLag(cptr) &&
|
||||
#ifdef FAKELAG_CONFIGURABLE
|
||||
!(cptr->class && (cptr->class->options & CLASS_OPT_NOFAKELAG)) &&
|
||||
!(cptr->local->class && (cptr->local->class->options & CLASS_OPT_NOFAKELAG)) &&
|
||||
#endif
|
||||
!ValidatePermissionsForPath("privacy:fakelag",cptr,NULL,NULL,NULL))
|
||||
{
|
||||
cptr->since += (1 + cmdbytes/90);
|
||||
cptr->local->since += (1 + cmdbytes/90);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,10 +197,10 @@ int parse(aClient *cptr, char *buffer, char *bufend)
|
||||
if (IsDead(cptr))
|
||||
return 0;
|
||||
|
||||
if ((cptr->receiveK >= UNKNOWN_FLOOD_AMOUNT) && IsUnknown(cptr))
|
||||
if ((cptr->local->receiveK >= UNKNOWN_FLOOD_AMOUNT) && IsUnknown(cptr))
|
||||
{
|
||||
sendto_snomask(SNO_FLOOD, "Flood from unknown connection %s detected",
|
||||
cptr->sockhost);
|
||||
cptr->local->sockhost);
|
||||
ban_flooder(cptr);
|
||||
return FLUSH_BUFFER;
|
||||
}
|
||||
@@ -278,7 +278,7 @@ int parse(aClient *cptr, char *buffer, char *bufend)
|
||||
Debug((DEBUG_NOTICE, "Empty message from host %s:%s",
|
||||
cptr->name, from->name));
|
||||
if (!IsServer(cptr))
|
||||
cptr->since++; /* 1s fake lag */
|
||||
cptr->local->since++; /* 1s fake lag */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ int parse(aClient *cptr, char *buffer, char *bufend)
|
||||
return (do_numeric(numeric, cptr, from, i, para));
|
||||
cmptr->count++;
|
||||
if (IsRegisteredUser(cptr) && (cmptr->flags & M_RESETIDLE))
|
||||
cptr->last = TStime();
|
||||
cptr->local->last = TStime();
|
||||
|
||||
#ifndef DEBUGMODE
|
||||
if (cmptr->flags & M_ALIAS)
|
||||
@@ -467,7 +467,7 @@ int parse(aClient *cptr, char *buffer, char *bufend)
|
||||
cmptr->rticks += ticks;
|
||||
else
|
||||
cmptr->lticks += ticks;
|
||||
cptr->cputime += ticks;
|
||||
cptr->local->cputime += ticks;
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
||||
@@ -260,26 +260,26 @@ char ipv4[4];
|
||||
static struct hostent *he;
|
||||
char *cache_name, ipv6;
|
||||
|
||||
cache_name = unrealdns_findcache_byaddr(&cptr->ip);
|
||||
cache_name = unrealdns_findcache_byaddr(&cptr->local->ip);
|
||||
if (cache_name)
|
||||
return unreal_create_hostent(cache_name, &cptr->ip);
|
||||
return unreal_create_hostent(cache_name, &cptr->local->ip);
|
||||
|
||||
/* Create a request */
|
||||
r = MyMallocEx(sizeof(DNSReq));
|
||||
r->cptr = cptr;
|
||||
r->ipv6 = isipv6(&cptr->ip);
|
||||
r->ipv6 = isipv6(&cptr->local->ip);
|
||||
unrealdns_addreqtolist(r);
|
||||
|
||||
/* Execute it */
|
||||
#ifndef INET6
|
||||
/* easy */
|
||||
ares_gethostbyaddr(resolver_channel, &cptr->ip, 4, AF_INET, unrealdns_cb_iptoname, r);
|
||||
ares_gethostbyaddr(resolver_channel, &cptr->local->ip, 4, AF_INET, unrealdns_cb_iptoname, r);
|
||||
#else
|
||||
if (r->ipv6)
|
||||
ares_gethostbyaddr(resolver_channel, &cptr->ip, 16, AF_INET6, unrealdns_cb_iptoname, r);
|
||||
ares_gethostbyaddr(resolver_channel, &cptr->local->ip, 16, AF_INET6, unrealdns_cb_iptoname, r);
|
||||
else {
|
||||
/* This is slightly more tricky: convert it to an IPv4 presentation and issue the request with that */
|
||||
memcpy(ipv4, ((char *)&cptr->ip) + 12, 4);
|
||||
memcpy(ipv4, ((char *)&cptr->local->ip) + 12, 4);
|
||||
ares_gethostbyaddr(resolver_channel, ipv4, 4, AF_INET, unrealdns_cb_iptoname, r);
|
||||
}
|
||||
#endif
|
||||
@@ -397,9 +397,9 @@ void unrealdns_cb_nametoip_verify(void *arg, int status, int timeouts, struct ho
|
||||
|
||||
if (!ipv6)
|
||||
#ifndef INET6
|
||||
ipv4_addr = acptr->ip.S_ADDR;
|
||||
ipv4_addr = acptr->local->ip.S_ADDR;
|
||||
#else
|
||||
inet6_to_inet4(&acptr->ip, &ipv4_addr);
|
||||
inet6_to_inet4(&acptr->local->ip, &ipv4_addr);
|
||||
#endif
|
||||
|
||||
/* Verify ip->name and name->ip mapping... */
|
||||
@@ -411,7 +411,7 @@ void unrealdns_cb_nametoip_verify(void *arg, int status, int timeouts, struct ho
|
||||
#else
|
||||
if (ipv6)
|
||||
{
|
||||
if ((he->h_length == 16) && !memcmp(he->h_addr_list[i], &acptr->ip, 16))
|
||||
if ((he->h_length == 16) && !memcmp(he->h_addr_list[i], &acptr->local->ip, 16))
|
||||
break;
|
||||
} else {
|
||||
if ((he->h_length == 4) && !memcmp(he->h_addr_list[i], &ipv4_addr, 4))
|
||||
@@ -435,9 +435,9 @@ void unrealdns_cb_nametoip_verify(void *arg, int status, int timeouts, struct ho
|
||||
}
|
||||
|
||||
/* Entry was found, verified, and can be added to cache */
|
||||
unrealdns_addtocache(r->name, &acptr->ip, sizeof(acptr->ip));
|
||||
unrealdns_addtocache(r->name, &acptr->local->ip, sizeof(acptr->local->ip));
|
||||
|
||||
he2 = unreal_create_hostent(r->name, &acptr->ip);
|
||||
he2 = unreal_create_hostent(r->name, &acptr->local->ip);
|
||||
proceed_normal_client_handshake(acptr, he2);
|
||||
|
||||
bad:
|
||||
@@ -777,7 +777,7 @@ char *param;
|
||||
sendtxtnumeric(sptr, "DNS Request List:");
|
||||
for (r = requests; r; r = r->next)
|
||||
sendtxtnumeric(sptr, " %s",
|
||||
r->cptr ? Inet_ia2p(&r->cptr->ip) : "<client lost>");
|
||||
r->cptr ? Inet_ia2p(&r->cptr->local->ip) : "<client lost>");
|
||||
} else
|
||||
if (*param == 'c') /* CLEAR CACHE */
|
||||
{
|
||||
|
||||
+32
-32
@@ -47,16 +47,16 @@ void ident_failed(aClient *cptr)
|
||||
{
|
||||
Debug((DEBUG_NOTICE, "ident_failed() for %x", cptr));
|
||||
ircstp->is_abad++;
|
||||
if (cptr->authfd != -1)
|
||||
if (cptr->local->authfd != -1)
|
||||
{
|
||||
fd_close(cptr->authfd);
|
||||
fd_close(cptr->local->authfd);
|
||||
--OpenFiles;
|
||||
cptr->authfd = -1;
|
||||
cptr->local->authfd = -1;
|
||||
}
|
||||
cptr->flags &= ~(FLAGS_WRAUTH | FLAGS_AUTH);
|
||||
if (!DoingDNS(cptr))
|
||||
finish_auth(cptr);
|
||||
if (SHOWCONNECTINFO && !cptr->serv && !IsServersOnlyListener(cptr->listener))
|
||||
if (SHOWCONNECTINFO && !cptr->serv && !IsServersOnlyListener(cptr->local->listener))
|
||||
sendto_one(cptr, "%s", REPORT_FAIL_ID);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ void start_auth(aClient *cptr)
|
||||
Debug((DEBUG_NOTICE, "start_auth(%x) fd=%d, status=%d",
|
||||
cptr, cptr->fd, cptr->status));
|
||||
snprintf(buf, sizeof buf, "identd: %s", get_client_name(cptr, TRUE));
|
||||
if ((cptr->authfd = fd_socket(AFINET, SOCK_STREAM, 0, buf)) == -1)
|
||||
if ((cptr->local->authfd = fd_socket(AFINET, SOCK_STREAM, 0, buf)) == -1)
|
||||
{
|
||||
Debug((DEBUG_ERROR, "Unable to create auth socket for %s:%s",
|
||||
get_client_name(cptr, TRUE), strerror(get_sockerr(cptr))));
|
||||
@@ -94,21 +94,21 @@ void start_auth(aClient *cptr)
|
||||
if (++OpenFiles >= (MAXCONNECTIONS - 2))
|
||||
{
|
||||
sendto_ops("Can't allocate fd, too many connections.");
|
||||
fd_close(cptr->authfd);
|
||||
fd_close(cptr->local->authfd);
|
||||
--OpenFiles;
|
||||
cptr->authfd = -1;
|
||||
cptr->local->authfd = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(INET6) && defined(IPV6_V6ONLY)
|
||||
int opt = 0;
|
||||
setsockopt(cptr->authfd, IPPROTO_IPV6, IPV6_V6ONLY, (OPT_TYPE *)&opt, sizeof(opt));
|
||||
setsockopt(cptr->local->authfd, IPPROTO_IPV6, IPV6_V6ONLY, (OPT_TYPE *)&opt, sizeof(opt));
|
||||
#endif
|
||||
|
||||
if (SHOWCONNECTINFO && !cptr->serv && !IsServersOnlyListener(cptr->listener))
|
||||
if (SHOWCONNECTINFO && !cptr->serv && !IsServersOnlyListener(cptr->local->listener))
|
||||
sendto_one(cptr, "%s", REPORT_DO_ID);
|
||||
|
||||
set_non_blocking(cptr->authfd, cptr);
|
||||
set_non_blocking(cptr->local->authfd, cptr);
|
||||
|
||||
/* Bind to the IP the user got in */
|
||||
memset(&sock, 0, sizeof(sock));
|
||||
@@ -122,23 +122,23 @@ void start_auth(aClient *cptr)
|
||||
#endif
|
||||
sock.SIN_PORT = 0;
|
||||
sock.SIN_FAMILY = AFINET; /* redundant? */
|
||||
(void)bind(cptr->authfd, (struct SOCKADDR *)&sock, sizeof(sock));
|
||||
(void)bind(cptr->local->authfd, (struct SOCKADDR *)&sock, sizeof(sock));
|
||||
}
|
||||
|
||||
bcopy((char *)&cptr->ip, (char *)&sock.SIN_ADDR,
|
||||
bcopy((char *)&cptr->local->ip, (char *)&sock.SIN_ADDR,
|
||||
sizeof(struct IN_ADDR));
|
||||
|
||||
sock.SIN_PORT = htons(113);
|
||||
sock.SIN_FAMILY = AFINET;
|
||||
|
||||
if (connect(cptr->authfd, (struct sockaddr *)&sock, sizeof(sock)) == -1 && !(ERRNO == P_EWORKING))
|
||||
if (connect(cptr->local->authfd, (struct sockaddr *)&sock, sizeof(sock)) == -1 && !(ERRNO == P_EWORKING))
|
||||
{
|
||||
ident_failed(cptr);
|
||||
return;
|
||||
}
|
||||
cptr->flags |= (FLAGS_WRAUTH | FLAGS_AUTH);
|
||||
|
||||
fd_setselect(cptr->authfd, FD_SELECT_WRITE, send_authports, cptr);
|
||||
fd_setselect(cptr->local->authfd, FD_SELECT_WRITE, send_authports, cptr);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ static void send_authports(int fd, int revents, void *data)
|
||||
aClient *cptr = data;
|
||||
|
||||
Debug((DEBUG_NOTICE, "write_authports(%x) fd %d authfd %d stat %d",
|
||||
cptr, cptr->fd, cptr->authfd, cptr->status));
|
||||
cptr, cptr->fd, cptr->local->authfd, cptr->status));
|
||||
tlen = ulen = sizeof(us);
|
||||
if (getsockname(cptr->fd, (struct SOCKADDR *)&us, &ulen) ||
|
||||
getpeername(cptr->fd, (struct SOCKADDR *)&them, &tlen))
|
||||
@@ -174,7 +174,7 @@ static void send_authports(int fd, int revents, void *data)
|
||||
|
||||
Debug((DEBUG_SEND, "sending [%s] to auth port %s.113",
|
||||
authbuf, inetntoa((char *)&them.SIN_ADDR)));
|
||||
if (WRITE_SOCK(cptr->authfd, authbuf, strlen(authbuf)) != strlen(authbuf))
|
||||
if (WRITE_SOCK(cptr->local->authfd, authbuf, strlen(authbuf)) != strlen(authbuf))
|
||||
{
|
||||
if (ERRNO == P_EAGAIN)
|
||||
return; /* Not connected yet, try again later */
|
||||
@@ -184,7 +184,7 @@ authsenderr:
|
||||
}
|
||||
cptr->flags &= ~FLAGS_WRAUTH;
|
||||
|
||||
fd_setselect(cptr->authfd, FD_SELECT_READ, read_authports, cptr);
|
||||
fd_setselect(cptr->local->authfd, FD_SELECT_READ, read_authports, cptr);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -206,7 +206,7 @@ static void read_authports(int fd, int revents, void *userdata)
|
||||
|
||||
*system = *ruser = '\0';
|
||||
Debug((DEBUG_NOTICE, "read_authports(%x) fd %d authfd %d stat %d",
|
||||
cptr, cptr->fd, cptr->authfd, cptr->status));
|
||||
cptr, cptr->fd, cptr->local->authfd, cptr->status));
|
||||
/*
|
||||
* Nasty. Cant allow any other reads from client fd while we're
|
||||
* waiting on the authfd to return a full valid string. Use the
|
||||
@@ -214,21 +214,21 @@ static void read_authports(int fd, int revents, void *userdata)
|
||||
* Oh. this is needed because an authd reply may come back in more
|
||||
* than 1 read! -avalon
|
||||
*/
|
||||
if ((len = READ_SOCK(cptr->authfd, cptr->buffer + cptr->count,
|
||||
sizeof(cptr->buffer) - 1 - cptr->count)) >= 0)
|
||||
if ((len = READ_SOCK(cptr->local->authfd, cptr->local->buffer + cptr->count,
|
||||
sizeof(cptr->local->buffer) - 1 - cptr->count)) >= 0)
|
||||
{
|
||||
cptr->count += len;
|
||||
cptr->buffer[cptr->count] = '\0';
|
||||
cptr->local->buffer[cptr->count] = '\0';
|
||||
}
|
||||
|
||||
cptr->lasttime = TStime();
|
||||
if ((len > 0) && (cptr->count != (sizeof(cptr->buffer) - 1)) &&
|
||||
(sscanf(cptr->buffer, "%hd , %hd : USERID : %*[^:]: %10s",
|
||||
cptr->local->lasttime = TStime();
|
||||
if ((len > 0) && (cptr->count != (sizeof(cptr->local->buffer) - 1)) &&
|
||||
(sscanf(cptr->local->buffer, "%hd , %hd : USERID : %*[^:]: %10s",
|
||||
&remp, &locp, ruser) == 3))
|
||||
{
|
||||
s = rindex(cptr->buffer, ':');
|
||||
s = rindex(cptr->local->buffer, ':');
|
||||
*s++ = '\0';
|
||||
for (t = (rindex(cptr->buffer, ':') + 1); *t; t++)
|
||||
for (t = (rindex(cptr->local->buffer, ':') + 1); *t; t++)
|
||||
if (!isspace(*t))
|
||||
break;
|
||||
strlcpy(system, t, sizeof(system));
|
||||
@@ -241,23 +241,23 @@ static void read_authports(int fd, int revents, void *userdata)
|
||||
}
|
||||
else if (len != 0)
|
||||
{
|
||||
if (!index(cptr->buffer, '\n') && !index(cptr->buffer, '\r'))
|
||||
if (!index(cptr->local->buffer, '\n') && !index(cptr->local->buffer, '\r'))
|
||||
return;
|
||||
Debug((DEBUG_ERROR, "local %d remote %d", locp, remp));
|
||||
Debug((DEBUG_ERROR, "bad auth reply in [%s]", cptr->buffer));
|
||||
Debug((DEBUG_ERROR, "bad auth reply in [%s]", cptr->local->buffer));
|
||||
*ruser = '\0';
|
||||
}
|
||||
fd_close(cptr->authfd);
|
||||
fd_close(cptr->local->authfd);
|
||||
--OpenFiles;
|
||||
cptr->authfd = -1;
|
||||
cptr->local->authfd = -1;
|
||||
cptr->count = 0;
|
||||
ClearAuth(cptr);
|
||||
if (!DoingDNS(cptr))
|
||||
finish_auth(cptr);
|
||||
if (len > 0)
|
||||
Debug((DEBUG_INFO, "ident reply: [%s]", cptr->buffer));
|
||||
Debug((DEBUG_INFO, "ident reply: [%s]", cptr->local->buffer));
|
||||
|
||||
if (SHOWCONNECTINFO && !cptr->serv && !IsServersOnlyListener(cptr->listener))
|
||||
if (SHOWCONNECTINFO && !cptr->serv && !IsServersOnlyListener(cptr->local->listener))
|
||||
sendto_one(cptr, "%s", REPORT_FIN_ID);
|
||||
|
||||
if (!locp || !remp || !*ruser)
|
||||
|
||||
+83
-83
@@ -154,9 +154,9 @@ void close_connections(void)
|
||||
cptr->fd = -2;
|
||||
}
|
||||
|
||||
if (cptr->authfd >= 0)
|
||||
if (cptr->local->authfd >= 0)
|
||||
{
|
||||
fd_close(cptr->authfd);
|
||||
fd_close(cptr->local->authfd);
|
||||
cptr->fd = -1;
|
||||
}
|
||||
}
|
||||
@@ -675,17 +675,17 @@ void write_pidfile(void)
|
||||
*/
|
||||
static int check_init(aClient *cptr, char *sockn, size_t size)
|
||||
{
|
||||
strlcpy(sockn, cptr->sockhost, HOSTLEN);
|
||||
strlcpy(sockn, cptr->local->sockhost, HOSTLEN);
|
||||
|
||||
RunHookReturnInt3(HOOKTYPE_CHECK_INIT, cptr, sockn, size, ==0);
|
||||
|
||||
/* Some silly hack to convert 127.0.0.1 and such into 'localhost' */
|
||||
if (IsLocal(cptr))
|
||||
{
|
||||
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;
|
||||
}
|
||||
strlcpy(sockn, "localhost", HOSTLEN);
|
||||
}
|
||||
@@ -708,12 +708,12 @@ int check_client(aClient *cptr, char *username)
|
||||
|
||||
ClearAccess(cptr);
|
||||
Debug((DEBUG_DNS, "ch_cl: check access for %s[%s]",
|
||||
cptr->name, inetntoa((char *)&cptr->ip)));
|
||||
cptr->name, inetntoa((char *)&cptr->local->ip)));
|
||||
|
||||
if (check_init(cptr, sockname, sizeof(sockname)))
|
||||
return -2;
|
||||
|
||||
hp = cptr->hostp;
|
||||
hp = cptr->local->hostp;
|
||||
/*
|
||||
* Verify that the host to ip mapping is correct both ways and that
|
||||
* the ip#(s) for the socket is listed for the host.
|
||||
@@ -721,13 +721,13 @@ int check_client(aClient *cptr, char *username)
|
||||
if (hp)
|
||||
{
|
||||
for (i = 0; hp->h_addr_list[i]; i++)
|
||||
if (!bcmp(hp->h_addr_list[i], (char *)&cptr->ip,
|
||||
if (!bcmp(hp->h_addr_list[i], (char *)&cptr->local->ip,
|
||||
sizeof(struct IN_ADDR)))
|
||||
break;
|
||||
if (!hp->h_addr_list[i])
|
||||
{
|
||||
sendto_snomask(SNO_JUNK, "IP# Mismatch: %s != %s[%08lx]",
|
||||
Inet_ia2p((struct IN_ADDR *)&cptr->ip), hp->h_name,
|
||||
Inet_ia2p((struct IN_ADDR *)&cptr->local->ip), hp->h_name,
|
||||
*((unsigned long *)hp->h_addr));
|
||||
hp = NULL;
|
||||
}
|
||||
@@ -818,7 +818,7 @@ void completed_connection(int fd, int revents, void *data)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cptr->ssl && !(aconf->outgoing.options & CONNECT_INSECURE))
|
||||
if (!cptr->local->ssl && !(aconf->outgoing.options & CONNECT_INSECURE))
|
||||
{
|
||||
sendto_one(cptr, "STARTTLS");
|
||||
} else
|
||||
@@ -848,11 +848,11 @@ void close_connection(aClient *cptr)
|
||||
if (IsServer(cptr))
|
||||
{
|
||||
ircstp->is_sv++;
|
||||
ircstp->is_sbs += cptr->sendB;
|
||||
ircstp->is_sbr += cptr->receiveB;
|
||||
ircstp->is_sks += cptr->sendK;
|
||||
ircstp->is_skr += cptr->receiveK;
|
||||
ircstp->is_sti += TStime() - cptr->firsttime;
|
||||
ircstp->is_sbs += cptr->local->sendB;
|
||||
ircstp->is_sbr += cptr->local->receiveB;
|
||||
ircstp->is_sks += cptr->local->sendK;
|
||||
ircstp->is_skr += cptr->local->receiveK;
|
||||
ircstp->is_sti += TStime() - cptr->local->firsttime;
|
||||
if (ircstp->is_sbs > 1023)
|
||||
{
|
||||
ircstp->is_sks += (ircstp->is_sbs >> 10);
|
||||
@@ -867,11 +867,11 @@ void close_connection(aClient *cptr)
|
||||
else if (IsClient(cptr))
|
||||
{
|
||||
ircstp->is_cl++;
|
||||
ircstp->is_cbs += cptr->sendB;
|
||||
ircstp->is_cbr += cptr->receiveB;
|
||||
ircstp->is_cks += cptr->sendK;
|
||||
ircstp->is_ckr += cptr->receiveK;
|
||||
ircstp->is_cti += TStime() - cptr->firsttime;
|
||||
ircstp->is_cbs += cptr->local->sendB;
|
||||
ircstp->is_cbr += cptr->local->receiveB;
|
||||
ircstp->is_cks += cptr->local->sendK;
|
||||
ircstp->is_ckr += cptr->local->receiveK;
|
||||
ircstp->is_cti += TStime() - cptr->local->firsttime;
|
||||
if (ircstp->is_cbs > 1023)
|
||||
{
|
||||
ircstp->is_cks += (ircstp->is_cbs >> 10);
|
||||
@@ -891,27 +891,27 @@ void close_connection(aClient *cptr)
|
||||
*/
|
||||
unrealdns_delreq_bycptr(cptr);
|
||||
|
||||
if (cptr->authfd >= 0)
|
||||
if (cptr->local->authfd >= 0)
|
||||
{
|
||||
fd_close(cptr->authfd);
|
||||
cptr->authfd = -1;
|
||||
fd_close(cptr->local->authfd);
|
||||
cptr->local->authfd = -1;
|
||||
--OpenFiles;
|
||||
}
|
||||
|
||||
if (cptr->fd >= 0)
|
||||
{
|
||||
send_queued(cptr);
|
||||
if (IsSSL(cptr) && cptr->ssl) {
|
||||
SSL_set_shutdown(cptr->ssl, SSL_RECEIVED_SHUTDOWN);
|
||||
SSL_smart_shutdown(cptr->ssl);
|
||||
SSL_free(cptr->ssl);
|
||||
cptr->ssl = NULL;
|
||||
if (IsSSL(cptr) && cptr->local->ssl) {
|
||||
SSL_set_shutdown(cptr->local->ssl, SSL_RECEIVED_SHUTDOWN);
|
||||
SSL_smart_shutdown(cptr->local->ssl);
|
||||
SSL_free(cptr->local->ssl);
|
||||
cptr->local->ssl = NULL;
|
||||
}
|
||||
fd_close(cptr->fd);
|
||||
cptr->fd = -2;
|
||||
--OpenFiles;
|
||||
DBufClear(&cptr->sendQ);
|
||||
DBufClear(&cptr->recvQ);
|
||||
DBufClear(&cptr->local->sendQ);
|
||||
DBufClear(&cptr->local->recvQ);
|
||||
|
||||
}
|
||||
|
||||
@@ -1154,20 +1154,20 @@ add_con_refuse:
|
||||
* have something valid to put into error messages...
|
||||
*/
|
||||
get_sockhost(acptr, Inet_si2p(&addr));
|
||||
bcopy((char *)&addr.SIN_ADDR, (char *)&acptr->ip, sizeof(struct IN_ADDR));
|
||||
bcopy((char *)&addr.SIN_ADDR, (char *)&acptr->local->ip, sizeof(struct IN_ADDR));
|
||||
|
||||
/* Tag loopback connections as FLAGS_LOCAL */
|
||||
#ifdef INET6
|
||||
if (IN6_IS_ADDR_LOOPBACK(&acptr->ip) ||
|
||||
(acptr->ip.s6_addr[0] == mysk.sin6_addr.s6_addr[0] &&
|
||||
acptr->ip.s6_addr[1] == mysk.sin6_addr.s6_addr[1])
|
||||
if (IN6_IS_ADDR_LOOPBACK(&acptr->local->ip) ||
|
||||
(acptr->local->ip.s6_addr[0] == mysk.sin6_addr.s6_addr[0] &&
|
||||
acptr->local->ip.s6_addr[1] == mysk.sin6_addr.s6_addr[1])
|
||||
/* ||
|
||||
IN6_ARE_ADDR_SAMEPREFIX(&acptr->ip, &mysk.SIN_ADDR))
|
||||
IN6_ARE_ADDR_SAMEPREFIX(&acptr->local->ip, &mysk.SIN_ADDR))
|
||||
about the same, I think NOT */
|
||||
)
|
||||
#else
|
||||
if (inet_netof(acptr->ip) == IN_LOOPBACKNET ||
|
||||
inet_netof(acptr->ip) == inet_netof(mysk.SIN_ADDR))
|
||||
if (inet_netof(acptr->local->ip) == IN_LOOPBACKNET ||
|
||||
inet_netof(acptr->local->ip) == inet_netof(mysk.SIN_ADDR))
|
||||
#endif
|
||||
{
|
||||
ircstp->is_loc++;
|
||||
@@ -1178,9 +1178,9 @@ add_con_refuse:
|
||||
|
||||
list_for_each_entry(acptr2, &unknown_list, lclient_node)
|
||||
#ifndef INET6
|
||||
if (acptr2->ip.S_ADDR == acptr->ip.S_ADDR)
|
||||
if (acptr2->local->ip.S_ADDR == acptr->local->ip.S_ADDR)
|
||||
#else
|
||||
if (!bcmp(acptr2->ip.S_ADDR, acptr->ip.S_ADDR, sizeof(acptr->ip.S_ADDR)))
|
||||
if (!bcmp(acptr2->ip.S_ADDR, acptr->local->ip.S_ADDR, sizeof(acptr->local->ip.S_ADDR)))
|
||||
#endif
|
||||
{
|
||||
j++;
|
||||
@@ -1189,7 +1189,7 @@ add_con_refuse:
|
||||
ircsnprintf(zlinebuf, sizeof(zlinebuf),
|
||||
"ERROR :Closing Link: [%s] (Too many unknown connections from your IP)"
|
||||
"\r\n",
|
||||
Inet_ia2p(&acptr->ip));
|
||||
Inet_ia2p(&acptr->local->ip));
|
||||
set_non_blocking(fd, acptr);
|
||||
set_sock_opts(fd, acptr);
|
||||
send(fd, zlinebuf, strlen(zlinebuf), 0);
|
||||
@@ -1197,13 +1197,13 @@ add_con_refuse:
|
||||
}
|
||||
}
|
||||
|
||||
if ((bconf = Find_ban(acptr, Inet_ia2p(&acptr->ip), CONF_BAN_IP))) {
|
||||
if ((bconf = Find_ban(acptr, Inet_ia2p(&acptr->local->ip), CONF_BAN_IP))) {
|
||||
if (bconf)
|
||||
{
|
||||
ircsnprintf(zlinebuf, sizeof(zlinebuf),
|
||||
"ERROR :Closing Link: [%s] (You are not welcome on "
|
||||
"this server: %s. Email %s for more information.)\r\n",
|
||||
Inet_ia2p(&acptr->ip),
|
||||
Inet_ia2p(&acptr->local->ip),
|
||||
bconf->reason ? bconf->reason : "no reason",
|
||||
KLINE_ADDRESS);
|
||||
set_non_blocking(fd, acptr);
|
||||
@@ -1222,12 +1222,12 @@ add_con_refuse:
|
||||
else
|
||||
{
|
||||
int val;
|
||||
if (!(val = throttle_can_connect(acptr, &acptr->ip)))
|
||||
if (!(val = throttle_can_connect(acptr, &acptr->local->ip)))
|
||||
{
|
||||
ircsnprintf(zlinebuf, sizeof(zlinebuf),
|
||||
"ERROR :Closing Link: [%s] (Throttled: Reconnecting too fast) -"
|
||||
"Email %s for more information.\r\n",
|
||||
Inet_ia2p(&acptr->ip),
|
||||
Inet_ia2p(&acptr->local->ip),
|
||||
KLINE_ADDRESS);
|
||||
set_non_blocking(fd, acptr);
|
||||
set_sock_opts(fd, acptr);
|
||||
@@ -1235,15 +1235,15 @@ add_con_refuse:
|
||||
goto add_con_refuse;
|
||||
}
|
||||
else if (val == 1)
|
||||
add_throttling_bucket(&acptr->ip);
|
||||
add_throttling_bucket(&acptr->local->ip);
|
||||
}
|
||||
acptr->port = ntohs(addr.SIN_PORT);
|
||||
acptr->local->port = ntohs(addr.SIN_PORT);
|
||||
}
|
||||
|
||||
acptr->fd = fd;
|
||||
acptr->listener = cptr;
|
||||
if (acptr->listener != NULL)
|
||||
acptr->listener->clients++;
|
||||
acptr->local->listener = cptr;
|
||||
if (acptr->local->listener != NULL)
|
||||
acptr->local->listener->clients++;
|
||||
add_client_to_list(acptr);
|
||||
|
||||
set_non_blocking(acptr->fd, acptr);
|
||||
@@ -1256,19 +1256,19 @@ add_con_refuse:
|
||||
if ((cptr->options & LISTENER_SSL) && ctx_server)
|
||||
{
|
||||
SetSSLAcceptHandshake(acptr);
|
||||
Debug((DEBUG_DEBUG, "Starting SSL accept handshake for %s", acptr->sockhost));
|
||||
if ((acptr->ssl = SSL_new(ctx_server)) == NULL)
|
||||
Debug((DEBUG_DEBUG, "Starting SSL accept handshake for %s", acptr->local->sockhost));
|
||||
if ((acptr->local->ssl = SSL_new(ctx_server)) == NULL)
|
||||
{
|
||||
goto add_con_refuse;
|
||||
}
|
||||
acptr->flags |= FLAGS_SSL;
|
||||
SSL_set_fd(acptr->ssl, fd);
|
||||
SSL_set_nonblocking(acptr->ssl);
|
||||
SSL_set_fd(acptr->local->ssl, fd);
|
||||
SSL_set_nonblocking(acptr->local->ssl);
|
||||
if (!ircd_SSL_accept(acptr, fd)) {
|
||||
Debug((DEBUG_DEBUG, "Failed SSL accept handshake in instance 1: %s", acptr->sockhost));
|
||||
SSL_set_shutdown(acptr->ssl, SSL_RECEIVED_SHUTDOWN);
|
||||
SSL_smart_shutdown(acptr->ssl);
|
||||
SSL_free(acptr->ssl);
|
||||
Debug((DEBUG_DEBUG, "Failed SSL accept handshake in instance 1: %s", acptr->local->sockhost));
|
||||
SSL_set_shutdown(acptr->local->ssl, SSL_RECEIVED_SHUTDOWN);
|
||||
SSL_smart_shutdown(acptr->local->ssl);
|
||||
SSL_free(acptr->local->ssl);
|
||||
goto add_con_refuse;
|
||||
}
|
||||
}
|
||||
@@ -1289,13 +1289,13 @@ struct hostent *he;
|
||||
|
||||
if (!DONT_RESOLVE)
|
||||
{
|
||||
if (SHOWCONNECTINFO && !acptr->serv && !IsServersOnlyListener(acptr->listener))
|
||||
if (SHOWCONNECTINFO && !acptr->serv && !IsServersOnlyListener(acptr->local->listener))
|
||||
sendto_one(acptr, "%s", REPORT_DO_DNS);
|
||||
dns_special_flag = 1;
|
||||
he = unrealdns_doclient(acptr);
|
||||
dns_special_flag = 0;
|
||||
|
||||
if (acptr->hostp)
|
||||
if (acptr->local->hostp)
|
||||
goto doauth; /* Race condition detected, DNS has been done, continue with auth */
|
||||
|
||||
if (!he)
|
||||
@@ -1304,8 +1304,8 @@ struct hostent *he;
|
||||
SetDNS(acptr);
|
||||
} else {
|
||||
/* Host was in our cache */
|
||||
acptr->hostp = he;
|
||||
if (SHOWCONNECTINFO && !acptr->serv && !IsServersOnlyListener(acptr->listener))
|
||||
acptr->local->hostp = he;
|
||||
if (SHOWCONNECTINFO && !acptr->serv && !IsServersOnlyListener(acptr->local->listener))
|
||||
sendto_one(acptr, "%s", REPORT_FIN_DNSC);
|
||||
}
|
||||
}
|
||||
@@ -1318,9 +1318,9 @@ doauth:
|
||||
void proceed_normal_client_handshake(aClient *acptr, struct hostent *he)
|
||||
{
|
||||
ClearDNS(acptr);
|
||||
acptr->hostp = he;
|
||||
if (SHOWCONNECTINFO && !acptr->serv && !IsServersOnlyListener(acptr->listener))
|
||||
sendto_one(acptr, "%s", acptr->hostp ? REPORT_FIN_DNS : REPORT_FAIL_DNS);
|
||||
acptr->local->hostp = he;
|
||||
if (SHOWCONNECTINFO && !acptr->serv && !IsServersOnlyListener(acptr->local->listener))
|
||||
sendto_one(acptr, "%s", acptr->local->hostp ? REPORT_FIN_DNS : REPORT_FAIL_DNS);
|
||||
|
||||
if (!dns_special_flag && !DoingAuth(acptr))
|
||||
finish_auth(acptr);
|
||||
@@ -1354,10 +1354,10 @@ static int parse_client_queued(aClient *cptr)
|
||||
if (DoingDNS(cptr))
|
||||
return 0; /* we delay processing of data until the host is resolved */
|
||||
|
||||
while (DBufLength(&cptr->recvQ) &&
|
||||
((cptr->status < STAT_UNKNOWN) || (cptr->since - now < 10)))
|
||||
while (DBufLength(&cptr->local->recvQ) &&
|
||||
((cptr->status < STAT_UNKNOWN) || (cptr->local->since - now < 10)))
|
||||
{
|
||||
dolen = dbuf_getmsg(&cptr->recvQ, buf);
|
||||
dolen = dbuf_getmsg(&cptr->local->recvQ, buf);
|
||||
|
||||
if (dolen == 0)
|
||||
return 0;
|
||||
@@ -1383,13 +1383,13 @@ void read_packet(int fd, int revents, void *data)
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (IsSSL(cptr) && cptr->ssl != NULL)
|
||||
if (IsSSL(cptr) && cptr->local->ssl != NULL)
|
||||
{
|
||||
length = SSL_read(cptr->ssl, readbuf, sizeof(readbuf));
|
||||
length = SSL_read(cptr->local->ssl, readbuf, sizeof(readbuf));
|
||||
|
||||
if (length < 0)
|
||||
{
|
||||
int err = SSL_get_error(cptr->ssl, length);
|
||||
int err = SSL_get_error(cptr->local->ssl, length);
|
||||
|
||||
switch (err)
|
||||
{
|
||||
@@ -1431,9 +1431,9 @@ void read_packet(int fd, int revents, void *data)
|
||||
return;
|
||||
}
|
||||
|
||||
cptr->lasttime = now;
|
||||
if (cptr->lasttime > cptr->since)
|
||||
cptr->since = cptr->lasttime;
|
||||
cptr->local->lasttime = now;
|
||||
if (cptr->local->lasttime > cptr->local->since)
|
||||
cptr->local->since = cptr->local->lasttime;
|
||||
cptr->flags &= ~(FLAGS_PINGSENT | FLAGS_NONL);
|
||||
|
||||
for (h = Hooks[HOOKTYPE_RAWPACKET_IN]; h; h = h->next)
|
||||
@@ -1443,7 +1443,7 @@ void read_packet(int fd, int revents, void *data)
|
||||
return;
|
||||
}
|
||||
|
||||
dbuf_put(&cptr->recvQ, readbuf, length);
|
||||
dbuf_put(&cptr->local->recvQ, readbuf, length);
|
||||
|
||||
/* parse some of what we have (inducing fakelag, etc) */
|
||||
if (!(DoingDNS(cptr) || DoingAuth(cptr)))
|
||||
@@ -1451,14 +1451,14 @@ void read_packet(int fd, int revents, void *data)
|
||||
return;
|
||||
|
||||
/* excess flood check */
|
||||
if (IsPerson(cptr) && DBufLength(&cptr->recvQ) > get_recvq(cptr))
|
||||
if (IsPerson(cptr) && DBufLength(&cptr->local->recvQ) > get_recvq(cptr))
|
||||
{
|
||||
sendto_snomask(SNO_FLOOD,
|
||||
"*** Flood -- %s!%s@%s (%d) exceeds %d recvQ",
|
||||
cptr->name[0] ? cptr->name : "*",
|
||||
cptr->user ? cptr->user->username : "*",
|
||||
cptr->user ? cptr->user->realhost : "*",
|
||||
DBufLength(&cptr->recvQ), get_recvq(cptr));
|
||||
DBufLength(&cptr->local->recvQ), get_recvq(cptr));
|
||||
exit_client(cptr, cptr, cptr, "Excess Flood");
|
||||
return;
|
||||
}
|
||||
@@ -1475,11 +1475,11 @@ void process_clients(void)
|
||||
aClient *cptr, *cptr2;
|
||||
|
||||
list_for_each_entry_safe(cptr, cptr2, &lclient_list, lclient_node)
|
||||
if ((cptr->fd >= 0) && DBufLength(&cptr->recvQ))
|
||||
if ((cptr->fd >= 0) && DBufLength(&cptr->local->recvQ))
|
||||
parse_client_queued(cptr);
|
||||
|
||||
list_for_each_entry_safe(cptr, cptr2, &unknown_list, lclient_node)
|
||||
if ((cptr->fd >= 0) && DBufLength(&cptr->recvQ))
|
||||
if ((cptr->fd >= 0) && DBufLength(&cptr->local->recvQ))
|
||||
parse_client_queued(cptr);
|
||||
}
|
||||
|
||||
@@ -1542,12 +1542,12 @@ int connect_server(ConfigItem_link *aconf, aClient *by, struct hostent *hp)
|
||||
}
|
||||
}
|
||||
cptr = make_client(NULL, NULL);
|
||||
cptr->hostp = hp;
|
||||
cptr->local->hostp = hp;
|
||||
/*
|
||||
* Copy these in so we have something for error detection.
|
||||
*/
|
||||
strlcpy(cptr->name, aconf->servername, sizeof(cptr->name));
|
||||
strlcpy(cptr->sockhost, aconf->outgoing.hostname, HOSTLEN + 1);
|
||||
strlcpy(cptr->local->sockhost, aconf->outgoing.hostname, HOSTLEN + 1);
|
||||
|
||||
svp = connect_inet(aconf, cptr, &len);
|
||||
if (!svp)
|
||||
@@ -1707,7 +1707,7 @@ static struct SOCKADDR *connect_inet(ConfigItem_link *aconf, aClient *cptr, int
|
||||
if (aconf->ipnum.S_ADDR == -1)
|
||||
#endif
|
||||
{
|
||||
hp = cptr->hostp;
|
||||
hp = cptr->local->hostp;
|
||||
if (!hp)
|
||||
{
|
||||
Debug((DEBUG_FATAL, "%s: unknown host", aconf->outgoing.hostname));
|
||||
@@ -1716,7 +1716,7 @@ static struct SOCKADDR *connect_inet(ConfigItem_link *aconf, aClient *cptr, int
|
||||
bcopy(hp->h_addr, (char *)&aconf->ipnum, sizeof(struct IN_ADDR));
|
||||
}
|
||||
bcopy((char *)&aconf->ipnum, (char *)&server.SIN_ADDR, sizeof(struct IN_ADDR));
|
||||
bcopy((char *)&aconf->ipnum, (char *)&cptr->ip, sizeof(struct IN_ADDR));
|
||||
bcopy((char *)&aconf->ipnum, (char *)&cptr->local->ip, sizeof(struct IN_ADDR));
|
||||
server.SIN_PORT = htons(((aconf->outgoing.port > 0) ? aconf->outgoing.port : portnum));
|
||||
*lenp = sizeof(server);
|
||||
return (struct SOCKADDR *)&server;
|
||||
|
||||
+17
-17
@@ -2588,7 +2588,7 @@ ConfigItem_except *Find_except(aClient *sptr, char *host, short type) {
|
||||
for(excepts = conf_except; excepts; excepts =(ConfigItem_except *) excepts->next) {
|
||||
if (excepts->flag.type == type)
|
||||
{
|
||||
if (match_ip(sptr->ip, host, excepts->mask, excepts->netmask))
|
||||
if (match_ip(sptr->local->ip, host, excepts->mask, excepts->netmask))
|
||||
return excepts;
|
||||
}
|
||||
}
|
||||
@@ -2655,7 +2655,7 @@ ConfigItem_ban *Find_ban(aClient *sptr, char *host, short type)
|
||||
{
|
||||
if (sptr)
|
||||
{
|
||||
if (match_ip(sptr->ip, host, ban->mask, ban->netmask))
|
||||
if (match_ip(sptr->local->ip, host, ban->mask, ban->netmask))
|
||||
{
|
||||
/* Person got a exception */
|
||||
if ((type == CONF_BAN_USER || type == CONF_BAN_IP)
|
||||
@@ -2686,7 +2686,7 @@ ConfigItem_ban *Find_banEx(aClient *sptr, char *host, short type, short type2)
|
||||
{
|
||||
if (sptr)
|
||||
{
|
||||
if (match_ip(sptr->ip, host, ban->mask, ban->netmask)) {
|
||||
if (match_ip(sptr->local->ip, host, ban->mask, ban->netmask)) {
|
||||
/* Person got a exception */
|
||||
if (Find_except(sptr, host, type))
|
||||
return NULL;
|
||||
@@ -2715,7 +2715,7 @@ int AllowClient(aClient *cptr, struct hostent *hp, char *sockhost, char *usernam
|
||||
{
|
||||
if (!aconf->hostname || !aconf->ip)
|
||||
goto attach;
|
||||
if (aconf->auth && !cptr->passwd && aconf->flags.nopasscont)
|
||||
if (aconf->auth && !cptr->local->passwd && aconf->flags.nopasscont)
|
||||
continue;
|
||||
if (aconf->flags.ssl && !IsSecure(cptr))
|
||||
continue;
|
||||
@@ -2752,7 +2752,7 @@ int AllowClient(aClient *cptr, struct hostent *hp, char *sockhost, char *usernam
|
||||
*uhost = '\0';
|
||||
strlcat(uhost, sockhost, sizeof(uhost));
|
||||
/* Check the IP */
|
||||
if (match_ip(cptr->ip, uhost, aconf->ip, aconf->netmask))
|
||||
if (match_ip(cptr->local->ip, uhost, aconf->ip, aconf->netmask))
|
||||
goto attach;
|
||||
|
||||
/* Hmm, localhost is a special case, hp == NULL and sockhost contains
|
||||
@@ -2785,7 +2785,7 @@ int AllowClient(aClient *cptr, struct hostent *hp, char *sockhost, char *usernam
|
||||
strlcpy(uhost, sockhost, sizeof(uhost));
|
||||
get_sockhost(cptr, uhost);
|
||||
#ifdef INET6
|
||||
is_ipv4 = IN6_IS_ADDR_V4MAPPED(&cptr->ip);
|
||||
is_ipv4 = IN6_IS_ADDR_V4MAPPED(&cptr->local->ip);
|
||||
#endif /* INET6 */
|
||||
|
||||
/* FIXME */
|
||||
@@ -2798,15 +2798,15 @@ int AllowClient(aClient *cptr, struct hostent *hp, char *sockhost, char *usernam
|
||||
{
|
||||
if (
|
||||
#ifndef INET6
|
||||
acptr->ip.S_ADDR == cptr->ip.S_ADDR)
|
||||
acptr->local->ip.S_ADDR == cptr->local->ip.S_ADDR)
|
||||
#else
|
||||
/*
|
||||
* match IPv4 exactly and the ipv6
|
||||
* based on ipv6_clone_mask.
|
||||
*/
|
||||
(is_ipv4
|
||||
? !bcmp(acptr->ip.S_ADDR, cptr->ip.S_ADDR, sizeof(cptr->ip.S_ADDR))
|
||||
: match_ipv6(&acptr->ip, &cptr->ip, aconf->ipv6_clone_mask)))
|
||||
? !bcmp(acptr->local->ip.S_ADDR, cptr->local->ip.S_ADDR, sizeof(cptr->local->ip.S_ADDR))
|
||||
: match_ipv6(&acptr->local->ip, &cptr->local->ip, aconf->ipv6_clone_mask)))
|
||||
|
||||
#endif
|
||||
{
|
||||
@@ -2820,21 +2820,21 @@ int AllowClient(aClient *cptr, struct hostent *hp, char *sockhost, char *usernam
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((i = Auth_Check(cptr, aconf->auth, cptr->passwd)) == -1)
|
||||
if ((i = Auth_Check(cptr, aconf->auth, cptr->local->passwd)) == -1)
|
||||
{
|
||||
exit_client(cptr, cptr, &me,
|
||||
"Password mismatch");
|
||||
return -5;
|
||||
}
|
||||
if ((i == 2) && (cptr->passwd))
|
||||
if ((i == 2) && (cptr->local->passwd))
|
||||
{
|
||||
MyFree(cptr->passwd);
|
||||
cptr->passwd = NULL;
|
||||
MyFree(cptr->local->passwd);
|
||||
cptr->local->passwd = NULL;
|
||||
}
|
||||
if (!((aconf->class->clients + 1) > aconf->class->maxclients))
|
||||
{
|
||||
cptr->class = aconf->class;
|
||||
cptr->class->clients++;
|
||||
cptr->local->class = aconf->class;
|
||||
cptr->local->class->clients++;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2865,14 +2865,14 @@ ConfigItem_deny_channel *Find_channel_allowed(aClient *cptr, char *name)
|
||||
|
||||
for (dchannel = conf_deny_channel; dchannel; dchannel = (ConfigItem_deny_channel *)dchannel->next)
|
||||
{
|
||||
if (!match(dchannel->channel, name) && (dchannel->class ? !strcmp(cptr->class->name, dchannel->class) : 1))
|
||||
if (!match(dchannel->channel, name) && (dchannel->class ? !strcmp(cptr->local->class->name, dchannel->class) : 1))
|
||||
break;
|
||||
}
|
||||
if (dchannel)
|
||||
{
|
||||
for (achannel = conf_allow_channel; achannel; achannel = (ConfigItem_allow_channel *)achannel->next)
|
||||
{
|
||||
if (!match(achannel->channel, name) && (achannel->class ? !strcmp(cptr->class->name, achannel->class) : 1))
|
||||
if (!match(achannel->channel, name) && (achannel->class ? !strcmp(cptr->local->class->name, achannel->class) : 1))
|
||||
break;
|
||||
}
|
||||
if (achannel)
|
||||
|
||||
+2
-2
@@ -242,7 +242,7 @@ void send_usage(aClient *cptr, char *nick)
|
||||
return;
|
||||
}
|
||||
secs = rus.ru_utime.tv_sec + rus.ru_stime.tv_sec;
|
||||
rup = TStime() - me.since;
|
||||
rup = TStime() - me.local->since;
|
||||
if (secs == 0)
|
||||
secs = 1;
|
||||
|
||||
@@ -306,6 +306,6 @@ int checkprotoflags(aClient *sptr, int flags, char *file, int line)
|
||||
if (!MyConnect(sptr))
|
||||
ircd_log(LOG_ERROR, "[Debug] [BUG] ERROR: %s:%d: IsToken(<%s>,%d) on remote client",
|
||||
file, line, sptr->name, flags);
|
||||
return (sptr->proto & flags) ? 1 : 0;
|
||||
return (sptr->local->proto & flags) ? 1 : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
+24
-24
@@ -324,7 +324,7 @@ int check_registered(aClient *sptr)
|
||||
**
|
||||
** NOTE 1:
|
||||
** Watch out the allocation of "nbuf", if either sptr->name
|
||||
** or sptr->sockhost gets changed into pointers instead of
|
||||
** or sptr->local->sockhost gets changed into pointers instead of
|
||||
** directly allocated within the structure...
|
||||
**
|
||||
** NOTE 2:
|
||||
@@ -345,16 +345,16 @@ char *get_client_name(aClient *sptr, int showip)
|
||||
sptr->username,
|
||||
#ifdef INET6
|
||||
inetntop(AF_INET6,
|
||||
(char *)&sptr->ip, mydummy, MYDUMMY_SIZE),
|
||||
(char *)&sptr->local->ip, mydummy, MYDUMMY_SIZE),
|
||||
#else
|
||||
inetntoa((char *)&sptr->ip),
|
||||
inetntoa((char *)&sptr->local->ip),
|
||||
#endif
|
||||
(unsigned int)sptr->port);
|
||||
(unsigned int)sptr->local->port);
|
||||
else
|
||||
{
|
||||
if (mycmp(sptr->name, sptr->sockhost))
|
||||
if (mycmp(sptr->name, sptr->local->sockhost))
|
||||
(void)ircsnprintf(nbuf, sizeof(nbuf), "%s[%s]",
|
||||
sptr->name, sptr->sockhost);
|
||||
sptr->name, sptr->local->sockhost);
|
||||
else
|
||||
return sptr->name;
|
||||
}
|
||||
@@ -369,12 +369,12 @@ char *get_client_host(aClient *cptr)
|
||||
|
||||
if (!MyConnect(cptr))
|
||||
return cptr->name;
|
||||
if (!cptr->hostp)
|
||||
if (!cptr->local->hostp)
|
||||
return get_client_name(cptr, FALSE);
|
||||
(void)ircsnprintf(nbuf, sizeof(nbuf), "%s[%-.*s@%-.*s]",
|
||||
cptr->name, USERLEN,
|
||||
(!(cptr->flags & FLAGS_GOTID)) ? "" : cptr->username,
|
||||
HOSTLEN, cptr->hostp->h_name);
|
||||
HOSTLEN, cptr->local->hostp->h_name);
|
||||
return nbuf;
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ void get_sockhost(aClient *cptr, char *host)
|
||||
s++;
|
||||
else
|
||||
s = host;
|
||||
strlcpy(cptr->sockhost, s, sizeof(cptr->sockhost));
|
||||
strlcpy(cptr->local->sockhost, s, sizeof(cptr->local->sockhost));
|
||||
}
|
||||
|
||||
void remove_dcc_references(aClient *sptr)
|
||||
@@ -605,13 +605,13 @@ int exit_client(aClient *cptr, aClient *sptr, aClient *from, char *comment)
|
||||
|
||||
if (MyConnect(sptr))
|
||||
{
|
||||
if (sptr->class)
|
||||
if (sptr->local->class)
|
||||
{
|
||||
sptr->class->clients--;
|
||||
if ((sptr->class->flag.temporary) && !sptr->class->clients && !sptr->class->xrefcount)
|
||||
sptr->local->class->clients--;
|
||||
if ((sptr->local->class->flag.temporary) && !sptr->local->class->clients && !sptr->local->class->xrefcount)
|
||||
{
|
||||
delete_classblock(sptr->class);
|
||||
sptr->class = NULL;
|
||||
delete_classblock(sptr->local->class);
|
||||
sptr->local->class = NULL;
|
||||
}
|
||||
}
|
||||
if (IsClient(sptr))
|
||||
@@ -635,10 +635,10 @@ int exit_client(aClient *cptr, aClient *sptr, aClient *from, char *comment)
|
||||
ircd_log(LOG_SERVER, "SQUIT %s (%s)", sptr->name, comment);
|
||||
}
|
||||
free_pending_net(sptr);
|
||||
if (sptr->listener)
|
||||
if (sptr->listener && !IsOutgoing(sptr))
|
||||
if (sptr->local->listener)
|
||||
if (sptr->local->listener && !IsOutgoing(sptr))
|
||||
{
|
||||
listen_conf = sptr->listener;
|
||||
listen_conf = sptr->local->listener;
|
||||
listen_conf->clients--;
|
||||
if (listen_conf->flag.temporary && (listen_conf->clients == 0))
|
||||
{
|
||||
@@ -659,7 +659,7 @@ int exit_client(aClient *cptr, aClient *sptr, aClient *from, char *comment)
|
||||
free_str_list(sptr->user->lopt->nolist);
|
||||
MyFree(sptr->user->lopt);
|
||||
}
|
||||
on_for = TStime() - sptr->firsttime;
|
||||
on_for = TStime() - sptr->local->firsttime;
|
||||
if (IsHidden(sptr))
|
||||
ircd_log(LOG_CLIENT, "Disconnect - (%ld:%ld:%ld) %s!%s@%s [VHOST %s] (%s)",
|
||||
on_for / 3600, (on_for % 3600) / 60, on_for % 60,
|
||||
@@ -1109,20 +1109,20 @@ int unreal_mask_match(aClient *acptr, ConfigItem_mask *m)
|
||||
{
|
||||
/* is a person */
|
||||
strlcpy(nuhost, make_user_host(acptr->user->username, acptr->user->realhost), sizeof(nuhost));
|
||||
strlcpy(nuip, make_user_host(acptr->user->username, Inet_ia2pNB(&acptr->ip, 0)), sizeof(nuip));
|
||||
strlcpy(nuip2, make_user_host(acptr->user->username, Inet_ia2pNB(&acptr->ip, 1)), sizeof(nuip2));
|
||||
strlcpy(nuip, make_user_host(acptr->user->username, Inet_ia2pNB(&acptr->local->ip, 0)), sizeof(nuip));
|
||||
strlcpy(nuip2, make_user_host(acptr->user->username, Inet_ia2pNB(&acptr->local->ip, 1)), sizeof(nuip2));
|
||||
} else {
|
||||
/* is an unknown or a server */
|
||||
snprintf(nuhost, sizeof(nuhost), "%s@%s", acptr->username, acptr->sockhost);
|
||||
snprintf(nuip, sizeof(nuip), "%s@%s", acptr->username, Inet_ia2pNB(&acptr->ip, 0));
|
||||
snprintf(nuip2, sizeof(nuip2), "%s@%s", acptr->username, Inet_ia2pNB(&acptr->ip, 1));
|
||||
snprintf(nuhost, sizeof(nuhost), "%s@%s", acptr->username, acptr->local->sockhost);
|
||||
snprintf(nuip, sizeof(nuip), "%s@%s", acptr->username, Inet_ia2pNB(&acptr->local->ip, 0));
|
||||
snprintf(nuip2, sizeof(nuip2), "%s@%s", acptr->username, Inet_ia2pNB(&acptr->local->ip, 1));
|
||||
}
|
||||
|
||||
// wait.. if we use match_ip() we don't need both nuip & nuip2 ? better verify... (IPv4-IPv6 fun)
|
||||
|
||||
for (; m; m = m->next)
|
||||
{
|
||||
if (match_ip(acptr->ip, nuip, m->mask, m->netmask) || !match(m->mask, nuhost))
|
||||
if (match_ip(acptr->local->ip, nuip, m->mask, m->netmask) || !match(m->mask, nuhost))
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -304,7 +304,7 @@ char **text = unrealinfo;
|
||||
sendto_one(sptr, ":%s %d %s :Birth Date: %s, compile # %s", me.name,
|
||||
RPL_INFO, sptr->name, creation, generation);
|
||||
sendto_one(sptr, ":%s %d %s :On-line since %s", me.name, RPL_INFO,
|
||||
sptr->name, myctime(me.firsttime));
|
||||
sptr->name, myctime(me.local->firsttime));
|
||||
sendto_one(sptr, ":%s %d %s :ReleaseID (%s)", me.name, RPL_INFO,
|
||||
sptr->name, buildid);
|
||||
sendto_one(sptr, rpl_str(RPL_ENDOFINFO), me.name, sptr->name);
|
||||
@@ -351,7 +351,7 @@ CMD_FUNC(m_dalinfo)
|
||||
":%s %d %s :Birth Date: %s, compile # %s",
|
||||
me.name, RPL_INFO, sptr->name, creation, generation);
|
||||
sendto_one(sptr, ":%s %d %s :On-line since %s",
|
||||
me.name, RPL_INFO, sptr->name, myctime(me.firsttime));
|
||||
me.name, RPL_INFO, sptr->name, myctime(me.local->firsttime));
|
||||
sendto_one(sptr, rpl_str(RPL_ENDOFINFO), me.name, sptr->name);
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ CMD_FUNC(m_credits)
|
||||
":%s %d %s :Birth Date: %s, compile # %s",
|
||||
me.name, RPL_INFO, sptr->name, creation, generation);
|
||||
sendto_one(sptr, ":%s %d %s :On-line since %s",
|
||||
me.name, RPL_INFO, sptr->name, myctime(me.firsttime));
|
||||
me.name, RPL_INFO, sptr->name, myctime(me.local->firsttime));
|
||||
sendto_one(sptr, rpl_str(RPL_ENDOFINFO), me.name, sptr->name);
|
||||
}
|
||||
|
||||
|
||||
+14
-14
@@ -305,38 +305,38 @@ int check_for_target_limit(aClient *sptr, void *target, const char *name)
|
||||
|
||||
if (ValidatePermissionsForPath("immune:limits",sptr,NULL,NULL,NULL))
|
||||
return 0;
|
||||
if (sptr->targets[0] == hash)
|
||||
if (sptr->local->targets[0] == hash)
|
||||
return 0;
|
||||
|
||||
for (p = sptr->targets; p < &sptr->targets[MAXTARGETS - 1];)
|
||||
for (p = sptr->local->targets; p < &sptr->local->targets[MAXTARGETS - 1];)
|
||||
if (*++p == hash)
|
||||
{
|
||||
/* move targethash to first position... */
|
||||
memmove(&sptr->targets[1], &sptr->targets[0],
|
||||
p - sptr->targets);
|
||||
sptr->targets[0] = hash;
|
||||
memmove(&sptr->local->targets[1], &sptr->local->targets[0],
|
||||
p - sptr->local->targets);
|
||||
sptr->local->targets[0] = hash;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (TStime() < sptr->nexttarget)
|
||||
if (TStime() < sptr->local->nexttarget)
|
||||
{
|
||||
sptr->since += TARGET_DELAY; /* lag them up */
|
||||
sptr->nexttarget += TARGET_DELAY;
|
||||
sptr->local->since += TARGET_DELAY; /* lag them up */
|
||||
sptr->local->nexttarget += TARGET_DELAY;
|
||||
sendto_one(sptr, err_str(ERR_TARGETTOOFAST), me.name, sptr->name,
|
||||
name, sptr->nexttarget - TStime());
|
||||
name, sptr->local->nexttarget - TStime());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (TStime() > sptr->nexttarget + TARGET_DELAY*MAXTARGETS)
|
||||
if (TStime() > sptr->local->nexttarget + TARGET_DELAY*MAXTARGETS)
|
||||
{
|
||||
sptr->nexttarget = TStime() - TARGET_DELAY*MAXTARGETS;
|
||||
sptr->local->nexttarget = TStime() - TARGET_DELAY*MAXTARGETS;
|
||||
}
|
||||
|
||||
sptr->nexttarget += TARGET_DELAY;
|
||||
sptr->local->nexttarget += TARGET_DELAY;
|
||||
|
||||
memmove(&sptr->targets[1], &sptr->targets[0], MAXTARGETS - 1);
|
||||
sptr->targets[0] = hash;
|
||||
memmove(&sptr->local->targets[1], &sptr->local->targets[0], MAXTARGETS - 1);
|
||||
sptr->local->targets[0] = hash;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
+39
-39
@@ -72,10 +72,10 @@ int dead_link(aClient *to, char *notice)
|
||||
* If because of BUFFERPOOL problem then clean dbuf's now so that
|
||||
* notices don't hurt operators below.
|
||||
*/
|
||||
DBufClear(&to->recvQ);
|
||||
DBufClear(&to->sendQ);
|
||||
DBufClear(&to->local->recvQ);
|
||||
DBufClear(&to->local->sendQ);
|
||||
|
||||
if ((to->flags & FLAGS_DEADSOCKET) && to->error_str)
|
||||
if ((to->flags & FLAGS_DEADSOCKET) && to->local->error_str)
|
||||
return -1; /* already pending to be closed */
|
||||
|
||||
to->flags |= FLAGS_DEADSOCKET;
|
||||
@@ -84,7 +84,7 @@ int dead_link(aClient *to, char *notice)
|
||||
sendto_umode(UMODE_OPER, "Closing link: %s - %s",
|
||||
notice, get_client_name(to, FALSE));
|
||||
Debug((DEBUG_ERROR, "dead_link: %s - %s", notice, get_client_name(to, FALSE)));
|
||||
to->error_str = strdup(notice);
|
||||
to->local->error_str = strdup(notice);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -129,9 +129,9 @@ int send_queued(aClient *to)
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (DBufLength(&to->sendQ) > 0)
|
||||
while (DBufLength(&to->local->sendQ) > 0)
|
||||
{
|
||||
block = container_of(to->sendQ.dbuf_list.next, dbufbuf, dbuf_node);
|
||||
block = container_of(to->local->sendQ.dbuf_list.next, dbufbuf, dbuf_node);
|
||||
len = block->size;
|
||||
|
||||
/* Returns always len > 0 */
|
||||
@@ -141,8 +141,8 @@ int send_queued(aClient *to)
|
||||
snprintf(buf, 256, "Write error: %s", STRERROR(ERRNO));
|
||||
return dead_link(to, buf);
|
||||
}
|
||||
(void)dbuf_delete(&to->sendQ, rlen);
|
||||
to->lastsq = DBufLength(&to->sendQ) / 1024;
|
||||
(void)dbuf_delete(&to->local->sendQ, rlen);
|
||||
to->local->lastsq = DBufLength(&to->local->sendQ) / 1024;
|
||||
if (rlen < block->size)
|
||||
{
|
||||
/* incomplete write due to EWOULDBLOCK, reschedule */
|
||||
@@ -152,7 +152,7 @@ int send_queued(aClient *to)
|
||||
}
|
||||
|
||||
/* Nothing left to write, stop asking for write-ready notification. */
|
||||
if ((DBufLength(&to->sendQ) == 0) && (to->fd >= 0))
|
||||
if ((DBufLength(&to->local->sendQ) == 0) && (to->fd >= 0))
|
||||
fd_setselect(to->fd, FD_SELECT_NOWRITE, NULL, to);
|
||||
|
||||
return (IsDead(to)) ? -1 : 0;
|
||||
@@ -246,27 +246,27 @@ void sendbufto_one(aClient *to, char *msg, unsigned int quick)
|
||||
(*(h->func.intfunc))(&me, to, &msg, &len);
|
||||
if(!msg) return;
|
||||
}
|
||||
if (DBufLength(&to->sendQ) > get_sendq(to))
|
||||
if (DBufLength(&to->local->sendQ) > get_sendq(to))
|
||||
{
|
||||
if (IsServer(to))
|
||||
sendto_ops("Max SendQ limit exceeded for %s: %u > %d",
|
||||
get_client_name(to, FALSE), DBufLength(&to->sendQ),
|
||||
get_client_name(to, FALSE), DBufLength(&to->local->sendQ),
|
||||
get_sendq(to));
|
||||
dead_link(to, "Max SendQ exceeded");
|
||||
return;
|
||||
}
|
||||
|
||||
dbuf_put(&to->sendQ, msg, len);
|
||||
dbuf_put(&to->local->sendQ, msg, len);
|
||||
|
||||
/*
|
||||
* Update statistics. The following is slightly incorrect
|
||||
* because it counts messages even if queued, but bytes
|
||||
* only really sent. Queued bytes get updated in SendQueued.
|
||||
*/
|
||||
to->sendM += 1;
|
||||
me.sendM += 1;
|
||||
to->local->sendM += 1;
|
||||
me.local->sendM += 1;
|
||||
|
||||
if (DBufLength(&to->sendQ) > 0)
|
||||
if (DBufLength(&to->local->sendQ) > 0)
|
||||
send_queued(to);
|
||||
}
|
||||
|
||||
@@ -287,9 +287,9 @@ void sendto_channel_butone(aClient *one, aClient *from, aChannel *chptr,
|
||||
continue;
|
||||
if (MyConnect(acptr)) /* (It is always a client) */
|
||||
vsendto_prefix_one(acptr, from, pattern, vl);
|
||||
else if (acptr->from->serial != current_serial)
|
||||
else if (acptr->from->local->serial != current_serial)
|
||||
{
|
||||
acptr->from->serial = current_serial;
|
||||
acptr->from->local->serial = current_serial;
|
||||
/*
|
||||
* Burst messages comes here..
|
||||
*/
|
||||
@@ -319,9 +319,9 @@ void sendto_channel_butone_with_capability(aClient *one, unsigned int cap,
|
||||
continue;
|
||||
if (MyConnect(acptr)) /* (It is always a client) */
|
||||
vsendto_prefix_one(acptr, from, pattern, vl);
|
||||
else if (acptr->from->serial != current_serial)
|
||||
else if (acptr->from->local->serial != current_serial)
|
||||
{
|
||||
acptr->from->serial = current_serial;
|
||||
acptr->from->local->serial = current_serial;
|
||||
/*
|
||||
* Burst messages comes here..
|
||||
*/
|
||||
@@ -386,7 +386,7 @@ good:
|
||||
{
|
||||
/* Now check whether a message has been sent to this
|
||||
* remote link already */
|
||||
if (acptr->from->serial != current_serial)
|
||||
if (acptr->from->local->serial != current_serial)
|
||||
{
|
||||
#ifdef SECURECHANMSGSONLYGOTOSECURE
|
||||
for (h = Hooks[HOOKTYPE_CAN_SEND_SECURE]; h; h = h->next)
|
||||
@@ -403,7 +403,7 @@ good:
|
||||
vsendto_prefix_one(acptr, from, pattern, vl);
|
||||
va_end(vl);
|
||||
|
||||
acptr->from->serial = current_serial;
|
||||
acptr->from->local->serial = current_serial;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -508,15 +508,15 @@ void sendto_common_channels(aClient *user, char *pattern, ...)
|
||||
|
||||
++current_serial;
|
||||
if (MyConnect(user))
|
||||
user->serial = current_serial;
|
||||
user->local->serial = current_serial;
|
||||
if (user->user)
|
||||
for (channels = user->user->channel; channels; channels = channels->next)
|
||||
for (users = channels->chptr->members; users; users = users->next)
|
||||
{
|
||||
cptr = users->cptr;
|
||||
if (!MyConnect(cptr) || (cptr->serial == current_serial))
|
||||
if (!MyConnect(cptr) || (cptr->local->serial == current_serial))
|
||||
continue;
|
||||
cptr->serial = current_serial;
|
||||
cptr->local->serial = current_serial;
|
||||
sendbufto_one(cptr, sendbuf, sendlen);
|
||||
}
|
||||
|
||||
@@ -549,17 +549,17 @@ void sendto_common_channels_local_butone(aClient *user, int cap, char *pattern,
|
||||
|
||||
++current_serial;
|
||||
if (MyConnect(user))
|
||||
user->serial = current_serial;
|
||||
user->local->serial = current_serial;
|
||||
if (user->user)
|
||||
{
|
||||
for (channels = user->user->channel; channels; channels = channels->next)
|
||||
for (users = channels->chptr->members; users; users = users->next)
|
||||
{
|
||||
cptr = users->cptr;
|
||||
if (!MyConnect(cptr) || (cptr->serial == current_serial) ||
|
||||
if (!MyConnect(cptr) || (cptr->local->serial == current_serial) ||
|
||||
!CHECKPROTO(cptr, cap))
|
||||
continue;
|
||||
cptr->serial = current_serial;
|
||||
cptr->local->serial = current_serial;
|
||||
sendbufto_one(cptr, sendbuf, sendlen);
|
||||
}
|
||||
}
|
||||
@@ -1009,11 +1009,11 @@ void sendto_ops_butone(aClient *one, aClient *from, char *pattern, ...)
|
||||
{
|
||||
if (!SendWallops(cptr))
|
||||
continue;
|
||||
if (cptr->from->serial == current_serial) /* sent message along it already ? */
|
||||
if (cptr->from->local->serial == current_serial) /* sent message along it already ? */
|
||||
continue;
|
||||
if (cptr->from == one)
|
||||
continue; /* ...was the one I should skip */
|
||||
cptr->from->serial = current_serial;
|
||||
cptr->from->local->serial = current_serial;
|
||||
|
||||
va_start(vl, pattern);
|
||||
vsendto_prefix_one(cptr->from, from, pattern, vl);
|
||||
@@ -1039,11 +1039,11 @@ void sendto_opers_butone(aClient *one, aClient *from, char *pattern, ...)
|
||||
{
|
||||
if (!IsOper(cptr))
|
||||
continue;
|
||||
if (cptr->from->serial == current_serial) /* sent message along it already ? */
|
||||
if (cptr->from->local->serial == current_serial) /* sent message along it already ? */
|
||||
continue;
|
||||
if (cptr->from == one)
|
||||
continue; /* ...was the one I should skip */
|
||||
cptr->from->serial = current_serial;
|
||||
cptr->from->local->serial = current_serial;
|
||||
|
||||
va_start(vl, pattern);
|
||||
vsendto_prefix_one(cptr->from, from, pattern, vl);
|
||||
@@ -1067,11 +1067,11 @@ void sendto_ops_butme(aClient *from, char *pattern, ...)
|
||||
{
|
||||
if (!SendWallops(cptr))
|
||||
continue;
|
||||
if (cptr->from->serial == current_serial) /* sent message along it already ? */
|
||||
if (cptr->from->local->serial == current_serial) /* sent message along it already ? */
|
||||
continue;
|
||||
if (!strcmp(cptr->user->server, me.name)) /* a locop */
|
||||
continue;
|
||||
cptr->from->serial = current_serial;
|
||||
cptr->from->local->serial = current_serial;
|
||||
|
||||
va_start(vl, pattern);
|
||||
vsendto_prefix_one(cptr->from, from, pattern, vl);
|
||||
@@ -1206,22 +1206,22 @@ void sendto_connectnotice(char *nick, anUser *user, aClient *sptr, int disconnec
|
||||
RunHook(HOOKTYPE_LOCAL_CONNECT, sptr);
|
||||
ircsnprintf(connectd, sizeof(connectd),
|
||||
"*** Notice -- Client connecting on port %d: %s (%s@%s) [%s] %s%s%s",
|
||||
sptr->listener->port, nick, user->username, user->realhost,
|
||||
sptr->class ? sptr->class->name : "",
|
||||
sptr->local->listener->port, nick, user->username, user->realhost,
|
||||
sptr->local->class ? sptr->local->class->name : "",
|
||||
IsSecure(sptr) ? "[secure " : "",
|
||||
IsSecure(sptr) ? SSL_get_cipher(sptr->ssl) : "",
|
||||
IsSecure(sptr) ? SSL_get_cipher(sptr->local->ssl) : "",
|
||||
IsSecure(sptr) ? "]" : "");
|
||||
ircsnprintf(connecth, sizeof(connecth),
|
||||
"*** Notice -- Client connecting: %s (%s@%s) [%s] {%s}", nick,
|
||||
user->username, user->realhost, Inet_ia2p(&sptr->ip),
|
||||
sptr->class ? sptr->class->name : "0");
|
||||
user->username, user->realhost, Inet_ia2p(&sptr->local->ip),
|
||||
sptr->local->class ? sptr->local->class->name : "0");
|
||||
}
|
||||
else
|
||||
{
|
||||
ircsnprintf(connectd, sizeof(connectd), "*** Notice -- Client exiting: %s (%s@%s) [%s]",
|
||||
nick, user->username, user->realhost, comment);
|
||||
ircsnprintf(connecth, sizeof(connecth), "*** Notice -- Client exiting: %s (%s@%s) [%s] [%s]",
|
||||
nick, user->username, user->realhost, comment, Inet_ia2p(&sptr->ip));
|
||||
nick, user->username, user->realhost, comment, Inet_ia2p(&sptr->local->ip));
|
||||
}
|
||||
|
||||
list_for_each_entry(cptr, &oper_list, special_node)
|
||||
|
||||
+11
-11
@@ -71,13 +71,13 @@ int deliver_it(aClient *cptr, char *str, int len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (IsSSL(cptr) && cptr->ssl != NULL)
|
||||
if (IsSSL(cptr) && cptr->local->ssl != NULL)
|
||||
{
|
||||
retval = SSL_write(cptr->ssl, str, len);
|
||||
retval = SSL_write(cptr->local->ssl, str, len);
|
||||
|
||||
if (retval < 0)
|
||||
{
|
||||
switch (SSL_get_error(cptr->ssl, retval))
|
||||
switch (SSL_get_error(cptr->local->ssl, retval))
|
||||
{
|
||||
case SSL_ERROR_WANT_READ:
|
||||
/* retry later */
|
||||
@@ -116,17 +116,17 @@ int deliver_it(aClient *cptr, char *str, int len)
|
||||
|
||||
if (retval > 0)
|
||||
{
|
||||
cptr->sendB += retval;
|
||||
me.sendB += retval;
|
||||
if (cptr->sendB > 1023)
|
||||
cptr->local->sendB += retval;
|
||||
me.local->sendB += retval;
|
||||
if (cptr->local->sendB > 1023)
|
||||
{
|
||||
cptr->sendK += (cptr->sendB >> 10);
|
||||
cptr->sendB &= 0x03ff; /* 2^10 = 1024, 3ff = 1023 */
|
||||
cptr->local->sendK += (cptr->local->sendB >> 10);
|
||||
cptr->local->sendB &= 0x03ff; /* 2^10 = 1024, 3ff = 1023 */
|
||||
}
|
||||
if (me.sendB > 1023)
|
||||
if (me.local->sendB > 1023)
|
||||
{
|
||||
me.sendK += (me.sendB >> 10);
|
||||
me.sendB &= 0x03ff;
|
||||
me.local->sendK += (me.local->sendB >> 10);
|
||||
me.local->sendB &= 0x03ff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -414,9 +414,9 @@ int ssl_handshake(aClient *cptr)
|
||||
return -1;
|
||||
}
|
||||
|
||||
cptr->ssl = SSL_new(ctx_server);
|
||||
CHK_NULL(cptr->ssl);
|
||||
SSL_set_fd(cptr->ssl, cptr->fd);
|
||||
cptr->local->ssl = SSL_new(ctx_server);
|
||||
CHK_NULL(cptr->local->ssl);
|
||||
SSL_set_fd(cptr->local->ssl, cptr->fd);
|
||||
set_non_blocking(cptr->fd, cptr);
|
||||
/*
|
||||
* if necessary, SSL_write() will negotiate a TLS/SSL session, if not already explicitly
|
||||
@@ -426,10 +426,10 @@ int ssl_handshake(aClient *cptr)
|
||||
*
|
||||
*/
|
||||
if (!ircd_SSL_accept(cptr, cptr->fd)) {
|
||||
SSL_set_shutdown(cptr->ssl, SSL_RECEIVED_SHUTDOWN);
|
||||
SSL_smart_shutdown(cptr->ssl);
|
||||
SSL_free(cptr->ssl);
|
||||
cptr->ssl = NULL;
|
||||
SSL_set_shutdown(cptr->local->ssl, SSL_RECEIVED_SHUTDOWN);
|
||||
SSL_smart_shutdown(cptr->local->ssl);
|
||||
SSL_free(cptr->local->ssl);
|
||||
cptr->local->ssl = NULL;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -448,19 +448,19 @@ int ssl_handshake(aClient *cptr)
|
||||
*/
|
||||
int ssl_client_handshake(aClient *cptr, ConfigItem_link *l)
|
||||
{
|
||||
cptr->ssl = SSL_new((SSL_CTX *)ctx_client);
|
||||
if (!cptr->ssl)
|
||||
cptr->local->ssl = SSL_new((SSL_CTX *)ctx_client);
|
||||
if (!cptr->local->ssl)
|
||||
{
|
||||
sendto_realops("Couldn't SSL_new(ctx_client) on %s",
|
||||
get_client_name(cptr, FALSE));
|
||||
return -1;
|
||||
}
|
||||
/* set_blocking(cptr->fd); */
|
||||
SSL_set_fd(cptr->ssl, cptr->fd);
|
||||
SSL_set_connect_state(cptr->ssl);
|
||||
SSL_set_fd(cptr->local->ssl, cptr->fd);
|
||||
SSL_set_connect_state(cptr->local->ssl);
|
||||
if (l && l->ciphers)
|
||||
{
|
||||
if (SSL_set_cipher_list(cptr->ssl, l->ciphers) == 0)
|
||||
if (SSL_set_cipher_list(cptr->local->ssl, l->ciphers) == 0)
|
||||
{
|
||||
/* We abort */
|
||||
sendto_realops("SSL cipher selecting for %s was unsuccesful (%s)",
|
||||
@@ -468,7 +468,7 @@ int ssl_client_handshake(aClient *cptr, ConfigItem_link *l)
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
if (SSL_connect(cptr->ssl) <= 0)
|
||||
if (SSL_connect(cptr->local->ssl) <= 0)
|
||||
{
|
||||
#if 0
|
||||
sendto_realops("Couldn't SSL_connect");
|
||||
@@ -523,29 +523,29 @@ void ircd_SSL_client_handshake(int fd, int revents, void *data)
|
||||
return;
|
||||
}
|
||||
|
||||
acptr->ssl = SSL_new(ctx_client);
|
||||
if (!acptr->ssl)
|
||||
acptr->local->ssl = SSL_new(ctx_client);
|
||||
if (!acptr->local->ssl)
|
||||
{
|
||||
sendto_realops("Failed to SSL_new(ctx_client)");
|
||||
return;
|
||||
}
|
||||
SSL_set_fd(acptr->ssl, acptr->fd);
|
||||
SSL_set_connect_state(acptr->ssl);
|
||||
SSL_set_nonblocking(acptr->ssl);
|
||||
SSL_set_fd(acptr->local->ssl, acptr->fd);
|
||||
SSL_set_connect_state(acptr->local->ssl);
|
||||
SSL_set_nonblocking(acptr->local->ssl);
|
||||
if (iConf.ssl_renegotiate_bytes > 0)
|
||||
{
|
||||
BIO_set_ssl_renegotiate_bytes(SSL_get_rbio(acptr->ssl), iConf.ssl_renegotiate_bytes);
|
||||
BIO_set_ssl_renegotiate_bytes(SSL_get_wbio(acptr->ssl), iConf.ssl_renegotiate_bytes);
|
||||
BIO_set_ssl_renegotiate_bytes(SSL_get_rbio(acptr->local->ssl), iConf.ssl_renegotiate_bytes);
|
||||
BIO_set_ssl_renegotiate_bytes(SSL_get_wbio(acptr->local->ssl), iConf.ssl_renegotiate_bytes);
|
||||
}
|
||||
if (iConf.ssl_renegotiate_timeout > 0)
|
||||
{
|
||||
BIO_set_ssl_renegotiate_timeout(SSL_get_rbio(acptr->ssl), iConf.ssl_renegotiate_timeout);
|
||||
BIO_set_ssl_renegotiate_timeout(SSL_get_wbio(acptr->ssl), iConf.ssl_renegotiate_timeout);
|
||||
BIO_set_ssl_renegotiate_timeout(SSL_get_rbio(acptr->local->ssl), iConf.ssl_renegotiate_timeout);
|
||||
BIO_set_ssl_renegotiate_timeout(SSL_get_wbio(acptr->local->ssl), iConf.ssl_renegotiate_timeout);
|
||||
}
|
||||
|
||||
if (acptr->serv && acptr->serv->conf->ciphers)
|
||||
{
|
||||
if (SSL_set_cipher_list(acptr->ssl,
|
||||
if (SSL_set_cipher_list(acptr->local->ssl,
|
||||
acptr->serv->conf->ciphers) == 0)
|
||||
{
|
||||
/* We abort */
|
||||
@@ -605,9 +605,9 @@ int ircd_SSL_accept(aClient *acptr, int fd) {
|
||||
acptr->flags |= FLAGS_NCALL;
|
||||
}
|
||||
#endif
|
||||
if ((ssl_err = SSL_accept(acptr->ssl)) <= 0)
|
||||
if ((ssl_err = SSL_accept(acptr->local->ssl)) <= 0)
|
||||
{
|
||||
switch(ssl_err = SSL_get_error(acptr->ssl, ssl_err))
|
||||
switch(ssl_err = SSL_get_error(acptr->local->ssl, ssl_err))
|
||||
{
|
||||
case SSL_ERROR_SYSCALL:
|
||||
if (ERRNO == P_EINTR || ERRNO == P_EWOULDBLOCK || ERRNO == P_EAGAIN)
|
||||
@@ -644,9 +644,9 @@ static void ircd_SSL_connect_retry(int fd, int revents, void *data)
|
||||
int ircd_SSL_connect(aClient *acptr, int fd) {
|
||||
|
||||
int ssl_err;
|
||||
if((ssl_err = SSL_connect(acptr->ssl)) <= 0)
|
||||
if((ssl_err = SSL_connect(acptr->local->ssl)) <= 0)
|
||||
{
|
||||
ssl_err = SSL_get_error(acptr->ssl, ssl_err);
|
||||
ssl_err = SSL_get_error(acptr->local->ssl, ssl_err);
|
||||
switch(ssl_err)
|
||||
{
|
||||
case SSL_ERROR_SYSCALL:
|
||||
@@ -772,10 +772,10 @@ static int fatal_ssl_error(int ssl_error, int where, int my_errno, aClient *sptr
|
||||
if (errtmp)
|
||||
{
|
||||
SET_ERRNO(errtmp);
|
||||
sptr->error_str = strdup(strerror(errtmp));
|
||||
sptr->local->error_str = strdup(strerror(errtmp));
|
||||
} else {
|
||||
SET_ERRNO(P_EIO);
|
||||
sptr->error_str = strdup(ssl_errstr);
|
||||
sptr->local->error_str = strdup(ssl_errstr);
|
||||
}
|
||||
|
||||
/* deregister I/O notification since we don't care anymore. the actual closing of socket will happen later. */
|
||||
@@ -787,20 +787,20 @@ static int fatal_ssl_error(int ssl_error, int where, int my_errno, aClient *sptr
|
||||
|
||||
int client_starttls(aClient *acptr)
|
||||
{
|
||||
if ((acptr->ssl = SSL_new(ctx_client)) == NULL)
|
||||
if ((acptr->local->ssl = SSL_new(ctx_client)) == NULL)
|
||||
goto fail_starttls;
|
||||
|
||||
acptr->flags |= FLAGS_SSL;
|
||||
|
||||
SSL_set_fd(acptr->ssl, acptr->fd);
|
||||
SSL_set_nonblocking(acptr->ssl);
|
||||
SSL_set_fd(acptr->local->ssl, acptr->fd);
|
||||
SSL_set_nonblocking(acptr->local->ssl);
|
||||
|
||||
if (ircd_SSL_connect(acptr, acptr->fd) < 0)
|
||||
{
|
||||
Debug((DEBUG_DEBUG, "Failed SSL connect handshake in instance 1: %s", acptr->name));
|
||||
SSL_set_shutdown(acptr->ssl, SSL_RECEIVED_SHUTDOWN);
|
||||
SSL_smart_shutdown(acptr->ssl);
|
||||
SSL_free(acptr->ssl);
|
||||
SSL_set_shutdown(acptr->local->ssl, SSL_RECEIVED_SHUTDOWN);
|
||||
SSL_smart_shutdown(acptr->local->ssl);
|
||||
SSL_free(acptr->local->ssl);
|
||||
goto fail_starttls;
|
||||
}
|
||||
|
||||
@@ -809,7 +809,7 @@ int client_starttls(aClient *acptr)
|
||||
fail_starttls:
|
||||
/* Failure */
|
||||
sendto_one(acptr, err_str(ERR_STARTTLS), me.name, !BadPtr(acptr->name) ? acptr->name : "*", "STARTTLS failed");
|
||||
acptr->ssl = NULL;
|
||||
acptr->local->ssl = NULL;
|
||||
acptr->flags &= ~FLAGS_SSL;
|
||||
SetUnknown(acptr);
|
||||
return 0; /* hm. we allow to continue anyway. not sure if we want that. */
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ VOID WINAPI IRCDCtrlHandler(DWORD opcode)
|
||||
} */
|
||||
unload_all_modules();
|
||||
/* for (i = LastSlot; i >= 0; i--)
|
||||
if ((acptr = local[i]) && DBufLength(&acptr->sendQ) > 0)
|
||||
if ((acptr = local[i]) && DBufLength(&acptr->local->sendQ) > 0)
|
||||
(void)send_queued(acptr); */
|
||||
SetServiceStop(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user