1 |
|
/* |
2 |
< |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
< |
* client.c: Controls clients. |
2 |
> |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
3 |
|
* |
4 |
< |
* Copyright (C) 2002 by the past and present ircd coders, and others. |
4 |
> |
* Copyright (c) 1997-2014 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 |
17 |
|
* along with this program; if not, write to the Free Software |
18 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
19 |
|
* USA |
20 |
< |
* |
21 |
< |
* $Id$ |
20 |
> |
*/ |
21 |
> |
|
22 |
> |
/*! \file client.c |
23 |
> |
* \brief Controls clients. |
24 |
> |
* \version $Id$ |
25 |
|
*/ |
26 |
|
|
27 |
|
#include "stdinc.h" |
54 |
|
#include "userhost.h" |
55 |
|
#include "watch.h" |
56 |
|
#include "rng_mt.h" |
57 |
+ |
#include "parse.h" |
58 |
|
|
59 |
|
dlink_list listing_client_list = { NULL, NULL, 0 }; |
60 |
|
/* Pointer to beginning of Client list */ |
78 |
|
|
79 |
|
static void check_pings_list(dlink_list *); |
80 |
|
static void check_unknowns_list(void); |
78 |
– |
static void ban_them(struct Client *, struct MaskItem *); |
81 |
|
|
82 |
|
|
83 |
< |
/* init_client() |
83 |
> |
/* client_init() |
84 |
|
* |
85 |
|
* inputs - NONE |
86 |
|
* output - NONE |
87 |
|
* side effects - initialize client free memory |
88 |
|
*/ |
89 |
|
void |
90 |
< |
init_client(void) |
90 |
> |
client_init(void) |
91 |
|
{ |
92 |
|
/* start off the check ping event .. -- adrian |
93 |
|
* Every 30 seconds is plenty -- db |
139 |
|
|
140 |
|
client_p->idhnext = client_p; |
141 |
|
client_p->hnext = client_p; |
142 |
< |
client_p->status = STAT_UNKNOWN; |
142 |
> |
SetUnknown(client_p); |
143 |
|
strcpy(client_p->username, "unknown"); |
144 |
|
strcpy(client_p->svid, "0"); |
145 |
|
|
166 |
|
assert(!IsServer(client_p) || (IsServer(client_p) && client_p->serv)); |
167 |
|
|
168 |
|
MyFree(client_p->serv); |
169 |
+ |
MyFree(client_p->certfp); |
170 |
|
|
171 |
|
if (MyConnect(client_p)) |
172 |
|
{ |
173 |
|
assert(client_p->localClient->invited.head == NULL); |
174 |
|
assert(dlink_list_length(&client_p->localClient->invited) == 0); |
175 |
< |
assert(dlink_list_length(&client_p->localClient->watches) == 0); |
175 |
> |
assert(dlink_list_length(&client_p->localClient->watches) == 0); |
176 |
|
assert(IsClosing(client_p) && IsDead(client_p)); |
177 |
|
|
178 |
|
MyFree(client_p->localClient->response); |
185 |
|
{ |
186 |
|
assert(0 < client_p->localClient->listener->ref_count); |
187 |
|
if (0 == --client_p->localClient->listener->ref_count && |
188 |
< |
!client_p->localClient->listener->active) |
188 |
> |
!client_p->localClient->listener->active) |
189 |
|
free_listener(client_p->localClient->listener); |
190 |
|
} |
191 |
|
|
204 |
|
* |
205 |
|
* inputs - NOT USED (from event) |
206 |
|
* output - next time_t when check_pings() should be called again |
207 |
< |
* side effects - |
207 |
> |
* side effects - |
208 |
|
* |
209 |
|
* |
210 |
|
* A PING can be sent to clients as necessary. |
226 |
|
|
227 |
|
static void |
228 |
|
check_pings(void *notused) |
229 |
< |
{ |
229 |
> |
{ |
230 |
|
check_pings_list(&local_client_list); |
231 |
|
check_pings_list(&serv_list); |
232 |
|
check_unknowns_list(); |
236 |
|
* |
237 |
|
* inputs - pointer to list to check |
238 |
|
* output - NONE |
239 |
< |
* side effects - |
239 |
> |
* side effects - |
240 |
|
*/ |
241 |
|
static void |
242 |
|
check_pings_list(dlink_list *list) |
243 |
|
{ |
244 |
< |
char scratch[32]; /* way too generous but... */ |
244 |
> |
char scratch[IRCD_BUFSIZE]; |
245 |
|
int ping = 0; /* ping time value from client */ |
246 |
|
dlink_node *ptr = NULL, *next_ptr = NULL; |
247 |
|
|
256 |
|
if (IsDead(client_p)) |
257 |
|
{ |
258 |
|
/* Ignore it, its been exited already */ |
259 |
< |
continue; |
259 |
> |
continue; |
260 |
|
} |
261 |
|
|
262 |
|
if (!IsRegistered(client_p)) |
268 |
|
{ |
269 |
|
if (!IsPingSent(client_p)) |
270 |
|
{ |
271 |
< |
/* |
272 |
< |
* if we havent PINGed the connection and we havent |
273 |
< |
* heard from it in a while, PING it to make sure |
274 |
< |
* it is still alive. |
275 |
< |
*/ |
276 |
< |
SetPingSent(client_p); |
277 |
< |
client_p->localClient->lasttime = CurrentTime - ping; |
278 |
< |
sendto_one(client_p, "PING :%s", ID_or_name(&me, client_p)); |
271 |
> |
/* |
272 |
> |
* if we havent PINGed the connection and we havent |
273 |
> |
* heard from it in a while, PING it to make sure |
274 |
> |
* it is still alive. |
275 |
> |
*/ |
276 |
> |
SetPingSent(client_p); |
277 |
> |
client_p->localClient->lasttime = CurrentTime - ping; |
278 |
> |
sendto_one(client_p, "PING :%s", ID_or_name(&me, client_p)); |
279 |
|
} |
280 |
|
else |
281 |
|
{ |
286 |
|
* and it has a ping time, then close its connection. |
287 |
|
*/ |
288 |
|
if (IsServer(client_p) || IsHandshake(client_p)) |
289 |
< |
{ |
290 |
< |
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
291 |
< |
"No response from %s, closing link", |
292 |
< |
get_client_name(client_p, HIDE_IP)); |
293 |
< |
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
294 |
< |
"No response from %s, closing link", |
295 |
< |
get_client_name(client_p, MASK_IP)); |
296 |
< |
ilog(LOG_TYPE_IRCD, "No response from %s, closing link", |
297 |
< |
get_client_name(client_p, HIDE_IP)); |
298 |
< |
} |
289 |
> |
{ |
290 |
> |
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
291 |
> |
"No response from %s, closing link", |
292 |
> |
get_client_name(client_p, HIDE_IP)); |
293 |
> |
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
294 |
> |
"No response from %s, closing link", |
295 |
> |
get_client_name(client_p, MASK_IP)); |
296 |
> |
ilog(LOG_TYPE_IRCD, "No response from %s, closing link", |
297 |
> |
get_client_name(client_p, HIDE_IP)); |
298 |
> |
} |
299 |
|
|
300 |
|
snprintf(scratch, sizeof(scratch), "Ping timeout: %d seconds", |
301 |
|
(int)(CurrentTime - client_p->localClient->lasttime)); |
337 |
|
* side effects - Check all connections for a pending kline against the |
338 |
|
* client, exit the client if a kline matches. |
339 |
|
*/ |
340 |
< |
void |
340 |
> |
void |
341 |
|
check_conf_klines(void) |
342 |
< |
{ |
342 |
> |
{ |
343 |
|
struct Client *client_p = NULL; /* current local client_p being examined */ |
344 |
|
struct MaskItem *conf = NULL; |
345 |
|
dlink_node *ptr, *next_ptr; |
357 |
|
client_p->localClient->aftype)) != NULL) |
358 |
|
{ |
359 |
|
if (conf->type == CONF_EXEMPT) |
360 |
< |
continue; |
360 |
> |
continue; |
361 |
|
|
362 |
< |
ban_them(client_p, conf); |
362 |
> |
conf_try_ban(client_p, conf); |
363 |
|
continue; /* and go examine next fd/client_p */ |
364 |
|
} |
365 |
|
|
366 |
< |
if (ConfigFileEntry.glines && (conf = find_gline(client_p))) |
366 |
> |
if (ConfigFileEntry.glines) |
367 |
|
{ |
368 |
< |
if (IsExemptKline(client_p) || |
369 |
< |
IsExemptGline(client_p)) |
368 |
> |
if ((conf = find_conf_by_address(client_p->host, &client_p->localClient->ip, |
369 |
> |
CONF_GLINE, client_p->localClient->aftype, |
370 |
> |
client_p->username, NULL, 1))) |
371 |
|
{ |
372 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
373 |
< |
"GLINE over-ruled for %s, client is %sline_exempt", |
370 |
< |
get_client_name(client_p, HIDE_IP), IsExemptKline(client_p) ? "k" : "g"); |
372 |
> |
conf_try_ban(client_p, conf); |
373 |
> |
/* and go examine next fd/client_p */ |
374 |
|
continue; |
375 |
|
} |
376 |
+ |
} |
377 |
|
|
378 |
< |
ban_them(client_p, conf); |
379 |
< |
/* and go examine next fd/client_p */ |
380 |
< |
continue; |
377 |
< |
} |
378 |
< |
|
379 |
< |
if ((conf = find_kill(client_p)) != NULL) |
378 |
> |
if ((conf = find_conf_by_address(client_p->host, &client_p->localClient->ip, |
379 |
> |
CONF_KLINE, client_p->localClient->aftype, |
380 |
> |
client_p->username, NULL, 1))) |
381 |
|
{ |
382 |
< |
if (IsExemptKline(client_p)) |
383 |
< |
{ |
383 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
384 |
< |
"KLINE over-ruled for %s, client is kline_exempt", |
385 |
< |
get_client_name(client_p, HIDE_IP)); |
386 |
< |
continue; |
387 |
< |
} |
388 |
< |
|
389 |
< |
ban_them(client_p, conf); |
390 |
< |
continue; |
382 |
> |
conf_try_ban(client_p, conf); |
383 |
> |
continue; |
384 |
|
} |
385 |
|
|
386 |
|
if ((conf = find_matching_name_conf(CONF_XLINE, client_p->info, |
387 |
< |
NULL, NULL, 0)) != NULL || |
395 |
< |
(conf = find_matching_name_conf(CONF_RXLINE, client_p->info, |
396 |
< |
NULL, NULL, 0)) != NULL) |
387 |
> |
NULL, NULL, 0))) |
388 |
|
{ |
389 |
< |
ban_them(client_p, conf); |
389 |
> |
conf_try_ban(client_p, conf); |
390 |
|
continue; |
391 |
|
} |
392 |
|
} |
408 |
|
} |
409 |
|
|
410 |
|
/* |
411 |
< |
* ban_them |
411 |
> |
* conf_try_ban |
412 |
|
* |
413 |
|
* inputs - pointer to client to ban |
414 |
|
* - pointer to MaskItem |
415 |
|
* output - NONE |
416 |
|
* side effects - given client_p is banned |
417 |
|
*/ |
418 |
< |
static void |
419 |
< |
ban_them(struct Client *client_p, struct MaskItem *conf) |
418 |
> |
void |
419 |
> |
conf_try_ban(struct Client *client_p, struct MaskItem *conf) |
420 |
|
{ |
421 |
< |
const char *user_reason = NULL; /* What is sent to user */ |
421 |
> |
const char *user_reason = NULL; /* What is sent to user */ |
422 |
|
const char *type_string = NULL; |
423 |
|
const char dline_string[] = "D-line"; |
424 |
|
const char kline_string[] = "K-line"; |
427 |
|
|
428 |
|
switch (conf->type) |
429 |
|
{ |
439 |
– |
case CONF_RKLINE: |
430 |
|
case CONF_KLINE: |
431 |
+ |
if (IsExemptKline(client_p)) |
432 |
+ |
{ |
433 |
+ |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
434 |
+ |
"KLINE over-ruled for %s, client is kline_exempt", |
435 |
+ |
get_client_name(client_p, HIDE_IP)); |
436 |
+ |
return; |
437 |
+ |
} |
438 |
+ |
|
439 |
|
type_string = kline_string; |
440 |
|
break; |
441 |
|
case CONF_DLINE: |
442 |
|
type_string = dline_string; |
443 |
|
break; |
444 |
|
case CONF_GLINE: |
445 |
+ |
if (IsExemptKline(client_p) || |
446 |
+ |
IsExemptGline(client_p)) |
447 |
+ |
{ |
448 |
+ |
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
449 |
+ |
"GLINE over-ruled for %s, client is %sline_exempt", |
450 |
+ |
get_client_name(client_p, HIDE_IP), IsExemptKline(client_p) ? "k" : "g"); |
451 |
+ |
return; |
452 |
+ |
} |
453 |
+ |
|
454 |
|
type_string = gline_string; |
455 |
|
break; |
449 |
– |
case CONF_RXLINE: |
456 |
|
case CONF_XLINE: |
457 |
|
type_string = xline_string; |
458 |
|
++conf->count; |
469 |
|
|
470 |
|
if (IsClient(client_p)) |
471 |
|
sendto_one(client_p, form_str(ERR_YOUREBANNEDCREEP), |
472 |
< |
me.name, client_p->name, user_reason); |
472 |
> |
me.name, client_p->name, user_reason); |
473 |
|
|
474 |
|
exit_client(client_p, &me, user_reason); |
475 |
|
} |
478 |
|
* |
479 |
|
* input - pointer to client |
480 |
|
* output - NONE |
481 |
< |
* side effects - |
481 |
> |
* side effects - |
482 |
|
*/ |
483 |
|
static void |
484 |
|
update_client_exit_stats(struct Client *client_p) |
510 |
|
struct Client * |
511 |
|
find_person(const struct Client *client_p, const char *name) |
512 |
|
{ |
513 |
< |
struct Client *c2ptr = NULL; |
513 |
> |
struct Client *target_p = NULL; |
514 |
|
|
515 |
|
if (IsDigit(*name)) |
516 |
|
{ |
517 |
< |
if ((c2ptr = hash_find_id(name)) != NULL) |
518 |
< |
{ |
513 |
< |
/* invisible users shall not be found by UID guessing */ |
514 |
< |
if (HasUMode(c2ptr, UMODE_INVISIBLE)) |
515 |
< |
if (!IsServer(client_p) && !HasFlag(client_p, FLAGS_SERVICE)) |
516 |
< |
c2ptr = NULL; |
517 |
< |
} |
517 |
> |
if (IsServer(client_p) || HasFlag(client_p, FLAGS_SERVICE)) |
518 |
> |
target_p = hash_find_id(name); |
519 |
|
} |
520 |
|
else |
521 |
< |
c2ptr = hash_find_client(name); |
521 |
> |
target_p = hash_find_client(name); |
522 |
|
|
523 |
< |
return ((c2ptr != NULL && IsClient(c2ptr)) ? c2ptr : NULL); |
523 |
> |
return (target_p && IsClient(target_p)) ? target_p : NULL; |
524 |
|
} |
525 |
|
|
526 |
|
/* |
527 |
< |
* find_chasing - find the client structure for a nick name (user) |
528 |
< |
* using history mechanism if necessary. If the client is not found, |
527 |
> |
* find_chasing - find the client structure for a nick name (name) |
528 |
> |
* using history mechanism if necessary. If the client is not found, |
529 |
|
* an error message (NO SUCH NICK) is generated. If the client was found |
530 |
|
* through the history, chasing will be 1 and otherwise 0. |
531 |
|
*/ |
532 |
|
struct Client * |
533 |
< |
find_chasing(struct Client *client_p, struct Client *source_p, const char *user, int *chasing) |
533 |
> |
find_chasing(struct Client *source_p, const char *name, int *const chasing) |
534 |
|
{ |
535 |
< |
struct Client *who = find_person(client_p, user); |
535 |
> |
struct Client *who = find_person(source_p->from, name); |
536 |
|
|
537 |
|
if (chasing) |
538 |
|
*chasing = 0; |
540 |
|
if (who) |
541 |
|
return who; |
542 |
|
|
543 |
< |
if (IsDigit(*user)) |
543 |
> |
if (IsDigit(*name)) |
544 |
|
return NULL; |
545 |
|
|
546 |
< |
if ((who = get_history(user, |
547 |
< |
(time_t)ConfigFileEntry.kill_chase_time_limit)) |
548 |
< |
== NULL) |
546 |
> |
if ((who = whowas_get_history(name, |
547 |
> |
(time_t)ConfigFileEntry.kill_chase_time_limit)) |
548 |
> |
== NULL) |
549 |
|
{ |
550 |
|
sendto_one(source_p, form_str(ERR_NOSUCHNICK), |
551 |
< |
me.name, source_p->name, user); |
551 |
> |
me.name, source_p->name, name); |
552 |
|
return NULL; |
553 |
|
} |
554 |
|
|
583 |
|
|
584 |
|
assert(client != NULL); |
585 |
|
|
586 |
< |
if (!MyConnect(client)) |
586 |
> |
if (!MyConnect(client)) |
587 |
|
return client->name; |
588 |
|
|
589 |
|
if (IsServer(client) || IsConnecting(client) || IsHandshake(client)) |
627 |
|
free_exited_clients(void) |
628 |
|
{ |
629 |
|
dlink_node *ptr = NULL, *next = NULL; |
630 |
< |
|
630 |
> |
|
631 |
|
DLINK_FOREACH_SAFE(ptr, next, dead_list.head) |
632 |
|
{ |
633 |
|
free_client(ptr->data); |
666 |
|
DLINK_FOREACH_SAFE(lp, next_lp, source_p->channel.head) |
667 |
|
remove_user_from_channel(lp->data); |
668 |
|
|
669 |
< |
add_history(source_p, 0); |
670 |
< |
off_history(source_p); |
669 |
> |
whowas_add_history(source_p, 0); |
670 |
> |
whowas_off_history(source_p); |
671 |
|
|
672 |
|
watch_check_hash(source_p, RPL_LOGOFF); |
673 |
|
|
756 |
|
} |
757 |
|
} |
758 |
|
|
759 |
< |
/* |
759 |
> |
/* |
760 |
|
* Remove all clients that depend on source_p; assumes all (S)QUITs have |
761 |
< |
* already been sent. we make sure to exit a server's dependent clients |
762 |
< |
* and servers before the server itself; exit_one_client takes care of |
761 |
> |
* already been sent. we make sure to exit a server's dependent clients |
762 |
> |
* and servers before the server itself; exit_one_client takes care of |
763 |
|
* actually removing things off llists. tweaked from +CSr31 -orabidoo |
764 |
|
*/ |
765 |
|
static void |
831 |
|
if (IsIpHash(source_p)) |
832 |
|
remove_one_ip(&source_p->localClient->ip); |
833 |
|
|
834 |
< |
if (source_p->localClient->auth) |
834 |
< |
{ |
835 |
< |
delete_auth(source_p->localClient->auth); |
836 |
< |
source_p->localClient->auth = NULL; |
837 |
< |
} |
834 |
> |
delete_auth(&source_p->localClient->auth); |
835 |
|
|
836 |
|
/* |
837 |
|
* This source_p could have status of one of STAT_UNKNOWN, STAT_CONNECTING |
868 |
|
source_p->name, source_p->username, source_p->host, comment, |
869 |
|
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
870 |
|
"255.255.255.255" : source_p->sockhost); |
874 |
– |
sendto_realops_flags(UMODE_CCONN_FULL, L_ALL, SEND_NOTICE, |
875 |
– |
"CLIEXIT: %s %s %s %s 0 %s", |
876 |
– |
source_p->name, |
877 |
– |
source_p->username, |
878 |
– |
source_p->host, |
879 |
– |
ConfigFileEntry.hide_spoof_ips && IsIPSpoof(source_p) ? |
880 |
– |
"255.255.255.255" : source_p->sockhost, |
881 |
– |
comment); |
871 |
|
ilog(LOG_TYPE_USER, "%s (%3u:%02u:%02u): %s!%s@%s %llu/%llu", |
872 |
|
myctime(source_p->localClient->firsttime), (unsigned int)(on_for / 3600), |
873 |
|
(unsigned int)((on_for % 3600)/60), (unsigned int)(on_for % 60), |
891 |
|
{ |
892 |
|
/* for them, we are exiting the network */ |
893 |
|
sendto_one(source_p, ":%s SQUIT %s :%s", |
894 |
< |
ID_or_name(from, source_p), me.name, comment); |
894 |
> |
ID_or_name(from, source_p), me.name, comment); |
895 |
|
} |
896 |
|
|
897 |
|
sendto_one(source_p, "ERROR :Closing Link: %s (%s)", |
911 |
|
*/ |
912 |
|
close_connection(source_p); |
913 |
|
} |
914 |
+ |
else if (IsClient(source_p) && HasFlag(source_p->servptr, FLAGS_EOB)) |
915 |
+ |
sendto_realops_flags(UMODE_FARCONNECT, L_ALL, SEND_NOTICE, |
916 |
+ |
"Client exiting at %s: %s (%s@%s) [%s]", |
917 |
+ |
source_p->servptr->name, source_p->name, |
918 |
+ |
source_p->username, source_p->host, comment); |
919 |
|
|
920 |
|
if (IsServer(source_p)) |
921 |
|
{ |
926 |
|
|
927 |
|
if (ConfigServerHide.hide_servers) |
928 |
|
/* |
929 |
< |
* Set netsplit message to "*.net *.split" to still show |
929 |
> |
* Set netsplit message to "*.net *.split" to still show |
930 |
|
* that its a split, but hide the servers splitting |
931 |
|
*/ |
932 |
|
strcpy(splitstr, "*.net *.split"); |
944 |
|
source_p->localClient->send.bytes >> 10, |
945 |
|
source_p->localClient->recv.bytes >> 10); |
946 |
|
ilog(LOG_TYPE_IRCD, "%s was connected for %d seconds. %llu/%llu sendK/recvK.", |
947 |
< |
source_p->name, (int)(CurrentTime - source_p->localClient->firsttime), |
947 |
> |
source_p->name, (int)(CurrentTime - source_p->localClient->firsttime), |
948 |
|
source_p->localClient->send.bytes >> 10, |
949 |
|
source_p->localClient->recv.bytes >> 10); |
950 |
|
} |
999 |
|
void |
1000 |
|
dead_link_on_read(struct Client *client_p, int error) |
1001 |
|
{ |
1002 |
< |
char errmsg[255]; |
1002 |
> |
char errmsg[IRCD_BUFSIZE]; |
1003 |
|
int current_error; |
1004 |
|
|
1005 |
|
if (IsDefunct(client_p)) |
1013 |
|
if (IsServer(client_p) || IsHandshake(client_p)) |
1014 |
|
{ |
1015 |
|
int connected = CurrentTime - client_p->localClient->firsttime; |
1016 |
< |
|
1016 |
> |
|
1017 |
|
if (error == 0) |
1018 |
|
{ |
1019 |
|
/* Admins get the real IP */ |
1020 |
|
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
1021 |
< |
"Server %s closed the connection", |
1022 |
< |
get_client_name(client_p, SHOW_IP)); |
1021 |
> |
"Server %s closed the connection", |
1022 |
> |
get_client_name(client_p, SHOW_IP)); |
1023 |
|
|
1024 |
|
/* Opers get a masked IP */ |
1025 |
|
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
1026 |
< |
"Server %s closed the connection", |
1027 |
< |
get_client_name(client_p, MASK_IP)); |
1026 |
> |
"Server %s closed the connection", |
1027 |
> |
get_client_name(client_p, MASK_IP)); |
1028 |
|
|
1029 |
|
ilog(LOG_TYPE_IRCD, "Server %s closed the connection", |
1030 |
< |
get_client_name(client_p, SHOW_IP)); |
1030 |
> |
get_client_name(client_p, SHOW_IP)); |
1031 |
|
} |
1032 |
|
else |
1033 |
|
{ |
1034 |
|
report_error(L_ADMIN, "Lost connection to %s: %s", |
1035 |
< |
get_client_name(client_p, SHOW_IP), current_error); |
1035 |
> |
get_client_name(client_p, SHOW_IP), current_error); |
1036 |
|
report_error(L_OPER, "Lost connection to %s: %s", |
1037 |
< |
get_client_name(client_p, MASK_IP), current_error); |
1037 |
> |
get_client_name(client_p, MASK_IP), current_error); |
1038 |
|
} |
1039 |
|
|
1040 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
1041 |
< |
"%s had been connected for %d day%s, %2d:%02d:%02d", |
1042 |
< |
client_p->name, connected/86400, |
1043 |
< |
(connected/86400 == 1) ? "" : "s", |
1044 |
< |
(connected % 86400) / 3600, (connected % 3600) / 60, |
1045 |
< |
connected % 60); |
1041 |
> |
"%s had been connected for %d day%s, %2d:%02d:%02d", |
1042 |
> |
client_p->name, connected/86400, |
1043 |
> |
(connected/86400 == 1) ? "" : "s", |
1044 |
> |
(connected % 86400) / 3600, (connected % 3600) / 60, |
1045 |
> |
connected % 60); |
1046 |
|
} |
1047 |
|
|
1048 |
|
if (error == 0) |
1083 |
|
else |
1084 |
|
notice = "Write error: connection closed"; |
1085 |
|
|
1086 |
< |
exit_client(target_p, &me, notice); |
1086 |
> |
exit_client(target_p, &me, notice); |
1087 |
|
free_dlink_node(ptr); |
1088 |
|
} |
1089 |
|
} |
1111 |
|
|
1112 |
|
struct split_nuh_item * |
1113 |
|
find_accept(const char *nick, const char *user, |
1114 |
< |
const char *host, struct Client *client_p, int do_match) |
1114 |
> |
const char *host, struct Client *client_p, |
1115 |
> |
int (*cmpfunc)(const char *, const char *)) |
1116 |
|
{ |
1117 |
|
dlink_node *ptr = NULL; |
1123 |
– |
/* XXX We wouldn't need that if match() would return 0 on match */ |
1124 |
– |
int (*cmpfunc)(const char *, const char *) = do_match ? match : irccmp; |
1118 |
|
|
1119 |
|
DLINK_FOREACH(ptr, client_p->localClient->acceptlist.head) |
1120 |
|
{ |
1143 |
|
dlink_node *ptr = NULL; |
1144 |
|
|
1145 |
|
if (source == target || find_accept(source->name, source->username, |
1146 |
< |
source->host, target, 1)) |
1146 |
> |
source->host, target, match)) |
1147 |
|
return 1; |
1148 |
|
|
1149 |
|
if (HasUMode(target, UMODE_SOFTCALLERID)) |
1175 |
|
unsigned int idle = 0; |
1176 |
|
unsigned int min_idle = 0; |
1177 |
|
unsigned int max_idle = 0; |
1178 |
< |
struct ClassItem *class = get_class_ptr(&target_p->localClient->confs); |
1178 |
> |
const struct ClassItem *class = get_class_ptr(&target_p->localClient->confs); |
1179 |
|
|
1180 |
|
if (!(class->flags & CLASS_FLAGS_FAKE_IDLE) || target_p == source_p) |
1181 |
|
return CurrentTime - target_p->localClient->last_privmsg; |