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