-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck.patch
1052 lines (1044 loc) · 37.2 KB
/
check.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# HG changeset patch
# Parent 4e198b121c286785bbdc97fefed95f6d7b95c9ab
diff -r 4e198b121c28 include/check.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/check.h Fri Jul 26 19:55:24 2013 +0100
@@ -0,0 +1,49 @@
+/*
+ * IRC - Internet Relay Chat, ircd/check.h
+ * Copyright (C) 1990 University of Oulu, Computing Center
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 1, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * - ASUKA ---------------------------------------------------------------------
+ * These are the declarations of the CHECK functions for Asuka.
+ * Some of this code is from previous QuakeNet ircds, and some of it is my own.
+ * The old code was written by Durzel (durzel@quakenet.org).
+ *
+ * qoreQ (qoreQ@quakenet.org) - 08/14/2002
+ * -----------------------------------------------------------------------------
+ */
+
+#ifndef INCLUDED_check_h
+#define INCLUDED_check_h
+
+#define HEADERLINE "--------------------------------------------------------------------"
+#define COLOR_OFF '\017'
+
+/* IP is IPv4, or IPv4 over IPv6 (2002::/16 range) */
+#define has_ipv4_addr(x) (irc_in_addr_is_ipv4(x) || (x)->in6_16[0] == htons(0x2002))
+/* Return IP in IPv4 notation, also when IP is IPv4 over IPv6 */
+#define get_ipv4_addr(x) (irc_in_addr_is_ipv4(x) ? \
+ (ntohs((x)->in6_16[6]) << 16) | ntohs((x)->in6_16[7]) : \
+ (ntohs((x)->in6_16[1]) << 16) | ntohs((x)->in6_16[2]))
+
+extern void checkChannel(struct Client *sptr, struct Channel *chptr);
+extern void checkUsers(struct Client *sptr, struct Channel *chptr, int flags);
+extern void checkClient(struct Client *sptr, struct Client *acptr);
+extern void checkServer(struct Client *sptr, struct Client *acptr);
+extern signed int checkHostmask(struct Client *sptr, char *hoststr, int flags);
+
+#endif /* INCLUDED_check_h */
diff -r 4e198b121c28 include/client.h
--- a/include/client.h Thu Jul 25 22:43:11 2013 +0100
+++ b/include/client.h Fri Jul 26 19:55:24 2013 +0100
@@ -776,6 +776,9 @@
#define HIDE_IP 0 /**< Do not show IP address in get_client_name() */
#define SHOW_IP 1 /**< Show ident and IP address in get_client_name() */
+/** Number of bits unique per user under IPv6, used for clone checks */
+#define IPV6USERBITS 64
+
extern const char* get_client_name(const struct Client* sptr, int showip);
extern const char* client_get_default_umode(const struct Client* sptr);
extern int client_get_ping(const struct Client* local_client);
diff -r 4e198b121c28 include/handlers.h
--- a/include/handlers.h Thu Jul 25 22:43:11 2013 +0100
+++ b/include/handlers.h Fri Jul 26 19:55:24 2013 +0100
@@ -88,6 +88,19 @@
extern int m_admin(struct Client*, struct Client*, int, char*[]);
extern int m_away(struct Client*, struct Client*, int, char*[]);
+
+/*
+ * - ASUKA ---------------------------------------------------------------------
+ * Add the command for CHECK.
+ * This was adapted from Lain for use in Asuka.
+ * Original code by Durzel (durzel@quakenet.org).
+ *
+ * qoreQ (qoreQ@quakenet.org) - 08/30/2002
+ * -----------------------------------------------------------------------------
+ */
+
+extern int m_check(struct Client *cptr, struct Client *sptr, int parc, char *parv[]);
+
extern int m_cap(struct Client*, struct Client*, int, char*[]);
extern int m_cnotice(struct Client*, struct Client*, int, char*[]);
extern int m_cprivmsg(struct Client*, struct Client*, int, char*[]);
diff -r 4e198b121c28 include/ircd_features.h
--- a/include/ircd_features.h Thu Jul 25 22:43:11 2013 +0100
+++ b/include/ircd_features.h Fri Jul 26 19:55:24 2013 +0100
@@ -102,6 +102,7 @@
FEAT_ANNOUNCE_INVITES,
/* features that affect all operators */
+ FEAT_EXTENDED_CHECKCMD,
FEAT_CONFIG_OPERCMDS,
FEAT_SETHOST,
FEAT_SETHOST_USER,
diff -r 4e198b121c28 include/msg.h
--- a/include/msg.h Thu Jul 25 22:43:11 2013 +0100
+++ b/include/msg.h Fri Jul 26 19:55:24 2013 +0100
@@ -265,6 +265,10 @@
#define TOK_SERVSET "SERVSET"
#define CMD_SERVSET MSG_SERVSET, TOK_SERVSET
+#define MSG_CHECK "CHECK"
+#define TOK_CHECK "CC"
+#define CMD_CHECK MSG_CHECK, TOK_CHECK
+
#define MSG_REHASH "REHASH" /* REHA */
#define TOK_REHASH "REHASH"
#define CMD_REHASH MSG_REHASH, TOK_REHASH
diff -r 4e198b121c28 include/s_user.h
--- a/include/s_user.h Thu Jul 25 22:43:11 2013 +0100
+++ b/include/s_user.h Fri Jul 26 19:55:24 2013 +0100
@@ -54,6 +54,12 @@
#define ALLOWMODES_ANY 0 /**< Allow any user mode */
#define ALLOWMODES_DEFAULT 1 /**< Only allow the subset of modes that are legit defaults */
+/* return sets for umode_str() */
+#define UMODE_ALL_PARAMS 0 /**< return the user modes and all parameters */
+#define UMODE_ALL_PARAMS_BUT_OPERID 1 /**< return the user modes and all parameters except OperID */
+#define UMODE_AND_ACCOUNT 2 /**< return the user modes and account parameter */
+#define UMODE_AND_ACCOUNT_SHORT 3 /**< return the user modes and account (but no account timestamp, ID or flags) */
+
/** Formatter function for send_user_info().
* @param who Client being displayed.
* @param sptr Client requesting information.
diff -r 4e198b121c28 ircd/IPcheck.c
--- a/ircd/IPcheck.c Thu Jul 25 22:43:11 2013 +0100
+++ b/ircd/IPcheck.c Fri Jul 26 19:55:24 2013 +0100
@@ -120,7 +120,7 @@
ip_registry_canonicalize(&canon, ip);
entry = hashTable[ip_registry_hash(&canon)];
for ( ; entry; entry = entry->next) {
- int bits = (canon.in6_16[0] == htons(0x2002)) ? 48 : 64;
+ int bits = (canon.in6_16[0] == htons(0x2002)) ? 48 : IPV6USERBITS;
if (ipmask_check(&canon, &entry->addr, bits))
break;
}
diff -r 4e198b121c28 ircd/Makefile.in
--- a/ircd/Makefile.in Thu Jul 25 22:43:11 2013 +0100
+++ b/ircd/Makefile.in Fri Jul 26 19:55:24 2013 +0100
@@ -119,6 +119,7 @@
m_away.c \
m_burst.c \
m_cap.c \
+ m_check.c \
m_clearmode.c \
m_close.c \
m_connect.c \
diff -r 4e198b121c28 ircd/ircd_features.c
--- a/ircd/ircd_features.c Thu Jul 25 22:43:11 2013 +0100
+++ b/ircd/ircd_features.c Fri Jul 26 19:55:24 2013 +0100
@@ -367,6 +367,7 @@
F_B(ANNOUNCE_INVITES, 0, 0, 0),
/* features that affect all operators */
+ F_B(EXTENDED_CHECKCMD, 0, 0, 0),
F_B(CONFIG_OPERCMDS, 0, 0, 0),
F_B(SETHOST, 0, 0, 0),
F_B(SETHOST_USER, 0, 0, 0),
diff -r 4e198b121c28 ircd/m_check.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ircd/m_check.c Fri Jul 26 19:55:24 2013 +0100
@@ -0,0 +1,804 @@
+/*
+ * IRC - Internet Relay Chat, ircd/m_check.c
+ * Copyright (C) 1990 Jarkko Oikarinen and
+ * University of Oulu, Computing Center
+ *
+ * See file AUTHORS in IRC package for additional names of
+ * the programmers.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 1, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "channel.h"
+#include "check.h"
+#include "class.h"
+#include "client.h"
+#include "hash.h"
+#include "IPcheck.h"
+#include "ircd.h"
+#include "ircd_alloc.h"
+#include "ircd_defs.h"
+#include "ircd_features.h"
+#include "ircd_reply.h"
+#include "ircd_string.h"
+#include "ircd_snprintf.h"
+#include "ircd_osdep.h"
+#include "list.h"
+#include "listener.h"
+#include "match.h"
+#include "msg.h"
+#include "numeric.h"
+#include "numnicks.h"
+#include "querycmds.h"
+#include "send.h"
+#include "s_user.h"
+#include "s_debug.h"
+#include "s_misc.h"
+
+#include <string.h>
+
+#define CHECK_CHECKCHAN 0x01 /* -c */
+#define CHECK_SHOWUSERS 0x02 /* ! -u */
+#define CHECK_OPSONLY 0x04 /* -o */
+#define CHECK_SHOWIPS 0x08 /* -i */
+#define CHECK_CIDRMASK 0x10 /* automatically detected when performing a hostmask /CHECK */
+#define CHECK_OPLEVELS 0x20 /* -l */
+#define CHECK_CLONES 0x40 /* -C */
+#define CHECK_SHOWSERVER 0x80 /* -s */
+#define CHECK_SHOWHOSTIP 0x100 /* -I */
+#define CHECK_SHOWMORE 0x200 /* -e */
+
+/*
+ * - ASUKA ---------------------------------------------------------------------
+ * This is the implimentation of the CHECK function for Asuka.
+ * Some of this code is from previous QuakeNet ircds, but most of it is mine..
+ * The old code was written by Durzel (durzel@quakenet.org).
+ *
+ * qoreQ (qoreQ@quakenet.org) - 08/14/2002
+ * -----------------------------------------------------------------------------
+ */
+
+/*
+ * Syntax: CHECK <channel|nick|server|hostmask> [-flags]
+ *
+ * Where valid flags are:
+ * -c: Show channels when checking a hostmask.
+ * -e: show more inform when checking a mask.
+ * -i: Show IPs instead of hostnames when displaying results.
+ * -l: Show oplevels when checking a channel.
+ * -o: Only show channel operators when checking a channel.
+ * -s: show server user is on when checking a channel (or on a mask when combined with -e).
+ * -u: Hide users when checking a channel.
+ * -C: Perform clone count when checking a channel.
+ * -I: show hostnames and IPs when checking a channel.
+ *
+ * <hostmask> can be of the form host, user@host, nick!user@host,
+ * with host being host.domain.cc, 127.0.0.1 or 127.0.0.0/24.
+ * Wildcards are supported.
+ */
+
+int m_check(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) {
+ struct Channel *chptr;
+ struct Client *acptr;
+ int flags = CHECK_SHOWUSERS, i;
+
+ if (parc < 2) {
+ send_reply(sptr, ERR_NEEDMOREPARAMS, "CHECK");
+ return 0;
+ }
+
+ if ( parc>=4 ||
+ (parc==3 && parv[2][0] != '-')) {
+ /* remote query */
+ if (hunt_server_cmd(sptr, CMD_CHECK, cptr, 0, parc==4 ? "%C %s %s" : "%C %s", 1, parc, parv) != HUNTED_ISME)
+ return 0;
+ parv++; parc--;
+ }
+
+ /* This checks to see if any flags have been supplied */
+ if ((parc >= 3) && (parv[2][0] == '-')) {
+ for (i = 0; parv[2][i]; i++) {
+ switch (parv[2][i]) {
+ case 'c':
+ flags |= CHECK_CHECKCHAN;
+ break;
+
+ case 'o':
+ flags |= CHECK_OPSONLY; /* fall through */
+ case 'u':
+ flags &= ~(CHECK_SHOWUSERS);
+ break;
+
+ case 'i':
+ flags |= CHECK_SHOWIPS;
+ break;
+ case 'l':
+ flags |= CHECK_OPLEVELS;
+ break;
+ case 'C':
+ flags |= CHECK_CLONES;
+ break;
+ case 's':
+ flags |= CHECK_SHOWSERVER;
+ break;
+ case 'I':
+ flags |= CHECK_SHOWHOSTIP;
+ break;
+ case 'e':
+ flags |= CHECK_SHOWMORE;
+ break;
+ default:
+ /* might want to raise some sort of error here? */
+ break;
+ }
+ }
+ }
+
+ if (IsChannelName(parv[1])) { /* channel */
+ if ((chptr = FindChannel(parv[1]))) {
+ checkChannel(sptr, chptr);
+ checkUsers(sptr, chptr, flags);
+ }
+ else
+ send_reply(sptr, ERR_SEARCHNOMATCH, "CHECK", parv[1]);
+ }
+ else if ((acptr = FindUser(parv[1]))) {
+ checkClient(sptr, acptr);
+ }
+ else if ((acptr = FindServer(parv[1]))) { /* server */
+ checkServer(sptr, acptr);
+ }
+ else if (checkHostmask(sptr, parv[1], flags) > 0) /* hostmask */
+ return 1;
+ else /* no match */
+ send_reply(sptr, ERR_SEARCHNOMATCH, "CHECK", parv[1]);
+
+ return 1;
+}
+
+
+
+/* return number of clients from same IP on the channel */
+static int checkClones(struct Channel *chptr, struct Client *cptr) {
+ int clones = 0, count = 0;
+ struct Membership *lp;
+ struct Client *acptr;
+
+ for (lp = chptr->members; lp; lp = lp->next_member) {
+ acptr = lp->user;
+ if (are_ips_clones(&cli_ip(cptr),&cli_ip(acptr))) {
+ clones++;
+ }
+ }
+
+ /* Optimise only if we will actually save CPU time */
+ if (clones >= 2) {
+ for (lp = chptr->members; lp; lp = lp->next_member) {
+ acptr = lp->user;
+ if (are_ips_clones(&cli_ip(cptr),&cli_ip(acptr))) {
+ cli_marker(acptr) = clones;
+ count++;
+ if (clones == count) {
+ break;
+ }
+ }
+ }
+ }
+
+ return clones;
+}
+
+
+/* compare IPs from clients and return 1 when they are clones
+ * same IPv4 IP
+ * IPv4 and IPv6 IPs, but IPv4 over IPv6 etc cases
+ * IPv6 IPs from the same /64 block
+ */
+int are_ips_clones(const struct irc_in_addr *ip1, const struct irc_in_addr *ip2) {
+ int ipv4ip1 = has_ipv4_addr(ip1);
+
+ /* are both ip addresses ipv4 or ipv6? if not, no clones */
+ if (ipv4ip1 != has_ipv4_addr(ip2)) return 0;
+
+ if (ipv4ip1) /* check ipv4 */
+ return (get_ipv4_addr(ip1) == get_ipv4_addr(ip2)) ? 1 : 0;
+
+ /* check ipv6 */
+ return ipmask_check(ip1, ip2, IPV6USERBITS) ? 1 : 0;
+}
+
+
+void checkUsers(struct Client *sptr, struct Channel *chptr, int flags) {
+ struct Membership *lp;
+ struct Ban *ban;
+ struct Client *acptr;
+
+ char outbuf[BUFSIZE], outbuf2[BUFSIZE], ustat[64];
+ int cntr = 0, opcntr = 0, vcntr = 0, clones = 0, bans = 0, authed = 0, delayedjoin = 0;
+ char *zombie, *showlevel;
+
+ if (flags & CHECK_SHOWUSERS) {
+ send_reply(sptr, RPL_DATASTR, "Users (@ = op, + = voice)");
+ }
+
+ if (flags & CHECK_CLONES) {
+ for (lp = chptr->members; lp; lp = lp->next_member) {
+ cli_marker(lp->user) = 0;
+ }
+ }
+
+ for (lp = chptr->members; lp; lp = lp->next_member) {
+ int opped = 0, c = 0;
+
+ acptr = lp->user;
+ zombie = IsZombie(lp) ? "!" : "";
+ showlevel = (flags & CHECK_OPLEVELS) ? " " : "";
+
+ if (flags & CHECK_CLONES) {
+ if (!cli_marker(acptr)) {
+ c = checkClones(chptr, acptr);
+ } else {
+ c = cli_marker(acptr);
+ }
+
+ if (c != 1) {
+ clones++;
+ }
+ }
+
+ if (IsChanOp(lp)) {
+ if (flags & CHECK_OPLEVELS) {
+ if (c) {
+ ircd_snprintf(0, ustat, sizeof(ustat), "%2d %s%3hu@", c, zombie, OpLevel(lp));
+ } else {
+ ircd_snprintf(0, ustat, sizeof(ustat), "%s%3hu@", zombie, OpLevel(lp));
+ }
+ } else {
+ if (c) {
+ ircd_snprintf(0, ustat, sizeof(ustat), "%2d %s@", c, zombie);
+ } else {
+ ircd_snprintf(0, ustat, sizeof(ustat), "%s@", zombie);
+ }
+ }
+ opcntr++;
+ opped = 1;
+ }
+ else if (HasVoice(lp)) {
+ if (c) {
+ ircd_snprintf(0, ustat, sizeof(ustat), "%2d %s%s+", c, showlevel, zombie);
+ } else {
+ ircd_snprintf(0, ustat, sizeof(ustat), "%s%s+", showlevel, zombie);
+ }
+ vcntr++;
+ }
+ else if (IsDelayedJoin(lp)) {
+ if (c) {
+ ircd_snprintf(0, ustat, sizeof(ustat), "%2d %s%s<", c, showlevel, zombie);
+ } else {
+ ircd_snprintf(0, ustat, sizeof(ustat), "%s%s<", showlevel, zombie);
+ }
+ delayedjoin++;
+ }
+ else {
+ if (c) {
+ ircd_snprintf(0, ustat, sizeof(ustat), "%2d %s%s", c, showlevel, zombie);
+ } else {
+ ircd_snprintf(0, ustat, sizeof(ustat), " %s%s", showlevel, zombie);
+ }
+ }
+
+ if ((c = IsAccount(acptr))) {
+ authed++;
+ }
+
+ if ((flags & CHECK_SHOWUSERS) || ((flags & CHECK_OPSONLY) && opped)) {
+ ircd_snprintf(0, outbuf, sizeof(outbuf), "%s%c", acptr->cli_info, COLOR_OFF);
+ if (flags & CHECK_SHOWHOSTIP) {
+ ircd_snprintf(0, outbuf2, sizeof(outbuf2), " [%s]", ircd_ntoa(&(cli_ip(acptr))));
+ }
+ send_reply(sptr, RPL_CHANUSER, ustat, acptr->cli_name, cli_user(acptr)->realusername,
+ ((flags & CHECK_SHOWIPS) ? ircd_ntoa(&(cli_ip(acptr))) : cli_user(acptr)->realhost), (flags & CHECK_SHOWHOSTIP) ? outbuf2 : "", (flags & CHECK_SHOWSERVER) ? cli_name(cli_user(acptr)->server) : outbuf,
+ (c ? cli_user(acptr)->account : ""));
+ }
+
+ cntr++;
+ }
+
+ send_reply(sptr, RPL_DATASTR, " ");
+
+ if (flags & CHECK_CLONES) {
+ ircd_snprintf(0, outbuf, sizeof(outbuf),
+ "Total users:: %d (%d ops, %d voiced, %d clones, %d authed, %d hidden)",
+ cntr, opcntr, vcntr, clones, authed, delayedjoin);
+
+ for (lp = chptr->members; lp; lp = lp->next_member) {
+ cli_marker(lp->user) = 0;
+ }
+ } else {
+ ircd_snprintf(0, outbuf, sizeof(outbuf),
+ "Total users:: %d (%d ops, %d voiced, %d authed, %d hidden)",
+ cntr, opcntr, vcntr, authed, delayedjoin);
+ }
+
+ send_reply(sptr, RPL_DATASTR, outbuf);
+ send_reply(sptr, RPL_DATASTR, " ");
+
+ /* Do not display bans if ! flags & CHECK_SHOWUSERS */
+ if (flags & CHECK_SHOWUSERS) {
+ send_reply(sptr, RPL_DATASTR, "Bans on channel::");
+
+ for (ban = chptr->banlist; ban; ban = ban->next) {
+ ircd_snprintf(0, outbuf, sizeof(outbuf), "[%d] - %s - Set by %s, on %s (%Tu)",
+ ++bans, ban->banstr, ban->who, myctime(ban->when), ban->when);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+ }
+
+ if (bans == 0)
+ send_reply(sptr, RPL_DATASTR, "<none>");
+ }
+
+ send_reply(sptr, RPL_ENDOFCHECK, " ");
+}
+
+void checkChannel(struct Client *sptr, struct Channel *chptr) {
+ char outbuf[TOPICLEN + MODEBUFLEN + 64], modebuf[MODEBUFLEN], parabuf[MODEBUFLEN];
+
+ /* Header */
+ send_reply(sptr, RPL_DATASTR, " ");
+ send_reply(sptr, RPL_CHKHEAD, "channel", chptr->chname);
+ send_reply(sptr, RPL_DATASTR, " ");
+
+ /* Creation Time */
+ ircd_snprintf(sptr, outbuf, sizeof(outbuf), " Creation time:: %s (%Tu)", myctime(chptr->creationtime), chptr->creationtime);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+
+ /* Topic */
+ if (strlen(chptr->topic) <= 0)
+ send_reply(sptr, RPL_DATASTR, " Topic:: <none>");
+ else {
+ ircd_snprintf(sptr, outbuf, sizeof(outbuf), " Topic:: %s", chptr->topic);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+
+ /* ..set by */
+ ircd_snprintf(sptr, outbuf, sizeof(outbuf), " Set by:: %s", chptr->topic_nick);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+
+ ircd_snprintf(sptr, outbuf, sizeof(outbuf), " Set at:: %s (%Tu)", myctime(chptr->topic_time), chptr->topic_time);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+ }
+
+ /* Channel Modes */
+
+ strcpy(outbuf, "Channel mode(s):: ");
+
+ modebuf[0] = '\0';
+ parabuf[0] = '\0';
+
+ channel_modes(sptr, modebuf, parabuf, sizeof(modebuf), chptr, NULL);
+
+ if(modebuf[1] == '\0')
+ strcat(outbuf, "<none>");
+ else if(*parabuf) {
+ strcat(outbuf, modebuf);
+ strcat(outbuf, " ");
+ strcat(outbuf, parabuf);
+ }
+ else
+ strcat(outbuf, modebuf);
+
+ send_reply(sptr, RPL_DATASTR, outbuf);
+
+ /* Don't send 'END OF CHECK' message, it's sent in checkUsers, which is called after this. */
+}
+
+void checkClient(struct Client *sptr, struct Client *acptr) {
+ struct Channel *chptr;
+ struct Membership *lp;
+ struct irc_sockaddr sin;
+ char outbuf[BUFSIZE];
+ time_t nowr;
+
+ /* Header */
+ send_reply(sptr, RPL_DATASTR, " ");
+ send_reply(sptr, RPL_CHKHEAD, "user", cli_name(acptr));
+ send_reply(sptr, RPL_DATASTR, " ");
+
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Nick:: %s (%s%s)", cli_name(acptr), NumNick(acptr));
+ send_reply(sptr, RPL_DATASTR, outbuf);
+
+ if (MyUser(acptr)) {
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Signed on:: %s (%Tu)", myctime(acptr->cli_firsttime), acptr->cli_firsttime);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+ }
+
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Timestamp:: %s (%d)", myctime(acptr->cli_lastnick), acptr->cli_lastnick);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " User/Hostmask:: %s@%s [%s] (Clients: %hu)", cli_user(acptr)->username, cli_user(acptr)->host,
+ ircd_ntoa(&(cli_ip(acptr))), IPcheck_nr(acptr));
+ send_reply(sptr, RPL_DATASTR, outbuf);
+
+ if (IsSetHost(acptr) || HasHiddenHost(acptr)) {
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Real User/Host:: %s@%s", cli_user(acptr)->realusername, cli_user(acptr)->realhost);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+ }
+
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Real Name:: %s%c", cli_info(acptr), COLOR_OFF);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+
+ if( IsService(cli_user(acptr)->server)) {
+ if (IsChannelService(acptr))
+ send_reply(sptr, RPL_DATASTR, " Status:: Network Service");
+ else if (IsAnOper(acptr))
+ send_reply(sptr, RPL_DATASTR, " Status:: IRC Operator (service) (ID: %s)", cli_user(acptr)->opername ? cli_user(acptr)->opername : "<unknown>");
+ else
+ send_reply(sptr, RPL_DATASTR, " Status:: Client (service)");
+ } else if (IsAnOper(acptr)) {
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Status:: IRC Operator (ID: %s)", cli_user(acptr)->opername ? cli_user(acptr)->opername : "<unknown>");
+ send_reply(sptr, RPL_DATASTR, outbuf);
+ } else
+ send_reply(sptr, RPL_DATASTR, " Status:: Client");
+
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Connected to:: %s (Hops: %d)", cli_name(cli_user(acptr)->server), cli_hopcount(acptr));
+ send_reply(sptr, RPL_DATASTR, outbuf);
+
+ /* +s (SERV_NOTICE) is not relayed to us from remote servers,
+ * so we cannot tell if a remote client has that mode set.
+ * And hacking it onto the end of the output of umode_str is EVIL BAD AND WRONG
+ * (and breaks if the user is +r) so we won't do that either.
+ */
+
+ /* show the usermodes and account info (but not OperID and sethost) */
+ umodes = umode_str(acptr, UMODE_AND_ACCOUNT);
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Usermode(s):: %s%s", *umodes ? "+" : "<none>", umodes);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+
+ if (cli_user(acptr)->joined == 0)
+ send_reply(sptr, RPL_DATASTR, " Channel(s):: <none>");
+ else if (cli_user(acptr)->joined > 50) {
+
+ /* NB. As a sanity check, we DO NOT show the individual channels the
+ * client is on if it is on > 50 channels. This is to prevent the ircd
+ * barfing ala Uworld when someone does /quote check Q :).. (I shouldn't imagine
+ * an Oper would want to see every single channel 'x' client is on anyway if
+ * they are on *that* many).
+ */
+
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Channel(s):: - (total: %u)", cli_user(acptr)->joined);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+ }
+ else {
+ char chntext[BUFSIZE];
+ int len = strlen(" Channel(s):: ");
+ int mlen = strlen(me.cli_name) + len + strlen(cli_name(sptr));
+ *chntext = '\0';
+
+ strcpy(chntext, " Channel(s):: ");
+ for (lp = cli_user(acptr)->channel; lp; lp = lp->next_channel) {
+ chptr = lp->channel;
+ if (len + strlen(chptr->chname) + mlen > BUFSIZE - 5) {
+ send_reply(sptr, RPL_DATASTR, chntext);
+ *chntext = '\0';
+ strcpy(chntext, " Channel(s):: ");
+ len = strlen(chntext);
+ }
+ if (IsDeaf(acptr))
+ *(chntext + len++) = '-';
+ if (!PubChannel(chptr))
+ *(chntext + len++) = '*';
+ if (IsZombie(lp))
+ *(chntext + len++) = '!';
+ if (IsChanOp(lp))
+ *(chntext + len++) = '@';
+ else if (HasVoice(lp))
+ *(chntext + len++) = '+';
+ else if (IsDelayedJoin(lp))
+ *(chntext + len++) = '<';
+ if (len)
+ *(chntext + len) = '\0';
+
+ strcpy(chntext + len, chptr->chname);
+ len += strlen(chptr->chname);
+ strcat(chntext + len, " ");
+ len++;
+ }
+
+ if (chntext[0] != '\0')
+ send_reply(sptr, RPL_DATASTR, chntext);
+ }
+
+ if (MyUser(acptr)) {
+ nowr = CurrentTime - cli_user(acptr)->last;
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Idle for:: %d days, %02ld:%02ld:%02ld",
+ nowr / 86400, (nowr / 3600) % 24, (nowr / 60) % 60, nowr % 60);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+ }
+
+ /* Away message (if applicable) */
+ if (cli_user(acptr)->away) {
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Away message:: %s", cli_user(acptr)->away);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+ }
+
+ /* If local user.. */
+ if (MyUser(acptr)) {
+ os_get_peername(con_fd(cli_connect(sptr)), &sin);
+
+ send_reply(sptr, RPL_DATASTR, " ");
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Ports:: %d -> %d (client -> server)",
+ sin.port, cli_listener(acptr)->addr.port);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+ if (feature_bool(FEAT_EXTENDED_CHECKCMD)) {
+ /* Note: sendq = receiveq for a client (it makes sense really) */
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Data sent:: %lu.%0.3u Kb (%u protocol messages)",
+ (unsigned long)cli_receiveB(acptr) / 1024, (unsigned long)cli_receiveB(acptr) % 1024, cli_receiveM(acptr));
+ send_reply(sptr, RPL_DATASTR, outbuf);
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Data received:: %lu.%0.3lu Kb (%u protocol messages)",
+ (unsigned long)cli_sendB(acptr) / 1024, (unsigned long)cli_sendB(acptr) % 1024, cli_sendM(acptr));
+ send_reply(sptr, RPL_DATASTR, outbuf);
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " receiveQ size:: %d bytes (max. %d bytes)",
+ DBufLength(&(cli_recvQ(acptr))), feature_int(FEAT_CLIENT_FLOOD));
+ send_reply(sptr, RPL_DATASTR, outbuf);
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " sendQ size:: %d bytes (max. %d bytes)",
+ DBufLength(&(cli_sendQ(acptr))), get_sendq(acptr));
+ send_reply(sptr, RPL_DATASTR, outbuf);
+ }
+ }
+
+ /* Send 'END OF CHECK' message */
+ send_reply(sptr, RPL_ENDOFCHECK, " ");
+}
+
+void checkServer(struct Client *sptr, struct Client *acptr) {
+ char outbuf[BUFSIZE];
+
+ /* Header */
+ send_reply(sptr, RPL_DATASTR, " ");
+ send_reply(sptr, RPL_CHKHEAD, "server", acptr->cli_name);
+ send_reply(sptr, RPL_DATASTR, " ");
+
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Connected at:: %s (%Tu)", myctime(acptr->cli_serv->timestamp), acptr->cli_serv->timestamp);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Server name:: %s", acptr->cli_name);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Numeric:: %s --> %d", NumServ(acptr), base64toint(acptr->cli_yxx));
+ send_reply(sptr, RPL_DATASTR, outbuf);
+
+ ircd_snprintf(0, outbuf, sizeof(outbuf), " Users:: %d / %d", (acptr == &me) ? UserStats.local_clients : cli_serv(acptr)->clients,
+ base64toint(cli_serv(acptr)->nn_capacity));
+ send_reply(sptr, RPL_DATASTR, outbuf);
+
+ if (IsBurst(acptr))
+ send_reply(sptr, RPL_DATASTR, " Status:: Bursting");
+ else if (IsBurstAck(acptr))
+ send_reply(sptr, RPL_DATASTR, " Status:: Awaiting EOB Ack");
+ else if (IsService(acptr))
+ send_reply(sptr, RPL_DATASTR, " Status:: Network Service");
+ else if (IsHub(acptr))
+ send_reply(sptr, RPL_DATASTR, " Status:: Network Hub");
+
+ if (feature_bool(FEAT_EXTENDED_CHECKCMD)) {
+ int dlinkc = 0;
+ struct DLink* slink = NULL;
+
+ send_reply(sptr, RPL_DATASTR, " ");
+ send_reply(sptr, RPL_DATASTR, "Downlinks::");
+ for (slink = cli_serv(acptr)->down; slink; slink = slink->next) {
+ ircd_snprintf(0, outbuf, sizeof(outbuf), "[%d] - %s%s", ++dlinkc,
+ IsBurst(slink->value.cptr) ? "*" : IsBurstAck(slink->value.cptr) ? "!" : IsService(slink->value.cptr) ? "=" : IsHub(slink->value.cptr) ? "+" : " ",
+ cli_name(slink->value.cptr));
+ send_reply(sptr, RPL_DATASTR, outbuf);
+ }
+
+ if (!dlinkc)
+ send_reply(sptr, RPL_DATASTR, "<none>");
+ }
+
+ /* Send 'END OF CHECK' message */
+ send_reply(sptr, RPL_ENDOFCHECK, " ");
+}
+
+signed int checkHostmask(struct Client *sptr, char *orighoststr, int flags) {
+ struct Client *acptr;
+ struct Channel *chptr;
+ struct Membership *lp;
+ int count = 0, found = 0;
+ char outbuf[BUFSIZE];
+ char targhost[NICKLEN + USERLEN + HOSTLEN + 3], curhost[NICKLEN + USERLEN + HOSTLEN + 3];
+ char hoststr[NICKLEN + USERLEN + HOSTLEN + 3];
+ char nickm[NICKLEN + 1], userm[USERLEN + 1], hostm[HOSTLEN + 1];
+ char *p = NULL;
+ char *umodes;
+ struct irc_in_addr cidr_check;
+ unsigned char cidr_check_bits;
+
+ ircd_strncpy(hoststr, orighoststr, NICKLEN + USERLEN + HOSTLEN + 3);
+ strcpy(nickm,"*");
+ strcpy(userm,"*");
+ strcpy(hostm,"*");
+
+ if (!strchr(hoststr, '!') && !strchr(hoststr, '@'))
+ ircd_strncpy(hostm,hoststr,HOSTLEN);
+ else {
+ if ((p = strchr(hoststr, '@'))) {
+ *p++ = '\0';
+ if (*p) ircd_strncpy(hostm,p, HOSTLEN);
+ }
+
+ /* Get the nick!user mask */
+ if ((p = strchr(hoststr, '!'))) {
+ *p++ = '\0';
+ if (*p) ircd_strncpy(userm,p,USERLEN);
+ if (*hoststr) ircd_strncpy(nickm,hoststr,NICKLEN);
+ }
+ else if (*hoststr) {
+ /* Durz: We should only do the following *IF* the hoststr has not already been
+ * copied into hostm (ie. neither ! or @ specified).. otherwise, when we do
+ * /quote check *.barrysworld.com - we end up with targhost as: *!*.barryswo@*.barrysworld.com
+ */
+ ircd_strncpy(userm,hoststr,USERLEN);
+ }
+ }
+
+ if (ipmask_parse(hostm, &cidr_check, &cidr_check_bits) != 0) {
+ flags |= CHECK_CIDRMASK;
+ }
+
+ /* Copy formatted string into "targhost" buffer */
+ ircd_snprintf(0, targhost, sizeof(targhost), "%s!%s@%s", nickm, userm, hostm);
+
+ targhost[sizeof(targhost) - 1] = '\0';
+
+ /* Note: we have to exclude the last client struct as it is not a real client
+ * structure, and therefore any attempt to access elements in it would cause
+ * a segfault.
+ */
+
+ for (acptr = GlobalClientList; acptr; acptr = cli_next(acptr)) {
+ /* Dont process if acptr is a unregistered client, a server or a ping */
+ if (!IsRegistered(acptr) || IsServer(acptr))
+ continue;
+
+ if (IsMe(acptr)) /* Always the last acptr record */
+ break;
+
+ if(count >= 500) { /* sanity stuff */
+ ircd_snprintf(0, outbuf, sizeof(outbuf), "More than %d results, truncating...", count);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+ break;
+ }
+
+ /* Copy host info into buffer */
+ curhost[0] = '\0';
+ ircd_snprintf(0, curhost, sizeof(curhost), "%s!%s@%s", cli_name(acptr), cli_user(acptr)->realusername, cli_user(acptr)->realhost);
+
+ if (flags & CHECK_CIDRMASK) {
+ if (ipmask_check(&cli_ip(acptr), &cidr_check, cidr_check_bits) && !match(nickm, acptr->cli_name)
+ && (!match(userm, cli_user(acptr)->realusername) || !match(userm, cli_user(acptr)->username)))
+ found = 1;
+ }
+ else {
+ if(match((const char*)targhost,(const char*)curhost) == 0)
+ found = 1;
+ else {
+ curhost[0] = '\0';
+ ircd_snprintf(0, curhost, sizeof(curhost), "%s!%s@%s", acptr->cli_name, cli_user(acptr)->username, cli_user(acptr)->host);
+
+ if(match((const char*)targhost,(const char*)curhost) == 0)
+ found = 1;
+ }
+ }
+
+ if (found == 1) {
+ found = 0; /* reset that so it doesn't get crazy go nuts */
+
+ /* Show header if we've found at least 1 record */
+ if (count == 0) {
+ /* Output header */
+ send_reply(sptr, RPL_DATASTR, " ");
+ send_reply(sptr, RPL_CHKHEAD, "host", targhost);
+
+ send_reply(sptr, RPL_DATASTR, " ");
+ if (flags & CHECK_SHOWMORE)
+ ircd_snprintf(0, outbuf, sizeof(outbuf), "No. %s nick user@host [IP] (usermodes) :realname", (flags & CHECK_CLONES) ? "[clients]" : "");
+ else
+ ircd_snprintf(0, outbuf, sizeof(outbuf), "%s %-*s%-*s%s", "No.", (NICKLEN + 2), "Nick",
+ (USERLEN + 2), "User", "Host");
+ send_reply(sptr, RPL_DATASTR, outbuf);
+ }
+
+ if (flags & CHECK_SHOWMORE) {
+ /* show more information */
+ umodes = umode_str(acptr, UMODE_AND_ACCOUNT_SHORT);
+ ircd_snprintf(0, outbuf, sizeof(outbuf), "%-4d ", (count+1));
+ if (flags & CHECK_CLONES)
+ ircd_snprintf(0, outbuf, sizeof(outbuf), "%s[%+3hu] ", outbuf, IPcheck_nr(acptr));
+ ircd_snprintf(0, outbuf, sizeof(outbuf), "%s%s %s@%s [%s] (%s%s) :%s", outbuf,
+ acptr->cli_name,
+ cli_user(acptr)->realusername, cli_user(acptr)->realhost,
+ ircd_ntoa(&(cli_ip(acptr))),
+ *umodes ? "+" : "<none>", umodes,
+ (flags & CHECK_SHOWSERVER) ? cli_name(cli_user(acptr)->server) : cli_info(acptr));
+ } else {
+ /* default output */
+ ircd_snprintf(0, outbuf, sizeof(outbuf), "%-4d %-*s%-*s%s", (count+1), (NICKLEN + 2),
+ acptr->cli_name, (USERLEN + 2), cli_user(acptr)->realusername,
+ (flags & CHECK_SHOWIPS) ? ircd_ntoa(&(cli_ip(acptr))) : cli_user(acptr)->realhost);
+ }
+ send_reply(sptr, RPL_DATASTR, outbuf);
+
+ /* Show channel output (if applicable) - the 50 channel limit sanity check
+ * is specifically to prevent coredumping when someone lamely tries to /check
+ * Q or some other channel service...
+ */
+ if (flags & CHECK_CHECKCHAN) {
+ if (cli_user(acptr)->joined > 0 && cli_user(acptr)->joined <= 50) {
+ char chntext[BUFSIZE];
+ int len = strlen(" on channels: ");
+ int mlen = strlen(me.cli_name) + len + strlen(sptr->cli_name);
+ *chntext = '\0';
+
+ strcpy(chntext, " on channels: ");
+ for (lp = cli_user(acptr)->channel; lp; lp = lp->next_channel) {
+ chptr = lp->channel;
+ if (len + strlen(chptr->chname) + mlen > BUFSIZE - 5) {
+ send_reply(sptr, RPL_DATASTR, chntext);
+ *chntext = '\0';
+ strcpy(chntext, " on channels: ");
+ len = strlen(chntext);
+ }
+ if (IsDeaf(acptr))
+ *(chntext + len++) = '-';
+ if (!PubChannel(chptr))
+ *(chntext + len++) = '*';
+ if (IsZombie(lp))
+ *(chntext + len++) = '!';
+ if (IsChanOp(lp))
+ *(chntext + len++) = '@';
+ else if (HasVoice(lp))
+ *(chntext + len++) = '+';
+ else if (IsDelayedJoin(lp))
+ *(chntext + len++) = '<';
+ if (len)
+ *(chntext + len) = '\0';
+
+ strcpy(chntext + len, chptr->chname);
+ len += strlen(chptr->chname);
+ strcat(chntext + len, " ");
+ len++;
+ }
+ if (chntext[0] != '\0')
+ send_reply(sptr, RPL_DATASTR, chntext);
+
+ send_reply(sptr, RPL_DATASTR, " ");
+ }
+ }
+ count++;
+ }
+ }
+
+ if (count > 0) {
+ send_reply(sptr, RPL_DATASTR, " ");
+
+ ircd_snprintf(0, outbuf, sizeof(outbuf), "Matching records found:: %d", count);
+ send_reply(sptr, RPL_DATASTR, outbuf);
+
+ send_reply(sptr, RPL_ENDOFCHECK, " ");
+ }
+
+ return count;
+}
diff -r 4e198b121c28 ircd/parse.c
--- a/ircd/parse.c Thu Jul 25 22:43:11 2013 +0100
+++ b/ircd/parse.c Fri Jul 26 19:55:24 2013 +0100
@@ -654,6 +654,23 @@
{ m_cap, m_cap, m_ignore, m_cap, m_ignore }
},
#endif
+
+ /*
+ * - ASUKA ---------------------------------------------------------------------
+ * Add the command for CHECK.
+ * This was adapted from Lain for use in Asuka.
+ * Original code by Durzel (durzel@quakenet.org).
+ *
+ * qoreQ (qoreQ@quakenet.org) - 08/14/2002
+ * -----------------------------------------------------------------------------
+ */
+ {
+ MSG_CHECK,
+ TOK_CHECK,
+ 0, MAXPARA, MFLG_SLOW, 0, NULL,
+ { m_unregistered, m_not_oper, m_check, m_check, m_ignore }
+ },
+
/* This command is an alias for QUIT during the unregistered part of