]> jfr.im git - irc/rqf/shadowircd.git/blob - src/s_conf.c
Automated merge with ssh://shadowircd/uranium/shadowircd/
[irc/rqf/shadowircd.git] / src / s_conf.c
1 /*
2 * ircd-ratbox: A slightly useful ircd.
3 * s_conf.c: Configuration file functions.
4 *
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2005 ircd-ratbox development team
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * USA
23 *
24 * $Id: s_conf.c 3550 2007-08-09 06:47:26Z nenolod $
25 */
26
27 #include "stdinc.h"
28 #include "ircd_defs.h"
29 #include "s_conf.h"
30 #include "s_newconf.h"
31 #include "newconf.h"
32 #include "s_serv.h"
33 #include "s_user.h"
34 #include "s_stats.h"
35 #include "channel.h"
36 #include "class.h"
37 #include "client.h"
38 #include "common.h"
39 #include "hash.h"
40 #include "match.h"
41 #include "ircd.h"
42 #include "listener.h"
43 #include "hostmask.h"
44 #include "modules.h"
45 #include "numeric.h"
46 #include "logger.h"
47 #include "send.h"
48 #include "reject.h"
49 #include "cache.h"
50 #include "blacklist.h"
51 #include "privilege.h"
52 #include "sslproc.h"
53 #include "bandbi.h"
54
55 struct config_server_hide ConfigServerHide;
56
57 extern int yyparse(void); /* defined in y.tab.c */
58 extern char linebuf[];
59
60 #ifndef INADDR_NONE
61 #define INADDR_NONE ((unsigned int) 0xffffffff)
62 #endif
63
64 static rb_bh *confitem_heap = NULL;
65
66 rb_dlink_list temp_klines[LAST_TEMP_TYPE];
67 rb_dlink_list temp_dlines[LAST_TEMP_TYPE];
68 rb_dlink_list service_list;
69
70 /* internally defined functions */
71 static void set_default_conf(void);
72 static void validate_conf(void);
73 static void read_conf(FILE *);
74 static void clear_out_old_conf(void);
75
76 static void expire_temp_kd(void *list);
77 static void reorganise_temp_kd(void *list);
78
79 FILE *conf_fbfile_in;
80 extern char yytext[];
81
82 static int verify_access(struct Client *client_p, const char *username);
83 static int attach_iline(struct Client *, struct ConfItem *);
84
85 void
86 init_s_conf(void)
87 {
88 confitem_heap = rb_bh_create(sizeof(struct ConfItem), CONFITEM_HEAP_SIZE, "confitem_heap");
89
90 rb_event_addish("expire_temp_klines", expire_temp_kd, &temp_klines[TEMP_MIN], 60);
91 rb_event_addish("expire_temp_dlines", expire_temp_kd, &temp_dlines[TEMP_MIN], 60);
92
93 rb_event_addish("expire_temp_klines_hour", reorganise_temp_kd,
94 &temp_klines[TEMP_HOUR], 3600);
95 rb_event_addish("expire_temp_dlines_hour", reorganise_temp_kd,
96 &temp_dlines[TEMP_HOUR], 3600);
97 rb_event_addish("expire_temp_klines_day", reorganise_temp_kd,
98 &temp_klines[TEMP_DAY], 86400);
99 rb_event_addish("expire_temp_dlines_day", reorganise_temp_kd,
100 &temp_dlines[TEMP_DAY], 86400);
101 rb_event_addish("expire_temp_klines_week", reorganise_temp_kd,
102 &temp_klines[TEMP_WEEK], 604800);
103 rb_event_addish("expire_temp_dlines_week", reorganise_temp_kd,
104 &temp_dlines[TEMP_WEEK], 604800);
105 }
106
107 /*
108 * make_conf
109 *
110 * inputs - none
111 * output - pointer to new conf entry
112 * side effects - none
113 */
114 struct ConfItem *
115 make_conf()
116 {
117 struct ConfItem *aconf;
118
119 aconf = rb_bh_alloc(confitem_heap);
120 aconf->status = CONF_ILLEGAL;
121 return (aconf);
122 }
123
124 /*
125 * free_conf
126 *
127 * inputs - pointer to conf to free
128 * output - none
129 * side effects - crucial password fields are zeroed, conf is freed
130 */
131 void
132 free_conf(struct ConfItem *aconf)
133 {
134 s_assert(aconf != NULL);
135 if(aconf == NULL)
136 return;
137
138 /* security.. */
139 if(aconf->passwd)
140 memset(aconf->passwd, 0, strlen(aconf->passwd));
141 if(aconf->spasswd)
142 memset(aconf->spasswd, 0, strlen(aconf->spasswd));
143
144 rb_free(aconf->passwd);
145 rb_free(aconf->spasswd);
146 rb_free(aconf->name);
147 rb_free(aconf->className);
148 rb_free(aconf->user);
149 rb_free(aconf->host);
150
151 rb_bh_free(confitem_heap, aconf);
152 }
153
154 /*
155 * check_client
156 *
157 * inputs - pointer to client
158 * output - 0 = Success
159 * NOT_AUTHORISED (-1) = Access denied (no I line match)
160 * SOCKET_ERROR (-2) = Bad socket.
161 * I_LINE_FULL (-3) = I-line is full
162 * TOO_MANY (-4) = Too many connections from hostname
163 * BANNED_CLIENT (-5) = K-lined
164 * side effects - Ordinary client access check.
165 * Look for conf lines which have the same
166 * status as the flags passed.
167 */
168 int
169 check_client(struct Client *client_p, struct Client *source_p, const char *username)
170 {
171 int i;
172
173 if((i = verify_access(source_p, username)))
174 {
175 ilog(L_FUSER, "Access denied: %s[%s]",
176 source_p->name, source_p->sockhost);
177 }
178
179 switch (i)
180 {
181 case SOCKET_ERROR:
182 exit_client(client_p, source_p, &me, "Socket Error");
183 break;
184
185 case TOO_MANY_LOCAL:
186 /* Note that these notices are sent to opers on other
187 * servers also, so even if local opers are allowed to
188 * see the IP, we still cannot send it.
189 */
190 sendto_realops_snomask(SNO_FULL, L_NETWIDE,
191 "Too many local connections for %s!%s%s@%s",
192 source_p->name, IsGotId(source_p) ? "" : "~",
193 source_p->username,
194 show_ip(NULL, source_p) && !IsIPSpoof(source_p) ? source_p->sockhost : source_p->host);
195
196 ilog(L_FUSER, "Too many local connections from %s!%s%s@%s",
197 source_p->name, IsGotId(source_p) ? "" : "~",
198 source_p->username, source_p->sockhost);
199
200 ServerStats.is_ref++;
201 exit_client(client_p, source_p, &me, "Too many host connections (local)");
202 break;
203
204 case TOO_MANY_GLOBAL:
205 sendto_realops_snomask(SNO_FULL, L_NETWIDE,
206 "Too many global connections for %s!%s%s@%s",
207 source_p->name, IsGotId(source_p) ? "" : "~",
208 source_p->username,
209 show_ip(NULL, source_p) && !IsIPSpoof(source_p) ? source_p->sockhost : source_p->host);
210 ilog(L_FUSER, "Too many global connections from %s!%s%s@%s",
211 source_p->name, IsGotId(source_p) ? "" : "~",
212 source_p->username, source_p->sockhost);
213
214 ServerStats.is_ref++;
215 exit_client(client_p, source_p, &me, "Too many host connections (global)");
216 break;
217
218 case TOO_MANY_IDENT:
219 sendto_realops_snomask(SNO_FULL, L_NETWIDE,
220 "Too many user connections for %s!%s%s@%s",
221 source_p->name, IsGotId(source_p) ? "" : "~",
222 source_p->username,
223 show_ip(NULL, source_p) && !IsIPSpoof(source_p) ? source_p->sockhost : source_p->host);
224 ilog(L_FUSER, "Too many user connections from %s!%s%s@%s",
225 source_p->name, IsGotId(source_p) ? "" : "~",
226 source_p->username, source_p->sockhost);
227
228 ServerStats.is_ref++;
229 exit_client(client_p, source_p, &me, "Too many user connections (global)");
230 break;
231
232 case I_LINE_FULL:
233 sendto_realops_snomask(SNO_FULL, L_NETWIDE,
234 "I-line is full for %s!%s%s@%s (%s).",
235 source_p->name, IsGotId(source_p) ? "" : "~",
236 source_p->username, source_p->host,
237 show_ip(NULL, source_p) && !IsIPSpoof(source_p) ? source_p->sockhost : "255.255.255.255");
238
239 ilog(L_FUSER, "Too many connections from %s!%s%s@%s.",
240 source_p->name, IsGotId(source_p) ? "" : "~",
241 source_p->username, source_p->sockhost);
242
243 ServerStats.is_ref++;
244 exit_client(client_p, source_p, &me,
245 "No more connections allowed in your connection class");
246 break;
247
248 case NOT_AUTHORISED:
249 {
250 int port = -1;
251 #ifdef RB_IPV6
252 if(source_p->localClient->ip.ss_family == AF_INET6)
253 port = ntohs(((struct sockaddr_in6 *)&source_p->localClient->listener->addr)->sin6_port);
254 else
255 #endif
256 port = ntohs(((struct sockaddr_in *)&source_p->localClient->listener->addr)->sin_port);
257
258 ServerStats.is_ref++;
259 /* jdc - lists server name & port connections are on */
260 /* a purely cosmetical change */
261 /* why ipaddr, and not just source_p->sockhost? --fl */
262 #if 0
263 static char ipaddr[HOSTIPLEN];
264 rb_inet_ntop_sock(&source_p->localClient->ip, ipaddr, sizeof(ipaddr));
265 #endif
266 sendto_realops_snomask(SNO_UNAUTH, L_ALL,
267 "Unauthorised client connection from "
268 "%s!%s%s@%s [%s] on [%s/%u].",
269 source_p->name, IsGotId(source_p) ? "" : "~",
270 source_p->username, source_p->host,
271 source_p->sockhost,
272 source_p->localClient->listener->name, port);
273
274 ilog(L_FUSER,
275 "Unauthorised client connection from %s!%s%s@%s on [%s/%u].",
276 source_p->name, IsGotId(source_p) ? "" : "~",
277 source_p->username, source_p->sockhost,
278 source_p->localClient->listener->name, port);
279 add_reject(client_p, NULL, NULL);
280 exit_client(client_p, source_p, &me,
281 "You are not authorised to use this server");
282 break;
283 }
284 case BANNED_CLIENT:
285 exit_client(client_p, client_p, &me, "*** Banned ");
286 ServerStats.is_ref++;
287 break;
288
289 case 0:
290 default:
291 break;
292 }
293 return (i);
294 }
295
296 /*
297 * verify_access
298 *
299 * inputs - pointer to client to verify
300 * - pointer to proposed username
301 * output - 0 if success -'ve if not
302 * side effect - find the first (best) I line to attach.
303 */
304 static int
305 verify_access(struct Client *client_p, const char *username)
306 {
307 struct ConfItem *aconf;
308 char non_ident[USERLEN + 1];
309
310 if(IsGotId(client_p))
311 {
312 aconf = find_address_conf(client_p->host, client_p->sockhost,
313 client_p->username, client_p->username,
314 (struct sockaddr *) &client_p->localClient->ip,
315 client_p->localClient->ip.ss_family,
316 client_p->localClient->auth_user);
317 }
318 else
319 {
320 rb_strlcpy(non_ident, "~", sizeof(non_ident));
321 rb_strlcat(non_ident, username, sizeof(non_ident));
322 aconf = find_address_conf(client_p->host, client_p->sockhost,
323 non_ident, client_p->username,
324 (struct sockaddr *) &client_p->localClient->ip,
325 client_p->localClient->ip.ss_family,
326 client_p->localClient->auth_user);
327 }
328
329 if(aconf == NULL)
330 return NOT_AUTHORISED;
331
332 if(aconf->status & CONF_CLIENT)
333 {
334 if(aconf->flags & CONF_FLAGS_REDIR)
335 {
336 sendto_one_numeric(client_p, RPL_REDIR, form_str(RPL_REDIR),
337 aconf->name ? aconf->name : "", aconf->port);
338 return (NOT_AUTHORISED);
339 }
340
341 /* Thanks for spoof idea amm */
342 if(IsConfDoSpoofIp(aconf))
343 {
344 char *p;
345
346 /* show_ip() depends on this --fl */
347 SetIPSpoof(client_p);
348
349 if(IsConfSpoofNotice(aconf))
350 {
351 sendto_realops_snomask(SNO_GENERAL, L_ALL,
352 "%s spoofing: %s as %s",
353 client_p->name,
354 show_ip(NULL, client_p) ? client_p->host : aconf->name,
355 aconf->name);
356 }
357
358 /* user@host spoof */
359 if((p = strchr(aconf->name, '@')) != NULL)
360 {
361 char *host = p+1;
362 *p = '\0';
363
364 rb_strlcpy(client_p->username, aconf->name,
365 sizeof(client_p->username));
366 rb_strlcpy(client_p->host, host,
367 sizeof(client_p->host));
368 *p = '@';
369 }
370 else
371 rb_strlcpy(client_p->host, aconf->name, sizeof(client_p->host));
372 }
373 return (attach_iline(client_p, aconf));
374 }
375 else if(aconf->status & CONF_KILL)
376 {
377 if(ConfigFileEntry.kline_with_reason)
378 {
379 sendto_one(client_p,
380 form_str(ERR_YOUREBANNEDCREEP),
381 me.name, client_p->name, aconf->passwd);
382 }
383 add_reject(client_p, aconf->user, aconf->host);
384 return (BANNED_CLIENT);
385 }
386
387 return NOT_AUTHORISED;
388 }
389
390
391 /*
392 * add_ip_limit
393 *
394 * Returns 1 if successful 0 if not
395 *
396 * This checks if the user has exceed the limits for their class
397 * unless of course they are exempt..
398 */
399
400 static int
401 add_ip_limit(struct Client *client_p, struct ConfItem *aconf)
402 {
403 rb_patricia_node_t *pnode;
404 int bitlen;
405
406 /* If the limits are 0 don't do anything.. */
407 if(ConfCidrAmount(aconf) == 0
408 || (ConfCidrIpv4Bitlen(aconf) == 0 && ConfCidrIpv6Bitlen(aconf) == 0))
409 return -1;
410
411 pnode = rb_match_ip(ConfIpLimits(aconf), (struct sockaddr *)&client_p->localClient->ip);
412
413 if(GET_SS_FAMILY(&client_p->localClient->ip) == AF_INET)
414 bitlen = ConfCidrIpv4Bitlen(aconf);
415 else
416 bitlen = ConfCidrIpv6Bitlen(aconf);
417
418 if(pnode == NULL)
419 pnode = make_and_lookup_ip(ConfIpLimits(aconf), (struct sockaddr *)&client_p->localClient->ip, bitlen);
420
421 s_assert(pnode != NULL);
422
423 if(pnode != NULL)
424 {
425 if(((intptr_t)pnode->data) >= ConfCidrAmount(aconf) && !IsConfExemptLimits(aconf))
426 {
427 /* This should only happen if the limits are set to 0 */
428 if((intptr_t)pnode->data == 0)
429 {
430 rb_patricia_remove(ConfIpLimits(aconf), pnode);
431 }
432 return (0);
433 }
434
435 pnode->data = (void *)(((intptr_t)pnode->data) + 1);
436 }
437 return 1;
438 }
439
440 static void
441 remove_ip_limit(struct Client *client_p, struct ConfItem *aconf)
442 {
443 rb_patricia_node_t *pnode;
444
445 /* If the limits are 0 don't do anything.. */
446 if(ConfCidrAmount(aconf) == 0
447 || (ConfCidrIpv4Bitlen(aconf) == 0 && ConfCidrIpv6Bitlen(aconf) == 0))
448 return;
449
450 pnode = rb_match_ip(ConfIpLimits(aconf), (struct sockaddr *)&client_p->localClient->ip);
451 if(pnode == NULL)
452 return;
453
454 pnode->data = (void *)(((intptr_t)pnode->data) - 1);
455 if(((intptr_t)pnode->data) == 0)
456 {
457 rb_patricia_remove(ConfIpLimits(aconf), pnode);
458 }
459
460 }
461
462 /*
463 * attach_iline
464 *
465 * inputs - client pointer
466 * - conf pointer
467 * output -
468 * side effects - do actual attach
469 */
470 static int
471 attach_iline(struct Client *client_p, struct ConfItem *aconf)
472 {
473 struct Client *target_p;
474 rb_dlink_node *ptr;
475 int local_count = 0;
476 int global_count = 0;
477 int ident_count = 0;
478 int unidented = 0;
479
480 if(IsConfExemptLimits(aconf))
481 return (attach_conf(client_p, aconf));
482
483 if(*client_p->username == '~')
484 unidented = 1;
485
486
487 /* find_hostname() returns the head of the list to search */
488 RB_DLINK_FOREACH(ptr, find_hostname(client_p->host))
489 {
490 target_p = ptr->data;
491
492 if(irccmp(client_p->host, target_p->orighost) != 0)
493 continue;
494
495 if(MyConnect(target_p))
496 local_count++;
497
498 global_count++;
499
500 if(unidented)
501 {
502 if(*target_p->username == '~')
503 ident_count++;
504 }
505 else if(irccmp(target_p->username, client_p->username) == 0)
506 ident_count++;
507
508 if(ConfMaxLocal(aconf) && local_count >= ConfMaxLocal(aconf))
509 return (TOO_MANY_LOCAL);
510 else if(ConfMaxGlobal(aconf) && global_count >= ConfMaxGlobal(aconf))
511 return (TOO_MANY_GLOBAL);
512 else if(ConfMaxIdent(aconf) && ident_count >= ConfMaxIdent(aconf))
513 return (TOO_MANY_IDENT);
514 }
515
516
517 return (attach_conf(client_p, aconf));
518 }
519
520 /*
521 * detach_conf
522 *
523 * inputs - pointer to client to detach
524 * output - 0 for success, -1 for failure
525 * side effects - Disassociate configuration from the client.
526 * Also removes a class from the list if marked for deleting.
527 */
528 int
529 detach_conf(struct Client *client_p)
530 {
531 struct ConfItem *aconf;
532
533 aconf = client_p->localClient->att_conf;
534
535 if(aconf != NULL)
536 {
537 if(ClassPtr(aconf))
538 {
539 remove_ip_limit(client_p, aconf);
540
541 if(ConfCurrUsers(aconf) > 0)
542 --ConfCurrUsers(aconf);
543
544 if(ConfMaxUsers(aconf) == -1 && ConfCurrUsers(aconf) == 0)
545 {
546 free_class(ClassPtr(aconf));
547 ClassPtr(aconf) = NULL;
548 }
549
550 }
551
552 aconf->clients--;
553 if(!aconf->clients && IsIllegal(aconf))
554 free_conf(aconf);
555
556 client_p->localClient->att_conf = NULL;
557 return 0;
558 }
559
560 return -1;
561 }
562
563 /*
564 * attach_conf
565 *
566 * inputs - client pointer
567 * - conf pointer
568 * output -
569 * side effects - Associate a specific configuration entry to a *local*
570 * client (this is the one which used in accepting the
571 * connection). Note, that this automatically changes the
572 * attachment if there was an old one...
573 */
574 int
575 attach_conf(struct Client *client_p, struct ConfItem *aconf)
576 {
577 if(IsIllegal(aconf))
578 return (NOT_AUTHORISED);
579
580 if(ClassPtr(aconf))
581 {
582 if(!add_ip_limit(client_p, aconf))
583 return (TOO_MANY_LOCAL);
584 }
585
586 if((aconf->status & CONF_CLIENT) &&
587 ConfCurrUsers(aconf) >= ConfMaxUsers(aconf) && ConfMaxUsers(aconf) > 0)
588 {
589 if(!IsConfExemptLimits(aconf))
590 {
591 return (I_LINE_FULL);
592 }
593 else
594 {
595 sendto_one_notice(client_p, ":*** I: line is full, but you have an >I: line!");
596 }
597
598 }
599
600 if(client_p->localClient->att_conf != NULL)
601 detach_conf(client_p);
602
603 client_p->localClient->att_conf = aconf;
604
605 aconf->clients++;
606 ConfCurrUsers(aconf)++;
607 return (0);
608 }
609
610 /*
611 * rehash
612 *
613 * Actual REHASH service routine. Called with sig == 0 if it has been called
614 * as a result of an operator issuing this command, else assume it has been
615 * called as a result of the server receiving a HUP signal.
616 */
617 int
618 rehash(int sig)
619 {
620 if(sig != 0)
621 {
622 sendto_realops_snomask(SNO_GENERAL, L_ALL,
623 "Got signal SIGHUP, reloading ircd conf. file");
624 }
625
626 restart_resolver();
627 /* don't close listeners until we know we can go ahead with the rehash */
628 read_conf_files(NO);
629
630 if(ServerInfo.description != NULL)
631 rb_strlcpy(me.info, ServerInfo.description, sizeof(me.info));
632 else
633 rb_strlcpy(me.info, "unknown", sizeof(me.info));
634
635 open_logfiles();
636 return (0);
637 }
638
639 void
640 rehash_bans(int sig)
641 {
642 bandb_rehash_bans();
643 }
644
645 /*
646 * set_default_conf()
647 *
648 * inputs - NONE
649 * output - NONE
650 * side effects - Set default values here.
651 * This is called **PRIOR** to parsing the
652 * configuration file. If you want to do some validation
653 * of values later, put them in validate_conf().
654 */
655
656 #define YES 1
657 #define NO 0
658 #define UNSET -1
659
660 static void
661 set_default_conf(void)
662 {
663 /* ServerInfo.name is not rehashable */
664 /* ServerInfo.name = ServerInfo.name; */
665 ServerInfo.description = NULL;
666 ServerInfo.network_name = rb_strdup(NETWORK_NAME_DEFAULT);
667 ServerInfo.network_desc = rb_strdup(NETWORK_DESC_DEFAULT);
668
669 memset(&ServerInfo.ip, 0, sizeof(ServerInfo.ip));
670 ServerInfo.specific_ipv4_vhost = 0;
671 #ifdef RB_IPV6
672 memset(&ServerInfo.ip6, 0, sizeof(ServerInfo.ip6));
673 ServerInfo.specific_ipv6_vhost = 0;
674 #endif
675
676 /* Don't reset hub, as that will break lazylinks */
677 /* ServerInfo.hub = NO; */
678 AdminInfo.name = NULL;
679 AdminInfo.email = NULL;
680 AdminInfo.description = NULL;
681
682 ConfigFileEntry.default_operstring = rb_strdup("is an IRC operator");
683 ConfigFileEntry.default_adminstring = rb_strdup("is a Server Administrator");
684 ConfigFileEntry.default_operhost = rb_strdup("");
685 ConfigFileEntry.servicestring = rb_strdup("is a Network Service");
686
687 ConfigFileEntry.default_umodes = UMODE_INVISIBLE;
688 ConfigFileEntry.failed_oper_notice = YES;
689 ConfigFileEntry.anti_nick_flood = NO;
690 ConfigFileEntry.disable_fake_channels = NO;
691 ConfigFileEntry.max_nick_time = 20;
692 ConfigFileEntry.max_nick_changes = 5;
693 ConfigFileEntry.max_accept = 20;
694 ConfigFileEntry.max_monitor = 60;
695 ConfigFileEntry.nick_delay = 900; /* 15 minutes */
696 ConfigFileEntry.target_change = YES;
697 ConfigFileEntry.anti_spam_exit_message_time = 0;
698 ConfigFileEntry.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
699 ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;
700 ConfigFileEntry.client_exit = YES;
701 ConfigFileEntry.dline_with_reason = YES;
702 ConfigFileEntry.kline_with_reason = YES;
703 ConfigFileEntry.kline_delay = 0;
704 ConfigFileEntry.warn_no_nline = YES;
705 ConfigFileEntry.non_redundant_klines = YES;
706 ConfigFileEntry.stats_e_disabled = NO;
707 ConfigFileEntry.stats_o_oper_only = NO;
708 ConfigFileEntry.stats_k_oper_only = 1; /* masked */
709 ConfigFileEntry.stats_i_oper_only = 1; /* masked */
710 ConfigFileEntry.stats_P_oper_only = NO;
711 ConfigFileEntry.stats_c_oper_only = NO;
712 ConfigFileEntry.stats_y_oper_only = NO;
713 ConfigFileEntry.stats_h_oper_only = NO;
714 ConfigFileEntry.map_oper_only = YES;
715 ConfigFileEntry.operspy_admin_only = NO;
716 ConfigFileEntry.pace_wait = 10;
717 ConfigFileEntry.caller_id_wait = 60;
718 ConfigFileEntry.pace_wait_simple = 1;
719 ConfigFileEntry.short_motd = NO;
720 ConfigFileEntry.no_oper_flood = NO;
721 ConfigFileEntry.fname_userlog = NULL;
722 ConfigFileEntry.fname_fuserlog = NULL;
723 ConfigFileEntry.fname_operlog = NULL;
724 ConfigFileEntry.fname_foperlog = NULL;
725 ConfigFileEntry.fname_serverlog = NULL;
726 ConfigFileEntry.fname_klinelog = NULL;
727 ConfigFileEntry.fname_operspylog = NULL;
728 ConfigFileEntry.fname_ioerrorlog = NULL;
729 ConfigFileEntry.use_egd = NO;
730 ConfigFileEntry.hide_spoof_ips = YES;
731 ConfigFileEntry.hide_error_messages = 1;
732 ConfigFileEntry.dots_in_ident = 0;
733 ConfigFileEntry.max_targets = MAX_TARGETS_DEFAULT;
734 ConfigFileEntry.egdpool_path = NULL;
735 ConfigFileEntry.use_whois_actually = YES;
736 ConfigFileEntry.burst_away = NO;
737 ConfigFileEntry.collision_fnc = YES;
738 ConfigFileEntry.global_snotices = YES;
739 ConfigFileEntry.operspy_dont_care_user_info = NO;
740 ConfigFileEntry.secret_channels_in_whois = NO;
741
742 #ifdef HAVE_LIBZ
743 ConfigFileEntry.compression_level = 4;
744 #endif
745
746 ConfigFileEntry.oper_umodes = UMODE_LOCOPS | UMODE_SERVNOTICE |
747 UMODE_OPERWALL | UMODE_WALLOP;
748 ConfigFileEntry.oper_only_umodes = UMODE_SERVNOTICE;
749 ConfigFileEntry.oper_snomask = SNO_GENERAL;
750
751 ConfigChannel.autochanmodes = rb_strdup("nt");
752 ConfigChannel.exemptchanops = rb_strdup("");
753 ConfigChannel.use_halfop = YES;
754 ConfigChannel.use_owner = YES;
755 ConfigChannel.use_except = YES;
756 ConfigChannel.use_invex = YES;
757 ConfigChannel.use_knock = YES;
758 ConfigChannel.use_forward = YES;
759 ConfigChannel.use_local_channels = YES;
760 ConfigChannel.knock_delay = 300;
761 ConfigChannel.knock_delay_channel = 60;
762 ConfigChannel.max_chans_per_user = 15;
763 ConfigChannel.max_bans = 25;
764 ConfigChannel.max_bans_large = 500;
765 ConfigChannel.only_ascii_channels = NO;
766 ConfigChannel.cycle_host_change = YES;
767 ConfigChannel.host_in_topic = YES;
768 ConfigChannel.burst_topicwho = NO;
769 ConfigChannel.kick_on_split_riding = NO;
770
771 ConfigChannel.default_split_user_count = 15000;
772 ConfigChannel.default_split_server_count = 10;
773 ConfigChannel.no_join_on_split = NO;
774 ConfigChannel.no_create_on_split = YES;
775 ConfigChannel.resv_forcepart = YES;
776 ConfigChannel.kick_no_rejoin_time = 30;
777
778 ConfigChannel.exempt_cmode_c = NO;
779 ConfigChannel.exempt_cmode_C = NO;
780 ConfigChannel.exempt_cmode_D = NO;
781 ConfigChannel.exempt_cmode_T = NO;
782 ConfigChannel.exempt_cmode_N = NO;
783 ConfigChannel.exempt_cmode_G = NO;
784 ConfigChannel.exempt_cmode_K = NO;
785
786 ConfigServerHide.flatten_links = 0;
787 ConfigServerHide.links_delay = 300;
788 ConfigServerHide.hidden = 0;
789 ConfigServerHide.disable_hidden = 0;
790
791 ConfigFileEntry.min_nonwildcard = 4;
792 ConfigFileEntry.min_nonwildcard_simple = 3;
793 ConfigFileEntry.default_floodcount = 8;
794 ConfigFileEntry.client_flood = CLIENT_FLOOD_DEFAULT;
795 ConfigFileEntry.tkline_expire_notices = 0;
796
797 ConfigFileEntry.reject_after_count = 5;
798 ConfigFileEntry.reject_ban_time = 300;
799 ConfigFileEntry.reject_duration = 120;
800 ConfigFileEntry.throttle_count = 4;
801 ConfigFileEntry.throttle_duration = 60;
802 ConfigFileEntry.expire_override_time = 300;
803
804 ServerInfo.default_max_clients = MAXCONNECTIONS;
805
806 if (!alias_dict)
807 alias_dict = irc_dictionary_create(strcasecmp);
808 }
809
810 #undef YES
811 #undef NO
812
813 /*
814 * read_conf()
815 *
816 *
817 * inputs - file descriptor pointing to config file to use
818 * output - None
819 * side effects - Read configuration file.
820 */
821 static void
822 read_conf(FILE * file)
823 {
824 lineno = 0;
825
826 set_default_conf(); /* Set default values prior to conf parsing */
827 yyparse(); /* Load the values from the conf */
828 validate_conf(); /* Check to make sure some values are still okay. */
829 /* Some global values are also loaded here. */
830 check_class(); /* Make sure classes are valid */
831 privilegeset_delete_all_illegal();
832 }
833
834 static void
835 validate_conf(void)
836 {
837 if(ConfigFileEntry.ts_warn_delta < TS_WARN_DELTA_MIN)
838 ConfigFileEntry.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
839
840 if(ConfigFileEntry.ts_max_delta < TS_MAX_DELTA_MIN)
841 ConfigFileEntry.ts_max_delta = TS_MAX_DELTA_DEFAULT;
842
843 if(ServerInfo.network_name == NULL)
844 ServerInfo.network_name = rb_strdup(NETWORK_NAME_DEFAULT);
845
846 if(ServerInfo.network_desc == NULL)
847 ServerInfo.network_desc = rb_strdup(NETWORK_DESC_DEFAULT);
848
849 if(ServerInfo.ssld_count < 1)
850 ServerInfo.ssld_count = 1;
851
852 if(!rb_setup_ssl_server(ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params))
853 {
854 ilog(L_MAIN, "WARNING: Unable to setup SSL.");
855 ssl_ok = 0;
856 } else {
857 ssl_ok = 1;
858 send_new_ssl_certs(ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params);
859 }
860
861 if(ServerInfo.ssld_count > get_ssld_count())
862 {
863 int start = ServerInfo.ssld_count - get_ssld_count();
864 /* start up additional ssld if needed */
865 start_ssldaemon(start, ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params);
866
867 }
868
869 if((ConfigFileEntry.client_flood < CLIENT_FLOOD_MIN) ||
870 (ConfigFileEntry.client_flood > CLIENT_FLOOD_MAX))
871 ConfigFileEntry.client_flood = CLIENT_FLOOD_MAX;
872
873 if(!split_users || !split_servers ||
874 (!ConfigChannel.no_create_on_split && !ConfigChannel.no_join_on_split))
875 {
876 rb_event_delete(check_splitmode_ev);
877 check_splitmode_ev = NULL;
878 splitmode = 0;
879 splitchecking = 0;
880 }
881
882 if(!valid_hostname(ConfigFileEntry.default_operhost))
883 {
884 conf_report_error("Warning -- invalid default_operhost specified, ignoring.");
885 ConfigFileEntry.default_operhost = rb_strdup("");
886 }
887
888 /* Parse the exemptchanops option and set the internal variables
889 * that we will use. */
890 char * ech;
891
892 for(ech = ConfigChannel.exemptchanops; *ech; ech++)
893 {
894 if(*ech == 'c')
895 {
896 ConfigChannel.exempt_cmode_c = 1;
897 continue;
898 }
899 if(*ech == 'C')
900 {
901 ConfigChannel.exempt_cmode_C = 1;
902 continue;
903 }
904 if(*ech == 'D')
905 {
906 ConfigChannel.exempt_cmode_D = 1;
907 continue;
908 }
909 if(*ech == 'T')
910 {
911 ConfigChannel.exempt_cmode_T = 1;
912 continue;
913 }
914 if(*ech == 'N')
915 {
916 ConfigChannel.exempt_cmode_N = 1;
917 continue;
918 }
919 if(*ech == 'G')
920 {
921 ConfigChannel.exempt_cmode_G = 1;
922 continue;
923 }
924 if(*ech == 'K')
925 ConfigChannel.exempt_cmode_K = 1;
926 }
927 }
928
929 /* add_temp_kline()
930 *
931 * inputs - pointer to struct ConfItem
932 * output - none
933 * Side effects - links in given struct ConfItem into
934 * temporary kline link list
935 */
936 void
937 add_temp_kline(struct ConfItem *aconf)
938 {
939 if(aconf->hold >= rb_current_time() + (10080 * 60))
940 {
941 rb_dlinkAddAlloc(aconf, &temp_klines[TEMP_WEEK]);
942 aconf->port = TEMP_WEEK;
943 }
944 else if(aconf->hold >= rb_current_time() + (1440 * 60))
945 {
946 rb_dlinkAddAlloc(aconf, &temp_klines[TEMP_DAY]);
947 aconf->port = TEMP_DAY;
948 }
949 else if(aconf->hold >= rb_current_time() + (60 * 60))
950 {
951 rb_dlinkAddAlloc(aconf, &temp_klines[TEMP_HOUR]);
952 aconf->port = TEMP_HOUR;
953 }
954 else
955 {
956 rb_dlinkAddAlloc(aconf, &temp_klines[TEMP_MIN]);
957 aconf->port = TEMP_MIN;
958 }
959
960 aconf->flags |= CONF_FLAGS_TEMPORARY;
961 add_conf_by_address(aconf->host, CONF_KILL, aconf->user, NULL, aconf);
962 }
963
964 /* add_temp_dline()
965 *
966 * input - pointer to struct ConfItem
967 * output - none
968 * side effects - added to tdline link list and address hash
969 */
970 void
971 add_temp_dline(struct ConfItem *aconf)
972 {
973 if(aconf->hold >= rb_current_time() + (10080 * 60))
974 {
975 rb_dlinkAddAlloc(aconf, &temp_dlines[TEMP_WEEK]);
976 aconf->port = TEMP_WEEK;
977 }
978 else if(aconf->hold >= rb_current_time() + (1440 * 60))
979 {
980 rb_dlinkAddAlloc(aconf, &temp_dlines[TEMP_DAY]);
981 aconf->port = TEMP_DAY;
982 }
983 else if(aconf->hold >= rb_current_time() + (60 * 60))
984 {
985 rb_dlinkAddAlloc(aconf, &temp_dlines[TEMP_HOUR]);
986 aconf->port = TEMP_HOUR;
987 }
988 else
989 {
990 rb_dlinkAddAlloc(aconf, &temp_dlines[TEMP_MIN]);
991 aconf->port = TEMP_MIN;
992 }
993
994 aconf->flags |= CONF_FLAGS_TEMPORARY;
995 add_conf_by_address(aconf->host, CONF_DLINE, aconf->user, NULL, aconf);
996 }
997
998 /* expire_tkline()
999 *
1000 * inputs - list pointer
1001 * - type
1002 * output - NONE
1003 * side effects - expire tklines and moves them between lists
1004 */
1005 static void
1006 expire_temp_kd(void *list)
1007 {
1008 rb_dlink_node *ptr;
1009 rb_dlink_node *next_ptr;
1010 struct ConfItem *aconf;
1011
1012 RB_DLINK_FOREACH_SAFE(ptr, next_ptr, ((rb_dlink_list *) list)->head)
1013 {
1014 aconf = ptr->data;
1015
1016 if(aconf->hold <= rb_current_time())
1017 {
1018 /* Alert opers that a TKline expired - Hwy */
1019 if(ConfigFileEntry.tkline_expire_notices)
1020 sendto_realops_snomask(SNO_GENERAL, L_ALL,
1021 "Temporary K-line for [%s@%s] expired",
1022 (aconf->user) ? aconf->
1023 user : "*", (aconf->host) ? aconf->host : "*");
1024
1025 delete_one_address_conf(aconf->host, aconf);
1026 rb_dlinkDestroy(ptr, list);
1027 }
1028 }
1029 }
1030
1031 static void
1032 reorganise_temp_kd(void *list)
1033 {
1034 struct ConfItem *aconf;
1035 rb_dlink_node *ptr, *next_ptr;
1036
1037 RB_DLINK_FOREACH_SAFE(ptr, next_ptr, ((rb_dlink_list *) list)->head)
1038 {
1039 aconf = ptr->data;
1040
1041 if(aconf->hold < (rb_current_time() + (60 * 60)))
1042 {
1043 rb_dlinkMoveNode(ptr, list, (aconf->status == CONF_KILL) ?
1044 &temp_klines[TEMP_MIN] : &temp_dlines[TEMP_MIN]);
1045 aconf->port = TEMP_MIN;
1046 }
1047 else if(aconf->port > TEMP_HOUR)
1048 {
1049 if(aconf->hold < (rb_current_time() + (1440 * 60)))
1050 {
1051 rb_dlinkMoveNode(ptr, list, (aconf->status == CONF_KILL) ?
1052 &temp_klines[TEMP_HOUR] : &temp_dlines[TEMP_HOUR]);
1053 aconf->port = TEMP_HOUR;
1054 }
1055 else if(aconf->port > TEMP_DAY &&
1056 (aconf->hold < (rb_current_time() + (10080 * 60))))
1057 {
1058 rb_dlinkMoveNode(ptr, list, (aconf->status == CONF_KILL) ?
1059 &temp_klines[TEMP_DAY] : &temp_dlines[TEMP_DAY]);
1060 aconf->port = TEMP_DAY;
1061 }
1062 }
1063 }
1064 }
1065
1066
1067 /* const char* get_oper_name(struct Client *client_p)
1068 * Input: A client to find the active oper{} name for.
1069 * Output: The nick!user@host{oper} of the oper.
1070 * "oper" is server name for remote opers
1071 * Side effects: None.
1072 */
1073 char *
1074 get_oper_name(struct Client *client_p)
1075 {
1076 /* +5 for !,@,{,} and null */
1077 static char buffer[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5];
1078
1079 if(MyOper(client_p))
1080 {
1081 rb_snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}",
1082 client_p->name, client_p->username,
1083 client_p->host, client_p->localClient->opername);
1084 return buffer;
1085 }
1086
1087 rb_snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}",
1088 client_p->name, client_p->username,
1089 client_p->host, client_p->servptr->name);
1090 return buffer;
1091 }
1092
1093 /*
1094 * get_printable_conf
1095 *
1096 * inputs - struct ConfItem
1097 *
1098 * output - name
1099 * - host
1100 * - pass
1101 * - user
1102 * - port
1103 *
1104 * side effects -
1105 * Examine the struct struct ConfItem, setting the values
1106 * of name, host, pass, user to values either
1107 * in aconf, or "<NULL>" port is set to aconf->port in all cases.
1108 */
1109 void
1110 get_printable_conf(struct ConfItem *aconf, char **name, char **host,
1111 char **pass, char **user, int *port, char **classname)
1112 {
1113 static char null[] = "<NULL>";
1114 static char zero[] = "default";
1115
1116 *name = EmptyString(aconf->name) ? null : aconf->name;
1117 *host = EmptyString(aconf->host) ? null : aconf->host;
1118 *pass = EmptyString(aconf->passwd) ? null : aconf->passwd;
1119 *user = EmptyString(aconf->user) ? null : aconf->user;
1120 *classname = EmptyString(aconf->className) ? zero : aconf->className;
1121 *port = (int) aconf->port;
1122 }
1123
1124 void
1125 get_printable_kline(struct Client *source_p, struct ConfItem *aconf,
1126 char **host, char **reason,
1127 char **user, char **oper_reason)
1128 {
1129 static char null[] = "<NULL>";
1130
1131 *host = EmptyString(aconf->host) ? null : aconf->host;
1132 *reason = EmptyString(aconf->passwd) ? null : aconf->passwd;
1133 *user = EmptyString(aconf->user) ? null : aconf->user;
1134
1135 if(EmptyString(aconf->spasswd) || !IsOper(source_p))
1136 *oper_reason = NULL;
1137 else
1138 *oper_reason = aconf->spasswd;
1139 }
1140
1141 /*
1142 * read_conf_files
1143 *
1144 * inputs - cold start YES or NO
1145 * output - none
1146 * side effects - read all conf files needed, ircd.conf kline.conf etc.
1147 */
1148 void
1149 read_conf_files(int cold)
1150 {
1151 const char *filename;
1152
1153 conf_fbfile_in = NULL;
1154
1155 filename = ConfigFileEntry.configfile;
1156
1157 /* We need to know the initial filename for the yyerror() to report
1158 FIXME: The full path is in conffilenamebuf first time since we
1159 dont know anything else
1160
1161 - Gozem 2002-07-21
1162 */
1163 rb_strlcpy(conffilebuf, filename, sizeof(conffilebuf));
1164
1165 if((conf_fbfile_in = fopen(filename, "r")) == NULL)
1166 {
1167 if(cold)
1168 {
1169 ilog(L_MAIN, "Failed in reading configuration file %s", filename);
1170 exit(-1);
1171 }
1172 else
1173 {
1174 sendto_realops_snomask(SNO_GENERAL, L_ALL,
1175 "Can't open file '%s' - aborting rehash!", filename);
1176 return;
1177 }
1178 }
1179
1180 if(!cold)
1181 {
1182 clear_out_old_conf();
1183 }
1184
1185 read_conf(conf_fbfile_in);
1186 fclose(conf_fbfile_in);
1187 }
1188
1189 /*
1190 * free an alias{} entry.
1191 */
1192 static void
1193 free_alias_cb(struct DictionaryElement *ptr, void *unused)
1194 {
1195 struct alias_entry *aptr = ptr->data;
1196
1197 rb_free(aptr->name);
1198 rb_free(aptr->target);
1199 rb_free(aptr);
1200 }
1201
1202 /*
1203 * clear_out_old_conf
1204 *
1205 * inputs - none
1206 * output - none
1207 * side effects - Clear out the old configuration
1208 */
1209 static void
1210 clear_out_old_conf(void)
1211 {
1212 struct Class *cltmp;
1213 rb_dlink_node *ptr;
1214 rb_dlink_node *next_ptr;
1215
1216 /*
1217 * don't delete the class table, rather mark all entries
1218 * for deletion. The table is cleaned up by check_class. - avalon
1219 */
1220 RB_DLINK_FOREACH(ptr, class_list.head)
1221 {
1222 cltmp = ptr->data;
1223 MaxUsers(cltmp) = -1;
1224 }
1225
1226 clear_out_address_conf();
1227 clear_s_newconf();
1228
1229 /* clean out module paths */
1230 #ifndef STATIC_MODULES
1231 mod_clear_paths();
1232 mod_add_path(MODULE_DIR);
1233 mod_add_path(MODULE_DIR "/autoload");
1234 #endif
1235
1236 /* clean out ServerInfo */
1237 rb_free(ServerInfo.description);
1238 ServerInfo.description = NULL;
1239 rb_free(ServerInfo.network_name);
1240 ServerInfo.network_name = NULL;
1241 rb_free(ServerInfo.network_desc);
1242 ServerInfo.network_desc = NULL;
1243
1244 ServerInfo.ssld_count = 1;
1245
1246 /* clean out AdminInfo */
1247 rb_free(AdminInfo.name);
1248 AdminInfo.name = NULL;
1249 rb_free(AdminInfo.email);
1250 AdminInfo.email = NULL;
1251 rb_free(AdminInfo.description);
1252 AdminInfo.description = NULL;
1253
1254 /* operator{} and class{} blocks are freed above */
1255 /* clean out listeners */
1256 close_listeners();
1257
1258 /* auth{}, quarantine{}, shared{}, connect{}, kill{}, deny{}, exempt{}
1259 * and gecos{} blocks are freed above too
1260 */
1261
1262 /* clean out general */
1263 rb_free(ConfigFileEntry.kline_reason);
1264 ConfigFileEntry.kline_reason = NULL;
1265
1266 RB_DLINK_FOREACH_SAFE(ptr, next_ptr, service_list.head)
1267 {
1268 rb_free(ptr->data);
1269 rb_dlinkDestroy(ptr, &service_list);
1270 }
1271
1272 /* remove any aliases... -- nenolod */
1273 if (alias_dict != NULL)
1274 {
1275 irc_dictionary_destroy(alias_dict, free_alias_cb, NULL);
1276 alias_dict = NULL;
1277 }
1278
1279 destroy_blacklists();
1280
1281 privilegeset_mark_all_illegal();
1282
1283 /* OK, that should be everything... */
1284 }
1285
1286
1287 /*
1288 * conf_add_class_to_conf
1289 * inputs - pointer to config item
1290 * output - NONE
1291 * side effects - Add a class pointer to a conf
1292 */
1293
1294 void
1295 conf_add_class_to_conf(struct ConfItem *aconf)
1296 {
1297 if(aconf->className == NULL)
1298 {
1299 aconf->className = rb_strdup("default");
1300 ClassPtr(aconf) = default_class;
1301 return;
1302 }
1303
1304 ClassPtr(aconf) = find_class(aconf->className);
1305
1306 if(ClassPtr(aconf) == default_class)
1307 {
1308 if(aconf->status == CONF_CLIENT)
1309 {
1310 conf_report_error(
1311 "Using default class for missing class \"%s\" in auth{} for %s@%s",
1312 aconf->className, aconf->user, aconf->host);
1313 }
1314
1315 rb_free(aconf->className);
1316 aconf->className = rb_strdup("default");
1317 return;
1318 }
1319
1320 if(ConfMaxUsers(aconf) < 0)
1321 {
1322 ClassPtr(aconf) = default_class;
1323 rb_free(aconf->className);
1324 aconf->className = rb_strdup("default");
1325 return;
1326 }
1327 }
1328
1329 /*
1330 * conf_add_d_conf
1331 * inputs - pointer to config item
1332 * output - NONE
1333 * side effects - Add a d/D line
1334 */
1335 void
1336 conf_add_d_conf(struct ConfItem *aconf)
1337 {
1338 if(aconf->host == NULL)
1339 return;
1340
1341 aconf->user = NULL;
1342
1343 /* XXX - Should 'd' ever be in the old conf? For new conf we don't
1344 * need this anyway, so I will disable it for now... -A1kmm
1345 */
1346
1347 if(parse_netmask(aconf->host, NULL, NULL) == HM_HOST)
1348 {
1349 ilog(L_MAIN, "Invalid Dline %s ignored", aconf->host);
1350 free_conf(aconf);
1351 }
1352 else
1353 {
1354 add_conf_by_address(aconf->host, CONF_DLINE, NULL, NULL, aconf);
1355 }
1356 }
1357
1358 static char *
1359 strip_tabs(char *dest, const char *src, size_t len)
1360 {
1361 char *d = dest;
1362
1363 if(dest == NULL || src == NULL)
1364 return NULL;
1365
1366 rb_strlcpy(dest, src, len);
1367
1368 while(*d)
1369 {
1370 if(*d == '\t')
1371 *d = ' ';
1372 d++;
1373 }
1374 return dest;
1375 }
1376
1377 /*
1378 * yyerror
1379 *
1380 * inputs - message from parser
1381 * output - none
1382 * side effects - message to opers and log file entry is made
1383 */
1384 void
1385 yyerror(const char *msg)
1386 {
1387 char newlinebuf[BUFSIZE];
1388
1389 strip_tabs(newlinebuf, linebuf, strlen(linebuf));
1390
1391 ierror("\"%s\", line %d: %s at '%s'", conffilebuf, lineno + 1, msg, newlinebuf);
1392 sendto_realops_snomask(SNO_GENERAL, L_ALL, "\"%s\", line %d: %s at '%s'",
1393 conffilebuf, lineno + 1, msg, newlinebuf);
1394
1395 }
1396
1397 int
1398 conf_fgets(char *lbuf, int max_size, FILE * fb)
1399 {
1400 char *buff;
1401
1402 if((buff = fgets(lbuf, max_size, fb)) == NULL)
1403 return (0);
1404
1405 return (strlen(lbuf));
1406 }
1407
1408 int
1409 conf_yy_fatal_error(const char *msg)
1410 {
1411 return (0);
1412 }