23 |
|
*/ |
24 |
|
|
25 |
|
#include "stdinc.h" |
26 |
< |
#include "tools.h" |
26 |
> |
#include "list.h" |
27 |
|
#include "send.h" |
28 |
|
#include "channel.h" |
29 |
|
#include "client.h" |
30 |
– |
#include "common.h" |
30 |
|
#include "dbuf.h" |
31 |
|
#include "irc_string.h" |
32 |
|
#include "ircd.h" |
34 |
– |
#include "handlers.h" |
33 |
|
#include "numeric.h" |
34 |
|
#include "fdlist.h" |
35 |
|
#include "s_bsd.h" |
36 |
|
#include "s_serv.h" |
37 |
|
#include "sprintf_irc.h" |
38 |
< |
#include "s_conf.h" |
39 |
< |
#include "list.h" |
42 |
< |
#include "s_log.h" |
38 |
> |
#include "conf.h" |
39 |
> |
#include "log.h" |
40 |
|
#include "memory.h" |
41 |
|
#include "hook.h" |
45 |
– |
#include "irc_getnameinfo.h" |
42 |
|
#include "packet.h" |
43 |
|
|
48 |
– |
#define LOG_BUFSIZE 2048 |
44 |
|
|
45 |
|
struct Callback *iosend_cb = NULL; |
46 |
< |
struct Callback *iosendctrl_cb = NULL; |
46 |
> |
static unsigned int current_serial = 0; |
47 |
|
|
53 |
– |
static void send_message(struct Client *, char *, int); |
54 |
– |
static void send_message_remote(struct Client *, struct Client *, char *, int); |
55 |
– |
|
56 |
– |
static unsigned long current_serial = 0L; |
48 |
|
|
49 |
|
/* send_format() |
50 |
|
* |
78 |
|
|
79 |
|
lsendbuf[len++] = '\r'; |
80 |
|
lsendbuf[len++] = '\n'; |
81 |
< |
return (len); |
81 |
> |
return len; |
82 |
|
} |
83 |
|
|
84 |
|
/* |
103 |
|
static void |
104 |
|
send_message(struct Client *to, char *buf, int len) |
105 |
|
{ |
106 |
< |
#ifdef INVARIANTS |
107 |
< |
if (IsMe(to)) |
117 |
< |
{ |
118 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
119 |
< |
"Trying to send message to myself!"); |
120 |
< |
return; |
121 |
< |
} |
122 |
< |
#endif |
106 |
> |
assert(!IsMe(to)); |
107 |
> |
assert(to != &me); |
108 |
|
|
109 |
|
if (dbuf_length(&to->localClient->buf_sendq) + len > get_sendq(to)) |
110 |
|
{ |
158 |
|
return; |
159 |
|
} |
160 |
|
|
176 |
– |
if (ServerInfo.hub && IsCapable(to, CAP_LL)) |
177 |
– |
{ |
178 |
– |
if (((from->lazyLinkClientExists & |
179 |
– |
to->localClient->serverMask) == 0)) |
180 |
– |
client_burst_if_needed(to, from); |
181 |
– |
} |
182 |
– |
|
161 |
|
/* Optimize by checking if (from && to) before everything */ |
162 |
|
/* we set to->from up there.. */ |
163 |
|
|
177 |
|
from->name, from->username, from->host, |
178 |
|
to->from->name); |
179 |
|
|
180 |
< |
sendto_server(NULL, to, NULL, CAP_TS6, NOCAPS, NOFLAGS, |
180 |
> |
sendto_server(NULL, CAP_TS6, NOCAPS, |
181 |
|
":%s KILL %s :%s (%s[%s@%s] Ghosted %s)", |
182 |
|
me.id, to->name, me.name, to->name, |
183 |
|
to->username, to->host, to->from->name); |
184 |
< |
sendto_server(NULL, to, NULL, NOCAPS, CAP_TS6, NOFLAGS, |
184 |
> |
sendto_server(NULL, NOCAPS, CAP_TS6, |
185 |
|
":%s KILL %s :%s (%s[%s@%s] Ghosted %s)", |
186 |
|
me.name, to->name, me.name, to->name, |
187 |
|
to->username, to->host, to->from->name); |
188 |
|
|
189 |
< |
SetKilled(to); |
189 |
> |
AddFlag(to, FLAGS_KILLED); |
190 |
|
|
191 |
|
if (IsClient(from)) |
192 |
|
sendto_one(from, form_str(ERR_GHOSTEDCLIENT), |
221 |
|
} |
222 |
|
|
223 |
|
/* |
246 |
– |
** slinkq_unblocked |
247 |
– |
** Called when a server control socket is ready for writing. |
248 |
– |
*/ |
249 |
– |
static void |
250 |
– |
slinkq_unblocked(fde_t *fd, struct Client *client_p) |
251 |
– |
{ |
252 |
– |
ClearSlinkqBlocked(client_p); |
253 |
– |
send_queued_slink_write(client_p); |
254 |
– |
} |
255 |
– |
|
256 |
– |
/* |
224 |
|
** send_queued_write |
225 |
|
** This is called when there is a chance that some output would |
226 |
|
** be possible. This attempts to empty the send queue as far as |
262 |
|
errno = EWOULDBLOCK; |
263 |
|
case SSL_ERROR_SYSCALL: |
264 |
|
break; |
265 |
< |
|
265 |
> |
case SSL_ERROR_SSL: |
266 |
> |
if (errno == EAGAIN) |
267 |
> |
break; |
268 |
|
default: |
269 |
|
retlen = errno = 0; /* either an SSL-specific error or EOF */ |
270 |
|
} |
274 |
|
retlen = send(to->localClient->fd.fd, first->data, first->size, 0); |
275 |
|
|
276 |
|
if (retlen <= 0) |
308 |
– |
{ |
309 |
– |
#ifdef _WIN32 |
310 |
– |
errno = WSAGetLastError(); |
311 |
– |
#endif |
277 |
|
break; |
313 |
– |
} |
278 |
|
|
279 |
|
dbuf_delete(&to->localClient->buf_sendq, retlen); |
280 |
|
|
298 |
|
} |
299 |
|
} |
300 |
|
|
337 |
– |
/* |
338 |
– |
** send_queued_slink_write |
339 |
– |
** This is called when there is a chance the some output would |
340 |
– |
** be possible. This attempts to empty the send queue as far as |
341 |
– |
** possible, and then if any data is left, a write is rescheduled. |
342 |
– |
*/ |
343 |
– |
void |
344 |
– |
send_queued_slink_write(struct Client *to) |
345 |
– |
{ |
346 |
– |
int retlen; |
347 |
– |
|
348 |
– |
/* |
349 |
– |
** Once socket is marked dead, we cannot start writing to it, |
350 |
– |
** even if the error is removed... |
351 |
– |
*/ |
352 |
– |
if (IsDead(to) || IsSlinkqBlocked(to)) |
353 |
– |
return; /* no use calling send() now */ |
354 |
– |
|
355 |
– |
/* Next, lets try to write some data */ |
356 |
– |
if (to->localClient->slinkq != NULL) |
357 |
– |
{ |
358 |
– |
retlen = send(to->localClient->ctrlfd.fd, |
359 |
– |
to->localClient->slinkq + to->localClient->slinkq_ofs, |
360 |
– |
to->localClient->slinkq_len, 0); |
361 |
– |
if (retlen < 0) |
362 |
– |
{ |
363 |
– |
/* If we have a fatal error */ |
364 |
– |
if (!ignoreErrno(errno)) |
365 |
– |
{ |
366 |
– |
dead_link_on_write(to, errno); |
367 |
– |
return; |
368 |
– |
} |
369 |
– |
} |
370 |
– |
else if (retlen == 0) |
371 |
– |
{ |
372 |
– |
/* 0 bytes is an EOF .. */ |
373 |
– |
dead_link_on_write(to, 0); |
374 |
– |
return; |
375 |
– |
} |
376 |
– |
else |
377 |
– |
{ |
378 |
– |
execute_callback(iosendctrl_cb, to, retlen, |
379 |
– |
to->localClient->slinkq + to->localClient->slinkq_ofs); |
380 |
– |
to->localClient->slinkq_len -= retlen; |
381 |
– |
|
382 |
– |
assert(to->localClient->slinkq_len >= 0); |
383 |
– |
if (to->localClient->slinkq_len) |
384 |
– |
to->localClient->slinkq_ofs += retlen; |
385 |
– |
else |
386 |
– |
{ |
387 |
– |
to->localClient->slinkq_ofs = 0; |
388 |
– |
MyFree(to->localClient->slinkq); |
389 |
– |
to->localClient->slinkq = NULL; |
390 |
– |
} |
391 |
– |
} |
392 |
– |
|
393 |
– |
/* Finally, if we have any more data, reschedule a write */ |
394 |
– |
if (to->localClient->slinkq_len) |
395 |
– |
{ |
396 |
– |
SetSlinkqBlocked(to); |
397 |
– |
comm_setselect(&to->localClient->ctrlfd, COMM_SELECT_WRITE, |
398 |
– |
(PF *)slinkq_unblocked, (void *)to, 0); |
399 |
– |
} |
400 |
– |
} |
401 |
– |
} |
402 |
– |
|
301 |
|
/* send_queued_all() |
302 |
|
* |
303 |
|
* input - NONE |
376 |
|
char remote_buf[IRCD_BUFSIZE]; |
377 |
|
char uid_buf[IRCD_BUFSIZE]; |
378 |
|
int local_len, remote_len, uid_len; |
379 |
< |
dlink_node *ptr; |
482 |
< |
dlink_node *ptr_next; |
483 |
< |
struct Client *target_p; |
379 |
> |
dlink_node *ptr = NULL, *ptr_next = NULL; |
380 |
|
|
381 |
|
if (IsServer(from)) |
382 |
|
local_len = ircsprintf(local_buf, ":%s %s %s ", |
407 |
|
|
408 |
|
DLINK_FOREACH_SAFE(ptr, ptr_next, chptr->members.head) |
409 |
|
{ |
410 |
< |
target_p = ((struct Membership *)ptr->data)->client_p; |
411 |
< |
assert(target_p != NULL); |
410 |
> |
struct Client *target_p = ((struct Membership *)ptr->data)->client_p; |
411 |
> |
|
412 |
> |
assert(IsClient(target_p)); |
413 |
|
|
414 |
< |
if (IsDefunct(target_p) || IsDeaf(target_p) || target_p->from == one) |
414 |
> |
if (IsDefunct(target_p) || HasUMode(target_p, UMODE_DEAF) || target_p->from == one) |
415 |
|
continue; |
416 |
|
|
417 |
< |
if (MyClient(target_p)) |
417 |
> |
if (MyConnect(target_p)) |
418 |
|
{ |
419 |
< |
if (target_p->serial != current_serial) |
419 |
> |
if (target_p->localClient->serial != current_serial) |
420 |
|
{ |
421 |
|
send_message(target_p, local_buf, local_len); |
422 |
< |
target_p->serial = current_serial; |
422 |
> |
target_p->localClient->serial = current_serial; |
423 |
|
} |
424 |
|
} |
425 |
|
else |
427 |
|
/* Now check whether a message has been sent to this |
428 |
|
* remote link already |
429 |
|
*/ |
430 |
< |
if (target_p->from->serial != current_serial) |
430 |
> |
if (target_p->from->localClient->serial != current_serial) |
431 |
|
{ |
432 |
|
if (IsCapable(target_p->from, CAP_TS6)) |
433 |
|
send_message_remote(target_p->from, from, uid_buf, uid_len); |
434 |
|
else |
435 |
|
send_message_remote(target_p->from, from, remote_buf, remote_len); |
436 |
< |
target_p->from->serial = current_serial; |
436 |
> |
target_p->from->localClient->serial = current_serial; |
437 |
|
} |
438 |
|
} |
439 |
|
} |
442 |
|
/* sendto_server() |
443 |
|
* |
444 |
|
* inputs - pointer to client to NOT send to |
445 |
< |
* - pointer to source client required by LL (if any) |
549 |
< |
* - pointer to channel required by LL (if any) |
445 |
> |
* - pointer to channel |
446 |
|
* - caps or'd together which must ALL be present |
447 |
|
* - caps or'd together which must ALL NOT be present |
552 |
– |
* - LL flags: LL_ICLIENT | LL_ICHAN |
448 |
|
* - printf style format string |
449 |
|
* - args to format string |
450 |
|
* output - NONE |
451 |
|
* side effects - Send a message to all connected servers, except the |
452 |
|
* client 'one' (if non-NULL), as long as the servers |
453 |
|
* support ALL capabs in 'caps', and NO capabs in 'nocaps'. |
559 |
– |
* If the server is a lazylink client, then it must know |
560 |
– |
* about source_p if non-NULL (unless LL_ICLIENT is specified, |
561 |
– |
* when source_p will be introduced where required) and |
562 |
– |
* chptr if non-NULL (unless LL_ICHANNEL is specified, when |
563 |
– |
* chptr will be introduced where required). |
564 |
– |
* Note: nothing will be introduced to a LazyLeaf unless |
565 |
– |
* the message is actually sent. |
454 |
|
* |
455 |
|
* This function was written in an attempt to merge together the other |
456 |
|
* billion sendto_*serv*() functions, which sprung up with capabs, |
458 |
|
* -davidt |
459 |
|
*/ |
460 |
|
void |
461 |
< |
sendto_server(struct Client *one, struct Client *source_p, |
462 |
< |
struct Channel *chptr, unsigned long caps, |
463 |
< |
unsigned long nocaps, unsigned long llflags, |
461 |
> |
sendto_server(struct Client *one, |
462 |
> |
const unsigned int caps, |
463 |
> |
const unsigned int nocaps, |
464 |
|
const char *format, ...) |
465 |
|
{ |
466 |
|
va_list args; |
467 |
< |
struct Client *client_p; |
580 |
< |
dlink_node *ptr; |
467 |
> |
dlink_node *ptr = NULL; |
468 |
|
char buffer[IRCD_BUFSIZE]; |
469 |
< |
int len; |
583 |
< |
|
584 |
< |
if (chptr != NULL) |
585 |
< |
{ |
586 |
< |
if (chptr->chname[0] != '#') |
587 |
< |
return; |
588 |
< |
} |
469 |
> |
int len = 0; |
470 |
|
|
471 |
|
va_start(args, format); |
472 |
|
len = send_format(buffer, IRCD_BUFSIZE, format, args); |
474 |
|
|
475 |
|
DLINK_FOREACH(ptr, serv_list.head) |
476 |
|
{ |
477 |
< |
client_p = ptr->data; |
477 |
> |
struct Client *client_p = ptr->data; |
478 |
|
|
479 |
|
/* If dead already skip */ |
480 |
|
if (IsDead(client_p)) |
489 |
|
if ((client_p->localClient->caps & nocaps) != 0) |
490 |
|
continue; |
491 |
|
|
611 |
– |
if (ServerInfo.hub && IsCapable(client_p, CAP_LL)) |
612 |
– |
{ |
613 |
– |
/* check LL channel */ |
614 |
– |
if (chptr != NULL && |
615 |
– |
((chptr->lazyLinkChannelExists & |
616 |
– |
client_p->localClient->serverMask) == 0)) |
617 |
– |
{ |
618 |
– |
/* Only introduce the channel if we really will send this message */ |
619 |
– |
if (!(llflags & LL_ICLIENT) && source_p && |
620 |
– |
((source_p->lazyLinkClientExists & |
621 |
– |
client_p->localClient->serverMask) == 0)) |
622 |
– |
continue; /* we can't introduce the unknown source_p, skip */ |
623 |
– |
|
624 |
– |
if (llflags & LL_ICHAN) |
625 |
– |
burst_channel(client_p, chptr); |
626 |
– |
else |
627 |
– |
continue; /* we can't introduce the unknown chptr, skip */ |
628 |
– |
} |
629 |
– |
/* check LL client */ |
630 |
– |
if (source_p && |
631 |
– |
((source_p->lazyLinkClientExists & |
632 |
– |
client_p->localClient->serverMask) == 0)) |
633 |
– |
{ |
634 |
– |
if (llflags & LL_ICLIENT) |
635 |
– |
client_burst_if_needed(client_p,source_p); |
636 |
– |
else |
637 |
– |
continue; /* we can't introduce the unknown source_p, skip */ |
638 |
– |
} |
639 |
– |
} |
492 |
|
send_message(client_p, buffer, len); |
493 |
|
} |
494 |
|
} |
526 |
|
chptr = ((struct Membership *) cptr->data)->chptr; |
527 |
|
assert(chptr != NULL); |
528 |
|
|
529 |
< |
DLINK_FOREACH(uptr, chptr->locmembers.head) |
529 |
> |
DLINK_FOREACH(uptr, chptr->members.head) |
530 |
|
{ |
531 |
|
ms = uptr->data; |
532 |
|
target_p = ms->client_p; |
533 |
|
assert(target_p != NULL); |
534 |
|
|
535 |
< |
if (target_p == user || IsDefunct(target_p) || |
536 |
< |
target_p->serial == current_serial) |
535 |
> |
if (!MyConnect(target_p) || target_p == user || IsDefunct(target_p) || |
536 |
> |
target_p->localClient->serial == current_serial) |
537 |
|
continue; |
538 |
|
|
539 |
< |
target_p->serial = current_serial; |
539 |
> |
target_p->localClient->serial = current_serial; |
540 |
|
send_message(target_p, buffer, len); |
541 |
|
} |
542 |
|
} |
543 |
|
|
544 |
|
if (touser && MyConnect(user) && !IsDead(user) && |
545 |
< |
user->serial != current_serial) |
545 |
> |
user->localClient->serial != current_serial) |
546 |
|
send_message(user, buffer, len); |
547 |
|
} |
548 |
|
|
571 |
|
len = send_format(buffer, IRCD_BUFSIZE, pattern, args); |
572 |
|
va_end(args); |
573 |
|
|
574 |
< |
DLINK_FOREACH(ptr, chptr->locmembers.head) |
574 |
> |
DLINK_FOREACH(ptr, chptr->members.head) |
575 |
|
{ |
576 |
|
ms = ptr->data; |
577 |
|
target_p = ms->client_p; |
579 |
|
if (type != 0 && (ms->flags & type) == 0) |
580 |
|
continue; |
581 |
|
|
582 |
< |
if (IsDefunct(target_p) || (nodeaf && IsDeaf(target_p))) |
582 |
> |
if (!MyConnect(target_p) || IsDefunct(target_p) || |
583 |
> |
(nodeaf && HasUMode(target_p, UMODE_DEAF))) |
584 |
|
continue; |
585 |
|
|
586 |
|
send_message(target_p, buffer, len); |
614 |
|
len = send_format(buffer, IRCD_BUFSIZE, pattern, args); |
615 |
|
va_end(args); |
616 |
|
|
617 |
< |
DLINK_FOREACH(ptr, chptr->locmembers.head) |
617 |
> |
DLINK_FOREACH(ptr, chptr->members.head) |
618 |
|
{ |
619 |
|
ms = ptr->data; |
620 |
|
target_p = ms->client_p; |
622 |
|
if (type != 0 && (ms->flags & type) == 0) |
623 |
|
continue; |
624 |
|
|
625 |
< |
if (target_p == one || IsDefunct(target_p) || IsDeaf(target_p)) |
625 |
> |
if (!MyConnect(target_p) || target_p == one || |
626 |
> |
IsDefunct(target_p) || HasUMode(target_p, UMODE_DEAF)) |
627 |
|
continue; |
628 |
|
send_message(target_p, buffer, len); |
629 |
|
} |
642 |
|
* remote to this server. |
643 |
|
*/ |
644 |
|
void |
645 |
< |
sendto_channel_remote(struct Client *one, struct Client *from, int type, int caps, |
646 |
< |
int nocaps, struct Channel *chptr, const char *pattern, ...) |
645 |
> |
sendto_channel_remote(struct Client *one, struct Client *from, int type, |
646 |
> |
const unsigned int caps, const unsigned int nocaps, |
647 |
> |
struct Channel *chptr, const char *pattern, ...) |
648 |
|
{ |
649 |
|
va_list args; |
650 |
|
char buffer[IRCD_BUFSIZE]; |
675 |
|
((target_p->from->localClient->caps & caps) != caps) || |
676 |
|
((target_p->from->localClient->caps & nocaps) != 0)) |
677 |
|
continue; |
678 |
< |
if (target_p->from->serial != current_serial) |
678 |
> |
if (target_p->from->localClient->serial != current_serial) |
679 |
|
{ |
680 |
|
send_message(target_p, buffer, len); |
681 |
< |
target_p->from->serial = current_serial; |
681 |
> |
target_p->from->localClient->serial = current_serial; |
682 |
|
} |
683 |
|
} |
684 |
|
} |
704 |
|
match_it(const struct Client *one, const char *mask, int what) |
705 |
|
{ |
706 |
|
if (what == MATCH_HOST) |
707 |
< |
return(match(mask, one->host)); |
707 |
> |
return match(mask, one->host); |
708 |
|
|
709 |
< |
return(match(mask, one->servptr->name)); |
709 |
> |
return match(mask, one->servptr->name); |
710 |
|
} |
711 |
|
|
712 |
|
/* sendto_match_butone() |
804 |
|
vsnprintf(buffer, sizeof(buffer), pattern, args); |
805 |
|
va_end(args); |
806 |
|
|
807 |
< |
current_serial++; |
807 |
> |
++current_serial; |
808 |
|
|
809 |
|
DLINK_FOREACH(ptr, global_serv_list.head) |
810 |
|
{ |
814 |
|
if (IsMe(target_p) || target_p->from == source_p->from) |
815 |
|
continue; |
816 |
|
|
817 |
< |
if (target_p->from->serial == current_serial) |
817 |
> |
if (target_p->from->localClient->serial == current_serial) |
818 |
|
continue; |
819 |
|
|
820 |
|
if (match(mask, target_p->name)) |
823 |
|
* if we set the serial here, then we'll never do a |
824 |
|
* match() again, if !IsCapable() |
825 |
|
*/ |
826 |
< |
target_p->from->serial = current_serial; |
826 |
> |
target_p->from->localClient->serial = current_serial; |
827 |
|
found++; |
828 |
|
|
829 |
|
if (!IsCapable(target_p->from, cap)) |
891 |
|
void |
892 |
|
sendto_realops_flags(unsigned int flags, int level, const char *pattern, ...) |
893 |
|
{ |
894 |
< |
struct Client *client_p; |
894 |
> |
dlink_node *ptr = NULL; |
895 |
|
char nbuf[IRCD_BUFSIZE]; |
1041 |
– |
dlink_node *ptr; |
896 |
|
va_list args; |
897 |
|
|
898 |
|
va_start(args, pattern); |
901 |
|
|
902 |
|
DLINK_FOREACH(ptr, oper_list.head) |
903 |
|
{ |
904 |
< |
client_p = ptr->data; |
905 |
< |
assert(client_p->umodes & UMODE_OPER); |
904 |
> |
struct Client *client_p = ptr->data; |
905 |
> |
assert(HasUMode(client_p, UMODE_OPER)); |
906 |
|
|
907 |
|
/* If we're sending it to opers and theyre an admin, skip. |
908 |
|
* If we're sending it to admins, and theyre not, skip. |
909 |
|
*/ |
910 |
< |
if (((level == L_ADMIN) && !IsAdmin(client_p)) || |
911 |
< |
((level == L_OPER) && IsAdmin(client_p))) |
910 |
> |
if (((level == L_ADMIN) && !HasUMode(client_p, UMODE_ADMIN)) || |
911 |
> |
((level == L_OPER) && HasUMode(client_p, UMODE_ADMIN))) |
912 |
|
continue; |
913 |
|
|
914 |
< |
if (client_p->umodes & flags) |
914 |
> |
if (HasUMode(client_p, flags)) |
915 |
|
sendto_one(client_p, ":%s NOTICE %s :*** Notice -- %s", |
916 |
|
me.name, client_p->name, nbuf); |
917 |
|
} |
918 |
|
} |
919 |
|
|
920 |
+ |
void |
921 |
+ |
sendto_globops_flags(unsigned int flags, int level, const char *pattern, ...) |
922 |
+ |
{ |
923 |
+ |
dlink_node *ptr = NULL; |
924 |
+ |
char nbuf[IRCD_BUFSIZE]; |
925 |
+ |
va_list args; |
926 |
+ |
|
927 |
+ |
va_start(args, pattern); |
928 |
+ |
vsnprintf(nbuf, IRCD_BUFSIZE, pattern, args); |
929 |
+ |
va_end(args); |
930 |
+ |
|
931 |
+ |
DLINK_FOREACH(ptr, oper_list.head) |
932 |
+ |
{ |
933 |
+ |
struct Client *client_p = ptr->data; |
934 |
+ |
assert(client_p->umodes & UMODE_OPER); |
935 |
+ |
|
936 |
+ |
/* If we're sending it to opers and theyre an admin, skip. |
937 |
+ |
* If we're sending it to admins, and theyre not, skip. |
938 |
+ |
*/ |
939 |
+ |
if (((level == L_ADMIN) && !HasUMode(client_p, UMODE_ADMIN)) || |
940 |
+ |
((level == L_OPER) && HasUMode(client_p, UMODE_ADMIN))) |
941 |
+ |
continue; |
942 |
+ |
|
943 |
+ |
if (HasUMode(client_p, flags)) |
944 |
+ |
sendto_one(client_p, ":%s NOTICE %s :*** Global -- %s", |
945 |
+ |
me.name, client_p->name, nbuf); |
946 |
+ |
} |
947 |
+ |
} |
948 |
+ |
|
949 |
|
/* sendto_wallops_flags() |
950 |
|
* |
951 |
|
* inputs - flag types of messages to show to real opers |
958 |
|
sendto_wallops_flags(unsigned int flags, struct Client *source_p, |
959 |
|
const char *pattern, ...) |
960 |
|
{ |
961 |
< |
struct Client *client_p; |
1079 |
< |
dlink_node *ptr; |
961 |
> |
dlink_node *ptr = NULL; |
962 |
|
va_list args; |
963 |
|
char buffer[IRCD_BUFSIZE]; |
964 |
|
int len; |
975 |
|
|
976 |
|
DLINK_FOREACH(ptr, oper_list.head) |
977 |
|
{ |
978 |
< |
client_p = ptr->data; |
978 |
> |
struct Client *client_p = ptr->data; |
979 |
|
assert(client_p->umodes & UMODE_OPER); |
980 |
|
|
981 |
< |
if ((client_p->umodes & flags) && !IsDefunct(client_p)) |
981 |
> |
if (HasUMode(client_p, flags) && !IsDefunct(client_p)) |
982 |
|
send_message(client_p, buffer, len); |
983 |
|
} |
984 |
|
} |
994 |
|
ts_warn(const char *pattern, ...) |
995 |
|
{ |
996 |
|
va_list args; |
997 |
< |
char buffer[LOG_BUFSIZE]; |
997 |
> |
char buffer[IRCD_BUFSIZE]; |
998 |
|
static time_t last = 0; |
999 |
|
static int warnings = 0; |
1000 |
|
|
1017 |
|
} |
1018 |
|
|
1019 |
|
va_start(args, pattern); |
1020 |
< |
vsprintf_irc(buffer, pattern, args); |
1020 |
> |
vsnprintf(buffer, sizeof(buffer), pattern, args); |
1021 |
|
va_end(args); |
1022 |
|
|
1023 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, "%s", buffer); |
1024 |
< |
ilog(L_CRIT, "%s", buffer); |
1024 |
> |
ilog(LOG_TYPE_IRCD, "%s", buffer); |
1025 |
|
} |
1026 |
|
|
1027 |
|
/* kill_client() |
1071 |
|
{ |
1072 |
|
va_list args; |
1073 |
|
int have_uid = 0; |
1074 |
< |
struct Client *client_p; |
1193 |
< |
dlink_node *ptr; |
1074 |
> |
dlink_node *ptr = NULL; |
1075 |
|
char buf_uid[IRCD_BUFSIZE], buf_nick[IRCD_BUFSIZE]; |
1076 |
< |
int len_uid = 0, len_nick; |
1076 |
> |
int len_uid = 0, len_nick = 0; |
1077 |
|
|
1078 |
< |
if (HasID(source_p) && (me.id[0] != '\0')) |
1078 |
> |
if (HasID(source_p)) |
1079 |
|
{ |
1080 |
|
have_uid = 1; |
1081 |
|
va_start(args, pattern); |
1093 |
|
|
1094 |
|
DLINK_FOREACH(ptr, serv_list.head) |
1095 |
|
{ |
1096 |
< |
client_p = ptr->data; |
1096 |
> |
struct Client *client_p = ptr->data; |
1097 |
|
|
1098 |
|
if (one != NULL && (client_p == one->from)) |
1099 |
|
continue; |
1100 |
|
if (IsDefunct(client_p)) |
1101 |
|
continue; |
1102 |
|
|
1103 |
< |
/* XXX perhaps IsCapable should test for localClient itself ? -db */ |
1104 |
< |
if (client_p->localClient == NULL || !IsCapable(client_p, CAP_LL) || |
1105 |
< |
!ServerInfo.hub || |
1106 |
< |
(source_p->lazyLinkClientExists & client_p->localClient->serverMask)) |
1226 |
< |
{ |
1227 |
< |
if (have_uid && IsCapable(client_p, CAP_TS6)) |
1228 |
< |
send_message(client_p, buf_uid, len_uid); |
1229 |
< |
else |
1230 |
< |
send_message(client_p, buf_nick, len_nick); |
1231 |
< |
} |
1103 |
> |
if (have_uid && IsCapable(client_p, CAP_TS6)) |
1104 |
> |
send_message(client_p, buf_uid, len_uid); |
1105 |
> |
else |
1106 |
> |
send_message(client_p, buf_nick, len_nick); |
1107 |
|
} |
1108 |
|
} |