ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf.c
Revision: 4989
Committed: Mon Dec 8 20:07:36 2014 UTC (10 years, 8 months ago) by michael
Content type: text/x-csrc
File size: 51170 byte(s)
Log Message:
- The general::true_no_oper_flood configuration option has been deprecated.
  Operators still can have higher 'flood' limits with no_oper_flood = yes;
  hoewever, they are no longer allowed to bypass RecvQ limits.

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2916 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 2916 * Copyright (c) 1997-2014 ircd-hybrid development team
5 adx 30 *
6     * This program is free software; you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18 michael 4565 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 adx 30 * USA
20     */
21    
22 michael 2916 /*! \file conf.c
23     * \brief Configuration file functions.
24     * \version $Id$
25     */
26    
27 adx 30 #include "stdinc.h"
28 michael 1011 #include "list.h"
29 adx 30 #include "ircd_defs.h"
30 michael 1309 #include "conf.h"
31 michael 4545 #include "conf_pseudo.h"
32 michael 3347 #include "server.h"
33 adx 30 #include "resv.h"
34     #include "channel.h"
35     #include "client.h"
36     #include "event.h"
37     #include "irc_string.h"
38     #include "s_bsd.h"
39     #include "ircd.h"
40     #include "listener.h"
41     #include "hostmask.h"
42     #include "modules.h"
43     #include "numeric.h"
44     #include "fdlist.h"
45 michael 1309 #include "log.h"
46 adx 30 #include "send.h"
47     #include "memory.h"
48 michael 3322 #include "res.h"
49 adx 30 #include "userhost.h"
50 michael 3347 #include "user.h"
51 adx 30 #include "channel_mode.h"
52 michael 1243 #include "parse.h"
53 michael 3347 #include "misc.h"
54 michael 1622 #include "conf_db.h"
55 michael 1632 #include "conf_class.h"
56 michael 2150 #include "motd.h"
57 michael 4325 #include "ipcache.h"
58 adx 30
59 michael 2872
60 adx 30 /* general conf items link list root, other than k lines etc. */
61 michael 4982 dlink_list service_items;
62     dlink_list server_items;
63     dlink_list cluster_items;
64     dlink_list oconf_items;
65     dlink_list uconf_items;
66     dlink_list xconf_items;
67     dlink_list nresv_items;
68     dlink_list cresv_items;
69 adx 30
70     extern unsigned int lineno;
71     extern char linebuf[];
72     extern char conffilebuf[IRCD_BUFSIZE];
73     extern int yyparse(); /* defined in y.tab.c */
74    
75    
76     /* conf_dns_callback()
77     *
78 michael 1632 * inputs - pointer to struct MaskItem
79 adx 30 * - pointer to DNSReply reply
80     * output - none
81     * side effects - called when resolver query finishes
82     * if the query resulted in a successful search, hp will contain
83     * a non-null pointer, otherwise hp will be null.
84     * if successful save hp in the conf item it was called with
85     */
86     static void
87 michael 4408 conf_dns_callback(void *vptr, const struct irc_ssaddr *addr, const char *name, size_t namelength)
88 adx 30 {
89 michael 4874 struct MaskItem *const conf = vptr;
90 adx 30
91 michael 1632 conf->dns_pending = 0;
92 adx 30
93 michael 3235 if (addr)
94 michael 1632 memcpy(&conf->addr, addr, sizeof(conf->addr));
95 michael 992 else
96 michael 1632 conf->dns_failed = 1;
97 adx 30 }
98    
99     /* conf_dns_lookup()
100     *
101     * do a nameserver lookup of the conf host
102     * if the conf entry is currently doing a ns lookup do nothing, otherwise
103     * allocate a dns_query and start ns lookup.
104     */
105     static void
106 michael 1632 conf_dns_lookup(struct MaskItem *conf)
107 adx 30 {
108 michael 4982 if (conf->dns_pending)
109     return;
110    
111     conf->dns_pending = 1;
112    
113     if (conf->aftype == AF_INET)
114     gethost_byname_type(conf_dns_callback, conf, conf->host, T_A);
115     else
116     gethost_byname_type(conf_dns_callback, conf, conf->host, T_AAAA);
117     }
118    
119     /* map_to_list()
120     *
121     * inputs - ConfType conf
122     * output - pointer to dlink_list to use
123     * side effects - none
124     */
125     static dlink_list *
126     map_to_list(enum maskitem_type type)
127     {
128     switch (type)
129 adx 30 {
130 michael 4982 case CONF_XLINE:
131     return &xconf_items;
132     break;
133     case CONF_ULINE:
134     return &uconf_items;
135     break;
136     case CONF_NRESV:
137     return &nresv_items;
138     break;
139     case CONF_CRESV:
140     return &cresv_items;
141     break;
142     case CONF_OPER:
143     return &oconf_items;
144     break;
145     case CONF_SERVER:
146     return &server_items;
147     break;
148     case CONF_SERVICE:
149     return &service_items;
150     break;
151     case CONF_CLUSTER:
152     return &cluster_items;
153     break;
154     default:
155     return NULL;
156 adx 30 }
157     }
158    
159 michael 1632 struct MaskItem *
160     conf_make(enum maskitem_type type)
161     {
162 michael 4874 struct MaskItem *const conf = MyCalloc(sizeof(*conf));
163 michael 1632 dlink_list *list = NULL;
164    
165     conf->type = type;
166     conf->active = 1;
167     conf->aftype = AF_INET;
168    
169     if ((list = map_to_list(type)))
170     dlinkAdd(conf, &conf->node, list);
171     return conf;
172     }
173    
174     void
175     conf_free(struct MaskItem *conf)
176     {
177 michael 4815 dlink_node *node = NULL, *node_next = NULL;
178 michael 1636 dlink_list *list = NULL;
179    
180 michael 4511 if ((list = map_to_list(conf->type)))
181 michael 4523 dlinkFindDelete(list, conf);
182 michael 4511
183 michael 1632 MyFree(conf->name);
184    
185     if (conf->dns_pending)
186     delete_resolver_queries(conf);
187 michael 3235 if (conf->passwd)
188 michael 1632 memset(conf->passwd, 0, strlen(conf->passwd));
189 michael 3235 if (conf->spasswd)
190 michael 1632 memset(conf->spasswd, 0, strlen(conf->spasswd));
191    
192     conf->class = NULL;
193    
194     MyFree(conf->passwd);
195     MyFree(conf->spasswd);
196     MyFree(conf->reason);
197 michael 2228 MyFree(conf->certfp);
198 michael 1632 MyFree(conf->user);
199     MyFree(conf->host);
200     #ifdef HAVE_LIBCRYPTO
201     MyFree(conf->cipher_list);
202    
203     if (conf->rsa_public_key)
204     RSA_free(conf->rsa_public_key);
205     #endif
206 michael 4815 DLINK_FOREACH_SAFE(node, node_next, conf->hub_list.head)
207 michael 1632 {
208 michael 4815 MyFree(node->data);
209     dlinkDelete(node, &conf->hub_list);
210     free_dlink_node(node);
211 michael 1632 }
212    
213 michael 4815 DLINK_FOREACH_SAFE(node, node_next, conf->leaf_list.head)
214 michael 1632 {
215 michael 4815 MyFree(node->data);
216     dlinkDelete(node, &conf->leaf_list);
217     free_dlink_node(node);
218 michael 1632 }
219 adx 30
220 michael 4815 DLINK_FOREACH_SAFE(node, node_next, conf->exempt_list.head)
221 michael 1858 {
222 michael 4815 struct exempt *exptr = node->data;
223 michael 1858
224 michael 4815 dlinkDelete(node, &conf->exempt_list);
225 michael 1858 MyFree(exptr->name);
226     MyFree(exptr->user);
227     MyFree(exptr->host);
228     MyFree(exptr);
229     }
230    
231 michael 1636 MyFree(conf);
232 adx 30 }
233    
234 michael 4982 /* attach_iline()
235 adx 30 *
236 michael 4982 * inputs - client pointer
237     * - conf pointer
238     * output -
239     * side effects - do actual attach
240 adx 30 */
241 michael 4982 static int
242     attach_iline(struct Client *client_p, struct MaskItem *conf)
243 adx 30 {
244 michael 4982 const struct ClassItem *const class = conf->class;
245     struct ip_entry *ip_found;
246     int a_limit_reached = 0;
247     unsigned int local = 0, global = 0, ident = 0;
248 michael 2916
249 michael 4982 ip_found = ipcache_find_or_add_address(&client_p->connection->ip);
250     ip_found->count++;
251     AddFlag(client_p, FLAGS_IPHASH);
252 adx 30
253 michael 4982 count_user_host(client_p->username, client_p->host,
254     &global, &local, &ident);
255 adx 30
256 michael 4982 /* XXX blah. go down checking the various silly limits
257     * setting a_limit_reached if any limit is reached.
258     * - Dianora
259     */
260     if (class->max_total && class->ref_count >= class->max_total)
261     a_limit_reached = 1;
262     else if (class->max_perip && ip_found->count > class->max_perip)
263     a_limit_reached = 1;
264     else if (class->max_local && local >= class->max_local)
265     a_limit_reached = 1;
266     else if (class->max_global && global >= class->max_global)
267     a_limit_reached = 1;
268     else if (class->max_ident && ident >= class->max_ident &&
269     client_p->username[0] != '~')
270     a_limit_reached = 1;
271 adx 30
272 michael 4982 if (a_limit_reached)
273     {
274     if (!IsConfExemptLimits(conf))
275     return TOO_MANY; /* Already at maximum allowed */
276 adx 30
277 michael 4982 sendto_one_notice(client_p, &me, ":*** Your connection class is full, "
278     "but you have exceed_limit = yes;");
279 adx 30 }
280    
281 michael 4982 return attach_conf(client_p, conf);
282 adx 30 }
283    
284     /* verify_access()
285     *
286 michael 4982 * inputs - pointer to client to verify
287     * output - 0 if success -'ve if not
288     * side effect - find the first (best) I line to attach.
289 adx 30 */
290     static int
291 michael 1644 verify_access(struct Client *client_p)
292 adx 30 {
293 michael 1949 struct MaskItem *conf = NULL;
294 michael 3215 char non_ident[USERLEN + 1] = "~";
295 adx 30
296     if (IsGotId(client_p))
297     {
298 michael 1632 conf = find_address_conf(client_p->host, client_p->username,
299 michael 4588 &client_p->connection->ip,
300     client_p->connection->aftype,
301     client_p->connection->password);
302 adx 30 }
303     else
304     {
305 michael 2182 strlcpy(non_ident + 1, client_p->username, sizeof(non_ident) - 1);
306 michael 4982 conf = find_address_conf(client_p->host, non_ident,
307 michael 4588 &client_p->connection->ip,
308     client_p->connection->aftype,
309     client_p->connection->password);
310 adx 30 }
311    
312 michael 3215 if (conf)
313 adx 30 {
314 michael 1921 if (IsConfClient(conf))
315 adx 30 {
316 michael 1632 if (IsConfRedir(conf))
317 adx 30 {
318 michael 3109 sendto_one_numeric(client_p, &me, RPL_REDIR,
319     conf->name ? conf->name : "",
320     conf->port);
321 michael 2182 return NOT_AUTHORIZED;
322 adx 30 }
323    
324     /* Thanks for spoof idea amm */
325 michael 1632 if (IsConfDoSpoofIp(conf))
326 adx 30 {
327 michael 4967 if (IsConfSpoofNotice(conf))
328 michael 4982 sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, "%s spoofing: %s as %s",
329 adx 30 client_p->name, client_p->host, conf->name);
330 michael 4982
331 adx 30 strlcpy(client_p->host, conf->name, sizeof(client_p->host));
332     }
333    
334 michael 2182 return attach_iline(client_p, conf);
335 adx 30 }
336 michael 4340 else if (IsConfKill(conf) || (ConfigGeneral.glines && IsConfGline(conf)))
337 adx 30 {
338 michael 1632 if (IsConfGline(conf))
339 michael 3110 sendto_one_notice(client_p, &me, ":*** G-lined");
340 michael 4982
341 michael 3110 sendto_one_notice(client_p, &me, ":*** Banned: %s", conf->reason);
342 michael 2182 return BANNED_CLIENT;
343 adx 30 }
344     }
345    
346 michael 2182 return NOT_AUTHORIZED;
347 adx 30 }
348    
349 michael 4982 /* check_client()
350 adx 30 *
351 michael 4982 * inputs - pointer to client
352     * output - 0 = Success
353     * NOT_AUTHORIZED (-1) = Access denied (no I line match)
354     * IRCD_SOCKET_ERROR (-2) = Bad socket.
355     * I_LINE_FULL (-3) = I-line is full
356     * TOO_MANY (-4) = Too many connections from hostname
357     * BANNED_CLIENT (-5) = K-lined
358     * side effects - Ordinary client access check.
359     * Look for conf lines which have the same
360     * status as the flags passed.
361 adx 30 */
362 michael 4982 int
363     check_client(struct Client *source_p)
364 adx 30 {
365 michael 4982 int i;
366 adx 30
367 michael 4982 if ((i = verify_access(source_p)))
368     ilog(LOG_TYPE_IRCD, "Access denied: %s[%s]",
369     source_p->name, source_p->sockhost);
370 adx 30
371 michael 4982 switch (i)
372     {
373     case TOO_MANY:
374     sendto_realops_flags(UMODE_FULL, L_ALL, SEND_NOTICE,
375     "Too many on IP for %s (%s).",
376     get_client_name(source_p, SHOW_IP),
377     source_p->sockhost);
378     ilog(LOG_TYPE_IRCD, "Too many connections on IP from %s.",
379     get_client_name(source_p, SHOW_IP));
380     ++ServerStats.is_ref;
381     exit_client(source_p, "No more connections allowed on that IP");
382     break;
383 adx 30
384 michael 4982 case I_LINE_FULL:
385     sendto_realops_flags(UMODE_FULL, L_ALL, SEND_NOTICE,
386     "auth {} block is full for %s (%s).",
387     get_client_name(source_p, SHOW_IP),
388     source_p->sockhost);
389     ilog(LOG_TYPE_IRCD, "Too many connections from %s.",
390     get_client_name(source_p, SHOW_IP));
391     ++ServerStats.is_ref;
392     exit_client(source_p, "No more connections allowed in your connection class");
393     break;
394 adx 30
395 michael 4982 case NOT_AUTHORIZED:
396     /* jdc - lists server name & port connections are on */
397     /* a purely cosmetical change */
398     sendto_realops_flags(UMODE_UNAUTH, L_ALL, SEND_NOTICE,
399     "Unauthorized client connection from %s [%s] on [%s/%u].",
400     get_client_name(source_p, SHOW_IP),
401     source_p->sockhost,
402     source_p->connection->listener->name,
403     source_p->connection->listener->port);
404     ilog(LOG_TYPE_IRCD, "Unauthorized client connection from %s on [%s/%u].",
405     get_client_name(source_p, SHOW_IP),
406     source_p->connection->listener->name,
407     source_p->connection->listener->port);
408 adx 30
409 michael 4982 ++ServerStats.is_ref;
410     exit_client(source_p, "You are not authorized to use this server");
411     break;
412    
413     case BANNED_CLIENT:
414     ++ServerStats.is_ref;
415     exit_client(source_p, "Banned");
416     break;
417    
418     case 0:
419     default:
420     break;
421 adx 30 }
422    
423 michael 4982 return !(i < 0);
424 adx 30 }
425    
426     /* detach_conf()
427     *
428     * inputs - pointer to client to detach
429     * - type of conf to detach
430     * output - 0 for success, -1 for failure
431     * side effects - Disassociate configuration from the client.
432     * Also removes a class from the list if marked for deleting.
433     */
434 michael 1632 void
435     detach_conf(struct Client *client_p, enum maskitem_type type)
436 adx 30 {
437 michael 4815 dlink_node *node = NULL, *node_next = NULL;
438 adx 30
439 michael 4815 DLINK_FOREACH_SAFE(node, node_next, client_p->connection->confs.head)
440 adx 30 {
441 michael 4815 struct MaskItem *conf = node->data;
442 adx 30
443 michael 1645 assert(conf->type & (CONF_CLIENT | CONF_OPER | CONF_SERVER));
444     assert(conf->ref_count > 0);
445     assert(conf->class->ref_count > 0);
446 adx 30
447 michael 1645 if (!(conf->type & type))
448     continue;
449 michael 671
450 michael 4815 dlinkDelete(node, &client_p->connection->confs);
451     free_dlink_node(node);
452 michael 1644
453 michael 2278 if (conf->type == CONF_CLIENT)
454 michael 4588 remove_from_cidr_check(&client_p->connection->ip, conf->class);
455 adx 30
456 michael 1645 if (--conf->class->ref_count == 0 && conf->class->active == 0)
457     {
458     class_free(conf->class);
459     conf->class = NULL;
460 adx 30 }
461 michael 1645
462     if (--conf->ref_count == 0 && conf->active == 0)
463     conf_free(conf);
464 adx 30 }
465     }
466    
467     /* attach_conf()
468     *
469     * inputs - client pointer
470     * - conf pointer
471     * output -
472     * side effects - Associate a specific configuration entry to a *local*
473     * client (this is the one which used in accepting the
474     * connection). Note, that this automatically changes the
475     * attachment if there was an old one...
476     */
477     int
478 michael 1632 attach_conf(struct Client *client_p, struct MaskItem *conf)
479 adx 30 {
480 michael 4588 if (dlinkFind(&client_p->connection->confs, conf))
481 adx 30 return 1;
482    
483 michael 1632 if (conf->type == CONF_CLIENT)
484     if (cidr_limit_reached(IsConfExemptLimits(conf),
485 michael 4588 &client_p->connection->ip, conf->class))
486 michael 1394 return TOO_MANY; /* Already at maximum allowed */
487 adx 30
488 michael 1632 conf->class->ref_count++;
489 michael 1644 conf->ref_count++;
490 adx 30
491 michael 4588 dlinkAdd(conf, make_dlink_node(), &client_p->connection->confs);
492 adx 30
493     return 0;
494     }
495    
496     /* attach_connect_block()
497     *
498     * inputs - pointer to server to attach
499     * - name of server
500     * - hostname of server
501     * output - true (1) if both are found, otherwise return false (0)
502     * side effects - find connect block and attach them to connecting client
503     */
504     int
505     attach_connect_block(struct Client *client_p, const char *name,
506     const char *host)
507     {
508 michael 4815 dlink_node *node = NULL;
509 adx 30
510     assert(client_p != NULL);
511     assert(host != NULL);
512    
513     if (client_p == NULL || host == NULL)
514     return 0;
515    
516 michael 4815 DLINK_FOREACH(node, server_items.head)
517 adx 30 {
518 michael 4815 struct MaskItem *conf = node->data;
519 adx 30
520 michael 1652 if (match(conf->name, name) || match(conf->host, host))
521 adx 30 continue;
522    
523     attach_conf(client_p, conf);
524     return -1;
525     }
526    
527     return 0;
528     }
529    
530     /* find_conf_name()
531     *
532     * inputs - pointer to conf link list to search
533     * - pointer to name to find
534     * - int mask of type of conf to find
535     * output - NULL or pointer to conf found
536     * side effects - find a conf entry which matches the name
537     * and has the given mask.
538     */
539 michael 1632 struct MaskItem *
540     find_conf_name(dlink_list *list, const char *name, enum maskitem_type type)
541 adx 30 {
542 michael 4815 dlink_node *node = NULL;
543 adx 30
544 michael 4815 DLINK_FOREACH(node, list->head)
545 adx 30 {
546 michael 4815 struct MaskItem *conf = node->data;
547 michael 2916
548 adx 30 if (conf->type == type)
549     {
550 michael 4596 if (conf->name && !irccmp(conf->name, name))
551     return conf;
552 adx 30 }
553     }
554    
555     return NULL;
556     }
557    
558     /* find_matching_name_conf()
559     *
560     * inputs - type of link list to look in
561     * - pointer to name string to find
562     * - pointer to user
563     * - pointer to host
564 michael 1644 * - optional flags to match on as well
565 michael 1632 * output - NULL or pointer to found struct MaskItem
566 adx 30 * side effects - looks for a match on name field
567     */
568 michael 1632 struct MaskItem *
569     find_matching_name_conf(enum maskitem_type type, const char *name, const char *user,
570 michael 1644 const char *host, unsigned int flags)
571 adx 30 {
572 michael 4815 dlink_node *node = NULL;
573     dlink_list *list = map_to_list(type);
574     struct MaskItem *conf = NULL;
575 adx 30
576     switch (type)
577     {
578 michael 1632 case CONF_SERVICE:
579 michael 4815 DLINK_FOREACH(node, list->head)
580 michael 1157 {
581 michael 4815 conf = node->data;
582 michael 1157
583     if (EmptyString(conf->name))
584     continue;
585     if ((name != NULL) && !irccmp(name, conf->name))
586     return conf;
587     }
588     break;
589    
590 michael 1632 case CONF_XLINE:
591     case CONF_ULINE:
592     case CONF_NRESV:
593 michael 1825 case CONF_CRESV:
594 michael 4815 DLINK_FOREACH(node, list->head)
595 adx 30 {
596 michael 4815 conf = node->data;
597 adx 30
598     if (EmptyString(conf->name))
599 michael 2182 continue;
600 michael 1653 if ((name != NULL) && !match(conf->name, name))
601 adx 30 {
602 michael 2182 if ((user == NULL && (host == NULL)))
603     return conf;
604     if ((conf->flags & flags) != flags)
605 adx 30 continue;
606 michael 2182 if (EmptyString(conf->user) || EmptyString(conf->host))
607     return conf;
608     if (!match(conf->user, user) && !match(conf->host, host))
609     return conf;
610 adx 30 }
611     }
612     break;
613    
614 michael 1632 case CONF_SERVER:
615 michael 4815 DLINK_FOREACH(node, list->head)
616 adx 30 {
617 michael 4815 conf = node->data;
618 adx 30
619 michael 1652 if ((name != NULL) && !match(name, conf->name))
620 adx 30 return conf;
621 michael 1652 else if ((host != NULL) && !match(host, conf->host))
622 adx 30 return conf;
623     }
624     break;
625 michael 2916
626 adx 30 default:
627     break;
628     }
629     return NULL;
630     }
631    
632     /* find_exact_name_conf()
633     *
634     * inputs - type of link list to look in
635     * - pointer to name string to find
636     * - pointer to user
637     * - pointer to host
638 michael 1632 * output - NULL or pointer to found struct MaskItem
639 adx 30 * side effects - looks for an exact match on name field
640     */
641 michael 1632 struct MaskItem *
642     find_exact_name_conf(enum maskitem_type type, const struct Client *who, const char *name,
643 adx 30 const char *user, const char *host)
644     {
645 michael 4815 dlink_node *node = NULL;
646     dlink_list *list = map_to_list(type);
647     struct MaskItem *conf = NULL;
648 adx 30
649     switch(type)
650     {
651 michael 1632 case CONF_XLINE:
652     case CONF_ULINE:
653     case CONF_NRESV:
654 michael 1825 case CONF_CRESV:
655 adx 30
656 michael 4815 DLINK_FOREACH(node, list->head)
657 adx 30 {
658 michael 4815 conf = node->data;
659 michael 1632
660 adx 30 if (EmptyString(conf->name))
661 michael 2182 continue;
662 michael 2916
663 adx 30 if (irccmp(conf->name, name) == 0)
664     {
665 michael 2182 if ((user == NULL && (host == NULL)))
666     return conf;
667     if (EmptyString(conf->user) || EmptyString(conf->host))
668     return conf;
669     if (!match(conf->user, user) && !match(conf->host, host))
670     return conf;
671 adx 30 }
672     }
673     break;
674    
675 michael 1632 case CONF_OPER:
676 michael 4815 DLINK_FOREACH(node, list->head)
677 adx 30 {
678 michael 4815 conf = node->data;
679 michael 1285
680 adx 30 if (EmptyString(conf->name))
681 michael 1285 continue;
682    
683     if (!irccmp(conf->name, name))
684 adx 30 {
685 michael 1285 if (!who)
686     return conf;
687 michael 1632 if (EmptyString(conf->user) || EmptyString(conf->host))
688 michael 1636 return NULL;
689 michael 1652 if (!match(conf->user, who->username))
690 michael 1285 {
691 michael 1632 switch (conf->htype)
692 michael 1285 {
693     case HM_HOST:
694 michael 1652 if (!match(conf->host, who->host) || !match(conf->host, who->sockhost))
695 michael 1637 if (!conf->class->max_total || conf->class->ref_count < conf->class->max_total)
696     return conf;
697 michael 1285 break;
698     case HM_IPV4:
699 michael 4588 if (who->connection->aftype == AF_INET)
700     if (match_ipv4(&who->connection->ip, &conf->addr, conf->bits))
701 michael 1637 if (!conf->class->max_total || conf->class->ref_count < conf->class->max_total)
702     return conf;
703 michael 1285 break;
704     case HM_IPV6:
705 michael 4588 if (who->connection->aftype == AF_INET6)
706     if (match_ipv6(&who->connection->ip, &conf->addr, conf->bits))
707 michael 1637 if (!conf->class->max_total || conf->class->ref_count < conf->class->max_total)
708     return conf;
709 michael 1285 break;
710     default:
711     assert(0);
712     }
713     }
714 adx 30 }
715     }
716 michael 1285
717 adx 30 break;
718    
719 michael 1632 case CONF_SERVER:
720 michael 4815 DLINK_FOREACH(node, list->head)
721 adx 30 {
722 michael 4815 conf = node->data;
723 michael 1632
724 adx 30 if (EmptyString(conf->name))
725 michael 2182 continue;
726 michael 2916
727 adx 30 if (name == NULL)
728     {
729 michael 2182 if (EmptyString(conf->host))
730     continue;
731     if (irccmp(conf->host, host) == 0)
732     return conf;
733 adx 30 }
734     else if (irccmp(conf->name, name) == 0)
735 michael 2182 return conf;
736 adx 30 }
737 michael 2182
738 adx 30 break;
739    
740     default:
741     break;
742     }
743 michael 2182
744     return NULL;
745 adx 30 }
746    
747     /* set_default_conf()
748     *
749     * inputs - NONE
750     * output - NONE
751     * side effects - Set default values here.
752     * This is called **PRIOR** to parsing the
753     * configuration file. If you want to do some validation
754     * of values later, put them in validate_conf().
755     */
756     static void
757     set_default_conf(void)
758     {
759     /* verify init_class() ran, this should be an unnecessary check
760     * but its not much work.
761     */
762 michael 1644 assert(class_default == class_get_list()->tail->data);
763 adx 30
764     #ifdef HAVE_LIBCRYPTO
765 michael 4744 #if OPENSSL_VERSION_NUMBER >= 0x009080FFL && !defined(OPENSSL_NO_ECDH)
766 michael 4496 {
767     EC_KEY *key = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
768    
769     if (key)
770     {
771     SSL_CTX_set_tmp_ecdh(ConfigServerInfo.server_ctx, key);
772     EC_KEY_free(key);
773     }
774     }
775    
776     SSL_CTX_set_options(ConfigServerInfo.server_ctx, SSL_OP_SINGLE_ECDH_USE);
777     #endif
778    
779 michael 4892 SSL_CTX_set_cipher_list(ConfigServerInfo.server_ctx, "EECDH+HIGH:EDH+HIGH:HIGH:!aNULL");
780 michael 4340 ConfigServerInfo.message_digest_algorithm = EVP_sha256();
781     ConfigServerInfo.rsa_private_key = NULL;
782     ConfigServerInfo.rsa_private_key_file = NULL;
783 adx 30 #endif
784    
785 michael 4340 /* ConfigServerInfo.name is not rehashable */
786     /* ConfigServerInfo.name = ConfigServerInfo.name; */
787     ConfigServerInfo.description = NULL;
788     ConfigServerInfo.network_name = xstrdup(NETWORK_NAME_DEFAULT);
789     ConfigServerInfo.network_desc = xstrdup(NETWORK_DESC_DEFAULT);
790 adx 30
791 michael 4340 memset(&ConfigServerInfo.ip, 0, sizeof(ConfigServerInfo.ip));
792     ConfigServerInfo.specific_ipv4_vhost = 0;
793     memset(&ConfigServerInfo.ip6, 0, sizeof(ConfigServerInfo.ip6));
794     ConfigServerInfo.specific_ipv6_vhost = 0;
795 adx 30
796 michael 4340 ConfigServerInfo.max_clients = MAXCLIENTS_MAX;
797     ConfigServerInfo.max_nick_length = 9;
798     ConfigServerInfo.max_topic_length = 80;
799     ConfigServerInfo.hub = 0;
800 michael 4313
801 michael 4340 ConfigAdminInfo.name = NULL;
802     ConfigAdminInfo.email = NULL;
803     ConfigAdminInfo.description = NULL;
804 adx 30
805 michael 1831 log_del_all();
806 michael 1247
807 michael 4340 ConfigLog.use_logging = 1;
808 adx 30
809 michael 1243 ConfigChannel.disable_fake_channels = 0;
810 michael 3860 ConfigChannel.invite_client_count = 10;
811     ConfigChannel.invite_client_time = 300;
812     ConfigChannel.knock_client_count = 1;
813     ConfigChannel.knock_client_time = 300;
814 adx 30 ConfigChannel.knock_delay_channel = 60;
815 michael 3933 ConfigChannel.max_channels = 25;
816 adx 30 ConfigChannel.max_bans = 25;
817     ConfigChannel.default_split_user_count = 0;
818     ConfigChannel.default_split_server_count = 0;
819 michael 1243 ConfigChannel.no_join_on_split = 0;
820     ConfigChannel.no_create_on_split = 0;
821 adx 30
822 michael 1243 ConfigServerHide.flatten_links = 0;
823 adx 30 ConfigServerHide.links_delay = 300;
824 michael 1243 ConfigServerHide.hidden = 0;
825     ConfigServerHide.hide_servers = 0;
826 michael 1851 ConfigServerHide.hide_services = 0;
827 michael 1646 ConfigServerHide.hidden_name = xstrdup(NETWORK_NAME_DEFAULT);
828 michael 1243 ConfigServerHide.hide_server_ips = 0;
829 michael 2196 ConfigServerHide.disable_remote_commands = 0;
830 adx 30
831 michael 4340 ConfigGeneral.away_count = 2;
832     ConfigGeneral.away_time = 10;
833     ConfigGeneral.max_watch = WATCHSIZE_DEFAULT;
834     ConfigGeneral.cycle_on_host_change = 1;
835     ConfigGeneral.glines = 0;
836     ConfigGeneral.gline_time = 12 * 3600;
837     ConfigGeneral.gline_request_time = GLINE_REQUEST_EXPIRE_DEFAULT;
838     ConfigGeneral.gline_min_cidr = 16;
839     ConfigGeneral.gline_min_cidr6 = 48;
840     ConfigGeneral.invisible_on_connect = 1;
841     ConfigGeneral.tkline_expire_notices = 1;
842     ConfigGeneral.ignore_bogus_ts = 0;
843     ConfigGeneral.disable_auth = 0;
844     ConfigGeneral.kill_chase_time_limit = 90;
845     ConfigGeneral.default_floodcount = 8;
846     ConfigGeneral.failed_oper_notice = 1;
847     ConfigGeneral.dots_in_ident = 0;
848     ConfigGeneral.min_nonwildcard = 4;
849     ConfigGeneral.min_nonwildcard_simple = 3;
850     ConfigGeneral.max_accept = 20;
851     ConfigGeneral.anti_nick_flood = 0;
852     ConfigGeneral.max_nick_time = 20;
853     ConfigGeneral.max_nick_changes = 5;
854     ConfigGeneral.anti_spam_exit_message_time = 0;
855     ConfigGeneral.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
856     ConfigGeneral.ts_max_delta = TS_MAX_DELTA_DEFAULT;
857     ConfigGeneral.warn_no_connect_block = 1;
858     ConfigGeneral.stats_e_disabled = 0;
859     ConfigGeneral.stats_o_oper_only = 0;
860     ConfigGeneral.stats_k_oper_only = 1; /* 1 = masked */
861     ConfigGeneral.stats_i_oper_only = 1; /* 1 = masked */
862     ConfigGeneral.stats_P_oper_only = 0;
863     ConfigGeneral.stats_u_oper_only = 0;
864     ConfigGeneral.caller_id_wait = 60;
865     ConfigGeneral.opers_bypass_callerid = 0;
866     ConfigGeneral.pace_wait = 10;
867     ConfigGeneral.pace_wait_simple = 1;
868     ConfigGeneral.short_motd = 0;
869     ConfigGeneral.ping_cookie = 0;
870     ConfigGeneral.no_oper_flood = 0;
871     ConfigGeneral.oper_pass_resv = 1;
872     ConfigGeneral.max_targets = MAX_TARGETS_DEFAULT;
873     ConfigGeneral.oper_only_umodes = UMODE_DEBUG;
874     ConfigGeneral.oper_umodes = UMODE_BOTS | UMODE_LOCOPS | UMODE_SERVNOTICE | UMODE_WALLOP;
875     ConfigGeneral.throttle_count = 1;
876     ConfigGeneral.throttle_time = 1;
877 adx 30 }
878    
879     static void
880     validate_conf(void)
881     {
882 michael 4340 if (ConfigGeneral.ts_warn_delta < TS_WARN_DELTA_MIN)
883     ConfigGeneral.ts_warn_delta = TS_WARN_DELTA_DEFAULT;
884 adx 30
885 michael 4340 if (ConfigGeneral.ts_max_delta < TS_MAX_DELTA_MIN)
886     ConfigGeneral.ts_max_delta = TS_MAX_DELTA_DEFAULT;
887 adx 30
888 michael 4340 if (ConfigServerInfo.network_name == NULL)
889     ConfigServerInfo.network_name = xstrdup(NETWORK_NAME_DEFAULT);
890 adx 30
891 michael 4340 if (ConfigServerInfo.network_desc == NULL)
892     ConfigServerInfo.network_desc = xstrdup(NETWORK_DESC_DEFAULT);
893 adx 30
894 michael 4340 ConfigGeneral.max_watch = IRCD_MAX(ConfigGeneral.max_watch, WATCHSIZE_MIN);
895 adx 30 }
896    
897 michael 2916 /* read_conf()
898 michael 1363 *
899     * inputs - file descriptor pointing to config file to use
900     * output - None
901     * side effects - Read configuration file.
902     */
903     static void
904     read_conf(FILE *file)
905     {
906     lineno = 0;
907    
908 michael 3375 set_default_conf(); /* Set default values prior to conf parsing */
909 michael 1363 conf_parser_ctx.pass = 1;
910 michael 3375 yyparse(); /* Pick up the classes first */
911 michael 1363
912     rewind(file);
913    
914     conf_parser_ctx.pass = 2;
915 michael 3375 yyparse(); /* Load the values from the conf */
916     validate_conf(); /* Check to make sure some values are still okay. */
917     /* Some global values are also loaded here. */
918     class_delete_marked(); /* Delete unused classes that are marked for deletion */
919 michael 1363 }
920    
921 michael 4982 /* conf_rehash()
922     *
923     * Actual REHASH service routine. Called with sig == 0 if it has been called
924     * as a result of an operator issuing this command, else assume it has been
925     * called as a result of the server receiving a HUP signal.
926     */
927     int
928     conf_rehash(int sig)
929     {
930     if (sig)
931     sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
932     "Got signal SIGHUP, reloading configuration file(s)");
933    
934     restart_resolver();
935    
936     /* don't close listeners until we know we can go ahead with the rehash */
937    
938     read_conf_files(0);
939    
940     load_conf_modules();
941     check_conf_klines();
942    
943     return 0;
944     }
945    
946 adx 30 /* lookup_confhost()
947     *
948     * start DNS lookups of all hostnames in the conf
949     * line and convert an IP addresses in a.b.c.d number for to IP#s.
950     */
951 michael 1647 void
952 michael 1632 lookup_confhost(struct MaskItem *conf)
953 adx 30 {
954     struct addrinfo hints, *res;
955    
956 michael 3375 /*
957     * Do name lookup now on hostnames given and store the
958 adx 30 * ip numbers in conf structure.
959     */
960     memset(&hints, 0, sizeof(hints));
961    
962     hints.ai_family = AF_UNSPEC;
963     hints.ai_socktype = SOCK_STREAM;
964    
965     /* Get us ready for a bind() and don't bother doing dns lookup */
966     hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
967    
968 michael 1632 if (getaddrinfo(conf->host, NULL, &hints, &res))
969 adx 30 {
970 michael 1632 conf_dns_lookup(conf);
971 adx 30 return;
972     }
973    
974 michael 3235 assert(res);
975 adx 30
976 michael 1632 memcpy(&conf->addr, res->ai_addr, res->ai_addrlen);
977     conf->addr.ss_len = res->ai_addrlen;
978     conf->addr.ss.ss_family = res->ai_family;
979    
980 michael 1123 freeaddrinfo(res);
981 adx 30 }
982    
983     /* conf_connect_allowed()
984     *
985     * inputs - pointer to inaddr
986     * - int type ipv4 or ipv6
987     * output - BANNED or accepted
988     * side effects - none
989     */
990     int
991     conf_connect_allowed(struct irc_ssaddr *addr, int aftype)
992     {
993 michael 3877 struct ip_entry *ip_found = NULL;
994 michael 4874 struct MaskItem *const conf = find_dline_conf(addr, aftype);
995 adx 30
996     /* DLINE exempt also gets you out of static limits/pacing... */
997 michael 1636 if (conf && (conf->type == CONF_EXEMPT))
998 adx 30 return 0;
999    
1000 michael 3235 if (conf)
1001 adx 30 return BANNED_CLIENT;
1002    
1003 michael 4325 ip_found = ipcache_find_or_add_address(addr);
1004 adx 30
1005 michael 4340 if ((CurrentTime - ip_found->last_attempt) < ConfigGeneral.throttle_time)
1006 adx 30 {
1007 michael 4340 if (ip_found->connection_count >= ConfigGeneral.throttle_count)
1008 michael 3877 return TOO_FAST;
1009 michael 4055
1010     ++ip_found->connection_count;
1011 adx 30 }
1012 michael 3877 else
1013     ip_found->connection_count = 1;
1014 adx 30
1015     ip_found->last_attempt = CurrentTime;
1016     return 0;
1017     }
1018    
1019     /* expire_tklines()
1020     *
1021     * inputs - tkline list pointer
1022     * output - NONE
1023     * side effects - expire tklines
1024     */
1025     static void
1026 michael 4815 expire_tklines(dlink_list *list)
1027 adx 30 {
1028 michael 4815 dlink_node *node = NULL, *node_next = NULL;
1029 adx 30
1030 michael 4815 DLINK_FOREACH_SAFE(node, node_next, list->head)
1031 adx 30 {
1032 michael 4815 struct MaskItem *conf = node->data;
1033 adx 30
1034 michael 1649 if (!conf->until || conf->until > CurrentTime)
1035 michael 1644 continue;
1036    
1037 michael 1632 if (conf->type == CONF_XLINE)
1038 adx 30 {
1039 michael 4340 if (ConfigGeneral.tkline_expire_notices)
1040 michael 1644 sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1041 michael 1618 "Temporary X-line for [%s] expired", conf->name);
1042 michael 1644 conf_free(conf);
1043 adx 30 }
1044 michael 1825 else if (conf->type == CONF_NRESV || conf->type == CONF_CRESV)
1045 adx 30 {
1046 michael 4340 if (ConfigGeneral.tkline_expire_notices)
1047 michael 1644 sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1048 adx 30 "Temporary RESV for [%s] expired", conf->name);
1049 michael 1644 conf_free(conf);
1050 adx 30 }
1051     }
1052     }
1053    
1054 michael 4982 /* cleanup_tklines()
1055     *
1056     * inputs - NONE
1057     * output - NONE
1058     * side effects - call function to expire temporary k/d lines
1059     * This is an event started off in ircd.c
1060     */
1061     void
1062     cleanup_tklines(void *unused)
1063     {
1064     hostmask_expire_temporary();
1065     expire_tklines(&xconf_items);
1066     expire_tklines(&nresv_items);
1067     expire_tklines(&cresv_items);
1068     }
1069    
1070 adx 30 /* oper_privs_as_string()
1071     *
1072 michael 58 * inputs - pointer to client_p
1073 adx 30 * output - pointer to static string showing oper privs
1074     * side effects - return as string, the oper privs as derived from port
1075     */
1076 michael 58 static const struct oper_privs
1077     {
1078 michael 1644 const unsigned int flag;
1079 michael 58 const unsigned char c;
1080     } flag_list[] = {
1081 michael 2012 { OPER_FLAG_ADMIN, 'A' },
1082     { OPER_FLAG_REMOTEBAN, 'B' },
1083     { OPER_FLAG_DIE, 'D' },
1084     { OPER_FLAG_GLINE, 'G' },
1085     { OPER_FLAG_REHASH, 'H' },
1086 michael 4019 { OPER_FLAG_KLINE, 'K' },
1087 michael 2012 { OPER_FLAG_KILL, 'N' },
1088     { OPER_FLAG_KILL_REMOTE, 'O' },
1089     { OPER_FLAG_CONNECT, 'P' },
1090     { OPER_FLAG_CONNECT_REMOTE, 'Q' },
1091     { OPER_FLAG_SQUIT, 'R' },
1092     { OPER_FLAG_SQUIT_REMOTE, 'S' },
1093     { OPER_FLAG_UNKLINE, 'U' },
1094 michael 2852 { OPER_FLAG_XLINE, 'X' },
1095 michael 1294 { 0, '\0' }
1096 michael 58 };
1097 adx 30
1098     char *
1099     oper_privs_as_string(const unsigned int port)
1100     {
1101 michael 2694 static char privs_out[IRCD_BUFSIZE];
1102 michael 58 char *privs_ptr = privs_out;
1103 adx 30
1104 michael 3283 for (const struct oper_privs *opriv = flag_list; opriv->flag; ++opriv)
1105 michael 58 {
1106 michael 1644 if (port & opriv->flag)
1107     *privs_ptr++ = opriv->c;
1108 michael 58 else
1109 michael 1644 *privs_ptr++ = ToLower(opriv->c);
1110 michael 58 }
1111    
1112     *privs_ptr = '\0';
1113    
1114 adx 30 return privs_out;
1115     }
1116    
1117     /*
1118 michael 4298 * Input: A client to find the active operator {} name for.
1119 adx 30 * Output: The nick!user@host{oper} of the oper.
1120     * "oper" is server name for remote opers
1121     * Side effects: None.
1122     */
1123 michael 1364 const char *
1124 adx 30 get_oper_name(const struct Client *client_p)
1125     {
1126     /* +5 for !,@,{,} and null */
1127 michael 1147 static char buffer[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5];
1128 adx 30
1129 michael 4628 if (IsServer(client_p))
1130     return client_p->name;
1131    
1132 adx 30 if (MyConnect(client_p))
1133     {
1134 michael 4977 const dlink_node *const node = client_p->connection->confs.head;
1135    
1136     if (node)
1137 adx 30 {
1138 michael 4937 const struct MaskItem *const conf = node->data;
1139 adx 30
1140 michael 4937 if (conf->type == CONF_OPER)
1141 adx 30 {
1142 michael 2182 snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name,
1143 michael 1147 client_p->username, client_p->host, conf->name);
1144 michael 2182 return buffer;
1145 adx 30 }
1146     }
1147    
1148 michael 4298 /*
1149     * Probably should assert here for now. If there is an oper out there
1150     * with no operator {} conf attached, it would be good for us to know...
1151 adx 30 */
1152 michael 4298 assert(0); /* Oper without oper conf! */
1153 adx 30 }
1154    
1155 michael 1147 snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name,
1156 michael 2182 client_p->username, client_p->host, client_p->servptr->name);
1157 adx 30 return buffer;
1158     }
1159    
1160     /* clear_out_old_conf()
1161     *
1162     * inputs - none
1163     * output - none
1164     * side effects - Clear out the old configuration
1165     */
1166     static void
1167     clear_out_old_conf(void)
1168     {
1169 michael 4815 dlink_node *node = NULL, *node_next = NULL;
1170 adx 30 dlink_list *free_items [] = {
1171 michael 1383 &server_items, &oconf_items,
1172 michael 1921 &uconf_items, &xconf_items,
1173 michael 2174 &nresv_items, &cluster_items, &service_items, &cresv_items, NULL
1174 adx 30 };
1175    
1176     dlink_list ** iterator = free_items; /* C is dumb */
1177    
1178     /* We only need to free anything allocated by yyparse() here.
1179     * Resetting structs, etc, is taken care of by set_default_conf().
1180     */
1181 michael 2916
1182 adx 30 for (; *iterator != NULL; iterator++)
1183     {
1184 michael 4815 DLINK_FOREACH_SAFE(node, node_next, (*iterator)->head)
1185 adx 30 {
1186 michael 4815 struct MaskItem *conf = node->data;
1187 michael 1632
1188 michael 4523 conf->active = 0;
1189     dlinkDelete(&conf->node, *iterator);
1190 michael 1632
1191 adx 30 /* XXX This is less than pretty */
1192 michael 1632 if (conf->type == CONF_SERVER || conf->type == CONF_OPER)
1193 adx 30 {
1194 michael 1644 if (!conf->ref_count)
1195 michael 2182 conf_free(conf);
1196 adx 30 }
1197 michael 1921 else if (conf->type == CONF_XLINE)
1198 adx 30 {
1199 michael 1649 if (!conf->until)
1200 michael 1632 conf_free(conf);
1201 adx 30 }
1202     else
1203 michael 1632 conf_free(conf);
1204 adx 30 }
1205     }
1206    
1207 michael 2150 motd_clear();
1208    
1209 michael 671 /*
1210     * don't delete the class table, rather mark all entries
1211 michael 1632 * for deletion. The table is cleaned up by class_delete_marked. - avalon
1212 adx 30 */
1213 michael 1632 class_mark_for_deletion();
1214 michael 671
1215 adx 30 clear_out_address_conf();
1216    
1217     /* clean out module paths */
1218     mod_clear_paths();
1219    
1220 michael 4545 pseudo_clear();
1221    
1222 michael 4340 /* clean out ConfigServerInfo */
1223     MyFree(ConfigServerInfo.description);
1224     ConfigServerInfo.description = NULL;
1225     MyFree(ConfigServerInfo.network_name);
1226     ConfigServerInfo.network_name = NULL;
1227     MyFree(ConfigServerInfo.network_desc);
1228     ConfigServerInfo.network_desc = NULL;
1229 adx 30 #ifdef HAVE_LIBCRYPTO
1230 michael 4340 if (ConfigServerInfo.rsa_private_key)
1231 adx 30 {
1232 michael 4340 RSA_free(ConfigServerInfo.rsa_private_key);
1233     ConfigServerInfo.rsa_private_key = NULL;
1234 adx 30 }
1235    
1236 michael 4340 MyFree(ConfigServerInfo.rsa_private_key_file);
1237     ConfigServerInfo.rsa_private_key_file = NULL;
1238 adx 30 #endif
1239    
1240 michael 4340 /* clean out ConfigAdminInfo */
1241     MyFree(ConfigAdminInfo.name);
1242     ConfigAdminInfo.name = NULL;
1243     MyFree(ConfigAdminInfo.email);
1244     ConfigAdminInfo.email = NULL;
1245     MyFree(ConfigAdminInfo.description);
1246     ConfigAdminInfo.description = NULL;
1247 adx 30
1248     /* clean out listeners */
1249     close_listeners();
1250     }
1251    
1252 michael 4982 /* read_conf_files()
1253     *
1254     * inputs - cold start YES or NO
1255     * output - none
1256     * side effects - read all conf files needed, ircd.conf kline.conf etc.
1257     */
1258     void
1259     read_conf_files(int cold)
1260     {
1261     const char *filename = NULL;
1262     char chanmodes[IRCD_BUFSIZE] = "";
1263     char chanlimit[IRCD_BUFSIZE] = "";
1264    
1265     conf_parser_ctx.boot = cold;
1266     filename = ConfigGeneral.configfile;
1267    
1268     /* We need to know the initial filename for the yyerror() to report
1269     FIXME: The full path is in conffilenamebuf first time since we
1270     don't know anything else
1271    
1272     - Gozem 2002-07-21
1273     */
1274     strlcpy(conffilebuf, filename, sizeof(conffilebuf));
1275    
1276     if ((conf_parser_ctx.conf_file = fopen(filename, "r")) == NULL)
1277     {
1278     if (cold)
1279     {
1280     ilog(LOG_TYPE_IRCD, "Unable to read configuration file '%s': %s",
1281     filename, strerror(errno));
1282     exit(-1);
1283     }
1284     else
1285     {
1286     sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1287     "Unable to read configuration file '%s': %s",
1288     filename, strerror(errno));
1289     return;
1290     }
1291     }
1292    
1293     if (!cold)
1294     clear_out_old_conf();
1295    
1296     read_conf(conf_parser_ctx.conf_file);
1297     fclose(conf_parser_ctx.conf_file);
1298    
1299     log_reopen_all();
1300    
1301     add_isupport("NICKLEN", NULL, ConfigServerInfo.max_nick_length);
1302     add_isupport("NETWORK", ConfigServerInfo.network_name, -1);
1303    
1304     snprintf(chanmodes, sizeof(chanmodes), "beI:%d", ConfigChannel.max_bans);
1305     add_isupport("MAXLIST", chanmodes, -1);
1306     add_isupport("MAXTARGETS", NULL, ConfigGeneral.max_targets);
1307     add_isupport("CHANTYPES", "#", -1);
1308    
1309     snprintf(chanlimit, sizeof(chanlimit), "#:%d",
1310     ConfigChannel.max_channels);
1311     add_isupport("CHANLIMIT", chanlimit, -1);
1312     snprintf(chanmodes, sizeof(chanmodes), "%s", "beI,k,l,cimnprstMORS");
1313     add_isupport("CHANNELLEN", NULL, CHANNELLEN);
1314     add_isupport("TOPICLEN", NULL, ConfigServerInfo.max_topic_length);
1315     add_isupport("CHANMODES", chanmodes, -1);
1316    
1317     /*
1318     * message_locale may have changed. rebuild isupport since it relies
1319     * on strlen(form_str(RPL_ISUPPORT))
1320     */
1321     rebuild_isupport_message_line();
1322     }
1323    
1324 adx 30 /* conf_add_class_to_conf()
1325     *
1326     * inputs - pointer to config item
1327     * output - NONE
1328 michael 2916 * side effects - Add a class pointer to a conf
1329 adx 30 */
1330     void
1331 michael 1632 conf_add_class_to_conf(struct MaskItem *conf, const char *class_name)
1332 adx 30 {
1333 michael 2916 if (class_name == NULL)
1334 adx 30 {
1335 michael 1632 conf->class = class_default;
1336 michael 671
1337 michael 4941 if (conf->type == CONF_CLIENT || conf->type == CONF_OPER)
1338 michael 1618 sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1339 michael 2182 "Warning *** Defaulting to default class for %s@%s",
1340     conf->user, conf->host);
1341 adx 30 else
1342 michael 1618 sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1343 michael 2182 "Warning *** Defaulting to default class for %s",
1344     conf->name);
1345 adx 30 }
1346     else
1347 michael 1632 conf->class = class_find(class_name, 1);
1348 adx 30
1349 michael 1632 if (conf->class == NULL)
1350 adx 30 {
1351 michael 4941 if (conf->type == CONF_CLIENT || conf->type == CONF_OPER)
1352 michael 1618 sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1353 michael 2182 "Warning *** Defaulting to default class for %s@%s",
1354     conf->user, conf->host);
1355 adx 30 else
1356 michael 1618 sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1357 michael 2182 "Warning *** Defaulting to default class for %s",
1358     conf->name);
1359 michael 1632 conf->class = class_default;
1360 adx 30 }
1361     }
1362    
1363     /* yyerror()
1364     *
1365     * inputs - message from parser
1366     * output - NONE
1367     * side effects - message to opers and log file entry is made
1368     */
1369     void
1370     yyerror(const char *msg)
1371     {
1372     char newlinebuf[IRCD_BUFSIZE];
1373    
1374 michael 967 if (conf_parser_ctx.pass != 1)
1375 adx 30 return;
1376    
1377     strip_tabs(newlinebuf, linebuf, sizeof(newlinebuf));
1378 michael 1751 sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1379 michael 1618 "\"%s\", line %u: %s: %s",
1380 adx 30 conffilebuf, lineno + 1, msg, newlinebuf);
1381 michael 1247 ilog(LOG_TYPE_IRCD, "\"%s\", line %u: %s: %s",
1382 adx 30 conffilebuf, lineno + 1, msg, newlinebuf);
1383     }
1384    
1385 michael 1751 void
1386     conf_error_report(const char *msg)
1387     {
1388     char newlinebuf[IRCD_BUFSIZE];
1389    
1390     strip_tabs(newlinebuf, linebuf, sizeof(newlinebuf));
1391     sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
1392     "\"%s\", line %u: %s: %s",
1393     conffilebuf, lineno + 1, msg, newlinebuf);
1394     ilog(LOG_TYPE_IRCD, "\"%s\", line %u: %s: %s",
1395     conffilebuf, lineno + 1, msg, newlinebuf);
1396     }
1397    
1398 adx 30 /*
1399     * valid_tkline()
1400 michael 2916 *
1401 adx 30 * inputs - pointer to ascii string to check
1402     * - whether the specified time is in seconds or minutes
1403     * output - -1 not enough parameters
1404     * - 0 if not an integer number, else the number
1405     * side effects - none
1406     * Originally written by Dianora (Diane, db@db.net)
1407     */
1408     time_t
1409 michael 2313 valid_tkline(const char *data, const int minutes)
1410 adx 30 {
1411 michael 2313 const unsigned char *p = (const unsigned char *)data;
1412     unsigned char tmpch = '\0';
1413 adx 30 time_t result = 0;
1414    
1415 michael 2313 while ((tmpch = *p++))
1416 adx 30 {
1417 michael 2313 if (!IsDigit(tmpch))
1418 michael 1121 return 0;
1419 michael 1120
1420     result *= 10;
1421 michael 2313 result += (tmpch & 0xF);
1422 adx 30 }
1423    
1424 michael 1120 /*
1425 michael 2916 * In the degenerate case where oper does a /quote kline 0 user@host :reason
1426 adx 30 * i.e. they specifically use 0, I am going to return 1 instead
1427     * as a return value of non-zero is used to flag it as a temporary kline
1428     */
1429     if (result == 0)
1430     result = 1;
1431    
1432 michael 2916 /*
1433 adx 30 * If the incoming time is in seconds convert it to minutes for the purpose
1434     * of this calculation
1435     */
1436     if (!minutes)
1437 michael 2916 result = result / 60;
1438 adx 30
1439     if (result > MAX_TDKLINE_TIME)
1440     result = MAX_TDKLINE_TIME;
1441    
1442 michael 2313 result = result * 60; /* turn it into seconds */
1443 adx 30
1444     return result;
1445     }
1446    
1447 michael 2130 /* valid_wild_card_simple()
1448     *
1449     * inputs - data to check for sufficient non-wildcard characters
1450     * outputs - 1 if valid, else 0
1451     * side effects - none
1452     */
1453     int
1454     valid_wild_card_simple(const char *data)
1455     {
1456     const unsigned char *p = (const unsigned char *)data;
1457     unsigned char tmpch = '\0';
1458 michael 3870 unsigned int nonwild = 0;
1459 michael 2130
1460     while ((tmpch = *p++))
1461     {
1462 michael 4265 if (tmpch == '\\' && *p)
1463 michael 2130 {
1464     ++p;
1465 michael 4340 if (++nonwild >= ConfigGeneral.min_nonwildcard_simple)
1466 michael 2130 return 1;
1467     }
1468     else if (!IsMWildChar(tmpch))
1469     {
1470 michael 4340 if (++nonwild >= ConfigGeneral.min_nonwildcard_simple)
1471 michael 2130 return 1;
1472     }
1473     }
1474    
1475     return 0;
1476     }
1477    
1478 adx 30 /* valid_wild_card()
1479     *
1480     * input - pointer to client
1481     * - int flag, 0 for no warning oper 1 for warning oper
1482     * - count of following varargs to check
1483     * output - 0 if not valid, 1 if valid
1484     * side effects - NOTICE is given to source_p if warn is 1
1485     */
1486     int
1487     valid_wild_card(struct Client *source_p, int warn, int count, ...)
1488     {
1489 michael 3931 unsigned char tmpch = '\0';
1490 michael 3870 unsigned int nonwild = 0;
1491 adx 30 va_list args;
1492    
1493     /*
1494     * Now we must check the user and host to make sure there
1495     * are at least NONWILDCHARS non-wildcard characters in
1496     * them, otherwise assume they are attempting to kline
1497     * *@* or some variant of that. This code will also catch
1498     * people attempting to kline *@*.tld, as long as NONWILDCHARS
1499     * is greater than 3. In that case, there are only 3 non-wild
1500     * characters (tld), so if NONWILDCHARS is 4, the kline will
1501     * be disallowed.
1502     * -wnder
1503     */
1504    
1505     va_start(args, count);
1506    
1507     while (count--)
1508     {
1509 michael 3931 const unsigned char *p = va_arg(args, const unsigned char *);
1510 adx 30 if (p == NULL)
1511     continue;
1512    
1513     while ((tmpch = *p++))
1514     {
1515     if (!IsKWildChar(tmpch))
1516     {
1517     /*
1518     * If we find enough non-wild characters, we can
1519     * break - no point in searching further.
1520     */
1521 michael 4340 if (++nonwild >= ConfigGeneral.min_nonwildcard)
1522 michael 2659 {
1523     va_end(args);
1524 adx 30 return 1;
1525 michael 2659 }
1526 adx 30 }
1527     }
1528     }
1529    
1530     if (warn)
1531 michael 3110 sendto_one_notice(source_p, &me,
1532 michael 4058 ":Please include at least %u non-wildcard characters with the mask",
1533 michael 4340 ConfigGeneral.min_nonwildcard);
1534 michael 2659 va_end(args);
1535 adx 30 return 0;
1536     }
1537    
1538 michael 4982 /* find_user_host()
1539     *
1540     * inputs - pointer to client placing kline
1541     * - pointer to user_host_or_nick
1542     * - pointer to user buffer
1543     * - pointer to host buffer
1544     * output - 0 if not ok to kline, 1 to kline i.e. if valid user host
1545     * side effects -
1546     */
1547     static int
1548     find_user_host(struct Client *source_p, char *user_host_or_nick,
1549     char *luser, char *lhost, unsigned int flags)
1550     {
1551     struct Client *target_p = NULL;
1552     char *hostp = NULL;
1553    
1554     if (lhost == NULL)
1555     {
1556     strlcpy(luser, user_host_or_nick, USERLEN*4 + 1);
1557     return 1;
1558     }
1559    
1560     if ((hostp = strchr(user_host_or_nick, '@')) || *user_host_or_nick == '*')
1561     {
1562     /* Explicit user@host mask given */
1563     if (hostp) /* I'm a little user@host */
1564     {
1565     *(hostp++) = '\0'; /* short and squat */
1566    
1567     if (*user_host_or_nick)
1568     strlcpy(luser, user_host_or_nick, USERLEN*4 + 1); /* here is my user */
1569     else
1570     strcpy(luser, "*");
1571    
1572     if (*hostp)
1573     strlcpy(lhost, hostp, HOSTLEN + 1); /* here is my host */
1574     else
1575     strcpy(lhost, "*");
1576     }
1577     else
1578     {
1579     luser[0] = '*'; /* no @ found, assume its *@somehost */
1580     luser[1] = '\0';
1581     strlcpy(lhost, user_host_or_nick, HOSTLEN*4 + 1);
1582     }
1583    
1584     return 1;
1585     }
1586     else
1587     {
1588     /* Try to find user@host mask from nick */
1589     /* Okay to use source_p as the first param, because source_p == client_p */
1590     if ((target_p =
1591     find_chasing(source_p, user_host_or_nick)) == NULL)
1592     return 0; /* find_chasing sends ERR_NOSUCHNICK */
1593    
1594     if (IsExemptKline(target_p))
1595     {
1596     if (IsClient(source_p))
1597     sendto_one_notice(source_p, &me, ":%s is E-lined", target_p->name);
1598     return 0;
1599     }
1600    
1601     /*
1602     * turn the "user" bit into "*user", blow away '~'
1603     * if found in original user name (non-idented)
1604     */
1605     strlcpy(luser, target_p->username, USERLEN*4 + 1);
1606    
1607     if (target_p->username[0] == '~')
1608     luser[0] = '*';
1609    
1610     if (!strcmp(target_p->sockhost, "0"))
1611     strlcpy(lhost, target_p->host, HOSTLEN*4 + 1);
1612     else
1613     strlcpy(lhost, target_p->sockhost, HOSTLEN*4 + 1);
1614     return 1;
1615     }
1616    
1617     return 0;
1618     }
1619    
1620 adx 30 /* XXX should this go into a separate file ? -Dianora */
1621     /* parse_aline
1622     *
1623     * input - pointer to cmd name being used
1624     * - pointer to client using cmd
1625     * - parc parameter count
1626     * - parv[] list of parameters to parse
1627     * - parse_flags bit map of things to test
1628     * - pointer to user or string to parse into
1629     * - pointer to host or NULL to parse into if non NULL
1630 michael 2916 * - pointer to optional tkline time or NULL
1631 adx 30 * - pointer to target_server to parse into if non NULL
1632     * - pointer to reason to parse into
1633     *
1634     * output - 1 if valid, -1 if not valid
1635     * side effects - A generalised k/d/x etc. line parser,
1636     * "ALINE [time] user@host|string [ON] target :reason"
1637     * will parse returning a parsed user, host if
1638     * h_p pointer is non NULL, string otherwise.
1639     * if tkline_time pointer is non NULL a tk line will be set
1640     * to non zero if found.
1641     * if tkline_time pointer is NULL and tk line is found,
1642     * error is reported.
1643     * if target_server is NULL and an "ON" is found error
1644     * is reported.
1645     * if reason pointer is NULL ignore pointer,
1646 db 936 * this allows use of parse_a_line in unkline etc.
1647 adx 30 *
1648     * - Dianora
1649     */
1650     int
1651     parse_aline(const char *cmd, struct Client *source_p,
1652 michael 2182 int parc, char **parv,
1653     int parse_flags, char **up_p, char **h_p, time_t *tkline_time,
1654     char **target_server, char **reason)
1655 adx 30 {
1656     int found_tkline_time=0;
1657 michael 3499 static char def_reason[] = CONF_NOREASON;
1658 adx 30 static char user[USERLEN*4+1];
1659     static char host[HOSTLEN*4+1];
1660    
1661     parv++;
1662     parc--;
1663    
1664     found_tkline_time = valid_tkline(*parv, TK_MINUTES);
1665    
1666 michael 4982 if (found_tkline_time)
1667 adx 30 {
1668     parv++;
1669     parc--;
1670    
1671 michael 4982 if (tkline_time)
1672 adx 30 *tkline_time = found_tkline_time;
1673     else
1674     {
1675 michael 3110 sendto_one_notice(source_p, &me, ":temp_line not supported by %s", cmd);
1676 adx 30 return -1;
1677     }
1678     }
1679    
1680     if (parc == 0)
1681     {
1682 michael 3109 sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, cmd);
1683 adx 30 return -1;
1684     }
1685    
1686     if (h_p == NULL)
1687     *up_p = *parv;
1688     else
1689     {
1690     if (find_user_host(source_p, *parv, user, host, parse_flags) == 0)
1691     return -1;
1692    
1693     *up_p = user;
1694     *h_p = host;
1695     }
1696 michael 2916
1697 adx 30 parc--;
1698     parv++;
1699    
1700 michael 4982 if (parc)
1701 adx 30 {
1702     if (irccmp(*parv, "ON") == 0)
1703     {
1704     parc--;
1705     parv++;
1706    
1707     if (target_server == NULL)
1708     {
1709 michael 3110 sendto_one_notice(source_p, &me, ":ON server not supported by %s", cmd);
1710 michael 2182 return -1;
1711 adx 30 }
1712    
1713 michael 1219 if (!HasOFlag(source_p, OPER_FLAG_REMOTEBAN))
1714 adx 30 {
1715 michael 3109 sendto_one_numeric(source_p, &me, ERR_NOPRIVS, "remoteban");
1716 adx 30 return -1;
1717     }
1718    
1719     if (parc == 0 || EmptyString(*parv))
1720     {
1721 michael 3109 sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, cmd);
1722 michael 2182 return -1;
1723 adx 30 }
1724    
1725     *target_server = *parv;
1726     parc--;
1727     parv++;
1728     }
1729     else
1730     {
1731     /* Make sure target_server *is* NULL if no ON server found
1732     * caller probably NULL'd it first, but no harm to do it again -db
1733     */
1734 michael 4982 if (target_server)
1735 michael 2182 *target_server = NULL;
1736 adx 30 }
1737     }
1738    
1739 michael 4982 if (h_p)
1740 adx 30 {
1741 michael 4982 if (strchr(user, '!'))
1742 adx 30 {
1743 michael 3110 sendto_one_notice(source_p, &me, ":Invalid character '!' in kline");
1744 adx 30 return -1;
1745     }
1746    
1747 michael 1243 if ((parse_flags & AWILD) && !valid_wild_card(source_p, 1, 2, *up_p, *h_p))
1748 adx 30 return -1;
1749     }
1750     else
1751 michael 1243 if ((parse_flags & AWILD) && !valid_wild_card(source_p, 1, 1, *up_p))
1752 adx 30 return -1;
1753    
1754 michael 4982 if (reason)
1755 adx 30 {
1756 michael 4982 if (parc && !EmptyString(*parv))
1757 adx 30 {
1758     *reason = *parv;
1759 michael 4982
1760 michael 1243 if (!valid_comment(source_p, *reason, 1))
1761 michael 2182 return -1;
1762 adx 30 }
1763     else
1764     *reason = def_reason;
1765     }
1766    
1767     return 1;
1768     }
1769    
1770     /* valid_comment()
1771     *
1772     * inputs - pointer to client
1773     * - pointer to comment
1774     * output - 0 if no valid comment,
1775     * - 1 if valid
1776     * side effects - truncates reason where necessary
1777     */
1778     int
1779     valid_comment(struct Client *source_p, char *comment, int warn)
1780     {
1781     if (strlen(comment) > REASONLEN)
1782     comment[REASONLEN-1] = '\0';
1783    
1784     return 1;
1785     }
1786    
1787     /* match_conf_password()
1788     *
1789     * inputs - pointer to given password
1790     * - pointer to Conf
1791     * output - 1 or 0 if match
1792     * side effects - none
1793     */
1794     int
1795 michael 1632 match_conf_password(const char *password, const struct MaskItem *conf)
1796 adx 30 {
1797     const char *encr = NULL;
1798    
1799 michael 1632 if (EmptyString(password) || EmptyString(conf->passwd))
1800 adx 30 return 0;
1801    
1802 michael 1632 if (conf->flags & CONF_FLAGS_ENCRYPTED)
1803     encr = crypt(password, conf->passwd);
1804 adx 30 else
1805     encr = password;
1806    
1807 michael 3263 return encr && !strcmp(encr, conf->passwd);
1808 adx 30 }
1809    
1810     /*
1811     * cluster_a_line
1812     *
1813     * inputs - client sending the cluster
1814     * - command name "KLINE" "XLINE" etc.
1815 michael 3347 * - capab -- CAP_KLN etc. from server.h
1816 michael 1309 * - cluster type -- CLUSTER_KLINE etc. from conf.h
1817 adx 30 * - pattern and args to send along
1818     * output - none
1819     * side effects - Take source_p send the pattern with args given
1820     * along to all servers that match capab and cluster type
1821     */
1822     void
1823     cluster_a_line(struct Client *source_p, const char *command,
1824 michael 593 int capab, int cluster_type, const char *pattern, ...)
1825 adx 30 {
1826     va_list args;
1827 michael 3375 char buffer[IRCD_BUFSIZE] = "";
1828 michael 4815 const dlink_node *node = NULL;
1829 adx 30
1830     va_start(args, pattern);
1831     vsnprintf(buffer, sizeof(buffer), pattern, args);
1832     va_end(args);
1833    
1834 michael 4815 DLINK_FOREACH(node, cluster_items.head)
1835 adx 30 {
1836 michael 4815 const struct MaskItem *conf = node->data;
1837 adx 30
1838     if (conf->flags & cluster_type)
1839     sendto_match_servs(source_p, conf->name, CAP_CLUSTER|capab,
1840 michael 2182 "%s %s %s", command, conf->name, buffer);
1841 adx 30 }
1842     }
1843    
1844     /*
1845     * split_nuh
1846     *
1847     * inputs - pointer to original mask (modified in place)
1848     * - pointer to pointer where nick should go
1849     * - pointer to pointer where user should go
1850     * - pointer to pointer where host should go
1851     * output - NONE
1852     * side effects - mask is modified in place
1853     * If nick pointer is NULL, ignore writing to it
1854     * this allows us to use this function elsewhere.
1855     *
1856     * mask nick user host
1857     * ---------------------- ------- ------- ------
1858     * Dianora!db@db.net Dianora db db.net
1859     * Dianora Dianora * *
1860     * db.net * * db.net
1861     * OR if nick pointer is NULL
1862     * Dianora - * Dianora
1863     * Dianora! Dianora * *
1864     * Dianora!@ Dianora * *
1865     * Dianora!db Dianora db *
1866     * Dianora!@db.net Dianora * db.net
1867     * db@db.net * db db.net
1868     * !@ * * *
1869     * @ * * *
1870     * ! * * *
1871     */
1872     void
1873 michael 593 split_nuh(struct split_nuh_item *const iptr)
1874 adx 30 {
1875     char *p = NULL, *q = NULL;
1876    
1877 michael 593 if (iptr->nickptr)
1878     strlcpy(iptr->nickptr, "*", iptr->nicksize);
1879 michael 4982
1880 michael 593 if (iptr->userptr)
1881     strlcpy(iptr->userptr, "*", iptr->usersize);
1882 michael 4982
1883 michael 593 if (iptr->hostptr)
1884     strlcpy(iptr->hostptr, "*", iptr->hostsize);
1885    
1886     if ((p = strchr(iptr->nuhmask, '!')))
1887 adx 30 {
1888     *p = '\0';
1889    
1890 michael 3375 if (iptr->nickptr && *iptr->nuhmask)
1891 michael 593 strlcpy(iptr->nickptr, iptr->nuhmask, iptr->nicksize);
1892 adx 30
1893 michael 2525 if ((q = strchr(++p, '@')))
1894     {
1895 michael 593 *q++ = '\0';
1896    
1897 michael 3375 if (*p)
1898 michael 593 strlcpy(iptr->userptr, p, iptr->usersize);
1899 adx 30
1900 michael 3375 if (*q)
1901 michael 593 strlcpy(iptr->hostptr, q, iptr->hostsize);
1902 adx 30 }
1903     else
1904     {
1905 michael 3375 if (*p)
1906 michael 593 strlcpy(iptr->userptr, p, iptr->usersize);
1907 adx 30 }
1908     }
1909 michael 593 else
1910 adx 30 {
1911 michael 593 /* No ! found so lets look for a user@host */
1912     if ((p = strchr(iptr->nuhmask, '@')))
1913 adx 30 {
1914 michael 593 /* if found a @ */
1915     *p++ = '\0';
1916 adx 30
1917 michael 3375 if (*iptr->nuhmask)
1918 michael 593 strlcpy(iptr->userptr, iptr->nuhmask, iptr->usersize);
1919 adx 30
1920 michael 3375 if (*p)
1921 michael 593 strlcpy(iptr->hostptr, p, iptr->hostsize);
1922 adx 30 }
1923 michael 593 else
1924 adx 30 {
1925 michael 593 /* no @ found */
1926     if (!iptr->nickptr || strpbrk(iptr->nuhmask, ".:"))
1927     strlcpy(iptr->hostptr, iptr->nuhmask, iptr->hostsize);
1928 adx 30 else
1929 michael 593 strlcpy(iptr->nickptr, iptr->nuhmask, iptr->nicksize);
1930 adx 30 }
1931     }
1932     }

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision