ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
(Generate patch)

Comparing:
ircd-hybrid-7.3/src/ircd_parser.y (file contents), Revision 1074 by michael, Wed Feb 17 23:28:33 2010 UTC vs.
ircd-hybrid/trunk/src/conf_parser.y (file contents), Revision 1622 by michael, Thu Nov 1 13:16:37 2012 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 < *  ircd_parser.y: Parses the ircd configuration file.
3 > *  conf_parser.y: Parses the ircd configuration file.
4   *
5   *  Copyright (C) 2005 by the past and present ircd coders, and others.
6   *
# Line 32 | Line 32
32   #include "stdinc.h"
33   #include "ircd.h"
34   #include "list.h"
35 < #include "s_conf.h"
35 > #include "conf.h"
36   #include "event.h"
37 < #include "s_log.h"
37 > #include "log.h"
38   #include "client.h"     /* for UMODE_ALL only */
39   #include "irc_string.h"
40 #include "irc_getaddrinfo.h"
40   #include "sprintf_irc.h"
41   #include "memory.h"
42   #include "modules.h"
# Line 53 | Line 52
52   #include <openssl/rsa.h>
53   #include <openssl/bio.h>
54   #include <openssl/pem.h>
55 + #include <openssl/dh.h>
56   #endif
57  
58 + int yylex(void);
59 +
60   static char *class_name = NULL;
61   static struct ConfItem *yy_conf = NULL;
62   static struct AccessItem *yy_aconf = NULL;
# Line 63 | Line 65 | static struct ClassItem *yy_class = NULL
65   static char *yy_class_name = NULL;
66  
67   static dlink_list col_conf_list  = { NULL, NULL, 0 };
66 static dlink_list hub_conf_list  = { NULL, NULL, 0 };
67 static dlink_list leaf_conf_list = { NULL, NULL, 0 };
68   static unsigned int listener_flags = 0;
69   static unsigned int regex_ban = 0;
70   static char userbuf[IRCD_BUFSIZE];
71   static char hostbuf[IRCD_BUFSIZE];
72   static char reasonbuf[REASONLEN + 1];
73   static char gecos_name[REALLEN * 4];
74 <
74 > static char lfile[IRCD_BUFSIZE];
75 > static unsigned int ltype = 0;
76 > static unsigned int lsize = 0;
77   static char *resv_reason = NULL;
78   static char *listener_address = NULL;
77 static int not_atom = 0;
79  
80   struct CollectItem
81   {
# Line 104 | Line 105 | free_collect_item(struct CollectItem *it
105    MyFree(item);
106   }
107  
107 static void
108 unhook_hub_leaf_confs(void)
109 {
110  dlink_node *ptr;
111  dlink_node *next_ptr;
112  struct CollectItem *yy_hconf;
113  struct CollectItem *yy_lconf;
114
115  DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head)
116  {
117    yy_hconf = ptr->data;
118    dlinkDelete(&yy_hconf->node, &hub_conf_list);
119    free_collect_item(yy_hconf);
120  }
121
122  DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head)
123  {
124    yy_lconf = ptr->data;
125    dlinkDelete(&yy_lconf->node, &leaf_conf_list);
126    free_collect_item(yy_lconf);
127  }
128 }
129
108   %}
109  
110   %union {
# Line 135 | Line 113 | unhook_hub_leaf_confs(void)
113   }
114  
115   %token  ACCEPT_PASSWORD
138 %token  ACTION
116   %token  ADMIN
117   %token  AFTYPE
141 %token  T_ALLOW
118   %token  ANTI_NICK_FLOOD
119   %token  ANTI_SPAM_EXIT_MESSAGE_TIME
120   %token  AUTOCONN
121 < %token  T_BLOCK
146 < %token  BURST_AWAY
147 < %token  BURST_TOPICWHO
148 < %token  BYTES KBYTES MBYTES GBYTES TBYTES
121 > %token  BYTES KBYTES MBYTES
122   %token  CALLER_ID_WAIT
123   %token  CAN_FLOOD
151 %token  CAN_IDLE
124   %token  CHANNEL
125   %token  CIDR_BITLEN_IPV4
126   %token  CIDR_BITLEN_IPV6
155 %token  CIPHER_PREFERENCE
127   %token  CLASS
157 %token  COMPRESSED
158 %token  COMPRESSION_LEVEL
128   %token  CONNECT
129   %token  CONNECTFREQ
161 %token  CRYPTLINK
162 %token  DEFAULT_CIPHER_PREFERENCE
130   %token  DEFAULT_FLOODCOUNT
131   %token  DEFAULT_SPLIT_SERVER_COUNT
132   %token  DEFAULT_SPLIT_USER_COUNT
# Line 168 | Line 135 | unhook_hub_leaf_confs(void)
135   %token  DIE
136   %token  DISABLE_AUTH
137   %token  DISABLE_FAKE_CHANNELS
171 %token  DISABLE_HIDDEN
172 %token  DISABLE_LOCAL_CHANNELS
138   %token  DISABLE_REMOTE_COMMANDS
139   %token  DOTS_IN_IDENT
175 %token  DURATION
140   %token  EGDPOOL_PATH
141   %token  EMAIL
178 %token  ENABLE
142   %token  ENCRYPTED
143   %token  EXCEED_LIMIT
144   %token  EXEMPT
145   %token  FAILED_OPER_NOTICE
183 %token  FAKENAME
146   %token  IRCD_FLAGS
147   %token  FLATTEN_LINKS
186 %token  FFAILED_OPERLOG
187 %token  FKILLLOG
188 %token  FKLINELOG
189 %token  FGLINELOG
190 %token  FIOERRLOG
191 %token  FOPERLOG
192 %token  FOPERSPYLOG
193 %token  FUSERLOG
148   %token  GECOS
149   %token  GENERAL
150   %token  GLINE
151 < %token  GLINES
151 > %token  GLINE_DURATION
152 > %token  GLINE_ENABLE
153   %token  GLINE_EXEMPT
154 < %token  GLINE_LOG
200 < %token  GLINE_TIME
154 > %token  GLINE_REQUEST_DURATION
155   %token  GLINE_MIN_CIDR
156   %token  GLINE_MIN_CIDR6
157   %token  GLOBAL_KILL
# Line 205 | Line 159 | unhook_hub_leaf_confs(void)
159   %token  NEED_IDENT
160   %token  HAVENT_READ_CONF
161   %token  HIDDEN
208 %token  HIDDEN_ADMIN
162   %token  HIDDEN_NAME
210 %token  HIDDEN_OPER
163   %token  HIDE_SERVER_IPS
164   %token  HIDE_SERVERS
165   %token  HIDE_SPOOF_IPS
166   %token  HOST
167   %token  HUB
168   %token  HUB_MASK
217 %token  IDLETIME
169   %token  IGNORE_BOGUS_TS
170   %token  INVISIBLE_ON_CONNECT
171   %token  IP
# Line 222 | Line 173 | unhook_hub_leaf_confs(void)
173   %token  KILL_CHASE_TIME_LIMIT
174   %token  KLINE
175   %token  KLINE_EXEMPT
225 %token  KLINE_REASON
226 %token  KLINE_WITH_REASON
176   %token  KNOCK_DELAY
177   %token  KNOCK_DELAY_CHANNEL
178   %token  LEAF_MASK
179   %token  LINKS_DELAY
180   %token  LISTEN
181   %token  T_LOG
233 %token  LOGGING
234 %token  LOG_LEVEL
182   %token  MAX_ACCEPT
183   %token  MAX_BANS
184 + %token  MAX_CHANS_PER_OPER
185   %token  MAX_CHANS_PER_USER
186   %token  MAX_GLOBAL
187   %token  MAX_IDENT
# Line 258 | Line 206 | unhook_hub_leaf_confs(void)
206   %token  NO_JOIN_ON_SPLIT
207   %token  NO_OPER_FLOOD
208   %token  NO_TILDE
261 %token  NOT
209   %token  NUMBER
263 %token  NUMBER_PER_IDENT
210   %token  NUMBER_PER_CIDR
211   %token  NUMBER_PER_IP
266 %token  NUMBER_PER_IP_GLOBAL
212   %token  OPERATOR
213   %token  OPERS_BYPASS_CALLERID
269 %token  OPER_LOG
214   %token  OPER_ONLY_UMODES
215   %token  OPER_PASS_RESV
216   %token  OPER_SPY_T
# Line 288 | Line 232 | unhook_hub_leaf_confs(void)
232   %token  REDIRSERV
233   %token  REGEX_T
234   %token  REHASH
291 %token  TREJECT_HOLD_TIME
235   %token  REMOTE
236   %token  REMOTEBAN
237   %token  RESTRICT_CHANNELS
295 %token  RESTRICTED
238   %token  RSA_PRIVATE_KEY_FILE
239   %token  RSA_PUBLIC_KEY_FILE
240   %token  SSL_CERTIFICATE_FILE
241 < %token  T_SSL_CONNECTION_METHOD
241 > %token  SSL_DH_PARAM_FILE
242 > %token  T_SSL_CLIENT_METHOD
243 > %token  T_SSL_SERVER_METHOD
244   %token  T_SSLV3
245   %token  T_TLSV1
246   %token  RESV
# Line 306 | Line 250 | unhook_hub_leaf_confs(void)
250   %token  SEND_PASSWORD
251   %token  SERVERHIDE
252   %token  SERVERINFO
309 %token  SERVLINK_PATH
253   %token  IRCD_SID
254   %token  TKLINE_EXPIRE_NOTICES
255   %token  T_SHARED
256   %token  T_CLUSTER
257   %token  TYPE
258   %token  SHORT_MOTD
316 %token  SILENT
259   %token  SPOOF
260   %token  SPOOF_NOTICE
261   %token  STATS_E_DISABLED
# Line 323 | Line 265 | unhook_hub_leaf_confs(void)
265   %token  STATS_P_OPER_ONLY
266   %token  TBOOL
267   %token  TMASKED
326 %token  T_REJECT
268   %token  TS_MAX_DELTA
269   %token  TS_WARN_DELTA
270   %token  TWODOTS
# Line 333 | Line 274 | unhook_hub_leaf_confs(void)
274   %token  T_CALLERID
275   %token  T_CCONN
276   %token  T_CCONN_FULL
277 < %token  T_CLIENT_FLOOD
277 > %token  T_SSL_CIPHER_LIST
278   %token  T_DEAF
279   %token  T_DEBUG
280 < %token  T_DRONE
280 > %token  T_DLINE
281   %token  T_EXTERNAL
282   %token  T_FULL
283   %token  T_INVISIBLE
284   %token  T_IPV4
285   %token  T_IPV6
286   %token  T_LOCOPS
346 %token  T_LOGPATH
347 %token  T_L_CRIT
348 %token  T_L_DEBUG
349 %token  T_L_ERROR
350 %token  T_L_INFO
351 %token  T_L_NOTICE
352 %token  T_L_TRACE
353 %token  T_L_WARN
287   %token  T_MAX_CLIENTS
288   %token  T_NCHANGE
289   %token  T_OPERWALL
290 + %token  T_RECVQ
291   %token  T_REJ
292   %token  T_SERVER
293   %token  T_SERVNOTICE
294 + %token  T_SET
295   %token  T_SKILL
296   %token  T_SPY
297   %token  T_SSL
298   %token  T_UMODES
299   %token  T_UNAUTH
300 + %token  T_UNDLINE
301 + %token  T_UNLIMITED
302   %token  T_UNRESV
303   %token  T_UNXLINE
304 + %token  T_GLOBOPS
305   %token  T_WALLOP
306 + %token  T_RESTART
307 + %token  T_SERVICE
308 + %token  T_SERVICES_NAME
309   %token  THROTTLE_TIME
369 %token  TOPICBURST
310   %token  TRUE_NO_OPER_FLOOD
371 %token  TKLINE
372 %token  TXLINE
373 %token  TRESV
311   %token  UNKLINE
312   %token  USER
313   %token  USE_EGD
377 %token  USE_EXCEPT
378 %token  USE_INVEX
379 %token  USE_KNOCK
314   %token  USE_LOGGING
381 %token  USE_WHOIS_ACTUALLY
315   %token  VHOST
316   %token  VHOST6
317   %token  XLINE
385 %token  WARN
318   %token  WARN_NO_NLINE
319 + %token  T_SIZE
320 + %token  T_FILE
321  
322   %type <string> QSTRING
323   %type <number> NUMBER
# Line 407 | Line 341 | conf_item:        admin_entry
341                  | serverinfo_entry
342                  | serverhide_entry
343                  | resv_entry
344 +                | service_entry
345                  | shared_entry
346                  | cluster_entry
347                  | connect_entry
# Line 414 | Line 349 | conf_item:        admin_entry
349                  | deny_entry
350                  | exempt_entry
351                  | general_entry
417                | gline_entry
352                  | gecos_entry
353                  | modules_entry
354                  | error ';'
# Line 468 | Line 402 | modules_item:   modules_module | modules
402  
403   modules_module: MODULE '=' QSTRING ';'
404   {
471 #ifndef STATIC_MODULES /* NOOP in the static case */
405    if (conf_parser_ctx.pass == 2)
406      add_conf_module(libio_basename(yylval.string));
474 #endif
407   };
408  
409   modules_path: PATH '=' QSTRING ';'
410   {
479 #ifndef STATIC_MODULES
411    if (conf_parser_ctx.pass == 2)
412      mod_add_path(yylval.string);
482 #endif
413   };
414  
415  
# Line 489 | Line 419 | serverinfo_items:       serverinfo_items
419   serverinfo_item:        serverinfo_name | serverinfo_vhost |
420                          serverinfo_hub | serverinfo_description |
421                          serverinfo_network_name | serverinfo_network_desc |
422 <                        serverinfo_max_clients |
422 >                        serverinfo_max_clients | serverinfo_ssl_dh_param_file |
423                          serverinfo_rsa_private_key_file | serverinfo_vhost6 |
424                          serverinfo_sid | serverinfo_ssl_certificate_file |
425 <                        serverinfo_ssl_connection_method |
425 >                        serverinfo_ssl_client_method | serverinfo_ssl_server_method |
426 >                        serverinfo_ssl_cipher_list |
427                          error ';' ;
428  
429  
430 < serverinfo_ssl_connection_method: T_SSL_CONNECTION_METHOD
430 > serverinfo_ssl_client_method: T_SSL_CLIENT_METHOD '=' client_method_types ';' ;
431 > serverinfo_ssl_server_method: T_SSL_SERVER_METHOD '=' server_method_types ';' ;
432 >
433 > client_method_types: client_method_types ',' client_method_type_item | client_method_type_item;
434 > client_method_type_item: T_SSLV3
435   {
436   #ifdef HAVE_LIBCRYPTO
437 <  if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
438 <    ServerInfo.tls_version = 0;
437 >  if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx)
438 >    SSL_CTX_clear_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv3);
439   #endif
440 < } '=' method_types ';'
440 > } | T_TLSV1
441   {
442   #ifdef HAVE_LIBCRYPTO
443 <  if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
444 <  {
510 <    if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_SSLV3))
511 <      SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3);
512 <    if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_TLSV1))
513 <      SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1);
514 <  }
443 >  if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx)
444 >    SSL_CTX_clear_options(ServerInfo.client_ctx, SSL_OP_NO_TLSv1);
445   #endif
446   };
447  
448 < method_types: method_types ',' method_type_item | method_type_item;
449 < method_type_item: T_SSLV3
448 > server_method_types: server_method_types ',' server_method_type_item | server_method_type_item;
449 > server_method_type_item: T_SSLV3
450   {
451   #ifdef HAVE_LIBCRYPTO
452 <  if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
453 <    ServerInfo.tls_version |= CONF_SERVER_INFO_TLS_VERSION_SSLV3;
452 >  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
453 >    SSL_CTX_clear_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3);
454   #endif
455   } | T_TLSV1
456   {
457   #ifdef HAVE_LIBCRYPTO
458 <  if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
459 <    ServerInfo.tls_version |= CONF_SERVER_INFO_TLS_VERSION_TLSV1;
458 >  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
459 >    SSL_CTX_clear_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1);
460   #endif
461   };
462  
# Line 542 | Line 472 | serverinfo_ssl_certificate_file: SSL_CER
472      }
473  
474      if (SSL_CTX_use_certificate_file(ServerInfo.server_ctx, yylval.string,
475 +                                     SSL_FILETYPE_PEM) <= 0 ||
476 +        SSL_CTX_use_certificate_file(ServerInfo.client_ctx, yylval.string,
477                                       SSL_FILETYPE_PEM) <= 0)
478      {
479        yyerror(ERR_lib_error_string(ERR_get_error()));
# Line 549 | Line 481 | serverinfo_ssl_certificate_file: SSL_CER
481      }
482  
483      if (SSL_CTX_use_PrivateKey_file(ServerInfo.server_ctx, ServerInfo.rsa_private_key_file,
484 +                                    SSL_FILETYPE_PEM) <= 0 ||
485 +        SSL_CTX_use_PrivateKey_file(ServerInfo.client_ctx, ServerInfo.rsa_private_key_file,
486                                      SSL_FILETYPE_PEM) <= 0)
487      {
488        yyerror(ERR_lib_error_string(ERR_get_error()));
489        break;
490      }
491  
492 <    if (!SSL_CTX_check_private_key(ServerInfo.server_ctx))
492 >    if (!SSL_CTX_check_private_key(ServerInfo.server_ctx) ||
493 >        !SSL_CTX_check_private_key(ServerInfo.client_ctx))
494      {
495        yyerror(ERR_lib_error_string(ERR_get_error()));
496        break;
# Line 591 | Line 526 | serverinfo_rsa_private_key_file: RSA_PRI
526        break;
527      }
528  
529 <    ServerInfo.rsa_private_key = (RSA *)PEM_read_bio_RSAPrivateKey(file, NULL,
595 <      0, NULL);
529 >    ServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL);
530  
531      BIO_set_close(file, BIO_CLOSE);
532      BIO_free(file);
# Line 624 | Line 558 | serverinfo_rsa_private_key_file: RSA_PRI
558   #endif
559   };
560  
561 + serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';'
562 + {
563 + /* TBD - XXX: error reporting */
564 + #ifdef HAVE_LIBCRYPTO
565 +  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
566 +  {
567 +    BIO *file = BIO_new_file(yylval.string, "r");
568 +
569 +    if (file)
570 +    {
571 +      DH *dh = PEM_read_bio_DHparams(file, NULL, NULL, NULL);
572 +
573 +      BIO_free(file);
574 +
575 +      if (dh)
576 +      {
577 +        if (DH_size(dh) < 128)
578 +          ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::ssl_dh_param_file -- need at least a 1024 bit DH prime size");
579 +        else
580 +          SSL_CTX_set_tmp_dh(ServerInfo.server_ctx, dh);
581 +
582 +        DH_free(dh);
583 +      }
584 +    }
585 +  }
586 + #endif
587 + };
588 +
589 + serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
590 + {
591 + #ifdef HAVE_LIBCRYPTO
592 +  if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
593 +    SSL_CTX_set_cipher_list(ServerInfo.server_ctx, yylval.string);
594 + #endif
595 + };
596 +
597   serverinfo_name: NAME '=' QSTRING ';'
598   {
599    /* this isn't rehashable */
600 <  if (conf_parser_ctx.pass == 2)
600 >  if (conf_parser_ctx.pass == 2 && !ServerInfo.name)
601    {
602 <    if (ServerInfo.name == NULL)
602 >    if (valid_servname(yylval.string))
603 >      DupString(ServerInfo.name, yylval.string);
604 >    else
605      {
606 <      /* the ircd will exit() in main() if we dont set one */
607 <      if (strlen(yylval.string) <= HOSTLEN)
636 <        DupString(ServerInfo.name, yylval.string);
606 >      ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::name -- invalid name. Aborting.");
607 >      exit(0);
608      }
609    }
610   };
# Line 647 | Line 618 | serverinfo_sid: IRCD_SID '=' QSTRING ';'
618        DupString(ServerInfo.sid, yylval.string);
619      else
620      {
621 <      ilog(L_ERROR, "Ignoring config file entry SID -- invalid SID. Aborting.");
621 >      ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::sid -- invalid SID. Aborting.");
622        exit(0);
623      }
624    }
# Line 697 | Line 668 | serverinfo_vhost: VHOST '=' QSTRING ';'
668      hints.ai_socktype = SOCK_STREAM;
669      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
670  
671 <    if (irc_getaddrinfo(yylval.string, NULL, &hints, &res))
672 <      ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string);
671 >    if (getaddrinfo(yylval.string, NULL, &hints, &res))
672 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
673      else
674      {
675        assert(res != NULL);
# Line 706 | Line 677 | serverinfo_vhost: VHOST '=' QSTRING ';'
677        memcpy(&ServerInfo.ip, res->ai_addr, res->ai_addrlen);
678        ServerInfo.ip.ss.ss_family = res->ai_family;
679        ServerInfo.ip.ss_len = res->ai_addrlen;
680 <      irc_freeaddrinfo(res);
680 >      freeaddrinfo(res);
681  
682        ServerInfo.specific_ipv4_vhost = 1;
683      }
# Line 726 | Line 697 | serverinfo_vhost6: VHOST6 '=' QSTRING ';
697      hints.ai_socktype = SOCK_STREAM;
698      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
699  
700 <    if (irc_getaddrinfo(yylval.string, NULL, &hints, &res))
701 <      ilog(L_ERROR, "Invalid netmask for server vhost6(%s)", yylval.string);
700 >    if (getaddrinfo(yylval.string, NULL, &hints, &res))
701 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost6(%s)", yylval.string);
702      else
703      {
704        assert(res != NULL);
# Line 735 | Line 706 | serverinfo_vhost6: VHOST6 '=' QSTRING ';
706        memcpy(&ServerInfo.ip6, res->ai_addr, res->ai_addrlen);
707        ServerInfo.ip6.ss.ss_family = res->ai_family;
708        ServerInfo.ip6.ss_len = res->ai_addrlen;
709 <      irc_freeaddrinfo(res);
709 >      freeaddrinfo(res);
710  
711        ServerInfo.specific_ipv6_vhost = 1;
712      }
# Line 769 | Line 740 | serverinfo_max_clients: T_MAX_CLIENTS '=
740   serverinfo_hub: HUB '=' TBOOL ';'
741   {
742    if (conf_parser_ctx.pass == 2)
743 <  {
773 <    if (yylval.number)
774 <    {
775 <      ServerInfo.hub = 1;
776 <      delete_capability("HUB");
777 <      add_capability("HUB", CAP_HUB, 1);
778 <    }
779 <    else if (ServerInfo.hub)
780 <    {
781 <
782 <      ServerInfo.hub = 0;
783 <      delete_capability("HUB");
784 <    }
785 <  }
743 >    ServerInfo.hub = yylval.number;
744   };
745  
746   /***************************************************************************
# Line 824 | Line 782 | admin_description: DESCRIPTION '=' QSTRI
782   /***************************************************************************
783   *  section logging
784   ***************************************************************************/
785 < /* XXX */
786 < logging_entry:          LOGGING  '{' logging_items '}' ';' ;
785 > logging_entry:          T_LOG  '{' logging_items '}' ';' ;
786 > logging_items:          logging_items logging_item | logging_item ;
787  
788 < logging_items:          logging_items logging_item |
831 <                        logging_item ;
832 <
833 < logging_item:           logging_path | logging_oper_log |
834 <                        logging_log_level |
835 <                        logging_use_logging | logging_fuserlog |
836 <                        logging_foperlog | logging_fglinelog |
837 <                        logging_fklinelog | logging_killlog |
838 <                        logging_foperspylog | logging_ioerrlog |
839 <                        logging_ffailed_operlog |
788 > logging_item:           logging_use_logging | logging_file_entry |
789                          error ';' ;
790  
791 < logging_path:           T_LOGPATH '=' QSTRING ';'
843 <                        {
844 <                        };
845 <
846 < logging_oper_log:       OPER_LOG '=' QSTRING ';'
847 <                        {
848 <                        };
849 <
850 < logging_fuserlog: FUSERLOG '=' QSTRING ';'
791 > logging_use_logging: USE_LOGGING '=' TBOOL ';'
792   {
793    if (conf_parser_ctx.pass == 2)
794 <    strlcpy(ConfigLoggingEntry.userlog, yylval.string,
854 <            sizeof(ConfigLoggingEntry.userlog));
794 >    ConfigLoggingEntry.use_logging = yylval.number;
795   };
796  
797 < logging_ffailed_operlog: FFAILED_OPERLOG '=' QSTRING ';'
797 > logging_file_entry:
798   {
799 <  if (conf_parser_ctx.pass == 2)
800 <    strlcpy(ConfigLoggingEntry.failed_operlog, yylval.string,
801 <            sizeof(ConfigLoggingEntry.failed_operlog));
802 < };
863 <
864 < logging_foperlog: FOPERLOG '=' QSTRING ';'
799 >  lfile[0] = '\0';
800 >  ltype = 0;
801 >  lsize = 0;
802 > } T_FILE  '{' logging_file_items '}' ';'
803   {
804 <  if (conf_parser_ctx.pass == 2)
805 <    strlcpy(ConfigLoggingEntry.operlog, yylval.string,
868 <            sizeof(ConfigLoggingEntry.operlog));
804 >  if (conf_parser_ctx.pass == 2 && ltype > 0)
805 >    log_add_file(ltype, lsize, lfile);
806   };
807  
808 < logging_foperspylog: FOPERSPYLOG '=' QSTRING ';'
809 < {
873 <  if (conf_parser_ctx.pass == 2)
874 <    strlcpy(ConfigLoggingEntry.operspylog, yylval.string,
875 <            sizeof(ConfigLoggingEntry.operspylog));
876 < };
808 > logging_file_items: logging_file_items logging_file_item |
809 >                    logging_file_item ;
810  
811 < logging_fglinelog: FGLINELOG '=' QSTRING ';'
812 < {
880 <  if (conf_parser_ctx.pass == 2)
881 <    strlcpy(ConfigLoggingEntry.glinelog, yylval.string,
882 <            sizeof(ConfigLoggingEntry.glinelog));
883 < };
811 > logging_file_item:  logging_file_name | logging_file_type |
812 >                    logging_file_size | error ';' ;
813  
814 < logging_fklinelog: FKLINELOG '=' QSTRING ';'
814 > logging_file_name: NAME '=' QSTRING ';'
815   {
816 <  if (conf_parser_ctx.pass == 2)
817 <    strlcpy(ConfigLoggingEntry.klinelog, yylval.string,
889 <            sizeof(ConfigLoggingEntry.klinelog));
890 < };
816 >  strlcpy(lfile, yylval.string, sizeof(lfile));
817 > }
818  
819 < logging_ioerrlog: FIOERRLOG '=' QSTRING ';'
819 > logging_file_size: T_SIZE '=' sizespec ';'
820   {
821 <  if (conf_parser_ctx.pass == 2)
822 <    strlcpy(ConfigLoggingEntry.ioerrlog, yylval.string,
823 <            sizeof(ConfigLoggingEntry.ioerrlog));
821 >  lsize = $3;
822 > } | T_SIZE '=' T_UNLIMITED ';'
823 > {
824 >  lsize = 0;
825   };
826  
827 < logging_killlog: FKILLLOG '=' QSTRING ';'
827 > logging_file_type: TYPE
828   {
829    if (conf_parser_ctx.pass == 2)
830 <    strlcpy(ConfigLoggingEntry.killlog, yylval.string,
831 <            sizeof(ConfigLoggingEntry.killlog));
904 < };
830 >    ltype = 0;
831 > } '='  logging_file_type_items ';' ;
832  
833 < logging_log_level: LOG_LEVEL '=' T_L_CRIT ';'
834 < {
908 <  if (conf_parser_ctx.pass == 2)
909 <    set_log_level(L_CRIT);
910 < } | LOG_LEVEL '=' T_L_ERROR ';'
833 > logging_file_type_items: logging_file_type_items ',' logging_file_type_item | logging_file_type_item;
834 > logging_file_type_item:  USER
835   {
836    if (conf_parser_ctx.pass == 2)
837 <    set_log_level(L_ERROR);
838 < } | LOG_LEVEL '=' T_L_WARN ';'
837 >    ltype = LOG_TYPE_USER;
838 > } | OPERATOR
839   {
840    if (conf_parser_ctx.pass == 2)
841 <    set_log_level(L_WARN);
842 < } | LOG_LEVEL '=' T_L_NOTICE ';'
841 >    ltype = LOG_TYPE_OPER;
842 > } | GLINE
843   {
844    if (conf_parser_ctx.pass == 2)
845 <    set_log_level(L_NOTICE);
846 < } | LOG_LEVEL '=' T_L_TRACE ';'
845 >    ltype = LOG_TYPE_GLINE;
846 > } | T_DLINE
847   {
848    if (conf_parser_ctx.pass == 2)
849 <    set_log_level(L_TRACE);
850 < } | LOG_LEVEL '=' T_L_INFO ';'
849 >    ltype = LOG_TYPE_DLINE;
850 > } | KLINE
851   {
852    if (conf_parser_ctx.pass == 2)
853 <    set_log_level(L_INFO);
854 < } | LOG_LEVEL '=' T_L_DEBUG ';'
853 >    ltype = LOG_TYPE_KLINE;
854 > } | KILL
855   {
856    if (conf_parser_ctx.pass == 2)
857 <    set_log_level(L_DEBUG);
858 < };
935 <
936 < logging_use_logging: USE_LOGGING '=' TBOOL ';'
857 >    ltype = LOG_TYPE_KILL;
858 > } | T_DEBUG
859   {
860    if (conf_parser_ctx.pass == 2)
861 <    ConfigLoggingEntry.use_logging = yylval.number;
861 >    ltype = LOG_TYPE_DEBUG;
862   };
863  
864 +
865   /***************************************************************************
866   * section oper
867   ***************************************************************************/
# Line 955 | Line 878 | oper_entry: OPERATOR
878      MyFree(class_name);
879      class_name = NULL;
880    }
881 < } oper_name_b '{' oper_items '}' ';'
881 > } '{' oper_items '}' ';'
882   {
883    if (conf_parser_ctx.pass == 2)
884    {
# Line 990 | Line 913 | oper_entry: OPERATOR
913          DupString(new_aconf->host, yy_tmp->host);
914        else
915          DupString(new_aconf->host, "*");
916 +
917 +      new_aconf->type = parse_netmask(new_aconf->host, &new_aconf->addr,
918 +                                     &new_aconf->bits);
919 +
920        conf_add_class_to_conf(new_conf, class_name);
921        if (yy_aconf->passwd != NULL)
922          DupString(new_aconf->passwd, yy_aconf->passwd);
# Line 1004 | Line 931 | oper_entry: OPERATOR
931                    yy_aconf->rsa_public_key_file);
932  
933          file = BIO_new_file(yy_aconf->rsa_public_key_file, "r");
934 <        new_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file,
934 >        new_aconf->rsa_public_key = PEM_read_bio_RSA_PUBKEY(file,
935                                                             NULL, 0, NULL);
936          BIO_set_close(file, BIO_CLOSE);
937          BIO_free(file);
# Line 1036 | Line 963 | oper_entry: OPERATOR
963    }
964   };
965  
1039 oper_name_b: | oper_name_t;
966   oper_items:     oper_items oper_item | oper_item;
967 < oper_item:      oper_name | oper_user | oper_password | oper_hidden_admin |
968 <                oper_hidden_oper | oper_umodes |
969 <                oper_class | oper_global_kill | oper_remote |
1044 <                oper_kline | oper_xline | oper_unkline |
1045 <                oper_gline | oper_nick_changes | oper_remoteban |
1046 <                oper_die | oper_rehash | oper_admin | oper_operwall |
1047 <                oper_encrypted | oper_rsa_public_key_file |
1048 <                oper_flags | error ';' ;
967 > oper_item:      oper_name | oper_user | oper_password |
968 >                oper_umodes | oper_class | oper_encrypted |
969 >                oper_rsa_public_key_file | oper_flags | error ';' ;
970  
971   oper_name: NAME '=' QSTRING ';'
972   {
973    if (conf_parser_ctx.pass == 2)
974    {
1054    if (strlen(yylval.string) > OPERNICKLEN)
1055      yylval.string[OPERNICKLEN] = '\0';
1056
1057    MyFree(yy_conf->name);
1058    DupString(yy_conf->name, yylval.string);
1059  }
1060 };
1061
1062 oper_name_t: QSTRING
1063 {
1064  if (conf_parser_ctx.pass == 2)
1065  {
1066    if (strlen(yylval.string) > OPERNICKLEN)
1067      yylval.string[OPERNICKLEN] = '\0';
1068
975      MyFree(yy_conf->name);
976      DupString(yy_conf->name, yylval.string);
977    }
# Line 1092 | Line 998 | oper_user: USER '=' QSTRING ';'
998      {
999        DupString(yy_aconf->user, userbuf);
1000        DupString(yy_aconf->host, hostbuf);
1001 +
1002 +      yy_aconf->type = parse_netmask(yy_aconf->host, &yy_aconf->addr,
1003 +                                    &yy_aconf->bits);
1004      }
1005      else
1006      {
# Line 1156 | Line 1065 | oper_rsa_public_key_file: RSA_PUBLIC_KEY
1065        break;
1066      }
1067  
1068 <    yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL);
1068 >    yy_aconf->rsa_public_key = PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL);
1069  
1070      if (yy_aconf->rsa_public_key == NULL)
1071      {
# Line 1210 | Line 1119 | oper_umodes_item:  T_BOTS
1119   {
1120    if (conf_parser_ctx.pass == 2)
1121      yy_aconf->modes |= UMODE_FULL;
1122 + } | HIDDEN
1123 + {
1124 +  if (conf_parser_ctx.pass == 2)
1125 +    yy_aconf->modes |= UMODE_HIDDEN;
1126   } | T_SKILL
1127   {
1128    if (conf_parser_ctx.pass == 2)
# Line 1264 | Line 1177 | oper_umodes_item:  T_BOTS
1177      yy_aconf->modes |= UMODE_LOCOPS;
1178   };
1179  
1267 oper_global_kill: GLOBAL_KILL '=' TBOOL ';'
1268 {
1269  if (conf_parser_ctx.pass == 2)
1270  {
1271    if (yylval.number)
1272      yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1273    else
1274      yy_aconf->port &= ~OPER_FLAG_GLOBAL_KILL;
1275  }
1276 };
1277
1278 oper_remote: REMOTE '=' TBOOL ';'
1279 {
1280  if (conf_parser_ctx.pass == 2)
1281  {
1282    if (yylval.number)
1283      yy_aconf->port |= OPER_FLAG_REMOTE;
1284    else
1285      yy_aconf->port &= ~OPER_FLAG_REMOTE;
1286  }
1287 };
1288
1289 oper_remoteban: REMOTEBAN '=' TBOOL ';'
1290 {
1291  if (conf_parser_ctx.pass == 2)
1292  {
1293    if (yylval.number)
1294      yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1295    else
1296      yy_aconf->port &= ~OPER_FLAG_REMOTEBAN;
1297  }
1298 };
1299
1300 oper_kline: KLINE '=' TBOOL ';'
1301 {
1302  if (conf_parser_ctx.pass == 2)
1303  {
1304    if (yylval.number)
1305      yy_aconf->port |= OPER_FLAG_K;
1306    else
1307      yy_aconf->port &= ~OPER_FLAG_K;
1308  }
1309 };
1310
1311 oper_xline: XLINE '=' TBOOL ';'
1312 {
1313  if (conf_parser_ctx.pass == 2)
1314  {
1315    if (yylval.number)
1316      yy_aconf->port |= OPER_FLAG_X;
1317    else
1318      yy_aconf->port &= ~OPER_FLAG_X;
1319  }
1320 };
1321
1322 oper_unkline: UNKLINE '=' TBOOL ';'
1323 {
1324  if (conf_parser_ctx.pass == 2)
1325  {
1326    if (yylval.number)
1327      yy_aconf->port |= OPER_FLAG_UNKLINE;
1328    else
1329      yy_aconf->port &= ~OPER_FLAG_UNKLINE;
1330  }
1331 };
1332
1333 oper_gline: GLINE '=' TBOOL ';'
1334 {
1335  if (conf_parser_ctx.pass == 2)
1336  {
1337    if (yylval.number)
1338      yy_aconf->port |= OPER_FLAG_GLINE;
1339    else
1340      yy_aconf->port &= ~OPER_FLAG_GLINE;
1341  }
1342 };
1343
1344 oper_nick_changes: NICK_CHANGES '=' TBOOL ';'
1345 {
1346  if (conf_parser_ctx.pass == 2)
1347  {
1348    if (yylval.number)
1349      yy_aconf->port |= OPER_FLAG_N;
1350    else
1351      yy_aconf->port &= ~OPER_FLAG_N;
1352  }
1353 };
1354
1355 oper_die: DIE '=' TBOOL ';'
1356 {
1357  if (conf_parser_ctx.pass == 2)
1358  {
1359    if (yylval.number)
1360      yy_aconf->port |= OPER_FLAG_DIE;
1361    else
1362      yy_aconf->port &= ~OPER_FLAG_DIE;
1363  }
1364 };
1365
1366 oper_rehash: REHASH '=' TBOOL ';'
1367 {
1368  if (conf_parser_ctx.pass == 2)
1369  {
1370    if (yylval.number)
1371      yy_aconf->port |= OPER_FLAG_REHASH;
1372    else
1373      yy_aconf->port &= ~OPER_FLAG_REHASH;
1374  }
1375 };
1376
1377 oper_admin: ADMIN '=' TBOOL ';'
1378 {
1379  if (conf_parser_ctx.pass == 2)
1380  {
1381    if (yylval.number)
1382      yy_aconf->port |= OPER_FLAG_ADMIN;
1383    else
1384      yy_aconf->port &= ~OPER_FLAG_ADMIN;
1385  }
1386 };
1387
1388 oper_hidden_admin: HIDDEN_ADMIN '=' TBOOL ';'
1389 {
1390  if (conf_parser_ctx.pass == 2)
1391  {
1392    if (yylval.number)
1393      yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN;
1394    else
1395      yy_aconf->port &= ~OPER_FLAG_HIDDEN_ADMIN;
1396  }
1397 };
1398
1399 oper_hidden_oper: HIDDEN_OPER '=' TBOOL ';'
1400 {
1401  if (conf_parser_ctx.pass == 2)
1402  {
1403    if (yylval.number)
1404      yy_aconf->port |= OPER_FLAG_HIDDEN_OPER;
1405    else
1406      yy_aconf->port &= ~OPER_FLAG_HIDDEN_OPER;
1407  }
1408 };
1409
1410 oper_operwall: T_OPERWALL '=' TBOOL ';'
1411 {
1412  if (conf_parser_ctx.pass == 2)
1413  {
1414    if (yylval.number)
1415      yy_aconf->port |= OPER_FLAG_OPERWALL;
1416    else
1417      yy_aconf->port &= ~OPER_FLAG_OPERWALL;
1418  }
1419 };
1420
1180   oper_flags: IRCD_FLAGS
1181   {
1182 +  if (conf_parser_ctx.pass == 2)
1183 +    yy_aconf->port = 0;
1184   } '='  oper_flags_items ';';
1185  
1186   oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1187 < oper_flags_item: NOT { not_atom = 1; } oper_flags_item_atom
1427 <                | { not_atom = 0; } oper_flags_item_atom;
1428 <
1429 < oper_flags_item_atom: GLOBAL_KILL
1187 > oper_flags_item: GLOBAL_KILL
1188   {
1189    if (conf_parser_ctx.pass == 2)
1190 <  {
1433 <    if (not_atom)yy_aconf->port &= ~OPER_FLAG_GLOBAL_KILL;
1434 <    else yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1435 <  }
1190 >    yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1191   } | REMOTE
1192   {
1193    if (conf_parser_ctx.pass == 2)
1194 <  {
1440 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTE;
1441 <    else yy_aconf->port |= OPER_FLAG_REMOTE;
1442 <  }
1194 >    yy_aconf->port |= OPER_FLAG_REMOTE;
1195   } | KLINE
1196   {
1197    if (conf_parser_ctx.pass == 2)
1198 <  {
1447 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_K;
1448 <    else yy_aconf->port |= OPER_FLAG_K;
1449 <  }
1198 >    yy_aconf->port |= OPER_FLAG_K;
1199   } | UNKLINE
1200   {
1201    if (conf_parser_ctx.pass == 2)
1202 <  {
1203 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_UNKLINE;
1204 <    else yy_aconf->port |= OPER_FLAG_UNKLINE;
1205 <  }
1202 >    yy_aconf->port |= OPER_FLAG_UNKLINE;
1203 > } | T_DLINE
1204 > {
1205 >  if (conf_parser_ctx.pass == 2)
1206 >    yy_aconf->port |= OPER_FLAG_DLINE;
1207 > } | T_UNDLINE
1208 > {
1209 >  if (conf_parser_ctx.pass == 2)
1210 >    yy_aconf->port |= OPER_FLAG_UNDLINE;
1211   } | XLINE
1212   {
1213    if (conf_parser_ctx.pass == 2)
1214 <  {
1461 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_X;
1462 <    else yy_aconf->port |= OPER_FLAG_X;
1463 <  }
1214 >    yy_aconf->port |= OPER_FLAG_X;
1215   } | GLINE
1216   {
1217    if (conf_parser_ctx.pass == 2)
1218 <  {
1468 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_GLINE;
1469 <    else yy_aconf->port |= OPER_FLAG_GLINE;
1470 <  }
1218 >    yy_aconf->port |= OPER_FLAG_GLINE;
1219   } | DIE
1220   {
1221    if (conf_parser_ctx.pass == 2)
1222 <  {
1223 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_DIE;
1476 <    else yy_aconf->port |= OPER_FLAG_DIE;
1477 <  }
1478 < } | REHASH
1222 >    yy_aconf->port |= OPER_FLAG_DIE;
1223 > } | T_RESTART
1224   {
1225    if (conf_parser_ctx.pass == 2)
1226 <  {
1227 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REHASH;
1483 <    else yy_aconf->port |= OPER_FLAG_REHASH;
1484 <  }
1485 < } | ADMIN
1226 >    yy_aconf->port |= OPER_FLAG_RESTART;
1227 > } | REHASH
1228   {
1229    if (conf_parser_ctx.pass == 2)
1230 <  {
1231 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_ADMIN;
1490 <    else yy_aconf->port |= OPER_FLAG_ADMIN;
1491 <  }
1492 < } | HIDDEN_ADMIN
1230 >    yy_aconf->port |= OPER_FLAG_REHASH;
1231 > } | ADMIN
1232   {
1233    if (conf_parser_ctx.pass == 2)
1234 <  {
1496 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_ADMIN;
1497 <    else yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN;
1498 <  }
1234 >    yy_aconf->port |= OPER_FLAG_ADMIN;
1235   } | NICK_CHANGES
1236   {
1237    if (conf_parser_ctx.pass == 2)
1238 <  {
1503 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_N;
1504 <    else yy_aconf->port |= OPER_FLAG_N;
1505 <  }
1238 >    yy_aconf->port |= OPER_FLAG_N;
1239   } | T_OPERWALL
1240   {
1241    if (conf_parser_ctx.pass == 2)
1242 <  {
1243 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPERWALL;
1511 <    else yy_aconf->port |= OPER_FLAG_OPERWALL;
1512 <  }
1513 < } | OPER_SPY_T
1242 >    yy_aconf->port |= OPER_FLAG_OPERWALL;
1243 > } | T_GLOBOPS
1244   {
1245    if (conf_parser_ctx.pass == 2)
1246 <  {
1247 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_OPER_SPY;
1518 <    else yy_aconf->port |= OPER_FLAG_OPER_SPY;
1519 <  }
1520 < } | HIDDEN_OPER
1246 >    yy_aconf->port |= OPER_FLAG_GLOBOPS;
1247 > } | OPER_SPY_T
1248   {
1249    if (conf_parser_ctx.pass == 2)
1250 <  {
1524 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_HIDDEN_OPER;
1525 <    else yy_aconf->port |= OPER_FLAG_HIDDEN_OPER;
1526 <  }
1250 >    yy_aconf->port |= OPER_FLAG_OPER_SPY;
1251   } | REMOTEBAN
1252   {
1253    if (conf_parser_ctx.pass == 2)
1254 <  {
1255 <    if (not_atom) yy_aconf->port &= ~OPER_FLAG_REMOTEBAN;
1532 <    else yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1533 <  }
1534 < } | ENCRYPTED
1254 >    yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1255 > } | T_SET
1256   {
1257    if (conf_parser_ctx.pass == 2)
1258 <  {
1259 <    if (not_atom) ClearConfEncrypted(yy_aconf);
1260 <    else SetConfEncrypted(yy_aconf);
1261 <  }
1258 >    yy_aconf->port |= OPER_FLAG_SET;
1259 > } | MODULE
1260 > {
1261 >  if (conf_parser_ctx.pass == 2)
1262 >    yy_aconf->port |= OPER_FLAG_MODULE;
1263   };
1264  
1265  
# Line 1551 | Line 1273 | class_entry: CLASS
1273      yy_conf = make_conf_item(CLASS_TYPE);
1274      yy_class = map_to_conf(yy_conf);
1275    }
1276 < } class_name_b '{' class_items '}' ';'
1276 > } '{' class_items '}' ';'
1277   {
1278    if (conf_parser_ctx.pass == 1)
1279    {
# Line 1562 | Line 1284 | class_entry: CLASS
1284        delete_conf_item(yy_conf);
1285      else
1286      {
1287 <      cconf = find_exact_name_conf(CLASS_TYPE, yy_class_name, NULL, NULL);
1287 >      cconf = find_exact_name_conf(CLASS_TYPE, NULL, yy_class_name, NULL, NULL);
1288  
1289        if (cconf != NULL)                /* The class existed already */
1290        {
# Line 1594 | Line 1316 | class_entry: CLASS
1316    }
1317   };
1318  
1597 class_name_b: | class_name_t;
1598
1319   class_items:    class_items class_item | class_item;
1320   class_item:     class_name |
1321                  class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 |
# Line 1608 | Line 1328 | class_item:     class_name |
1328                  class_max_global |
1329                  class_max_local |
1330                  class_max_ident |
1331 <                class_sendq |
1331 >                class_sendq | class_recvq |
1332                  error ';' ;
1333  
1334   class_name: NAME '=' QSTRING ';'
# Line 1620 | Line 1340 | class_name: NAME '=' QSTRING ';'
1340    }
1341   };
1342  
1623 class_name_t: QSTRING
1624 {
1625  if (conf_parser_ctx.pass == 1)
1626  {
1627    MyFree(yy_class_name);
1628    DupString(yy_class_name, yylval.string);
1629  }
1630 };
1631
1343   class_ping_time: PING_TIME '=' timespec ';'
1344   {
1345    if (conf_parser_ctx.pass == 1)
1346 <    PingFreq(yy_class) = $3;
1346 >    yy_class->ping_freq = $3;
1347   };
1348  
1349   class_ping_warning: PING_WARNING '=' timespec ';'
1350   {
1351    if (conf_parser_ctx.pass == 1)
1352 <    PingWarning(yy_class) = $3;
1352 >    yy_class->ping_warning = $3;
1353   };
1354  
1355   class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1356   {
1357    if (conf_parser_ctx.pass == 1)
1358 <    MaxPerIp(yy_class) = $3;
1358 >    yy_class->max_perip = $3;
1359   };
1360  
1361   class_connectfreq: CONNECTFREQ '=' timespec ';'
1362   {
1363    if (conf_parser_ctx.pass == 1)
1364 <    ConFreq(yy_class) = $3;
1364 >    yy_class->con_freq = $3;
1365   };
1366  
1367   class_max_number: MAX_NUMBER '=' NUMBER ';'
1368   {
1369    if (conf_parser_ctx.pass == 1)
1370 <    MaxTotal(yy_class) = $3;
1370 >    yy_class->max_total = $3;
1371   };
1372  
1373   class_max_global: MAX_GLOBAL '=' NUMBER ';'
1374   {
1375    if (conf_parser_ctx.pass == 1)
1376 <    MaxGlobal(yy_class) = $3;
1376 >    yy_class->max_global = $3;
1377   };
1378  
1379   class_max_local: MAX_LOCAL '=' NUMBER ';'
1380   {
1381    if (conf_parser_ctx.pass == 1)
1382 <    MaxLocal(yy_class) = $3;
1382 >    yy_class->max_local = $3;
1383   };
1384  
1385   class_max_ident: MAX_IDENT '=' NUMBER ';'
1386   {
1387    if (conf_parser_ctx.pass == 1)
1388 <    MaxIdent(yy_class) = $3;
1388 >    yy_class->max_ident = $3;
1389   };
1390  
1391   class_sendq: SENDQ '=' sizespec ';'
1392   {
1393    if (conf_parser_ctx.pass == 1)
1394 <    MaxSendq(yy_class) = $3;
1394 >    yy_class->max_sendq = $3;
1395 > };
1396 >
1397 > class_recvq: T_RECVQ '=' sizespec ';'
1398 > {
1399 >  if (conf_parser_ctx.pass == 1)
1400 >    if ($3 >= CLIENT_FLOOD_MIN && $3 <= CLIENT_FLOOD_MAX)
1401 >      yy_class->max_recvq = $3;
1402   };
1403  
1404   class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';'
1405   {
1406    if (conf_parser_ctx.pass == 1)
1407 <    CidrBitlenIPV4(yy_class) = $3;
1407 >    yy_class->cidr_bitlen_ipv4 = $3 > 32 ? 32 : $3;
1408   };
1409  
1410   class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';'
1411   {
1412    if (conf_parser_ctx.pass == 1)
1413 <    CidrBitlenIPV6(yy_class) = $3;
1413 >    yy_class->cidr_bitlen_ipv6 = $3 > 128 ? 128 : $3;
1414   };
1415  
1416   class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';'
1417   {
1418    if (conf_parser_ctx.pass == 1)
1419 <    NumberPerCidr(yy_class) = $3;
1419 >    yy_class->number_per_cidr = $3;
1420   };
1421  
1422   /***************************************************************************
# Line 1875 | Line 1593 | auth_entry: IRCD_AUTH
1593  
1594   auth_items:     auth_items auth_item | auth_item;
1595   auth_item:      auth_user | auth_passwd | auth_class | auth_flags |
1596 <                auth_kline_exempt | auth_need_ident |
1597 <                auth_exceed_limit | auth_no_tilde | auth_gline_exempt |
1880 <                auth_spoof | auth_spoof_notice |
1881 <                auth_redir_serv | auth_redir_port | auth_can_flood |
1882 <                auth_need_password | auth_encrypted | error ';' ;
1596 >                auth_spoof | auth_redir_serv | auth_redir_port |
1597 >                auth_encrypted | error ';' ;
1598  
1599   auth_user: USER '=' QSTRING ';'
1600   {
# Line 1916 | Line 1631 | auth_user: USER '=' QSTRING ';'
1631    }
1632   };
1633  
1919 /* XXX - IP/IPV6 tags don't exist anymore - put IP/IPV6 into user. */
1920
1634   auth_passwd: PASSWORD '=' QSTRING ';'
1635   {
1636    if (conf_parser_ctx.pass == 2)
# Line 1931 | Line 1644 | auth_passwd: PASSWORD '=' QSTRING ';'
1644    }
1645   };
1646  
1934 auth_spoof_notice: SPOOF_NOTICE '=' TBOOL ';'
1935 {
1936  if (conf_parser_ctx.pass == 2)
1937  {
1938    if (yylval.number)
1939      yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1940    else
1941      yy_aconf->flags &= ~CONF_FLAGS_SPOOF_NOTICE;
1942  }
1943 };
1944
1647   auth_class: CLASS '=' QSTRING ';'
1648   {
1649    if (conf_parser_ctx.pass == 2)
# Line 1967 | Line 1669 | auth_flags: IRCD_FLAGS
1669   } '='  auth_flags_items ';';
1670  
1671   auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1672 < auth_flags_item: NOT { not_atom = 1; } auth_flags_item_atom
1971 <                | { not_atom = 0; } auth_flags_item_atom;
1972 <
1973 < auth_flags_item_atom: SPOOF_NOTICE
1672 > auth_flags_item: SPOOF_NOTICE
1673   {
1674    if (conf_parser_ctx.pass == 2)
1675 <  {
1977 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_SPOOF_NOTICE;
1978 <    else yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1979 <  }
1980 <
1675 >    yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1676   } | EXCEED_LIMIT
1677   {
1678    if (conf_parser_ctx.pass == 2)
1679 <  {
1985 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NOLIMIT;
1986 <    else yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
1987 <  }
1679 >    yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
1680   } | KLINE_EXEMPT
1681   {
1682    if (conf_parser_ctx.pass == 2)
1683 <  {
1992 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTKLINE;
1993 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
1994 <  }
1683 >    yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
1684   } | NEED_IDENT
1685   {
1686    if (conf_parser_ctx.pass == 2)
1687 <  {
1999 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_IDENTD;
2000 <    else yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
2001 <  }
1687 >    yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
1688   } | CAN_FLOOD
1689   {
1690    if (conf_parser_ctx.pass == 2)
1691 <  {
2006 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_CAN_FLOOD;
2007 <    else yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
2008 <  }
2009 < } | CAN_IDLE
2010 < {
2011 <  if (conf_parser_ctx.pass == 2)
2012 <  {
2013 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_IDLE_LINED;
2014 <    else yy_aconf->flags |= CONF_FLAGS_IDLE_LINED;
2015 <  }
1691 >    yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
1692   } | NO_TILDE
1693   {
1694    if (conf_parser_ctx.pass == 2)
1695 <  {
2020 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NO_TILDE;
2021 <    else yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
2022 <  }
1695 >    yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
1696   } | GLINE_EXEMPT
1697   {
1698    if (conf_parser_ctx.pass == 2)
1699 <  {
2027 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTGLINE;
2028 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
2029 <  }
1699 >    yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
1700   } | RESV_EXEMPT
1701   {
1702    if (conf_parser_ctx.pass == 2)
1703 <  {
2034 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_EXEMPTRESV;
2035 <    else yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV;
2036 <  }
1703 >    yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV;
1704   } | NEED_PASSWORD
1705   {
1706    if (conf_parser_ctx.pass == 2)
1707 <  {
2041 <    if (not_atom) yy_aconf->flags &= ~CONF_FLAGS_NEED_PASSWORD;
2042 <    else yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
2043 <  }
2044 < };
2045 <
2046 < auth_kline_exempt: KLINE_EXEMPT '=' TBOOL ';'
2047 < {
2048 <  if (conf_parser_ctx.pass == 2)
2049 <  {
2050 <    if (yylval.number)
2051 <      yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
2052 <    else
2053 <      yy_aconf->flags &= ~CONF_FLAGS_EXEMPTKLINE;
2054 <  }
2055 < };
2056 <
2057 < auth_need_ident: NEED_IDENT '=' TBOOL ';'
2058 < {
2059 <  if (conf_parser_ctx.pass == 2)
2060 <  {
2061 <    if (yylval.number)
2062 <      yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
2063 <    else
2064 <      yy_aconf->flags &= ~CONF_FLAGS_NEED_IDENTD;
2065 <  }
2066 < };
2067 <
2068 < auth_exceed_limit: EXCEED_LIMIT '=' TBOOL ';'
2069 < {
2070 <  if (conf_parser_ctx.pass == 2)
2071 <  {
2072 <    if (yylval.number)
2073 <      yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
2074 <    else
2075 <      yy_aconf->flags &= ~CONF_FLAGS_NOLIMIT;
2076 <  }
2077 < };
2078 <
2079 < auth_can_flood: CAN_FLOOD '=' TBOOL ';'
2080 < {
2081 <  if (conf_parser_ctx.pass == 2)
2082 <  {
2083 <    if (yylval.number)
2084 <      yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
2085 <    else
2086 <      yy_aconf->flags &= ~CONF_FLAGS_CAN_FLOOD;
2087 <  }
1707 >    yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
1708   };
1709  
2090 auth_no_tilde: NO_TILDE '=' TBOOL ';'
2091 {
2092  if (conf_parser_ctx.pass == 2)
2093  {
2094    if (yylval.number)
2095      yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
2096    else
2097      yy_aconf->flags &= ~CONF_FLAGS_NO_TILDE;
2098  }
2099 };
2100
2101 auth_gline_exempt: GLINE_EXEMPT '=' TBOOL ';'
2102 {
2103  if (conf_parser_ctx.pass == 2)
2104  {
2105    if (yylval.number)
2106      yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
2107    else
2108      yy_aconf->flags &= ~CONF_FLAGS_EXEMPTGLINE;
2109  }
2110 };
2111
2112 /* XXX - need check for illegal hostnames here */
1710   auth_spoof: SPOOF '=' QSTRING ';'
1711   {
1712    if (conf_parser_ctx.pass == 2)
1713    {
1714      MyFree(yy_conf->name);
1715  
1716 <    if (strlen(yylval.string) < HOSTLEN)
1716 >    if (strlen(yylval.string) <= HOSTLEN && valid_hostname(yylval.string))
1717      {    
1718        DupString(yy_conf->name, yylval.string);
1719        yy_aconf->flags |= CONF_FLAGS_SPOOF_IP;
1720      }
1721      else
1722      {
1723 <      ilog(L_ERROR, "Spoofs must be less than %d..ignoring it", HOSTLEN);
1723 >      ilog(LOG_TYPE_IRCD, "Spoof either is too long or contains invalid characters. Ignoring it.");
1724        yy_conf->name = NULL;
1725      }
1726    }
# Line 2148 | Line 1745 | auth_redir_port: REDIRPORT '=' NUMBER ';
1745    }
1746   };
1747  
2151 auth_need_password: NEED_PASSWORD '=' TBOOL ';'
2152 {
2153  if (conf_parser_ctx.pass == 2)
2154  {
2155    if (yylval.number)
2156      yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
2157    else
2158      yy_aconf->flags &= ~CONF_FLAGS_NEED_PASSWORD;
2159  }
2160 };
2161
1748  
1749   /***************************************************************************
1750   *  section resv
# Line 2217 | Line 1803 | resv_nick: NICK '=' QSTRING ';'
1803   };
1804  
1805   /***************************************************************************
1806 + *  section service
1807 + ***************************************************************************/
1808 + service_entry: T_SERVICE '{' service_items '}' ';';
1809 +
1810 + service_items:     service_items service_item | service_item;
1811 + service_item:      service_name | error;
1812 +
1813 + service_name: NAME '=' QSTRING ';'
1814 + {
1815 +  if (conf_parser_ctx.pass == 2)
1816 +  {
1817 +    if (valid_servname(yylval.string))
1818 +    {
1819 +      yy_conf = make_conf_item(SERVICE_TYPE);
1820 +      DupString(yy_conf->name, yylval.string);
1821 +    }
1822 +  }
1823 + };
1824 +
1825 + /***************************************************************************
1826   *  section shared, for sharing remote klines etc.
1827   ***************************************************************************/
1828   shared_entry: T_SHARED
# Line 2280 | Line 1886 | shared_type_item: KLINE
1886   {
1887    if (conf_parser_ctx.pass == 2)
1888      yy_match_item->action |= SHARED_KLINE;
2283 } | TKLINE
2284 {
2285  if (conf_parser_ctx.pass == 2)
2286    yy_match_item->action |= SHARED_TKLINE;
1889   } | UNKLINE
1890   {
1891    if (conf_parser_ctx.pass == 2)
1892      yy_match_item->action |= SHARED_UNKLINE;
1893 < } | XLINE
1893 > } | T_DLINE
1894   {
1895    if (conf_parser_ctx.pass == 2)
1896 <    yy_match_item->action |= SHARED_XLINE;
1897 < } | TXLINE
1896 >    yy_match_item->action |= SHARED_DLINE;
1897 > } | T_UNDLINE
1898   {
1899    if (conf_parser_ctx.pass == 2)
1900 <    yy_match_item->action |= SHARED_TXLINE;
1900 >    yy_match_item->action |= SHARED_UNDLINE;
1901 > } | XLINE
1902 > {
1903 >  if (conf_parser_ctx.pass == 2)
1904 >    yy_match_item->action |= SHARED_XLINE;
1905   } | T_UNXLINE
1906   {
1907    if (conf_parser_ctx.pass == 2)
# Line 2304 | Line 1910 | shared_type_item: KLINE
1910   {
1911    if (conf_parser_ctx.pass == 2)
1912      yy_match_item->action |= SHARED_RESV;
2307 } | TRESV
2308 {
2309  if (conf_parser_ctx.pass == 2)
2310    yy_match_item->action |= SHARED_TRESV;
1913   } | T_UNRESV
1914   {
1915    if (conf_parser_ctx.pass == 2)
# Line 2362 | Line 1964 | cluster_type_item: KLINE
1964   {
1965    if (conf_parser_ctx.pass == 2)
1966      yy_conf->flags |= SHARED_KLINE;
2365 } | TKLINE
2366 {
2367  if (conf_parser_ctx.pass == 2)
2368    yy_conf->flags |= SHARED_TKLINE;
1967   } | UNKLINE
1968   {
1969    if (conf_parser_ctx.pass == 2)
1970      yy_conf->flags |= SHARED_UNKLINE;
1971 < } | XLINE
1971 > } | T_DLINE
1972   {
1973    if (conf_parser_ctx.pass == 2)
1974 <    yy_conf->flags |= SHARED_XLINE;
1975 < } | TXLINE
1974 >    yy_conf->flags |= SHARED_DLINE;
1975 > } | T_UNDLINE
1976 > {
1977 >  if (conf_parser_ctx.pass == 2)
1978 >    yy_conf->flags |= SHARED_UNDLINE;
1979 > } | XLINE
1980   {
1981    if (conf_parser_ctx.pass == 2)
1982 <    yy_conf->flags |= SHARED_TXLINE;
1982 >    yy_conf->flags |= SHARED_XLINE;
1983   } | T_UNXLINE
1984   {
1985    if (conf_parser_ctx.pass == 2)
# Line 2386 | Line 1988 | cluster_type_item: KLINE
1988   {
1989    if (conf_parser_ctx.pass == 2)
1990      yy_conf->flags |= SHARED_RESV;
2389 } | TRESV
2390 {
2391  if (conf_parser_ctx.pass == 2)
2392    yy_conf->flags |= SHARED_TRESV;
1991   } | T_UNRESV
1992   {
1993    if (conf_parser_ctx.pass == 2)
# Line 2412 | Line 2010 | connect_entry: CONNECT
2010    if (conf_parser_ctx.pass == 2)
2011    {
2012      yy_conf = make_conf_item(SERVER_TYPE);
2013 <    yy_aconf = (struct AccessItem *)map_to_conf(yy_conf);
2014 <    yy_aconf->passwd = NULL;
2013 >    yy_aconf = map_to_conf(yy_conf);
2014 >
2015      /* defaults */
2016      yy_aconf->port = PORTNUM;
2419
2420    if (ConfigFileEntry.burst_away)
2421      yy_aconf->flags = CONF_FLAGS_BURST_AWAY;
2017    }
2018    else
2019    {
2020      MyFree(class_name);
2021      class_name = NULL;
2022    }
2023 < } connect_name_b '{' connect_items '}' ';'
2023 > } '{' connect_items '}' ';'
2024   {
2025    if (conf_parser_ctx.pass == 2)
2026    {
2027 <    struct CollectItem *yy_hconf=NULL;
2028 <    struct CollectItem *yy_lconf=NULL;
2029 <    dlink_node *ptr;
2030 <    dlink_node *next_ptr;
2031 < #ifdef HAVE_LIBCRYPTO
2032 <    if (yy_aconf->host &&
2033 <        ((yy_aconf->passwd && yy_aconf->spasswd) ||
2034 <         (yy_aconf->rsa_public_key && IsConfCryptLink(yy_aconf))))
2440 < #else /* !HAVE_LIBCRYPTO */
2441 <      if (yy_aconf->host && !IsConfCryptLink(yy_aconf) &&
2442 <          yy_aconf->passwd && yy_aconf->spasswd)
2443 < #endif /* !HAVE_LIBCRYPTO */
2444 <        {
2445 <          if (conf_add_server(yy_conf, class_name) == -1)
2446 <          {
2447 <            delete_conf_item(yy_conf);
2448 <            yy_conf = NULL;
2449 <            yy_aconf = NULL;
2450 <          }
2451 <        }
2452 <        else
2453 <        {
2454 <          /* Even if yy_conf ->name is NULL
2455 <           * should still unhook any hub/leaf confs still pending
2456 <           */
2457 <          unhook_hub_leaf_confs();
2458 <
2459 <          if (yy_conf->name != NULL)
2460 <          {
2461 < #ifndef HAVE_LIBCRYPTO
2462 <            if (IsConfCryptLink(yy_aconf))
2463 <              yyerror("Ignoring connect block -- no OpenSSL support");
2464 < #else
2465 <            if (IsConfCryptLink(yy_aconf) && !yy_aconf->rsa_public_key)
2466 <              yyerror("Ignoring connect block -- missing key");
2467 < #endif
2468 <            if (yy_aconf->host == NULL)
2469 <              yyerror("Ignoring connect block -- missing host");
2470 <            else if (!IsConfCryptLink(yy_aconf) &&
2471 <                    (!yy_aconf->passwd || !yy_aconf->spasswd))
2472 <              yyerror("Ignoring connect block -- missing password");
2473 <          }
2474 <
2475 <
2476 <          /* XXX
2477 <           * This fixes a try_connections() core (caused by invalid class_ptr
2478 <           * pointers) reported by metalrock. That's an ugly fix, but there
2479 <           * is currently no better way. The entire config subsystem needs an
2480 <           * rewrite ASAP. make_conf_item() shouldn't really add things onto
2481 <           * a doubly linked list immediately without any sanity checks!  -Michael
2482 <           */
2483 <          delete_conf_item(yy_conf);
2484 <
2485 <          yy_aconf = NULL;
2486 <          yy_conf = NULL;
2487 <        }
2488 <
2489 <      /*
2490 <       * yy_conf is still pointing at the server that is having
2491 <       * a connect block built for it. This means, y_aconf->name
2492 <       * points to the actual irc name this server will be known as.
2493 <       * Now this new server has a set or even just one hub_mask (or leaf_mask)
2494 <       * given in the link list at yy_hconf. Fill in the HUB confs
2495 <       * from this link list now.
2496 <       */        
2497 <      DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head)
2027 >    if (yy_aconf->host && yy_aconf->passwd && yy_aconf->spasswd)
2028 >    {
2029 >      if (conf_add_server(yy_conf, class_name) == -1)
2030 >        delete_conf_item(yy_conf);
2031 >    }
2032 >    else
2033 >    {
2034 >      if (yy_conf->name != NULL)
2035        {
2036 <        struct ConfItem *new_hub_conf;
2037 <        struct MatchItem *match_item;
2038 <
2039 <        yy_hconf = ptr->data;
2503 <
2504 <        /* yy_conf == NULL is a fatal error for this connect block! */
2505 <        if ((yy_conf != NULL) && (yy_conf->name != NULL))
2506 <        {
2507 <          new_hub_conf = make_conf_item(HUB_TYPE);
2508 <          match_item = (struct MatchItem *)map_to_conf(new_hub_conf);
2509 <          DupString(new_hub_conf->name, yy_conf->name);
2510 <          if (yy_hconf->user != NULL)
2511 <            DupString(match_item->user, yy_hconf->user);
2512 <          else
2513 <            DupString(match_item->user, "*");
2514 <          if (yy_hconf->host != NULL)
2515 <            DupString(match_item->host, yy_hconf->host);
2516 <          else
2517 <            DupString(match_item->host, "*");
2518 <        }
2519 <        dlinkDelete(&yy_hconf->node, &hub_conf_list);
2520 <        free_collect_item(yy_hconf);
2036 >        if (yy_aconf->host == NULL)
2037 >          yyerror("Ignoring connect block -- missing host");
2038 >        else if (!yy_aconf->passwd || !yy_aconf->spasswd)
2039 >          yyerror("Ignoring connect block -- missing password");
2040        }
2041  
2042 <      /* Ditto for the LEAF confs */
2043 <
2044 <      DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head)
2045 <      {
2046 <        struct ConfItem *new_leaf_conf;
2047 <        struct MatchItem *match_item;
2048 <
2049 <        yy_lconf = ptr->data;
2042 >      /* XXX
2043 >       * This fixes a try_connections() core (caused by invalid class_ptr
2044 >       * pointers) reported by metalrock. That's an ugly fix, but there
2045 >       * is currently no better way. The entire config subsystem needs an
2046 >       * rewrite ASAP. make_conf_item() shouldn't really add things onto
2047 >       * a doubly linked list immediately without any sanity checks!  -Michael
2048 >       */
2049 >      delete_conf_item(yy_conf);
2050 >    }
2051  
2052 <        if ((yy_conf != NULL) && (yy_conf->name != NULL))
2053 <        {
2054 <          new_leaf_conf = make_conf_item(LEAF_TYPE);
2055 <          match_item = (struct MatchItem *)map_to_conf(new_leaf_conf);
2536 <          DupString(new_leaf_conf->name, yy_conf->name);
2537 <          if (yy_lconf->user != NULL)
2538 <            DupString(match_item->user, yy_lconf->user);
2539 <          else
2540 <            DupString(match_item->user, "*");
2541 <          if (yy_lconf->host != NULL)
2542 <            DupString(match_item->host, yy_lconf->host);
2543 <          else
2544 <            DupString(match_item->host, "*");
2545 <        }
2546 <        dlinkDelete(&yy_lconf->node, &leaf_conf_list);
2547 <        free_collect_item(yy_lconf);
2548 <      }
2549 <      MyFree(class_name);
2550 <      class_name = NULL;
2551 <      yy_conf = NULL;
2552 <      yy_aconf = NULL;
2052 >    MyFree(class_name);
2053 >    class_name = NULL;
2054 >    yy_conf = NULL;
2055 >    yy_aconf = NULL;
2056    }
2057   };
2058  
2556 connect_name_b: | connect_name_t;
2059   connect_items:  connect_items connect_item | connect_item;
2060   connect_item:   connect_name | connect_host | connect_vhost |
2061                  connect_send_password | connect_accept_password |
2062 <                connect_aftype | connect_port |
2063 <                connect_fakename | connect_flags | connect_hub_mask |
2064 <                connect_leaf_mask | connect_class | connect_auto |
2065 <                connect_encrypted | connect_compressed | connect_cryptlink |
2564 <                connect_rsa_public_key_file | connect_cipher_preference |
2565 <                connect_topicburst | error ';' ;
2062 >                connect_aftype | connect_port | connect_ssl_cipher_list |
2063 >                connect_flags | connect_hub_mask | connect_leaf_mask |
2064 >                connect_class | connect_encrypted |
2065 >                error ';' ;
2066  
2067   connect_name: NAME '=' QSTRING ';'
2068   {
2069    if (conf_parser_ctx.pass == 2)
2070    {
2571    if (yy_conf->name != NULL)
2572      yyerror("Multiple connect name entry");
2573
2574    MyFree(yy_conf->name);
2575    DupString(yy_conf->name, yylval.string);
2576  }
2577 };
2578
2579 connect_name_t: QSTRING
2580 {
2581  if (conf_parser_ctx.pass == 2)
2582  {
2583    if (yy_conf->name != NULL)
2584      yyerror("Multiple connect name entry");
2585
2071      MyFree(yy_conf->name);
2072      DupString(yy_conf->name, yylval.string);
2073    }
# Line 2609 | Line 2094 | connect_vhost: VHOST '=' QSTRING ';'
2094      hints.ai_socktype = SOCK_STREAM;
2095      hints.ai_flags    = AI_PASSIVE | AI_NUMERICHOST;
2096  
2097 <    if (irc_getaddrinfo(yylval.string, NULL, &hints, &res))
2098 <      ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string);
2097 >    if (getaddrinfo(yylval.string, NULL, &hints, &res))
2098 >      ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
2099      else
2100      {
2101        assert(res != NULL);
2102  
2103 <      memcpy(&yy_aconf->my_ipnum, res->ai_addr, res->ai_addrlen);
2104 <      yy_aconf->my_ipnum.ss.ss_family = res->ai_family;
2105 <      yy_aconf->my_ipnum.ss_len = res->ai_addrlen;
2106 <      irc_freeaddrinfo(res);
2103 >      memcpy(&yy_aconf->bind, res->ai_addr, res->ai_addrlen);
2104 >      yy_aconf->bind.ss.ss_family = res->ai_family;
2105 >      yy_aconf->bind.ss_len = res->ai_addrlen;
2106 >      freeaddrinfo(res);
2107      }
2108    }
2109   };
# Line 2677 | Line 2162 | connect_aftype: AFTYPE '=' T_IPV4 ';'
2162   #endif
2163   };
2164  
2680 connect_fakename: FAKENAME '=' QSTRING ';'
2681 {
2682  if (conf_parser_ctx.pass == 2)
2683  {
2684    MyFree(yy_aconf->fakename);
2685    DupString(yy_aconf->fakename, yylval.string);
2686  }
2687 };
2688
2165   connect_flags: IRCD_FLAGS
2166   {
2167   } '='  connect_flags_items ';';
2168  
2169   connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2170 < connect_flags_item: NOT  { not_atom = 1; } connect_flags_item_atom
2695 <                        |  { not_atom = 0; } connect_flags_item_atom;
2696 <
2697 < connect_flags_item_atom: COMPRESSED
2698 < {
2699 <  if (conf_parser_ctx.pass == 2)
2700 < #ifndef HAVE_LIBZ
2701 <    yyerror("Ignoring flags = compressed; -- no zlib support");
2702 < #else
2703 < {
2704 <   if (not_atom)ClearConfCompressed(yy_aconf);
2705 <   else SetConfCompressed(yy_aconf);
2706 < }
2707 < #endif
2708 < } | CRYPTLINK
2709 < {
2710 <  if (conf_parser_ctx.pass == 2)
2711 <  {
2712 <    if (not_atom)ClearConfCryptLink(yy_aconf);
2713 <    else SetConfCryptLink(yy_aconf);
2714 <  }
2715 < } | AUTOCONN
2716 < {
2717 <  if (conf_parser_ctx.pass == 2)
2718 <  {
2719 <    if (not_atom)ClearConfAllowAutoConn(yy_aconf);
2720 <    else SetConfAllowAutoConn(yy_aconf);
2721 <  }
2722 < } | BURST_AWAY
2723 < {
2724 <  if (conf_parser_ctx.pass == 2)
2725 <  {
2726 <    if (not_atom)ClearConfAwayBurst(yy_aconf);
2727 <    else SetConfAwayBurst(yy_aconf);
2728 <  }
2729 < } | TOPICBURST
2170 > connect_flags_item: AUTOCONN
2171   {
2172    if (conf_parser_ctx.pass == 2)
2173 <  {
2174 <    if (not_atom)ClearConfTopicBurst(yy_aconf);
2734 <    else SetConfTopicBurst(yy_aconf);
2735 <  }
2736 < }
2737 < ;
2738 <
2739 < connect_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
2173 >    SetConfAllowAutoConn(yy_aconf);
2174 > } | T_SSL
2175   {
2741 #ifdef HAVE_LIBCRYPTO
2176    if (conf_parser_ctx.pass == 2)
2177 <  {
2744 <    BIO *file;
2745 <
2746 <    if (yy_aconf->rsa_public_key != NULL)
2747 <    {
2748 <      RSA_free(yy_aconf->rsa_public_key);
2749 <      yy_aconf->rsa_public_key = NULL;
2750 <    }
2751 <
2752 <    if (yy_aconf->rsa_public_key_file != NULL)
2753 <    {
2754 <      MyFree(yy_aconf->rsa_public_key_file);
2755 <      yy_aconf->rsa_public_key_file = NULL;
2756 <    }
2757 <
2758 <    DupString(yy_aconf->rsa_public_key_file, yylval.string);
2759 <
2760 <    if ((file = BIO_new_file(yylval.string, "r")) == NULL)
2761 <    {
2762 <      yyerror("Ignoring rsa_public_key_file -- file doesn't exist");
2763 <      break;
2764 <    }
2765 <
2766 <    yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL);
2767 <
2768 <    if (yy_aconf->rsa_public_key == NULL)
2769 <    {
2770 <      yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax.");
2771 <      break;
2772 <    }
2773 <      
2774 <    BIO_set_close(file, BIO_CLOSE);
2775 <    BIO_free(file);
2776 <  }
2777 < #endif /* HAVE_LIBCRYPTO */
2177 >    SetConfSSL(yy_aconf);
2178   };
2179  
2180   connect_encrypted: ENCRYPTED '=' TBOOL ';'
# Line 2788 | Line 2188 | connect_encrypted: ENCRYPTED '=' TBOOL '
2188    }
2189   };
2190  
2791 connect_cryptlink: CRYPTLINK '=' TBOOL ';'
2792 {
2793  if (conf_parser_ctx.pass == 2)
2794  {
2795    if (yylval.number)
2796      yy_aconf->flags |= CONF_FLAGS_CRYPTLINK;
2797    else
2798      yy_aconf->flags &= ~CONF_FLAGS_CRYPTLINK;
2799  }
2800 };
2801
2802 connect_compressed: COMPRESSED '=' TBOOL ';'
2803 {
2804  if (conf_parser_ctx.pass == 2)
2805  {
2806    if (yylval.number)
2807 #ifndef HAVE_LIBZ
2808      yyerror("Ignoring compressed=yes; -- no zlib support");
2809 #else
2810      yy_aconf->flags |= CONF_FLAGS_COMPRESSED;
2811 #endif
2812    else
2813      yy_aconf->flags &= ~CONF_FLAGS_COMPRESSED;
2814  }
2815 };
2816
2817 connect_auto: AUTOCONN '=' TBOOL ';'
2818 {
2819  if (conf_parser_ctx.pass == 2)
2820  {
2821    if (yylval.number)
2822      yy_aconf->flags |= CONF_FLAGS_ALLOW_AUTO_CONN;
2823    else
2824      yy_aconf->flags &= ~CONF_FLAGS_ALLOW_AUTO_CONN;
2825  }
2826 };
2827
2828 connect_topicburst: TOPICBURST '=' TBOOL ';'
2829 {
2830  if (conf_parser_ctx.pass == 2)
2831  {
2832    if (yylval.number)
2833      SetConfTopicBurst(yy_aconf);
2834    else
2835      ClearConfTopicBurst(yy_aconf);
2836  }
2837 };
2838
2191   connect_hub_mask: HUB_MASK '=' QSTRING ';'
2192   {
2193    if (conf_parser_ctx.pass == 2)
2194    {
2195 <    struct CollectItem *yy_tmp;
2195 >    char *mask;
2196  
2197 <    yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
2198 <    DupString(yy_tmp->host, yylval.string);
2847 <    DupString(yy_tmp->user, "*");
2848 <    dlinkAdd(yy_tmp, &yy_tmp->node, &hub_conf_list);
2197 >    DupString(mask, yylval.string);
2198 >    dlinkAdd(mask, make_dlink_node(), &yy_aconf->hub_list);
2199    }
2200   };
2201  
# Line 2853 | Line 2203 | connect_leaf_mask: LEAF_MASK '=' QSTRING
2203   {
2204    if (conf_parser_ctx.pass == 2)
2205    {
2206 <    struct CollectItem *yy_tmp;
2206 >    char *mask;
2207  
2208 <    yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
2209 <    DupString(yy_tmp->host, yylval.string);
2860 <    DupString(yy_tmp->user, "*");
2861 <    dlinkAdd(yy_tmp, &yy_tmp->node, &leaf_conf_list);
2208 >    DupString(mask, yylval.string);
2209 >    dlinkAdd(mask, make_dlink_node(), &yy_aconf->leaf_list);
2210    }
2211   };
2212  
# Line 2871 | Line 2219 | connect_class: CLASS '=' QSTRING ';'
2219    }
2220   };
2221  
2222 < connect_cipher_preference: CIPHER_PREFERENCE '=' QSTRING ';'
2222 > connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2223   {
2224   #ifdef HAVE_LIBCRYPTO
2225    if (conf_parser_ctx.pass == 2)
2226    {
2227 <    struct EncCapability *ecap;
2228 <    const char *cipher_name;
2881 <    int found = 0;
2882 <
2883 <    yy_aconf->cipher_preference = NULL;
2884 <    cipher_name = yylval.string;
2885 <
2886 <    for (ecap = CipherTable; ecap->name; ecap++)
2887 <    {
2888 <      if ((irccmp(ecap->name, cipher_name) == 0) &&
2889 <          (ecap->cap & CAP_ENC_MASK))
2890 <      {
2891 <        yy_aconf->cipher_preference = ecap;
2892 <        found = 1;
2893 <        break;
2894 <      }
2895 <    }
2896 <
2897 <    if (!found)
2898 <      yyerror("Invalid cipher");
2227 >    MyFree(yy_aconf->cipher_list);
2228 >    DupString(yy_aconf->cipher_list, yylval.string);
2229    }
2230   #else
2231    if (conf_parser_ctx.pass == 2)
2232 <    yyerror("Ignoring cipher_preference -- no OpenSSL support");
2232 >    yyerror("Ignoring connect::ciphers -- no OpenSSL support");
2233   #endif
2234   };
2235  
2236 +
2237   /***************************************************************************
2238   *  section kill
2239   ***************************************************************************/
# Line 2929 | Line 2260 | kill_entry: KILL
2260          if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) ||
2261              !(exp_host = ircd_pcre_compile(hostbuf, &errptr)))
2262          {
2263 <          ilog(L_ERROR, "Failed to add regular expression based K-Line: %s",
2263 >          ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: %s",
2264                 errptr);
2265            break;
2266          }
# Line 2938 | Line 2269 | kill_entry: KILL
2269          yy_aconf->regexuser = exp_user;
2270          yy_aconf->regexhost = exp_host;
2271  
2272 +        SetConfMain(yy_aconf);
2273 +
2274          DupString(yy_aconf->user, userbuf);
2275          DupString(yy_aconf->host, hostbuf);
2276  
# Line 2946 | Line 2279 | kill_entry: KILL
2279          else
2280            DupString(yy_aconf->reason, "No reason");
2281   #else
2282 <        ilog(L_ERROR, "Failed to add regular expression based K-Line: no PCRE support");
2282 >        ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: no PCRE support");
2283          break;
2284   #endif
2285        }
# Line 2954 | Line 2287 | kill_entry: KILL
2287        {
2288          yy_aconf = map_to_conf(make_conf_item(KLINE_TYPE));
2289  
2290 +        SetConfMain(yy_aconf);
2291 +
2292          DupString(yy_aconf->user, userbuf);
2293          DupString(yy_aconf->host, hostbuf);
2294  
# Line 2961 | Line 2296 | kill_entry: KILL
2296            DupString(yy_aconf->reason, reasonbuf);
2297          else
2298            DupString(yy_aconf->reason, "No reason");
2299 <        add_conf_by_address(CONF_KILL, yy_aconf);
2299 >        add_conf_by_address(CONF_KLINE, yy_aconf);
2300        }
2301      }
2302  
# Line 3023 | Line 2358 | deny_entry: DENY
2358      {
2359        yy_aconf = map_to_conf(make_conf_item(DLINE_TYPE));
2360        DupString(yy_aconf->host, hostbuf);
2361 +      SetConfMain(yy_aconf);
2362  
2363        if (reasonbuf[0])
2364          DupString(yy_aconf->reason, reasonbuf);
# Line 3096 | Line 2432 | gecos_entry: GECOS
2432  
2433          if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr)))
2434          {
2435 <          ilog(L_ERROR, "Failed to add regular expression based X-Line: %s",
2435 >          ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: %s",
2436                 errptr);
2437            break;
2438          }
# Line 3104 | Line 2440 | gecos_entry: GECOS
2440          yy_conf = make_conf_item(RXLINE_TYPE);
2441          yy_conf->regexpname = exp_p;
2442   #else
2443 <        ilog(L_ERROR, "Failed to add regular expression based X-Line: no PCRE support");
2443 >        ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: no PCRE support");
2444          break;
2445   #endif
2446        }
2447        else
2448          yy_conf = make_conf_item(XLINE_TYPE);
2449  
2450 +      SetConfMain(yy_conf);
2451        yy_match_item = map_to_conf(yy_conf);
2452        DupString(yy_conf->name, gecos_name);
2453  
# Line 3160 | Line 2497 | general_item:       general_hide_spoof_i
2497                      general_max_nick_time | general_max_nick_changes |
2498                      general_max_accept | general_anti_spam_exit_message_time |
2499                      general_ts_warn_delta | general_ts_max_delta |
2500 <                    general_kill_chase_time_limit | general_kline_with_reason |
2501 <                    general_kline_reason | general_invisible_on_connect |
2500 >                    general_kill_chase_time_limit |
2501 >                    general_invisible_on_connect |
2502                      general_warn_no_nline | general_dots_in_ident |
2503                      general_stats_o_oper_only | general_stats_k_oper_only |
2504                      general_pace_wait | general_stats_i_oper_only |
2505                      general_pace_wait_simple | general_stats_P_oper_only |
2506                      general_short_motd | general_no_oper_flood |
2507                      general_true_no_oper_flood | general_oper_pass_resv |
2508 <                    general_idletime | general_message_locale |
2508 >                    general_message_locale |
2509                      general_oper_only_umodes | general_max_targets |
2510                      general_use_egd | general_egdpool_path |
2511                      general_oper_umodes | general_caller_id_wait |
2512                      general_opers_bypass_callerid | general_default_floodcount |
2513                      general_min_nonwildcard | general_min_nonwildcard_simple |
2514 <                    general_servlink_path | general_disable_remote_commands |
3178 <                    general_default_cipher_preference |
3179 <                    general_compression_level | general_client_flood |
2514 >                    general_disable_remote_commands |
2515                      general_throttle_time | general_havent_read_conf |
2516                      general_ping_cookie |
2517 <                    general_disable_auth | general_burst_away |
2518 <                    general_tkline_expire_notices | general_gline_min_cidr |
2519 <                    general_gline_min_cidr6 | general_use_whois_actually |
2520 <                    general_reject_hold_time | general_stats_e_disabled |
2521 <                    general_max_watch |
2517 >                    general_disable_auth |
2518 >                    general_tkline_expire_notices | general_gline_enable |
2519 >                    general_gline_duration | general_gline_request_duration |
2520 >                    general_gline_min_cidr |
2521 >                    general_gline_min_cidr6 |
2522 >                    general_stats_e_disabled |
2523 >                    general_max_watch | general_services_name |
2524                      error;
2525  
2526  
# Line 3192 | Line 2529 | general_max_watch: MAX_WATCH '=' NUMBER
2529    ConfigFileEntry.max_watch = $3;
2530   };
2531  
2532 < general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2532 > general_gline_enable: GLINE_ENABLE '=' TBOOL ';'
2533   {
2534 <  ConfigFileEntry.gline_min_cidr = $3;
2534 >  if (conf_parser_ctx.pass == 2)
2535 >    ConfigFileEntry.glines = yylval.number;
2536   };
2537  
2538 < general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';'
2538 > general_gline_duration: GLINE_DURATION '=' timespec ';'
2539   {
2540 <  ConfigFileEntry.gline_min_cidr6 = $3;
2540 >  if (conf_parser_ctx.pass == 2)
2541 >    ConfigFileEntry.gline_time = $3;
2542   };
2543  
2544 < general_burst_away: BURST_AWAY '=' TBOOL ';'
2544 > general_gline_request_duration: GLINE_REQUEST_DURATION '=' timespec ';'
2545   {
2546 <  ConfigFileEntry.burst_away = yylval.number;
2546 >  if (conf_parser_ctx.pass == 2)
2547 >    ConfigFileEntry.gline_request_time = $3;
2548   };
2549  
2550 < general_use_whois_actually: USE_WHOIS_ACTUALLY '=' TBOOL ';'
2550 > general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2551   {
2552 <  ConfigFileEntry.use_whois_actually = yylval.number;
2552 >  ConfigFileEntry.gline_min_cidr = $3;
2553   };
2554  
2555 < general_reject_hold_time: TREJECT_HOLD_TIME '=' timespec ';'
2555 > general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';'
2556   {
2557 <  GlobalSetOptions.rejecttime = yylval.number;
2557 >  ConfigFileEntry.gline_min_cidr6 = $3;
2558   };
2559  
2560   general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
# Line 3287 | Line 2627 | general_havent_read_conf: HAVENT_READ_CO
2627   {
2628    if (($3 > 0) && conf_parser_ctx.pass == 1)
2629    {
2630 <    ilog(L_CRIT, "You haven't read your config file properly.");
2631 <    ilog(L_CRIT, "There is a line in the example conf that will kill your server if not removed.");
2632 <    ilog(L_CRIT, "Consider actually reading/editing the conf file, and removing this line.");
2630 >    ilog(LOG_TYPE_IRCD, "You haven't read your config file properly.");
2631 >    ilog(LOG_TYPE_IRCD, "There is a line in the example conf that will kill your server if not removed.");
2632 >    ilog(LOG_TYPE_IRCD, "Consider actually reading/editing the conf file, and removing this line.");
2633      exit(0);
2634    }
2635   };
2636  
3297 general_kline_with_reason: KLINE_WITH_REASON '=' TBOOL ';'
3298 {
3299  ConfigFileEntry.kline_with_reason = yylval.number;
3300 };
3301
3302 general_kline_reason: KLINE_REASON '=' QSTRING ';'
3303 {
3304  if (conf_parser_ctx.pass == 2)
3305  {
3306    MyFree(ConfigFileEntry.kline_reason);
3307    DupString(ConfigFileEntry.kline_reason, yylval.string);
3308  }
3309 };
3310
2637   general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2638   {
2639    ConfigFileEntry.invisible_on_connect = yylval.number;
# Line 3400 | Line 2726 | general_message_locale: MESSAGE_LOCALE '
2726    }
2727   };
2728  
3403 general_idletime: IDLETIME '=' timespec ';'
3404 {
3405  ConfigFileEntry.idletime = $3;
3406 };
3407
2729   general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
2730   {
2731    ConfigFileEntry.dots_in_ident = $3;
# Line 3415 | Line 2736 | general_max_targets: MAX_TARGETS '=' NUM
2736    ConfigFileEntry.max_targets = $3;
2737   };
2738  
3418 general_servlink_path: SERVLINK_PATH '=' QSTRING ';'
3419 {
3420  if (conf_parser_ctx.pass == 2)
3421  {
3422    MyFree(ConfigFileEntry.servlink_path);
3423    DupString(ConfigFileEntry.servlink_path, yylval.string);
3424  }
3425 };
3426
3427 general_default_cipher_preference: DEFAULT_CIPHER_PREFERENCE '=' QSTRING ';'
3428 {
3429 #ifdef HAVE_LIBCRYPTO
3430  if (conf_parser_ctx.pass == 2)
3431  {
3432    struct EncCapability *ecap;
3433    const char *cipher_name;
3434    int found = 0;
3435
3436    ConfigFileEntry.default_cipher_preference = NULL;
3437    cipher_name = yylval.string;
3438
3439    for (ecap = CipherTable; ecap->name; ecap++)
3440    {
3441      if ((irccmp(ecap->name, cipher_name) == 0) &&
3442          (ecap->cap & CAP_ENC_MASK))
3443      {
3444        ConfigFileEntry.default_cipher_preference = ecap;
3445        found = 1;
3446        break;
3447      }
3448    }
3449
3450    if (!found)
3451      yyerror("Invalid cipher");
3452  }
3453 #else
3454  if (conf_parser_ctx.pass == 2)
3455    yyerror("Ignoring default_cipher_preference -- no OpenSSL support");
3456 #endif
3457 };
3458
3459 general_compression_level: COMPRESSION_LEVEL '=' NUMBER ';'
3460 {
3461  if (conf_parser_ctx.pass == 2)
3462  {
3463    ConfigFileEntry.compression_level = $3;
3464 #ifndef HAVE_LIBZ
3465    yyerror("Ignoring compression_level -- no zlib support");
3466 #else
3467    if ((ConfigFileEntry.compression_level < 1) ||
3468        (ConfigFileEntry.compression_level > 9))
3469    {
3470      yyerror("Ignoring invalid compression_level, using default");
3471      ConfigFileEntry.compression_level = 0;
3472    }
3473 #endif
3474  }
3475 };
3476
2739   general_use_egd: USE_EGD '=' TBOOL ';'
2740   {
2741    ConfigFileEntry.use_egd = yylval.number;
# Line 3488 | Line 2750 | general_egdpool_path: EGDPOOL_PATH '=' Q
2750    }
2751   };
2752  
2753 + general_services_name: T_SERVICES_NAME '=' QSTRING ';'
2754 + {
2755 +  if (conf_parser_ctx.pass == 2 && valid_servname(yylval.string))
2756 +  {
2757 +    MyFree(ConfigFileEntry.service_name);
2758 +    DupString(ConfigFileEntry.service_name, yylval.string);
2759 +  }
2760 + };
2761 +
2762   general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2763   {
2764    ConfigFileEntry.ping_cookie = yylval.number;
# Line 3527 | Line 2798 | umode_oitem:     T_BOTS
2798   } | T_FULL
2799   {
2800    ConfigFileEntry.oper_umodes |= UMODE_FULL;
2801 + } | HIDDEN
2802 + {
2803 +  ConfigFileEntry.oper_umodes |= UMODE_HIDDEN;
2804   } | T_SKILL
2805   {
2806    ConfigFileEntry.oper_umodes |= UMODE_SKILL;
# Line 3595 | Line 2869 | umode_item:    T_BOTS
2869   } | T_SKILL
2870   {
2871    ConfigFileEntry.oper_only_umodes |= UMODE_SKILL;
2872 + } | HIDDEN
2873 + {
2874 +  ConfigFileEntry.oper_only_umodes |= UMODE_HIDDEN;
2875   } | T_NCHANGE
2876   {
2877    ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE;
# Line 3648 | Line 2925 | general_default_floodcount: DEFAULT_FLOO
2925    ConfigFileEntry.default_floodcount = $3;
2926   };
2927  
3651 general_client_flood: T_CLIENT_FLOOD '=' sizespec ';'
3652 {
3653  ConfigFileEntry.client_flood = $3;
3654 };
3655
3656
3657 /***************************************************************************
3658 *  section glines
3659 ***************************************************************************/
3660 gline_entry: GLINES
3661 {
3662  if (conf_parser_ctx.pass == 2)
3663  {
3664    yy_conf = make_conf_item(GDENY_TYPE);
3665    yy_aconf = map_to_conf(yy_conf);
3666  }
3667 } '{' gline_items '}' ';'
3668 {
3669  if (conf_parser_ctx.pass == 2)
3670  {
3671    /*
3672     * since we re-allocate yy_conf/yy_aconf after the end of action=, at the
3673     * end we will have one extra, so we should free it.
3674     */
3675    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3676    {
3677      delete_conf_item(yy_conf);
3678      yy_conf = NULL;
3679      yy_aconf = NULL;
3680    }
3681  }
3682 };
3683
3684 gline_items:        gline_items gline_item | gline_item;
3685 gline_item:         gline_enable |
3686                    gline_duration |
3687                    gline_logging |
3688                    gline_user |
3689                    gline_server |
3690                    gline_action |
3691                    error;
3692
3693 gline_enable: ENABLE '=' TBOOL ';'
3694 {
3695  if (conf_parser_ctx.pass == 2)
3696    ConfigFileEntry.glines = yylval.number;
3697 };
3698
3699 gline_duration: DURATION '=' timespec ';'
3700 {
3701  if (conf_parser_ctx.pass == 2)
3702    ConfigFileEntry.gline_time = $3;
3703 };
3704
3705 gline_logging: LOGGING
3706 {
3707  if (conf_parser_ctx.pass == 2)
3708    ConfigFileEntry.gline_logging = 0;
3709 } '=' gline_logging_types ';';
3710 gline_logging_types:     gline_logging_types ',' gline_logging_type_item | gline_logging_type_item;
3711 gline_logging_type_item: T_REJECT
3712 {
3713  if (conf_parser_ctx.pass == 2)
3714    ConfigFileEntry.gline_logging |= GDENY_REJECT;
3715 } | T_BLOCK
3716 {
3717  if (conf_parser_ctx.pass == 2)
3718    ConfigFileEntry.gline_logging |= GDENY_BLOCK;
3719 };
3720
3721 gline_user: USER '=' QSTRING ';'
3722 {
3723  if (conf_parser_ctx.pass == 2)
3724  {
3725    struct split_nuh_item nuh;
3726
3727    nuh.nuhmask  = yylval.string;
3728    nuh.nickptr  = NULL;
3729    nuh.userptr  = userbuf;
3730    nuh.hostptr  = hostbuf;
3731
3732    nuh.nicksize = 0;
3733    nuh.usersize = sizeof(userbuf);
3734    nuh.hostsize = sizeof(hostbuf);
3735
3736    split_nuh(&nuh);
3737
3738    if (yy_aconf->user == NULL)
3739    {
3740      DupString(yy_aconf->user, userbuf);
3741      DupString(yy_aconf->host, hostbuf);
3742    }
3743    else
3744    {
3745      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
3746
3747      DupString(yy_tmp->user, userbuf);
3748      DupString(yy_tmp->host, hostbuf);
3749
3750      dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
3751    }
3752  }
3753 };
3754
3755 gline_server: NAME '=' QSTRING ';'
3756 {
3757  if (conf_parser_ctx.pass == 2)  
3758  {
3759    MyFree(yy_conf->name);
3760    DupString(yy_conf->name, yylval.string);
3761  }
3762 };
3763
3764 gline_action: ACTION
3765 {
3766  if (conf_parser_ctx.pass == 2)
3767    yy_aconf->flags = 0;
3768 } '=' gdeny_types ';'
3769 {
3770  if (conf_parser_ctx.pass == 2)
3771  {
3772    struct CollectItem *yy_tmp = NULL;
3773    dlink_node *ptr, *next_ptr;
3774
3775    DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
3776    {
3777      struct AccessItem *new_aconf;
3778      struct ConfItem *new_conf;
3779
3780      yy_tmp = ptr->data;
3781      new_conf = make_conf_item(GDENY_TYPE);
3782      new_aconf = map_to_conf(new_conf);
3783
3784      new_aconf->flags = yy_aconf->flags;
3785
3786      if (yy_conf->name != NULL)
3787        DupString(new_conf->name, yy_conf->name);
3788      else
3789        DupString(new_conf->name, "*");
3790      if (yy_aconf->user != NULL)
3791         DupString(new_aconf->user, yy_tmp->user);
3792      else  
3793        DupString(new_aconf->user, "*");
3794      if (yy_aconf->host != NULL)
3795        DupString(new_aconf->host, yy_tmp->host);
3796      else
3797        DupString(new_aconf->host, "*");
3798
3799      dlinkDelete(&yy_tmp->node, &col_conf_list);
3800    }
3801
3802    /*
3803     * In case someone has fed us with more than one action= after user/name
3804     * which would leak memory  -Michael
3805     */
3806    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3807      delete_conf_item(yy_conf);
3808
3809    yy_conf = make_conf_item(GDENY_TYPE);
3810    yy_aconf = map_to_conf(yy_conf);
3811  }
3812 };
3813
3814 gdeny_types: gdeny_types ',' gdeny_type_item | gdeny_type_item;
3815 gdeny_type_item: T_REJECT
3816 {
3817  if (conf_parser_ctx.pass == 2)
3818    yy_aconf->flags |= GDENY_REJECT;
3819 } | T_BLOCK
3820 {
3821  if (conf_parser_ctx.pass == 2)
3822    yy_aconf->flags |= GDENY_BLOCK;
3823 };
2928  
2929   /***************************************************************************
2930   *  section channel
# Line 3829 | Line 2933 | channel_entry: CHANNEL
2933    '{' channel_items '}' ';';
2934  
2935   channel_items:      channel_items channel_item | channel_item;
2936 < channel_item:       channel_disable_local_channels | channel_use_except |
2937 <                    channel_use_invex | channel_use_knock |
2938 <                    channel_max_bans | channel_knock_delay |
3835 <                    channel_knock_delay_channel | channel_max_chans_per_user |
2936 > channel_item:       channel_max_bans |
2937 >                    channel_knock_delay | channel_knock_delay_channel |
2938 >                    channel_max_chans_per_user | channel_max_chans_per_oper |
2939                      channel_quiet_on_ban | channel_default_split_user_count |
2940                      channel_default_split_server_count |
2941                      channel_no_create_on_split | channel_restrict_channels |
2942 <                    channel_no_join_on_split | channel_burst_topicwho |
2942 >                    channel_no_join_on_split |
2943                      channel_jflood_count | channel_jflood_time |
2944                      channel_disable_fake_channels | error;
2945  
# Line 3850 | Line 2953 | channel_restrict_channels: RESTRICT_CHAN
2953    ConfigChannel.restrict_channels = yylval.number;
2954   };
2955  
3853 channel_disable_local_channels: DISABLE_LOCAL_CHANNELS '=' TBOOL ';'
3854 {
3855  ConfigChannel.disable_local_channels = yylval.number;
3856 };
3857
3858 channel_use_except: USE_EXCEPT '=' TBOOL ';'
3859 {
3860  ConfigChannel.use_except = yylval.number;
3861 };
3862
3863 channel_use_invex: USE_INVEX '=' TBOOL ';'
3864 {
3865  ConfigChannel.use_invex = yylval.number;
3866 };
3867
3868 channel_use_knock: USE_KNOCK '=' TBOOL ';'
3869 {
3870  ConfigChannel.use_knock = yylval.number;
3871 };
3872
2956   channel_knock_delay: KNOCK_DELAY '=' timespec ';'
2957   {
2958    ConfigChannel.knock_delay = $3;
# Line 3885 | Line 2968 | channel_max_chans_per_user: MAX_CHANS_PE
2968    ConfigChannel.max_chans_per_user = $3;
2969   };
2970  
2971 + channel_max_chans_per_oper: MAX_CHANS_PER_OPER '=' NUMBER ';'
2972 + {
2973 +  ConfigChannel.max_chans_per_oper = $3;
2974 + };
2975 +
2976   channel_quiet_on_ban: QUIET_ON_BAN '=' TBOOL ';'
2977   {
2978    ConfigChannel.quiet_on_ban = yylval.number;
# Line 3915 | Line 3003 | channel_no_join_on_split: NO_JOIN_ON_SPL
3003    ConfigChannel.no_join_on_split = yylval.number;
3004   };
3005  
3918 channel_burst_topicwho: BURST_TOPICWHO '=' TBOOL ';'
3919 {
3920  ConfigChannel.burst_topicwho = yylval.number;
3921 };
3922
3006   channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
3007   {
3008    GlobalSetOptions.joinfloodcount = yylval.number;
# Line 3939 | Line 3022 | serverhide_entry: SERVERHIDE
3022   serverhide_items:   serverhide_items serverhide_item | serverhide_item;
3023   serverhide_item:    serverhide_flatten_links | serverhide_hide_servers |
3024                      serverhide_links_delay |
3942                    serverhide_disable_hidden |
3025                      serverhide_hidden | serverhide_hidden_name |
3026                      serverhide_hide_server_ips |
3027                      error;
# Line 3985 | Line 3067 | serverhide_hidden: HIDDEN '=' TBOOL ';'
3067      ConfigServerHide.hidden = yylval.number;
3068   };
3069  
3988 serverhide_disable_hidden: DISABLE_HIDDEN '=' TBOOL ';'
3989 {
3990  if (conf_parser_ctx.pass == 2)
3991    ConfigServerHide.disable_hidden = yylval.number;
3992 };
3993
3070   serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';'
3071   {
3072    if (conf_parser_ctx.pass == 2)

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)