1 |
|
/* |
2 |
|
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
3 |
|
* |
4 |
< |
* Copyright (c) 1997-2014 ircd-hybrid development team |
4 |
> |
* Copyright (c) 1997-2015 ircd-hybrid development team |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
83 |
|
struct Client * |
84 |
|
make_client(struct Client *from) |
85 |
|
{ |
86 |
< |
struct Client *client_p = mp_pool_get(client_pool); |
86 |
> |
struct Client *const client_p = mp_pool_get(client_pool); |
87 |
|
|
88 |
|
if (!from) |
89 |
|
{ |
104 |
|
client_p->hnext = client_p; |
105 |
|
SetUnknown(client_p); |
106 |
|
strcpy(client_p->username, "unknown"); |
107 |
< |
strcpy(client_p->svid, "0"); |
107 |
> |
strcpy(client_p->account, "0"); |
108 |
|
|
109 |
|
return client_p; |
110 |
|
} |
119 |
|
static void |
120 |
|
free_client(struct Client *client_p) |
121 |
|
{ |
122 |
– |
assert(client_p); |
122 |
|
assert(client_p != &me); |
123 |
|
assert(client_p->hnext == client_p); |
124 |
|
assert(client_p->idhnext == client_p); |
143 |
|
client_p->connection->challenge_operator = NULL; |
144 |
|
|
145 |
|
/* |
146 |
< |
* clean up extra sockets from P-lines which have been discarded. |
146 |
> |
* Clean up extra sockets from listen{} blocks which have been discarded. |
147 |
|
*/ |
148 |
|
if (client_p->connection->listener) |
149 |
|
{ |
302 |
|
{ |
303 |
|
struct Client *client_p = node->data; |
304 |
|
|
305 |
< |
/* If a client is already being exited |
307 |
< |
*/ |
305 |
> |
/* If a client is already being exited */ |
306 |
|
if (IsDead(client_p)) |
307 |
|
continue; |
308 |
|
|
436 |
|
if (IsClient(client_p)) |
437 |
|
{ |
438 |
|
assert(Count.total > 0); |
439 |
+ |
|
440 |
|
--Count.total; |
441 |
|
if (HasUMode(client_p, UMODE_OPER)) |
442 |
|
--Count.oper; |
482 |
|
struct Client * |
483 |
|
find_chasing(struct Client *source_p, const char *name) |
484 |
|
{ |
485 |
< |
struct Client *who = find_person(source_p, name); |
485 |
> |
struct Client *target_p = find_person(source_p, name); |
486 |
|
|
487 |
< |
if (who) |
488 |
< |
return who; |
487 |
> |
if (target_p) |
488 |
> |
return target_p; |
489 |
|
|
490 |
|
if (IsDigit(*name)) |
491 |
|
return NULL; |
492 |
|
|
493 |
< |
if ((who = whowas_get_history(name, |
494 |
< |
(time_t)ConfigGeneral.kill_chase_time_limit)) |
495 |
< |
== NULL) |
493 |
> |
target_p = whowas_get_history(name, (time_t)ConfigGeneral.kill_chase_time_limit); |
494 |
> |
|
495 |
> |
if (!target_p) |
496 |
|
{ |
497 |
|
sendto_one_numeric(source_p, &me, ERR_NOSUCHNICK, name); |
498 |
|
return NULL; |
499 |
|
} |
500 |
|
|
501 |
< |
return who; |
501 |
> |
return target_p; |
502 |
|
} |
503 |
|
|
504 |
|
/* |
524 |
|
{ |
525 |
|
static char buf[HOSTLEN * 2 + USERLEN + 5]; |
526 |
|
|
528 |
– |
assert(client_p); |
529 |
– |
|
527 |
|
if (!MyConnect(client_p)) |
528 |
|
return client_p->name; |
529 |
|
|
535 |
|
type = MASK_IP; |
536 |
|
} |
537 |
|
|
541 |
– |
if (ConfigGeneral.hide_spoof_ips) |
542 |
– |
if (IsIPSpoof(client_p) && type == SHOW_IP) |
543 |
– |
type = MASK_IP; |
544 |
– |
|
538 |
|
/* And finally, let's get the host information, ip or name */ |
539 |
|
switch (type) |
540 |
|
{ |
601 |
|
sendto_common_channels_local(source_p, 0, 0, ":%s!%s@%s QUIT :%s", |
602 |
|
source_p->name, source_p->username, |
603 |
|
source_p->host, comment); |
604 |
+ |
|
605 |
|
DLINK_FOREACH_SAFE(node, node_next, source_p->channel.head) |
606 |
|
remove_user_from_channel(node->data); |
607 |
|
|
631 |
|
/* Remove source_p from the client lists */ |
632 |
|
if (source_p->id[0]) |
633 |
|
hash_del_id(source_p); |
634 |
+ |
|
635 |
|
if (source_p->name[0]) |
636 |
|
hash_del_client(source_p); |
637 |
|
|
728 |
|
else if (IsClient(source_p)) |
729 |
|
{ |
730 |
|
time_t on_for = CurrentTime - source_p->connection->firsttime; |
731 |
+ |
|
732 |
|
assert(Count.local > 0); |
733 |
< |
Count.local--; |
733 |
> |
|
734 |
> |
--Count.local; |
735 |
|
|
736 |
|
if (HasUMode(source_p, UMODE_OPER)) |
737 |
|
if ((node = dlinkFindDelete(&oper_list, source_p))) |
747 |
|
sendto_realops_flags(UMODE_CCONN, L_ALL, SEND_NOTICE, |
748 |
|
"Client exiting: %s (%s@%s) [%s] [%s]", |
749 |
|
source_p->name, source_p->username, source_p->host, comment, |
750 |
< |
ConfigGeneral.hide_spoof_ips && IsIPSpoof(source_p) ? |
751 |
< |
"255.255.255.255" : source_p->sockhost); |
750 |
> |
source_p->sockhost); |
751 |
> |
|
752 |
|
ilog(LOG_TYPE_USER, "%s (%3u:%02u:%02u): %s!%s@%s %llu/%llu", |
753 |
|
myctime(source_p->connection->firsttime), (unsigned int)(on_for / 3600), |
754 |
|
(unsigned int)((on_for % 3600)/60), (unsigned int)(on_for % 60), |
759 |
|
else if (IsServer(source_p)) |
760 |
|
{ |
761 |
|
assert(Count.myserver > 0); |
762 |
+ |
|
763 |
|
--Count.myserver; |
764 |
|
|
765 |
|
assert(dlinkFind(&local_server_list, source_p)); |
809 |
|
|
810 |
|
/* Send SQUIT for source_p in every direction. source_p is already off of local_server_list here */ |
811 |
|
if (!HasFlag(source_p, FLAGS_SQUIT)) |
812 |
< |
sendto_server(NULL, NOCAPS, NOCAPS, "SQUIT %s :%s", source_p->id, comment); |
812 |
> |
sendto_server(NULL, 0, 0, "SQUIT %s :%s", source_p->id, comment); |
813 |
|
|
814 |
|
/* Now exit the clients internally */ |
815 |
|
recurse_remove_clients(source_p, splitstr); |
831 |
|
} |
832 |
|
} |
833 |
|
else if (IsClient(source_p) && !HasFlag(source_p, FLAGS_KILLED)) |
834 |
< |
sendto_server(source_p->from, NOCAPS, NOCAPS, ":%s QUIT :%s", |
834 |
> |
sendto_server(source_p->from, 0, 0, ":%s QUIT :%s", |
835 |
|
source_p->id, comment); |
836 |
|
|
837 |
|
/* The client *better* be off all of the lists */ |
1019 |
|
{ |
1020 |
|
dlink_node *node = NULL; |
1021 |
|
|
1022 |
+ |
if (HasFlag(source, FLAGS_SERVICE) || |
1023 |
+ |
(HasUMode(source, UMODE_OPER) && ConfigGeneral.opers_bypass_callerid)) |
1024 |
+ |
return 1; |
1025 |
+ |
|
1026 |
|
if (source == target || find_accept(source->name, source->username, |
1027 |
|
source->host, target, match)) |
1028 |
|
return 1; |
1056 |
|
unsigned int idle = 0; |
1057 |
|
unsigned int min_idle = 0; |
1058 |
|
unsigned int max_idle = 0; |
1059 |
< |
const struct ClassItem *class = get_class_ptr(&target_p->connection->confs); |
1059 |
> |
const struct ClassItem *const class = get_class_ptr(&target_p->connection->confs); |
1060 |
|
|
1061 |
|
if (!(class->flags & CLASS_FLAGS_FAKE_IDLE) || target_p == source_p) |
1062 |
|
return CurrentTime - target_p->connection->last_privmsg; |
1063 |
+ |
|
1064 |
|
if (HasUMode(source_p, UMODE_OPER) && |
1065 |
|
!(class->flags & CLASS_FLAGS_HIDE_IDLE_FROM_OPERS)) |
1066 |
|
return CurrentTime - target_p->connection->last_privmsg; |