23 |
|
*/ |
24 |
|
|
25 |
|
#include "stdinc.h" |
26 |
< |
#include "tools.h" |
26 |
> |
#include "list.h" |
27 |
|
#include "client.h" |
28 |
|
#include "channel_mode.h" |
29 |
– |
#include "common.h" |
29 |
|
#include "event.h" |
30 |
|
#include "fdlist.h" |
31 |
|
#include "hash.h" |
32 |
|
#include "irc_string.h" |
34 |
– |
#include "sprintf_irc.h" |
33 |
|
#include "ircd.h" |
36 |
– |
#include "list.h" |
34 |
|
#include "s_gline.h" |
35 |
|
#include "numeric.h" |
36 |
|
#include "packet.h" |
37 |
|
#include "s_auth.h" |
38 |
|
#include "s_bsd.h" |
39 |
< |
#include "s_conf.h" |
40 |
< |
#include "s_log.h" |
39 |
> |
#include "conf.h" |
40 |
> |
#include "log.h" |
41 |
|
#include "s_misc.h" |
42 |
|
#include "s_serv.h" |
43 |
|
#include "send.h" |
50 |
|
#include "listener.h" |
51 |
|
#include "irc_res.h" |
52 |
|
#include "userhost.h" |
53 |
+ |
#include "watch.h" |
54 |
|
|
55 |
|
dlink_list listing_client_list = { NULL, NULL, 0 }; |
56 |
|
/* Pointer to beginning of Client list */ |
74 |
|
|
75 |
|
static void check_pings_list(dlink_list *); |
76 |
|
static void check_unknowns_list(void); |
77 |
< |
static void ban_them(struct Client *client_p, struct ConfItem *conf); |
77 |
> |
static void ban_them(struct Client *, struct ConfItem *); |
78 |
|
|
79 |
|
|
80 |
|
/* init_client() |
116 |
|
|
117 |
|
if (from == NULL) |
118 |
|
{ |
119 |
< |
client_p->from = client_p; /* 'from' of local client is self! */ |
120 |
< |
client_p->since = client_p->lasttime = client_p->firsttime = CurrentTime; |
119 |
> |
client_p->from = client_p; /* 'from' of local client is self! */ |
120 |
> |
client_p->localClient = BlockHeapAlloc(lclient_heap); |
121 |
> |
client_p->localClient->since = CurrentTime; |
122 |
> |
client_p->localClient->lasttime = CurrentTime; |
123 |
> |
client_p->localClient->firsttime = CurrentTime; |
124 |
> |
client_p->localClient->registration = REG_INIT; |
125 |
|
|
124 |
– |
client_p->localClient = BlockHeapAlloc(lclient_heap); |
126 |
|
/* as good a place as any... */ |
127 |
< |
dlinkAdd(client_p, make_dlink_node(), &unknown_list); |
127 |
> |
dlinkAdd(client_p, &client_p->localClient->lclient_node, &unknown_list); |
128 |
|
} |
129 |
|
else |
130 |
|
client_p->from = from; /* 'from' of local client is self! */ |
149 |
|
assert(client_p != NULL); |
150 |
|
assert(client_p != &me); |
151 |
|
assert(client_p->hnext == client_p); |
151 |
– |
assert(client_p->invited.head == NULL); |
152 |
|
assert(client_p->channel.head == NULL); |
153 |
– |
assert(dlink_list_length(&client_p->invited) == 0); |
153 |
|
assert(dlink_list_length(&client_p->channel) == 0); |
154 |
|
|
155 |
|
MyFree(client_p->away); |
157 |
|
|
158 |
|
if (MyConnect(client_p)) |
159 |
|
{ |
160 |
+ |
assert(client_p->localClient->invited.head == NULL); |
161 |
+ |
assert(dlink_list_length(&client_p->localClient->invited) == 0); |
162 |
|
assert(IsClosing(client_p) && IsDead(client_p)); |
163 |
|
|
164 |
|
MyFree(client_p->localClient->response); |
253 |
|
continue; |
254 |
|
} |
255 |
|
|
255 |
– |
if (GlobalSetOptions.idletime && IsClient(client_p)) |
256 |
– |
{ |
257 |
– |
if (!IsExemptKline(client_p) && !IsOper(client_p) && |
258 |
– |
!IsIdlelined(client_p) && |
259 |
– |
((CurrentTime - client_p->localClient->last) > GlobalSetOptions.idletime)) |
260 |
– |
{ |
261 |
– |
struct ConfItem *conf; |
262 |
– |
struct AccessItem *aconf; |
263 |
– |
|
264 |
– |
conf = make_conf_item(KLINE_TYPE); |
265 |
– |
aconf = (struct AccessItem *)map_to_conf(conf); |
266 |
– |
|
267 |
– |
DupString(aconf->host, client_p->host); |
268 |
– |
DupString(aconf->reason, "idle exceeder"); |
269 |
– |
DupString(aconf->user, client_p->username); |
270 |
– |
aconf->hold = CurrentTime + 60; |
271 |
– |
add_temp_line(conf); |
272 |
– |
|
273 |
– |
sendto_realops_flags(UMODE_ALL, L_ALL, |
274 |
– |
"Idle time limit exceeded for %s - temp k-lining", |
275 |
– |
get_client_name(client_p, HIDE_IP)); |
276 |
– |
exit_client(client_p, &me, aconf->reason); |
277 |
– |
continue; |
278 |
– |
} |
279 |
– |
} |
280 |
– |
|
256 |
|
if (!IsRegistered(client_p)) |
257 |
|
ping = CONNECTTIMEOUT, pingwarn = 0; |
258 |
|
else |
259 |
|
ping = get_client_ping(client_p, &pingwarn); |
260 |
|
|
261 |
< |
if (ping < CurrentTime - client_p->lasttime) |
261 |
> |
if (ping < CurrentTime - client_p->localClient->lasttime) |
262 |
|
{ |
263 |
|
if (!IsPingSent(client_p)) |
264 |
|
{ |
269 |
|
*/ |
270 |
|
SetPingSent(client_p); |
271 |
|
ClearPingWarning(client_p); |
272 |
< |
client_p->lasttime = CurrentTime - ping; |
272 |
> |
client_p->localClient->lasttime = CurrentTime - ping; |
273 |
|
sendto_one(client_p, "PING :%s", ID_or_name(&me, client_p)); |
274 |
|
} |
275 |
|
else |
276 |
|
{ |
277 |
< |
if (CurrentTime - client_p->lasttime >= 2 * ping) |
277 |
> |
if (CurrentTime - client_p->localClient->lasttime >= 2 * ping) |
278 |
|
{ |
279 |
|
/* |
280 |
|
* If the client/server hasn't talked to us in 2*ping seconds |
288 |
|
sendto_realops_flags(UMODE_ALL, L_OPER, |
289 |
|
"No response from %s, closing link", |
290 |
|
get_client_name(client_p, MASK_IP)); |
291 |
< |
ilog(L_NOTICE, "No response from %s, closing link", |
291 |
> |
ilog(LOG_TYPE_IRCD, "No response from %s, closing link", |
292 |
|
get_client_name(client_p, HIDE_IP)); |
293 |
|
} |
319 |
– |
ircsprintf(scratch, "Ping timeout: %d seconds", |
320 |
– |
(int)(CurrentTime - client_p->lasttime)); |
294 |
|
|
295 |
+ |
snprintf(scratch, sizeof(scratch), "Ping timeout: %d seconds", |
296 |
+ |
(int)(CurrentTime - client_p->localClient->lasttime)); |
297 |
|
exit_client(client_p, &me, scratch); |
298 |
|
} |
299 |
|
else if (!IsPingWarning(client_p) && pingwarn > 0 && |
300 |
|
(IsServer(client_p) || IsHandshake(client_p)) && |
301 |
< |
CurrentTime - client_p->lasttime >= ping + pingwarn) |
301 |
> |
CurrentTime - client_p->localClient->lasttime >= ping + pingwarn) |
302 |
|
{ |
303 |
|
/* |
304 |
|
* If the server hasn't replied in pingwarn seconds after sending |
311 |
|
sendto_realops_flags(UMODE_ALL, L_OPER, |
312 |
|
"Warning, no response from %s in %d seconds", |
313 |
|
get_client_name(client_p, MASK_IP), pingwarn); |
314 |
< |
ilog(L_NOTICE, "No response from %s in %d seconds", |
314 |
> |
ilog(LOG_TYPE_IRCD, "No response from %s in %d seconds", |
315 |
|
get_client_name(client_p, HIDE_IP), pingwarn); |
316 |
|
} |
317 |
|
} |
337 |
|
if (client_p->localClient->reject_delay > 0) |
338 |
|
{ |
339 |
|
if (client_p->localClient->reject_delay <= CurrentTime) |
340 |
< |
exit_client(client_p, &me, "Rejected"); |
340 |
> |
exit_client(client_p, &me, "Rejected"); |
341 |
|
continue; |
342 |
|
} |
343 |
|
|
344 |
< |
/* Check UNKNOWN connections - if they have been in this state |
344 |
> |
/* |
345 |
> |
* Check UNKNOWN connections - if they have been in this state |
346 |
|
* for > 30s, close them. |
347 |
|
*/ |
348 |
< |
if (client_p->firsttime ? ((CurrentTime - client_p->firsttime) > 30) : 0) |
349 |
< |
exit_client(client_p, &me, "Connection timed out"); |
348 |
> |
if (IsAuthFinished(client_p) && (CurrentTime - client_p->localClient->firsttime) > 30) |
349 |
> |
exit_client(client_p, &me, "Registration timed out"); |
350 |
|
} |
351 |
|
} |
352 |
|
|
528 |
|
static void |
529 |
|
update_client_exit_stats(struct Client *client_p) |
530 |
|
{ |
531 |
< |
if (IsServer(client_p)) |
556 |
< |
{ |
557 |
< |
sendto_realops_flags(UMODE_EXTERNAL, L_ALL, |
558 |
< |
"Server %s split from %s", |
559 |
< |
client_p->name, client_p->servptr->name); |
560 |
< |
} |
561 |
< |
else if (IsClient(client_p)) |
531 |
> |
if (IsClient(client_p)) |
532 |
|
{ |
533 |
+ |
assert(Count.total > 0); |
534 |
|
--Count.total; |
535 |
< |
if (IsOper(client_p)) |
535 |
> |
if (HasUMode(client_p, UMODE_OPER)) |
536 |
|
--Count.oper; |
537 |
< |
if (IsInvisible(client_p)) |
537 |
> |
if (HasUMode(client_p, UMODE_INVISIBLE)) |
538 |
|
--Count.invisi; |
539 |
|
} |
540 |
+ |
else if (IsServer(client_p)) |
541 |
+ |
sendto_realops_flags(UMODE_EXTERNAL, L_ALL, "Server %s split from %s", |
542 |
+ |
client_p->name, client_p->servptr->name); |
543 |
|
|
544 |
|
if (splitchecking && !splitmode) |
545 |
|
check_splitmode(NULL); |
562 |
|
if ((c2ptr = hash_find_id(name)) != NULL) |
563 |
|
{ |
564 |
|
/* invisible users shall not be found by UID guessing */ |
565 |
< |
if (IsInvisible(c2ptr) && !IsServer(client_p)) |
565 |
> |
if (HasUMode(c2ptr, UMODE_INVISIBLE) && !IsServer(client_p)) |
566 |
|
c2ptr = NULL; |
567 |
|
} |
568 |
|
} |
569 |
|
else |
570 |
< |
c2ptr = find_client(name); |
570 |
> |
c2ptr = hash_find_client(name); |
571 |
|
|
572 |
|
return ((c2ptr != NULL && IsClient(c2ptr)) ? c2ptr : NULL); |
573 |
|
} |
587 |
|
*chasing = 0; |
588 |
|
|
589 |
|
if (who) |
590 |
< |
return(who); |
590 |
> |
return who; |
591 |
|
|
592 |
|
if (IsDigit(*user)) |
593 |
< |
return(NULL); |
593 |
> |
return NULL; |
594 |
|
|
595 |
|
if ((who = get_history(user, |
596 |
|
(time_t)ConfigFileEntry.kill_chase_time_limit)) |
598 |
|
{ |
599 |
|
sendto_one(source_p, form_str(ERR_NOSUCHNICK), |
600 |
|
me.name, source_p->name, user); |
601 |
< |
return(NULL); |
601 |
> |
return NULL; |
602 |
|
} |
603 |
|
|
604 |
|
if (chasing) |
605 |
|
*chasing = 1; |
606 |
|
|
607 |
< |
return(who); |
607 |
> |
return who; |
608 |
|
} |
609 |
|
|
610 |
|
/* |
626 |
|
* to modify what it points!!! |
627 |
|
*/ |
628 |
|
const char * |
629 |
< |
get_client_name(struct Client *client, int showip) |
629 |
> |
get_client_name(const struct Client *client, enum addr_mask_type type) |
630 |
|
{ |
631 |
|
static char nbuf[HOSTLEN * 2 + USERLEN + 5]; |
632 |
|
|
633 |
|
assert(client != NULL); |
634 |
|
|
635 |
< |
if (irccmp(client->name, client->host) == 0) |
636 |
< |
return(client->name); |
635 |
> |
if (!MyConnect(client) || !irccmp(client->name, client->host)) |
636 |
> |
return client->name; |
637 |
|
|
638 |
|
if (ConfigServerHide.hide_server_ips) |
639 |
|
if (IsServer(client) || IsConnecting(client) || IsHandshake(client)) |
640 |
< |
showip = MASK_IP; |
640 |
> |
type = MASK_IP; |
641 |
|
|
642 |
|
if (ConfigFileEntry.hide_spoof_ips) |
643 |
< |
if (showip == SHOW_IP && IsIPSpoof(client)) |
644 |
< |
showip = MASK_IP; |
643 |
> |
if (type == SHOW_IP && IsIPSpoof(client)) |
644 |
> |
type = MASK_IP; |
645 |
|
|
646 |
|
/* And finally, let's get the host information, ip or name */ |
647 |
< |
switch (showip) |
647 |
> |
switch (type) |
648 |
|
{ |
649 |
|
case SHOW_IP: |
650 |
< |
if (MyConnect(client)) |
651 |
< |
{ |
652 |
< |
ircsprintf(nbuf, "%s[%s@%s]", client->name, client->username, |
653 |
< |
client->sockhost); |
680 |
< |
break; |
681 |
< |
} |
650 |
> |
snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", |
651 |
> |
client->name, |
652 |
> |
client->username, client->sockhost); |
653 |
> |
break; |
654 |
|
case MASK_IP: |
655 |
< |
ircsprintf(nbuf, "%s[%s@255.255.255.255]", client->name, |
656 |
< |
client->username); |
655 |
> |
if (client->localClient->aftype == AF_INET) |
656 |
> |
snprintf(nbuf, sizeof(nbuf), "%s[%s@255.255.255.255]", |
657 |
> |
client->name, client->username); |
658 |
> |
else |
659 |
> |
snprintf(nbuf, sizeof(nbuf), "%s[%s@ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]", |
660 |
> |
client->name, client->username); |
661 |
|
break; |
662 |
|
default: |
663 |
< |
ircsprintf(nbuf, "%s[%s@%s]", client->name, client->username, |
664 |
< |
client->host); |
663 |
> |
snprintf(nbuf, sizeof(nbuf), "%s[%s@%s]", |
664 |
> |
client->name, |
665 |
> |
client->username, client->host); |
666 |
|
} |
667 |
|
|
668 |
< |
return(nbuf); |
668 |
> |
return nbuf; |
669 |
|
} |
670 |
|
|
671 |
|
void |
672 |
|
free_exited_clients(void) |
673 |
|
{ |
674 |
< |
dlink_node *ptr, *next; |
698 |
< |
struct Client *target_p; |
674 |
> |
dlink_node *ptr = NULL, *next = NULL; |
675 |
|
|
676 |
|
DLINK_FOREACH_SAFE(ptr, next, dead_list.head) |
677 |
|
{ |
678 |
< |
target_p = ptr->data; |
703 |
< |
|
704 |
< |
if (ptr->data == NULL) |
705 |
< |
{ |
706 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
707 |
< |
"Warning: null client on dead_list!"); |
708 |
< |
dlinkDelete(ptr, &dead_list); |
709 |
< |
free_dlink_node(ptr); |
710 |
< |
continue; |
711 |
< |
} |
712 |
< |
|
713 |
< |
free_client(target_p); |
678 |
> |
free_client(ptr->data); |
679 |
|
dlinkDelete(ptr, &dead_list); |
680 |
|
free_dlink_node(ptr); |
681 |
|
} |
694 |
|
|
695 |
|
assert(!IsMe(source_p)); |
696 |
|
|
697 |
< |
if (IsServer(source_p)) |
733 |
< |
{ |
734 |
< |
dlinkDelete(&source_p->lnode, &source_p->servptr->serv->servers); |
735 |
< |
|
736 |
< |
if ((lp = dlinkFindDelete(&global_serv_list, source_p)) != NULL) |
737 |
< |
free_dlink_node(lp); |
738 |
< |
|
739 |
< |
if (!MyConnect(source_p)) |
740 |
< |
{ |
741 |
< |
source_p->from->serv->dep_servers--; |
742 |
< |
assert(source_p->from->serv->dep_servers > 0); |
743 |
< |
} |
744 |
< |
} |
745 |
< |
else if (IsClient(source_p)) |
697 |
> |
if (IsClient(source_p)) |
698 |
|
{ |
699 |
|
if (source_p->servptr->serv != NULL) |
700 |
< |
dlinkDelete(&source_p->lnode, &source_p->servptr->serv->users); |
700 |
> |
dlinkDelete(&source_p->lnode, &source_p->servptr->serv->client_list); |
701 |
|
|
702 |
< |
/* If a person is on a channel, send a QUIT notice |
703 |
< |
** to every client (person) on the same channel (so |
704 |
< |
** that the client can show the "**signoff" message). |
705 |
< |
** (Note: The notice is to the local clients *only*) |
706 |
< |
*/ |
702 |
> |
/* |
703 |
> |
* If a person is on a channel, send a QUIT notice |
704 |
> |
* to every client (person) on the same channel (so |
705 |
> |
* that the client can show the "**signoff" message). |
706 |
> |
* (Note: The notice is to the local clients *only*) |
707 |
> |
*/ |
708 |
|
sendto_common_channels_local(source_p, 0, ":%s!%s@%s QUIT :%s", |
709 |
|
source_p->name, source_p->username, |
710 |
|
source_p->host, quitmsg); |
711 |
|
DLINK_FOREACH_SAFE(lp, next_lp, source_p->channel.head) |
712 |
|
remove_user_from_channel(lp->data); |
713 |
|
|
761 |
– |
/* Clean up invitefield */ |
762 |
– |
DLINK_FOREACH_SAFE(lp, next_lp, source_p->invited.head) |
763 |
– |
del_invite(lp->data, source_p); |
764 |
– |
|
765 |
– |
/* Clean up allow lists */ |
766 |
– |
del_all_accepts(source_p); |
714 |
|
add_history(source_p, 0); |
715 |
|
off_history(source_p); |
716 |
|
|
717 |
< |
if (!MyConnect(source_p)) |
717 |
> |
watch_check_hash(source_p, RPL_LOGOFF); |
718 |
> |
|
719 |
> |
if (MyConnect(source_p)) |
720 |
|
{ |
721 |
< |
source_p->from->serv->dep_users--; |
722 |
< |
assert(source_p->from->serv->dep_users >= 0); |
721 |
> |
/* Clean up invitefield */ |
722 |
> |
DLINK_FOREACH_SAFE(lp, next_lp, source_p->localClient->invited.head) |
723 |
> |
del_invite(lp->data, source_p); |
724 |
> |
|
725 |
> |
del_all_accepts(source_p); |
726 |
|
} |
727 |
|
} |
728 |
+ |
else if (IsServer(source_p)) |
729 |
+ |
{ |
730 |
+ |
dlinkDelete(&source_p->lnode, &source_p->servptr->serv->server_list); |
731 |
+ |
|
732 |
+ |
if ((lp = dlinkFindDelete(&global_serv_list, source_p)) != NULL) |
733 |
+ |
free_dlink_node(lp); |
734 |
+ |
} |
735 |
|
|
736 |
|
/* Remove source_p from the client lists */ |
737 |
|
if (HasID(source_p)) |
771 |
|
static void |
772 |
|
recurse_send_quits(struct Client *original_source_p, struct Client *source_p, |
773 |
|
struct Client *from, struct Client *to, const char *comment, |
774 |
< |
const char *splitstr, const char *myname) |
774 |
> |
const char *splitstr) |
775 |
|
{ |
776 |
|
dlink_node *ptr, *next; |
777 |
|
struct Client *target_p; |
778 |
< |
int hidden = match(myname, source_p->name); |
778 |
> |
int hidden = match(me.name, source_p->name); /* XXX */ |
779 |
|
|
780 |
|
assert(to != source_p); /* should be already removed from serv_list */ |
781 |
|
|
786 |
|
* hidden behind fakename. If so, send out the QUITs -adx |
787 |
|
*/ |
788 |
|
if (hidden || !IsCapable(to, CAP_QS)) |
789 |
< |
DLINK_FOREACH_SAFE(ptr, next, source_p->serv->users.head) |
789 |
> |
DLINK_FOREACH_SAFE(ptr, next, source_p->serv->client_list.head) |
790 |
|
{ |
791 |
|
target_p = ptr->data; |
792 |
|
sendto_one(to, ":%s QUIT :%s", target_p->name, splitstr); |
793 |
|
} |
794 |
|
|
795 |
< |
DLINK_FOREACH_SAFE(ptr, next, source_p->serv->servers.head) |
795 |
> |
DLINK_FOREACH_SAFE(ptr, next, source_p->serv->server_list.head) |
796 |
|
recurse_send_quits(original_source_p, ptr->data, from, to, |
797 |
< |
comment, splitstr, myname); |
797 |
> |
comment, splitstr); |
798 |
|
|
799 |
|
if (!hidden && ((source_p == original_source_p && to != from) || |
800 |
|
!IsCapable(to, CAP_QS))) |
816 |
|
{ |
817 |
|
dlink_node *ptr, *next; |
818 |
|
|
819 |
< |
DLINK_FOREACH_SAFE(ptr, next, source_p->serv->users.head) |
819 |
> |
DLINK_FOREACH_SAFE(ptr, next, source_p->serv->client_list.head) |
820 |
|
exit_one_client(ptr->data, quitmsg); |
821 |
|
|
822 |
< |
DLINK_FOREACH_SAFE(ptr, next, source_p->serv->servers.head) |
822 |
> |
DLINK_FOREACH_SAFE(ptr, next, source_p->serv->server_list.head) |
823 |
|
{ |
824 |
|
recurse_remove_clients(ptr->data, quitmsg); |
825 |
|
exit_one_client(ptr->data, quitmsg); |
826 |
|
} |
868 |
– |
|
869 |
– |
assert(source_p->serv->dep_servers == 1); |
870 |
– |
assert(source_p->serv->dep_users == 0); |
827 |
|
} |
828 |
|
|
829 |
|
/* |
835 |
|
remove_dependents(struct Client *source_p, struct Client *from, |
836 |
|
const char *comment, const char *splitstr) |
837 |
|
{ |
838 |
< |
struct Client *to; |
883 |
< |
struct ConfItem *conf; |
884 |
< |
static char myname[HOSTLEN+1]; |
885 |
< |
dlink_node *ptr; |
838 |
> |
dlink_node *ptr = NULL; |
839 |
|
|
840 |
|
DLINK_FOREACH(ptr, serv_list.head) |
841 |
< |
{ |
842 |
< |
to = ptr->data; |
890 |
< |
|
891 |
< |
if ((conf = to->serv->sconf) != NULL) |
892 |
< |
strlcpy(myname, my_name_for_link(conf), sizeof(myname)); |
893 |
< |
else |
894 |
< |
strlcpy(myname, me.name, sizeof(myname)); |
895 |
< |
recurse_send_quits(source_p, source_p, from, to, |
896 |
< |
comment, splitstr, myname); |
897 |
< |
} |
841 |
> |
recurse_send_quits(source_p, source_p, from, ptr->data, |
842 |
> |
comment, splitstr); |
843 |
|
|
844 |
|
recurse_remove_clients(source_p, splitstr); |
845 |
|
} |
849 |
|
* this on any struct Client, regardless of its state. |
850 |
|
* |
851 |
|
* Note, you shouldn't exit remote _users_ without first doing |
852 |
< |
* SetKilled and propagating a kill or similar message. However, |
853 |
< |
* it is perfectly correct to call exit_client to force a _server_ |
852 |
> |
* AddFlag(x, FLAGS_KILLED) and propagating a kill or similar message. |
853 |
> |
* However, it is perfectly correct to call exit_client to force a _server_ |
854 |
|
* quit (either local or remote one). |
855 |
|
* |
856 |
|
* inputs: - a client pointer that is going to be exited |
865 |
|
void |
866 |
|
exit_client(struct Client *source_p, struct Client *from, const char *comment) |
867 |
|
{ |
868 |
< |
dlink_node *m; |
868 |
> |
dlink_node *m = NULL; |
869 |
|
|
870 |
|
if (MyConnect(source_p)) |
871 |
|
{ |
880 |
|
if (IsIpHash(source_p)) |
881 |
|
remove_one_ip(&source_p->localClient->ip); |
882 |
|
|
883 |
< |
delete_auth(source_p); |
883 |
> |
if (source_p->localClient->auth) |
884 |
> |
{ |
885 |
> |
delete_auth(source_p->localClient->auth); |
886 |
> |
source_p->localClient->auth = NULL; |
887 |
> |
} |
888 |
|
|
889 |
|
/* This source_p could have status of one of STAT_UNKNOWN, STAT_CONNECTING |
890 |
|
* STAT_HANDSHAKE or STAT_UNKNOWN |
894 |
|
*/ |
895 |
|
if (!IsRegistered(source_p)) |
896 |
|
{ |
897 |
< |
if ((m = dlinkFindDelete(&unknown_list, source_p)) != NULL) |
898 |
< |
free_dlink_node(m); |
897 |
> |
assert(dlinkFind(&unknown_list, source_p)); |
898 |
> |
|
899 |
> |
dlinkDelete(&source_p->localClient->lclient_node, &unknown_list); |
900 |
|
} |
901 |
|
else if (IsClient(source_p)) |
902 |
|
{ |
903 |
+ |
time_t on_for = CurrentTime - source_p->localClient->firsttime; |
904 |
+ |
assert(Count.local > 0); |
905 |
|
Count.local--; |
906 |
|
|
907 |
< |
if (IsOper(source_p)) |
907 |
> |
if (HasUMode(source_p, UMODE_OPER)) |
908 |
|
{ |
909 |
|
if ((m = dlinkFindDelete(&oper_list, source_p)) != NULL) |
910 |
|
free_dlink_node(m); |
911 |
|
} |
912 |
|
|
913 |
+ |
assert(dlinkFind(&local_client_list, source_p)); |
914 |
|
dlinkDelete(&source_p->localClient->lclient_node, &local_client_list); |
915 |
+ |
|
916 |
|
if (source_p->localClient->list_task != NULL) |
917 |
|
free_list_task(source_p->localClient->list_task, source_p); |
918 |
|
|
919 |
+ |
watch_del_watch_list(source_p); |
920 |
|
sendto_realops_flags(UMODE_CCONN, L_ALL, "Client exiting: %s (%s@%s) [%s] [%s]", |
921 |
|
source_p->name, source_p->username, source_p->host, comment, |
922 |
|
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
923 |
|
"255.255.255.255" : source_p->sockhost); |
924 |
+ |
sendto_realops_flags(UMODE_CCONN_FULL, L_ALL, "CLIEXIT: %s %s %s %s 0 %s", |
925 |
+ |
source_p->name, |
926 |
+ |
source_p->username, |
927 |
+ |
source_p->host, |
928 |
+ |
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
929 |
+ |
"255.255.255.255" : source_p->sockhost, |
930 |
+ |
comment); |
931 |
+ |
ilog(LOG_TYPE_USER, "%s (%3u:%02u:%02u): %s!%s@%s %llu/%llu", |
932 |
+ |
myctime(source_p->localClient->firsttime), (unsigned int)(on_for / 3600), |
933 |
+ |
(unsigned int)((on_for % 3600)/60), (unsigned int)(on_for % 60), |
934 |
+ |
source_p->name, source_p->username, source_p->host, |
935 |
+ |
source_p->localClient->send.bytes>>10, |
936 |
+ |
source_p->localClient->recv.bytes>>10); |
937 |
|
} |
938 |
|
|
939 |
|
/* As soon as a client is known to be a server of some sort |
940 |
|
* it has to be put on the serv_list, or SJOIN's to this new server |
941 |
|
* from the connect burst will not be seen. |
942 |
+ |
* XXX - TBV. This is not true. The only place where we put a server on |
943 |
+ |
* serv_list is in server_estab right now after registration process. |
944 |
+ |
* And only after this, a burst is sent to the remote server, i.e. we never |
945 |
+ |
* send a burst to STAT_CONNECTING, or STAT_HANDSHAKE. This will need |
946 |
+ |
* more investigation later on, but for now, it's not a problem after all. |
947 |
|
*/ |
948 |
|
if (IsServer(source_p) || IsConnecting(source_p) || |
949 |
|
IsHandshake(source_p)) |
950 |
|
{ |
951 |
< |
if ((m = dlinkFindDelete(&serv_list, source_p)) != NULL) |
951 |
> |
if (dlinkFind(&serv_list, source_p)) |
952 |
|
{ |
953 |
< |
free_dlink_node(m); |
953 |
> |
dlinkDelete(&source_p->localClient->lclient_node, &serv_list); |
954 |
|
unset_chcap_usage_counts(source_p); |
955 |
|
} |
956 |
|
|
957 |
|
if (IsServer(source_p)) |
985 |
– |
{ |
958 |
|
Count.myserver--; |
987 |
– |
if (ServerInfo.hub) |
988 |
– |
remove_lazylink_flags(source_p->localClient->serverMask); |
989 |
– |
else |
990 |
– |
uplink = NULL; |
991 |
– |
} |
959 |
|
} |
960 |
|
|
994 |
– |
log_user_exit(source_p); |
995 |
– |
|
961 |
|
if (!IsDead(source_p)) |
962 |
|
{ |
963 |
|
if (IsServer(source_p)) |
993 |
|
assert(source_p->serv != NULL && source_p->servptr != NULL); |
994 |
|
|
995 |
|
if (ConfigServerHide.hide_servers) |
996 |
< |
/* set netsplit message to "*.net *.split" to still show |
996 |
> |
/* |
997 |
> |
* Set netsplit message to "*.net *.split" to still show |
998 |
|
* that its a split, but hide the servers splitting |
999 |
|
*/ |
1000 |
|
strcpy(splitstr, "*.net *.split"); |
1008 |
|
{ |
1009 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, |
1010 |
|
"%s was connected for %d seconds. %llu/%llu sendK/recvK.", |
1011 |
< |
source_p->name, (int)(CurrentTime - source_p->firsttime), |
1011 |
> |
source_p->name, (int)(CurrentTime - source_p->localClient->firsttime), |
1012 |
|
source_p->localClient->send.bytes >> 10, |
1013 |
|
source_p->localClient->recv.bytes >> 10); |
1014 |
< |
ilog(L_NOTICE, "%s was connected for %d seconds. %llu/%llu sendK/recvK.", |
1015 |
< |
source_p->name, (int)(CurrentTime - source_p->firsttime), |
1014 |
> |
ilog(LOG_TYPE_IRCD, "%s was connected for %d seconds. %llu/%llu sendK/recvK.", |
1015 |
> |
source_p->name, (int)(CurrentTime - source_p->localClient->firsttime), |
1016 |
|
source_p->localClient->send.bytes >> 10, |
1017 |
|
source_p->localClient->recv.bytes >> 10); |
1018 |
|
} |
1019 |
|
} |
1020 |
< |
else if (IsClient(source_p) && !IsKilled(source_p)) |
1020 |
> |
else if (IsClient(source_p) && !HasFlag(source_p, FLAGS_KILLED)) |
1021 |
|
{ |
1022 |
< |
sendto_server(NULL, source_p, NULL, CAP_TS6, NOCAPS, NOFLAGS, |
1022 |
> |
sendto_server(from->from, NULL, CAP_TS6, NOCAPS, |
1023 |
|
":%s QUIT :%s", ID(source_p), comment); |
1024 |
< |
sendto_server(NULL, source_p, NULL, NOCAPS, CAP_TS6, NOFLAGS, |
1024 |
> |
sendto_server(from->from, NULL, NOCAPS, CAP_TS6, |
1025 |
|
":%s QUIT :%s", source_p->name, comment); |
1026 |
|
} |
1027 |
|
|
1080 |
|
|
1081 |
|
if (IsServer(client_p) || IsHandshake(client_p)) |
1082 |
|
{ |
1083 |
< |
int connected = CurrentTime - client_p->firsttime; |
1083 |
> |
int connected = CurrentTime - client_p->localClient->firsttime; |
1084 |
|
|
1085 |
|
if (error == 0) |
1086 |
|
{ |
1094 |
|
"Server %s closed the connection", |
1095 |
|
get_client_name(client_p, MASK_IP)); |
1096 |
|
|
1097 |
< |
ilog(L_NOTICE, "Server %s closed the connection", |
1097 |
> |
ilog(LOG_TYPE_IRCD, "Server %s closed the connection", |
1098 |
|
get_client_name(client_p, SHOW_IP)); |
1099 |
|
} |
1100 |
|
else |
1101 |
|
{ |
1102 |
< |
report_error(L_ADMIN, "Lost connection to %s: %d", |
1102 |
> |
report_error(L_ADMIN, "Lost connection to %s: %s", |
1103 |
|
get_client_name(client_p, SHOW_IP), current_error); |
1104 |
< |
report_error(L_OPER, "Lost connection to %s: %d", |
1104 |
> |
report_error(L_OPER, "Lost connection to %s: %s", |
1105 |
|
get_client_name(client_p, MASK_IP), current_error); |
1106 |
|
} |
1107 |
|
|
1117 |
|
strlcpy(errmsg, "Remote host closed the connection", |
1118 |
|
sizeof(errmsg)); |
1119 |
|
else |
1120 |
< |
ircsprintf(errmsg, "Read error: %s", |
1121 |
< |
strerror(current_error)); |
1120 |
> |
snprintf(errmsg, sizeof(errmsg), "Read error: %s", |
1121 |
> |
strerror(current_error)); |
1122 |
|
|
1123 |
|
exit_client(client_p, &me, errmsg); |
1124 |
|
} |
1158 |
|
|
1159 |
|
/* |
1160 |
|
* accept processing, this adds a form of "caller ID" to ircd |
1161 |
< |
* |
1161 |
> |
* |
1162 |
|
* If a client puts themselves into "caller ID only" mode, |
1163 |
< |
* only clients that match a client pointer they have put on |
1163 |
> |
* only clients that match a client pointer they have put on |
1164 |
|
* the accept list will be allowed to message them. |
1165 |
|
* |
1166 |
< |
* [ source.on_allow_list ] -> [ target1 ] -> [ target2 ] |
1201 |
< |
* |
1202 |
< |
* [target.allow_list] -> [ source1 ] -> [source2 ] |
1203 |
< |
* |
1204 |
< |
* i.e. a target will have a link list of source pointers it will allow |
1205 |
< |
* each source client then has a back pointer pointing back |
1206 |
< |
* to the client that has it on its accept list. |
1207 |
< |
* This allows for exit_one_client to remove these now bogus entries |
1208 |
< |
* from any client having an accept on them. |
1166 |
> |
* Diane Bruce, "Dianora" db@db.net |
1167 |
|
*/ |
1168 |
|
|
1169 |
< |
/* accept_message() |
1170 |
< |
* |
1213 |
< |
* inputs - pointer to source client |
1214 |
< |
* - pointer to target client |
1215 |
< |
* output - 1 if accept this message 0 if not |
1216 |
< |
* side effects - See if source is on target's allow list |
1217 |
< |
*/ |
1218 |
< |
int |
1219 |
< |
accept_message(struct Client *source, struct Client *target) |
1169 |
> |
void |
1170 |
> |
del_accept(struct split_nuh_item *accept_p, struct Client *client_p) |
1171 |
|
{ |
1172 |
< |
dlink_node *ptr; |
1222 |
< |
|
1223 |
< |
DLINK_FOREACH(ptr, target->allow_list.head) |
1224 |
< |
{ |
1225 |
< |
struct Client *target_p = ptr->data; |
1172 |
> |
dlinkDelete(&accept_p->node, &client_p->localClient->acceptlist); |
1173 |
|
|
1174 |
< |
if (source == target_p) |
1175 |
< |
return (1); |
1176 |
< |
} |
1177 |
< |
|
1231 |
< |
if (IsSoftCallerId(target)) |
1232 |
< |
{ |
1233 |
< |
DLINK_FOREACH(ptr, target->channel.head) |
1234 |
< |
if (IsMember(source, ptr->data)) |
1235 |
< |
return (1); |
1236 |
< |
} |
1237 |
< |
|
1238 |
< |
return (0); |
1174 |
> |
MyFree(accept_p->nickptr); |
1175 |
> |
MyFree(accept_p->userptr); |
1176 |
> |
MyFree(accept_p->hostptr); |
1177 |
> |
MyFree(accept_p); |
1178 |
|
} |
1179 |
|
|
1180 |
< |
/* del_from_accept() |
1181 |
< |
* |
1182 |
< |
* inputs - pointer to source client |
1244 |
< |
* - pointer to target client |
1245 |
< |
* output - NONE |
1246 |
< |
* side effects - Delete's source pointer to targets allow list |
1247 |
< |
* |
1248 |
< |
* Walk through the target's accept list, remove if source is found, |
1249 |
< |
* Then walk through the source's on_accept_list remove target if found. |
1250 |
< |
*/ |
1251 |
< |
void |
1252 |
< |
del_from_accept(struct Client *source, struct Client *target) |
1180 |
> |
struct split_nuh_item * |
1181 |
> |
find_accept(const char *nick, const char *user, |
1182 |
> |
const char *host, struct Client *client_p, int do_match) |
1183 |
|
{ |
1184 |
< |
dlink_node *ptr; |
1185 |
< |
dlink_node *ptr2; |
1186 |
< |
dlink_node *next_ptr; |
1257 |
< |
dlink_node *next_ptr2; |
1258 |
< |
struct Client *target_p; |
1184 |
> |
dlink_node *ptr = NULL; |
1185 |
> |
/* XXX We wouldn't need that if match() would return 0 on match */ |
1186 |
> |
int (*cmpfunc)(const char *, const char *) = do_match ? match : irccmp; |
1187 |
|
|
1188 |
< |
DLINK_FOREACH_SAFE(ptr, next_ptr, target->allow_list.head) |
1188 |
> |
DLINK_FOREACH(ptr, client_p->localClient->acceptlist.head) |
1189 |
|
{ |
1190 |
< |
target_p = ptr->data; |
1263 |
< |
|
1264 |
< |
if (source == target_p) |
1265 |
< |
{ |
1266 |
< |
dlinkDelete(ptr, &target->allow_list); |
1267 |
< |
free_dlink_node(ptr); |
1268 |
< |
|
1269 |
< |
DLINK_FOREACH_SAFE(ptr2, next_ptr2, source->on_allow_list.head) |
1270 |
< |
{ |
1271 |
< |
target_p = ptr2->data; |
1190 |
> |
struct split_nuh_item *accept_p = ptr->data; |
1191 |
|
|
1192 |
< |
if (target == target_p) |
1193 |
< |
{ |
1194 |
< |
dlinkDelete(ptr2, &source->on_allow_list); |
1195 |
< |
free_dlink_node(ptr2); |
1277 |
< |
} |
1278 |
< |
} |
1279 |
< |
} |
1192 |
> |
if (cmpfunc(accept_p->nickptr, nick) == do_match && |
1193 |
> |
cmpfunc(accept_p->userptr, user) == do_match && |
1194 |
> |
cmpfunc(accept_p->hostptr, host) == do_match) |
1195 |
> |
return accept_p; |
1196 |
|
} |
1281 |
– |
} |
1282 |
– |
|
1283 |
– |
/* del_all_accepts() |
1284 |
– |
* |
1285 |
– |
* inputs - pointer to exiting client |
1286 |
– |
* output - NONE |
1287 |
– |
* side effects - Walk through given clients allow_list and on_allow_list |
1288 |
– |
* remove all references to this client |
1289 |
– |
*/ |
1290 |
– |
void |
1291 |
– |
del_all_accepts(struct Client *client_p) |
1292 |
– |
{ |
1293 |
– |
dlink_node *ptr, *next_ptr; |
1294 |
– |
|
1295 |
– |
DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->allow_list.head) |
1296 |
– |
del_from_accept(ptr->data, client_p); |
1297 |
– |
|
1298 |
– |
DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->on_allow_list.head) |
1299 |
– |
del_from_accept(client_p, ptr->data); |
1300 |
– |
} |
1301 |
– |
|
1302 |
– |
/* del_all_their_accepts() |
1303 |
– |
* |
1304 |
– |
* inputs - pointer to exiting client |
1305 |
– |
* output - NONE |
1306 |
– |
* side effects - Walk through given clients on_allow_list |
1307 |
– |
* remove all references to this client, |
1308 |
– |
* allow this client to keep their own allow_list |
1309 |
– |
*/ |
1310 |
– |
void |
1311 |
– |
del_all_their_accepts(struct Client *client_p) |
1312 |
– |
{ |
1313 |
– |
dlink_node *ptr, *next_ptr; |
1197 |
|
|
1198 |
< |
DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->on_allow_list.head) |
1316 |
< |
del_from_accept(client_p, ptr->data); |
1198 |
> |
return NULL; |
1199 |
|
} |
1200 |
|
|
1201 |
< |
/* set_initial_nick() |
1320 |
< |
* |
1321 |
< |
* inputs |
1322 |
< |
* output |
1323 |
< |
* side effects - |
1201 |
> |
/* accept_message() |
1202 |
|
* |
1203 |
< |
* This function is only called to set up an initially registering |
1204 |
< |
* client. |
1203 |
> |
* inputs - pointer to source client |
1204 |
> |
* - pointer to target client |
1205 |
> |
* output - 1 if accept this message 0 if not |
1206 |
> |
* side effects - See if source is on target's allow list |
1207 |
|
*/ |
1208 |
< |
void |
1209 |
< |
set_initial_nick(struct Client *client_p, struct Client *source_p, |
1210 |
< |
const char *nick) |
1208 |
> |
int |
1209 |
> |
accept_message(struct Client *source, |
1210 |
> |
struct Client *target) |
1211 |
|
{ |
1212 |
< |
char buf[USERLEN + 1]; |
1333 |
< |
|
1334 |
< |
/* Client setting NICK the first time */ |
1335 |
< |
|
1336 |
< |
/* This had to be copied here to avoid problems.. */ |
1337 |
< |
source_p->tsinfo = CurrentTime; |
1212 |
> |
dlink_node *ptr = NULL; |
1213 |
|
|
1214 |
< |
if (source_p->name[0]) |
1215 |
< |
hash_del_client(source_p); |
1216 |
< |
|
1342 |
< |
strlcpy(source_p->name, nick, sizeof(source_p->name)); |
1343 |
< |
hash_add_client(source_p); |
1344 |
< |
|
1345 |
< |
/* fd_desc is long enough */ |
1346 |
< |
fd_note(&client_p->localClient->fd, "Nick: %s", nick); |
1347 |
< |
|
1348 |
< |
/* They have the nick they want now.. */ |
1349 |
< |
client_p->llname[0] = '\0'; |
1214 |
> |
if (source == target || find_accept(source->name, source->username, |
1215 |
> |
source->host, target, 1)) |
1216 |
> |
return 1; |
1217 |
|
|
1218 |
< |
if (source_p->flags & FLAGS_GOTUSER) |
1219 |
< |
{ |
1220 |
< |
strlcpy(buf, source_p->username, sizeof(buf)); |
1218 |
> |
if (HasUMode(target, UMODE_SOFTCALLERID)) |
1219 |
> |
DLINK_FOREACH(ptr, target->channel.head) |
1220 |
> |
if (IsMember(source, ((struct Membership *)ptr->data)->chptr)) |
1221 |
> |
return 1; |
1222 |
|
|
1223 |
< |
/* |
1356 |
< |
* USER already received, now we have NICK. |
1357 |
< |
* *NOTE* For servers "NICK" *must* precede the |
1358 |
< |
* user message (giving USER before NICK is possible |
1359 |
< |
* only for local client connection!). register_user |
1360 |
< |
* may reject the client and call exit_client for it |
1361 |
< |
* --must test this and exit m_nick too!!! |
1362 |
< |
*/ |
1363 |
< |
register_local_user(client_p, source_p, nick, buf); |
1364 |
< |
} |
1223 |
> |
return 0; |
1224 |
|
} |
1225 |
|
|
1226 |
< |
/* change_local_nick() |
1226 |
> |
/* del_all_accepts() |
1227 |
|
* |
1228 |
< |
* inputs - pointer to server |
1229 |
< |
* - pointer to client |
1230 |
< |
* - nick |
1372 |
< |
* output - |
1373 |
< |
* side effects - changes nick of a LOCAL user |
1228 |
> |
* inputs - pointer to exiting client |
1229 |
> |
* output - NONE |
1230 |
> |
* side effects - Walk through given clients acceptlist and remove all entries |
1231 |
|
*/ |
1232 |
|
void |
1233 |
< |
change_local_nick(struct Client *client_p, struct Client *source_p, const char *nick) |
1233 |
> |
del_all_accepts(struct Client *client_p) |
1234 |
|
{ |
1235 |
< |
/* |
1379 |
< |
** Client just changing his/her nick. If he/she is |
1380 |
< |
** on a channel, send note of change to all clients |
1381 |
< |
** on that channel. Propagate notice to other servers. |
1382 |
< |
*/ |
1383 |
< |
if ((source_p->localClient->last_nick_change + |
1384 |
< |
ConfigFileEntry.max_nick_time) < CurrentTime) |
1385 |
< |
source_p->localClient->number_of_nick_changes = 0; |
1386 |
< |
source_p->localClient->last_nick_change = CurrentTime; |
1387 |
< |
source_p->localClient->number_of_nick_changes++; |
1388 |
< |
|
1389 |
< |
if ((ConfigFileEntry.anti_nick_flood && |
1390 |
< |
(source_p->localClient->number_of_nick_changes |
1391 |
< |
<= ConfigFileEntry.max_nick_changes)) || |
1392 |
< |
!ConfigFileEntry.anti_nick_flood || |
1393 |
< |
(IsOper(source_p) && ConfigFileEntry.no_oper_flood)) |
1394 |
< |
{ |
1395 |
< |
if (irccmp(source_p->name, nick)) |
1396 |
< |
source_p->tsinfo = CurrentTime; |
1397 |
< |
|
1398 |
< |
/* XXX - the format of this notice should eventually be changed |
1399 |
< |
* to either %s[%s@%s], or even better would be get_client_name() -bill |
1400 |
< |
*/ |
1401 |
< |
sendto_realops_flags(UMODE_NCHANGE, L_ALL, "Nick change: From %s to %s [%s@%s]", |
1402 |
< |
source_p->name, nick, source_p->username, source_p->host); |
1403 |
< |
sendto_common_channels_local(source_p, 1, ":%s!%s@%s NICK :%s", |
1404 |
< |
source_p->name, source_p->username, |
1405 |
< |
source_p->host, nick); |
1406 |
< |
|
1407 |
< |
add_history(source_p, 1); |
1408 |
< |
|
1409 |
< |
/* Only hubs care about lazy link nicks not being sent on yet |
1410 |
< |
* lazylink leafs/leafs always send their nicks up to hub, |
1411 |
< |
* hence must always propagate nick changes. |
1412 |
< |
* hubs might not propagate a nick change, if the leaf |
1413 |
< |
* does not know about that client yet. |
1414 |
< |
*/ |
1415 |
< |
sendto_server(client_p, source_p, NULL, CAP_TS6, NOCAPS, NOFLAGS, |
1416 |
< |
":%s NICK %s :%lu", |
1417 |
< |
ID(source_p), nick, (unsigned long)source_p->tsinfo); |
1418 |
< |
sendto_server(client_p, source_p, NULL, NOCAPS, CAP_TS6, NOFLAGS, |
1419 |
< |
":%s NICK %s :%lu", |
1420 |
< |
source_p->name, nick, (unsigned long)source_p->tsinfo); |
1421 |
< |
} |
1422 |
< |
else |
1423 |
< |
{ |
1424 |
< |
sendto_one(source_p, form_str(ERR_NICKTOOFAST), |
1425 |
< |
me.name, source_p->name, source_p->name, |
1426 |
< |
nick, ConfigFileEntry.max_nick_time); |
1427 |
< |
return; |
1428 |
< |
} |
1429 |
< |
|
1430 |
< |
/* Finally, add to hash */ |
1431 |
< |
if (source_p->name[0]) |
1432 |
< |
hash_del_client(source_p); |
1433 |
< |
|
1434 |
< |
strcpy(source_p->name, nick); |
1435 |
< |
hash_add_client(source_p); |
1436 |
< |
|
1437 |
< |
/* Make sure everyone that has this client on its accept list |
1438 |
< |
* loses that reference. |
1439 |
< |
*/ |
1440 |
< |
del_all_their_accepts(source_p); |
1235 |
> |
dlink_node *ptr = NULL, *next_ptr = NULL; |
1236 |
|
|
1237 |
< |
/* fd_desc is long enough */ |
1238 |
< |
fd_note(&client_p->localClient->fd, "Nick: %s", nick); |
1237 |
> |
DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->localClient->acceptlist.head) |
1238 |
> |
del_accept(ptr->data, client_p); |
1239 |
|
} |