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-8/src/conf_parser.y (file contents):
Revision 1309 by michael, Sun Mar 25 11:24:18 2012 UTC vs.
Revision 1549 by michael, Mon Oct 1 18:11:11 2012 UTC

# Line 55 | Line 55
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];
# Line 105 | Line 105 | free_collect_item(struct CollectItem *it
105    MyFree(item);
106   }
107  
108 static void
109 unhook_hub_leaf_confs(void)
110 {
111  dlink_node *ptr;
112  dlink_node *next_ptr;
113  struct CollectItem *yy_hconf;
114  struct CollectItem *yy_lconf;
115
116  DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head)
117  {
118    yy_hconf = ptr->data;
119    dlinkDelete(&yy_hconf->node, &hub_conf_list);
120    free_collect_item(yy_hconf);
121  }
122
123  DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head)
124  {
125    yy_lconf = ptr->data;
126    dlinkDelete(&yy_lconf->node, &leaf_conf_list);
127    free_collect_item(yy_lconf);
128  }
129 }
130
108   %}
109  
110   %union {
# Line 136 | Line 113 | unhook_hub_leaf_confs(void)
113   }
114  
115   %token  ACCEPT_PASSWORD
139 %token  ACTION
116   %token  ADMIN
117   %token  AFTYPE
142 %token  T_ALLOW
118   %token  ANTI_NICK_FLOOD
119   %token  ANTI_SPAM_EXIT_MESSAGE_TIME
120   %token  AUTOCONN
121 < %token  T_BLOCK
147 < %token  BURST_AWAY
148 < %token  BURST_TOPICWHO
149 < %token  BYTES KBYTES MBYTES GBYTES TBYTES
121 > %token  BYTES KBYTES MBYTES
122   %token  CALLER_ID_WAIT
123   %token  CAN_FLOOD
124   %token  CHANNEL
# Line 163 | Line 135 | unhook_hub_leaf_confs(void)
135   %token  DIE
136   %token  DISABLE_AUTH
137   %token  DISABLE_FAKE_CHANNELS
166 %token  DISABLE_HIDDEN
167 %token  DISABLE_LOCAL_CHANNELS
138   %token  DISABLE_REMOTE_COMMANDS
139   %token  DOTS_IN_IDENT
170 %token  DURATION
140   %token  EGDPOOL_PATH
141   %token  EMAIL
173 %token  ENABLE
142   %token  ENCRYPTED
143   %token  EXCEED_LIMIT
144   %token  EXEMPT
# Line 180 | Line 148 | unhook_hub_leaf_confs(void)
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_TIME
154 > %token  GLINE_REQUEST_DURATION
155   %token  GLINE_MIN_CIDR
156   %token  GLINE_MIN_CIDR6
157   %token  GLOBAL_KILL
# Line 204 | Line 173 | unhook_hub_leaf_confs(void)
173   %token  KILL_CHASE_TIME_LIMIT
174   %token  KLINE
175   %token  KLINE_EXEMPT
207 %token  KLINE_REASON
208 %token  KLINE_WITH_REASON
176   %token  KNOCK_DELAY
177   %token  KNOCK_DELAY_CHANNEL
178   %token  LEAF_MASK
# Line 214 | Line 181 | unhook_hub_leaf_confs(void)
181   %token  T_LOG
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 239 | Line 207 | unhook_hub_leaf_confs(void)
207   %token  NO_OPER_FLOOD
208   %token  NO_TILDE
209   %token  NUMBER
242 %token  NUMBER_PER_IDENT
210   %token  NUMBER_PER_CIDR
211   %token  NUMBER_PER_IP
245 %token  NUMBER_PER_IP_GLOBAL
212   %token  OPERATOR
213   %token  OPERS_BYPASS_CALLERID
214   %token  OPER_ONLY_UMODES
# Line 266 | Line 232 | unhook_hub_leaf_confs(void)
232   %token  REDIRSERV
233   %token  REGEX_T
234   %token  REHASH
269 %token  TREJECT_HOLD_TIME
235   %token  REMOTE
236   %token  REMOTEBAN
237   %token  RESTRICT_CHANNELS
273 %token  RESTRICTED
238   %token  RSA_PRIVATE_KEY_FILE
239   %token  RSA_PUBLIC_KEY_FILE
240   %token  SSL_CERTIFICATE_FILE
241   %token  SSL_DH_PARAM_FILE
242 < %token  T_SSL_CONNECTION_METHOD
242 > %token  T_SSL_CLIENT_METHOD
243 > %token  T_SSL_SERVER_METHOD
244   %token  T_SSLV3
245   %token  T_TLSV1
246   %token  RESV
# Line 291 | Line 256 | unhook_hub_leaf_confs(void)
256   %token  T_CLUSTER
257   %token  TYPE
258   %token  SHORT_MOTD
294 %token  SILENT
259   %token  SPOOF
260   %token  SPOOF_NOTICE
261   %token  STATS_E_DISABLED
# Line 301 | Line 265 | unhook_hub_leaf_confs(void)
265   %token  STATS_P_OPER_ONLY
266   %token  TBOOL
267   %token  TMASKED
304 %token  T_REJECT
268   %token  TS_MAX_DELTA
269   %token  TS_WARN_DELTA
270   %token  TWODOTS
# Line 312 | Line 275 | unhook_hub_leaf_confs(void)
275   %token  T_CCONN
276   %token  T_CCONN_FULL
277   %token  T_SSL_CIPHER_LIST
315 %token  T_CLIENT_FLOOD
278   %token  T_DEAF
279   %token  T_DEBUG
280   %token  T_DLINE
319 %token  T_DRONE
281   %token  T_EXTERNAL
282   %token  T_FULL
283   %token  T_INVISIBLE
# Line 326 | Line 287 | unhook_hub_leaf_confs(void)
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
# Line 343 | Line 306 | unhook_hub_leaf_confs(void)
306   %token  T_RESTART
307   %token  T_SERVICE
308   %token  T_SERVICES_NAME
346 %token  T_TIMESTAMP
309   %token  THROTTLE_TIME
348 %token  TOPICBURST
310   %token  TRUE_NO_OPER_FLOOD
350 %token  TKLINE
351 %token  TXLINE
352 %token  TRESV
311   %token  UNKLINE
312   %token  USER
313   %token  USE_EGD
356 %token  USE_EXCEPT
357 %token  USE_INVEX
358 %token  USE_KNOCK
314   %token  USE_LOGGING
360 %token  USE_WHOIS_ACTUALLY
315   %token  VHOST
316   %token  VHOST6
317   %token  XLINE
364 %token  WARN
318   %token  WARN_NO_NLINE
319   %token  T_SIZE
320   %token  T_FILE
# Line 396 | Line 349 | conf_item:        admin_entry
349                  | deny_entry
350                  | exempt_entry
351                  | general_entry
399                | gline_entry
352                  | gecos_entry
353                  | modules_entry
354                  | error ';'
# Line 470 | Line 422 | serverinfo_item:        serverinfo_name
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 | serverinfo_ssl_cipher_list |
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 <  {
488 <    if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_SSLV3))
489 <    {
490 <      SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3);
491 <      SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv3);
492 <    }
493 <
494 <    if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_TLSV1))
495 <    {
496 <      SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1);
497 <      SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_NO_TLSv1);
498 <    }
499 <  }
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 629 | Line 574 | serverinfo_ssl_dh_param_file: SSL_DH_PAR
574  
575        if (dh)
576        {
577 <        SSL_CTX_set_tmp_dh(ServerInfo.server_ctx, dh);
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      }
# Line 641 | Line 590 | serverinfo_ssl_cipher_list: T_SSL_CIPHER
590   {
591   #ifdef HAVE_LIBCRYPTO
592    if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
644  {
593      SSL_CTX_set_cipher_list(ServerInfo.server_ctx, yylval.string);
646  }
594   #endif
595   };
596  
# Line 838 | Line 785 | admin_description: DESCRIPTION '=' QSTRI
785   logging_entry:          T_LOG  '{' logging_items '}' ';' ;
786   logging_items:          logging_items logging_item | logging_item ;
787  
788 < logging_item:           logging_use_logging | logging_timestamp | logging_file_entry |
788 > logging_item:           logging_use_logging | logging_file_entry |
789                          error ';' ;
790  
791   logging_use_logging: USE_LOGGING '=' TBOOL ';'
# Line 847 | Line 794 | logging_use_logging: USE_LOGGING '=' TBO
794      ConfigLoggingEntry.use_logging = yylval.number;
795   };
796  
850 logging_timestamp: T_TIMESTAMP '=' TBOOL ';'
851 {
852  if (conf_parser_ctx.pass == 2)
853    ConfigLoggingEntry.timestamp = yylval.number;
854 };
855
797   logging_file_entry:
798   {
799    lfile[0] = '\0';
# Line 973 | Line 914 | oper_entry: OPERATOR
914        else
915          DupString(new_aconf->host, "*");
916  
917 <      new_aconf->type = parse_netmask(new_aconf->host, &new_aconf->ipnum,
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);
# Line 990 | 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 1031 | Line 972 | oper_name: NAME '=' QSTRING ';'
972   {
973    if (conf_parser_ctx.pass == 2)
974    {
1034    if (strlen(yylval.string) > OPERNICKLEN)
1035      yylval.string[OPERNICKLEN] = '\0';
1036
975      MyFree(yy_conf->name);
976      DupString(yy_conf->name, yylval.string);
977    }
# Line 1061 | Line 999 | oper_user: USER '=' QSTRING ';'
999        DupString(yy_aconf->user, userbuf);
1000        DupString(yy_aconf->host, hostbuf);
1001  
1002 <      yy_aconf->type = parse_netmask(yy_aconf->host, &yy_aconf->ipnum,
1002 >      yy_aconf->type = parse_netmask(yy_aconf->host, &yy_aconf->addr,
1003                                      &yy_aconf->bits);
1004      }
1005      else
# Line 1127 | 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 1314 | Line 1252 | oper_flags_item: GLOBAL_KILL
1252   {
1253    if (conf_parser_ctx.pass == 2)
1254      yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1255 + } | T_SET
1256 + {
1257 +  if (conf_parser_ctx.pass == 2)
1258 +    yy_aconf->port |= OPER_FLAG_SET;
1259   } | MODULE
1260   {
1261    if (conf_parser_ctx.pass == 2)
# Line 1386 | 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 1401 | Line 1343 | class_name: NAME '=' QSTRING ';'
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 1682 | Line 1631 | auth_user: USER '=' QSTRING ';'
1631    }
1632   };
1633  
1685 /* XXX - IP/IPV6 tags don't exist anymore - put IP/IPV6 into user. */
1686
1634   auth_passwd: PASSWORD '=' QSTRING ';'
1635   {
1636    if (conf_parser_ctx.pass == 2)
# Line 1760 | Line 1707 | auth_flags_item: SPOOF_NOTICE
1707      yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
1708   };
1709  
1763 /* 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(LOG_TYPE_IRCD, "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 2078 | Line 2024 | connect_entry: CONNECT
2024   {
2025    if (conf_parser_ctx.pass == 2)
2026    {
2027 <    struct CollectItem *yy_hconf=NULL;
2082 <    struct CollectItem *yy_lconf=NULL;
2083 <    dlink_node *ptr = NULL, *next_ptr = NULL;
2084 <
2085 <    if (yy_aconf->host &&
2086 <        yy_aconf->passwd && yy_aconf->spasswd)
2027 >    if (yy_aconf->host && yy_aconf->passwd && yy_aconf->spasswd)
2028      {
2029        if (conf_add_server(yy_conf, class_name) == -1)
2089      {
2030          delete_conf_item(yy_conf);
2091        yy_conf = NULL;
2092        yy_aconf = NULL;
2093      }
2031      }
2032      else
2033      {
2097      /* Even if yy_conf ->name is NULL
2098       * should still unhook any hub/leaf confs still pending
2099       */
2100      unhook_hub_leaf_confs();
2101
2034        if (yy_conf->name != NULL)
2035        {
2036          if (yy_aconf->host == NULL)
# Line 2107 | Line 2039 | connect_entry: CONNECT
2039            yyerror("Ignoring connect block -- missing password");
2040        }
2041  
2110
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
# Line 2116 | Line 2047 | connect_entry: CONNECT
2047         * a doubly linked list immediately without any sanity checks!  -Michael
2048         */
2049        delete_conf_item(yy_conf);
2119
2120      yy_aconf = NULL;
2121      yy_conf = NULL;
2050      }
2051  
2052 <      /*
2053 <       * yy_conf is still pointing at the server that is having
2054 <       * a connect block built for it. This means, y_aconf->name
2055 <       * points to the actual irc name this server will be known as.
2128 <       * Now this new server has a set or even just one hub_mask (or leaf_mask)
2129 <       * given in the link list at yy_hconf. Fill in the HUB confs
2130 <       * from this link list now.
2131 <       */        
2132 <      DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head)
2133 <      {
2134 <        struct ConfItem *new_hub_conf;
2135 <        struct MatchItem *match_item;
2136 <
2137 <        yy_hconf = ptr->data;
2138 <
2139 <        /* yy_conf == NULL is a fatal error for this connect block! */
2140 <        if ((yy_conf != NULL) && (yy_conf->name != NULL))
2141 <        {
2142 <          new_hub_conf = make_conf_item(HUB_TYPE);
2143 <          match_item = (struct MatchItem *)map_to_conf(new_hub_conf);
2144 <          DupString(new_hub_conf->name, yy_conf->name);
2145 <          if (yy_hconf->user != NULL)
2146 <            DupString(match_item->user, yy_hconf->user);
2147 <          else
2148 <            DupString(match_item->user, "*");
2149 <          if (yy_hconf->host != NULL)
2150 <            DupString(match_item->host, yy_hconf->host);
2151 <          else
2152 <            DupString(match_item->host, "*");
2153 <        }
2154 <        dlinkDelete(&yy_hconf->node, &hub_conf_list);
2155 <        free_collect_item(yy_hconf);
2156 <      }
2157 <
2158 <      /* Ditto for the LEAF confs */
2159 <
2160 <      DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head)
2161 <      {
2162 <        struct ConfItem *new_leaf_conf;
2163 <        struct MatchItem *match_item;
2164 <
2165 <        yy_lconf = ptr->data;
2166 <
2167 <        if ((yy_conf != NULL) && (yy_conf->name != NULL))
2168 <        {
2169 <          new_leaf_conf = make_conf_item(LEAF_TYPE);
2170 <          match_item = (struct MatchItem *)map_to_conf(new_leaf_conf);
2171 <          DupString(new_leaf_conf->name, yy_conf->name);
2172 <          if (yy_lconf->user != NULL)
2173 <            DupString(match_item->user, yy_lconf->user);
2174 <          else
2175 <            DupString(match_item->user, "*");
2176 <          if (yy_lconf->host != NULL)
2177 <            DupString(match_item->host, yy_lconf->host);
2178 <          else
2179 <            DupString(match_item->host, "*");
2180 <        }
2181 <        dlinkDelete(&yy_lconf->node, &leaf_conf_list);
2182 <        free_collect_item(yy_lconf);
2183 <      }
2184 <      MyFree(class_name);
2185 <      class_name = NULL;
2186 <      yy_conf = NULL;
2187 <      yy_aconf = NULL;
2052 >    MyFree(class_name);
2053 >    class_name = NULL;
2054 >    yy_conf = NULL;
2055 >    yy_aconf = NULL;
2056    }
2057   };
2058  
# Line 2200 | Line 2068 | connect_name: NAME '=' QSTRING ';'
2068   {
2069    if (conf_parser_ctx.pass == 2)
2070    {
2203    if (yy_conf->name != NULL)
2204      yyerror("Multiple connect name entry");
2205
2071      MyFree(yy_conf->name);
2072      DupString(yy_conf->name, yylval.string);
2073    }
# Line 2235 | Line 2100 | connect_vhost: VHOST '=' QSTRING ';'
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;
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    }
# Line 2306 | Line 2171 | connect_flags_item: AUTOCONN
2171   {
2172    if (conf_parser_ctx.pass == 2)
2173      SetConfAllowAutoConn(yy_aconf);
2309 } | BURST_AWAY
2310 {
2311  if (conf_parser_ctx.pass == 2)
2312    SetConfAwayBurst(yy_aconf);
2313 } | TOPICBURST
2314 {
2315  if (conf_parser_ctx.pass == 2)
2316    SetConfTopicBurst(yy_aconf);
2174   } | T_SSL
2175   {
2176    if (conf_parser_ctx.pass == 2)
# Line 2335 | Line 2192 | 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);
2342 <    DupString(yy_tmp->user, "*");
2343 <    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 2348 | 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);
2355 <    DupString(yy_tmp->user, "*");
2356 <    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 2430 | Line 2283 | kill_entry: KILL
2283        }
2284        else
2285        {
2286 +        find_and_delete_temporary(userbuf, hostbuf, CONF_KLINE);
2287 +
2288          yy_aconf = map_to_conf(make_conf_item(KLINE_TYPE));
2289  
2290          DupString(yy_aconf->user, userbuf);
# Line 2439 | Line 2294 | kill_entry: KILL
2294            DupString(yy_aconf->reason, reasonbuf);
2295          else
2296            DupString(yy_aconf->reason, "No reason");
2297 <        add_conf_by_address(CONF_KILL, yy_aconf);
2297 >        add_conf_by_address(CONF_KLINE, yy_aconf);
2298        }
2299      }
2300  
# Line 2499 | Line 2354 | deny_entry: DENY
2354    {
2355      if (hostbuf[0] && parse_netmask(hostbuf, NULL, NULL) != HM_HOST)
2356      {
2357 +      find_and_delete_temporary(NULL, hostbuf, CONF_DLINE);
2358 +
2359        yy_aconf = map_to_conf(make_conf_item(DLINE_TYPE));
2360        DupString(yy_aconf->host, hostbuf);
2361  
# Line 2638 | Line 2495 | general_item:       general_hide_spoof_i
2495                      general_max_nick_time | general_max_nick_changes |
2496                      general_max_accept | general_anti_spam_exit_message_time |
2497                      general_ts_warn_delta | general_ts_max_delta |
2498 <                    general_kill_chase_time_limit | general_kline_with_reason |
2499 <                    general_kline_reason | general_invisible_on_connect |
2498 >                    general_kill_chase_time_limit |
2499 >                    general_invisible_on_connect |
2500                      general_warn_no_nline | general_dots_in_ident |
2501                      general_stats_o_oper_only | general_stats_k_oper_only |
2502                      general_pace_wait | general_stats_i_oper_only |
# Line 2653 | Line 2510 | general_item:       general_hide_spoof_i
2510                      general_opers_bypass_callerid | general_default_floodcount |
2511                      general_min_nonwildcard | general_min_nonwildcard_simple |
2512                      general_disable_remote_commands |
2656                    general_client_flood |
2513                      general_throttle_time | general_havent_read_conf |
2514                      general_ping_cookie |
2515                      general_disable_auth |
2516 <                    general_tkline_expire_notices | general_gline_min_cidr |
2517 <                    general_gline_min_cidr6 | general_use_whois_actually |
2518 <                    general_reject_hold_time | general_stats_e_disabled |
2516 >                    general_tkline_expire_notices | general_gline_enable |
2517 >                    general_gline_duration | general_gline_request_duration |
2518 >                    general_gline_min_cidr |
2519 >                    general_gline_min_cidr6 |
2520 >                    general_stats_e_disabled |
2521                      general_max_watch | general_services_name |
2522                      error;
2523  
# Line 2669 | Line 2527 | general_max_watch: MAX_WATCH '=' NUMBER
2527    ConfigFileEntry.max_watch = $3;
2528   };
2529  
2530 < general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2530 > general_gline_enable: GLINE_ENABLE '=' TBOOL ';'
2531   {
2532 <  ConfigFileEntry.gline_min_cidr = $3;
2532 >  if (conf_parser_ctx.pass == 2)
2533 >    ConfigFileEntry.glines = yylval.number;
2534   };
2535  
2536 < general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';'
2536 > general_gline_duration: GLINE_DURATION '=' timespec ';'
2537   {
2538 <  ConfigFileEntry.gline_min_cidr6 = $3;
2538 >  if (conf_parser_ctx.pass == 2)
2539 >    ConfigFileEntry.gline_time = $3;
2540   };
2541  
2542 < general_use_whois_actually: USE_WHOIS_ACTUALLY '=' TBOOL ';'
2542 > general_gline_request_duration: GLINE_REQUEST_DURATION '=' timespec ';'
2543   {
2544 <  ConfigFileEntry.use_whois_actually = yylval.number;
2544 >  if (conf_parser_ctx.pass == 2)
2545 >    ConfigFileEntry.gline_request_time = $3;
2546   };
2547  
2548 < general_reject_hold_time: TREJECT_HOLD_TIME '=' timespec ';'
2548 > general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2549   {
2550 <  GlobalSetOptions.rejecttime = yylval.number;
2550 >  ConfigFileEntry.gline_min_cidr = $3;
2551 > };
2552 >
2553 > general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';'
2554 > {
2555 >  ConfigFileEntry.gline_min_cidr6 = $3;
2556   };
2557  
2558   general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
# Line 2766 | Line 2632 | general_havent_read_conf: HAVENT_READ_CO
2632    }
2633   };
2634  
2769 general_kline_with_reason: KLINE_WITH_REASON '=' TBOOL ';'
2770 {
2771  ConfigFileEntry.kline_with_reason = yylval.number;
2772 };
2773
2774 general_kline_reason: KLINE_REASON '=' QSTRING ';'
2775 {
2776  if (conf_parser_ctx.pass == 2)
2777  {
2778    MyFree(ConfigFileEntry.kline_reason);
2779    DupString(ConfigFileEntry.kline_reason, yylval.string);
2780  }
2781 };
2782
2635   general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2636   {
2637    ConfigFileEntry.invisible_on_connect = yylval.number;
# Line 3071 | Line 2923 | general_default_floodcount: DEFAULT_FLOO
2923    ConfigFileEntry.default_floodcount = $3;
2924   };
2925  
3074 general_client_flood: T_CLIENT_FLOOD '=' sizespec ';'
3075 {
3076  ConfigFileEntry.client_flood = $3;
3077 };
3078
3079
3080 /***************************************************************************
3081 *  section glines
3082 ***************************************************************************/
3083 gline_entry: GLINES
3084 {
3085  if (conf_parser_ctx.pass == 2)
3086  {
3087    yy_conf = make_conf_item(GDENY_TYPE);
3088    yy_aconf = map_to_conf(yy_conf);
3089  }
3090 } '{' gline_items '}' ';'
3091 {
3092  if (conf_parser_ctx.pass == 2)
3093  {
3094    /*
3095     * since we re-allocate yy_conf/yy_aconf after the end of action=, at the
3096     * end we will have one extra, so we should free it.
3097     */
3098    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3099    {
3100      delete_conf_item(yy_conf);
3101      yy_conf = NULL;
3102      yy_aconf = NULL;
3103    }
3104  }
3105 };
3106
3107 gline_items:        gline_items gline_item | gline_item;
3108 gline_item:         gline_enable |
3109                    gline_duration |
3110                    gline_logging |
3111                    gline_user |
3112                    gline_server |
3113                    gline_action |
3114                    error;
3115
3116 gline_enable: ENABLE '=' TBOOL ';'
3117 {
3118  if (conf_parser_ctx.pass == 2)
3119    ConfigFileEntry.glines = yylval.number;
3120 };
3121
3122 gline_duration: DURATION '=' timespec ';'
3123 {
3124  if (conf_parser_ctx.pass == 2)
3125    ConfigFileEntry.gline_time = $3;
3126 };
3127
3128 gline_logging: T_LOG
3129 {
3130  if (conf_parser_ctx.pass == 2)
3131    ConfigFileEntry.gline_logging = 0;
3132 } '=' gline_logging_types ';';
3133 gline_logging_types:     gline_logging_types ',' gline_logging_type_item | gline_logging_type_item;
3134 gline_logging_type_item: T_REJECT
3135 {
3136  if (conf_parser_ctx.pass == 2)
3137    ConfigFileEntry.gline_logging |= GDENY_REJECT;
3138 } | T_BLOCK
3139 {
3140  if (conf_parser_ctx.pass == 2)
3141    ConfigFileEntry.gline_logging |= GDENY_BLOCK;
3142 };
3143
3144 gline_user: USER '=' QSTRING ';'
3145 {
3146  if (conf_parser_ctx.pass == 2)
3147  {
3148    struct split_nuh_item nuh;
3149
3150    nuh.nuhmask  = yylval.string;
3151    nuh.nickptr  = NULL;
3152    nuh.userptr  = userbuf;
3153    nuh.hostptr  = hostbuf;
3154
3155    nuh.nicksize = 0;
3156    nuh.usersize = sizeof(userbuf);
3157    nuh.hostsize = sizeof(hostbuf);
3158
3159    split_nuh(&nuh);
3160
3161    if (yy_aconf->user == NULL)
3162    {
3163      DupString(yy_aconf->user, userbuf);
3164      DupString(yy_aconf->host, hostbuf);
3165    }
3166    else
3167    {
3168      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
3169
3170      DupString(yy_tmp->user, userbuf);
3171      DupString(yy_tmp->host, hostbuf);
3172
3173      dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
3174    }
3175  }
3176 };
3177
3178 gline_server: NAME '=' QSTRING ';'
3179 {
3180  if (conf_parser_ctx.pass == 2)  
3181  {
3182    MyFree(yy_conf->name);
3183    DupString(yy_conf->name, yylval.string);
3184  }
3185 };
3186
3187 gline_action: ACTION
3188 {
3189  if (conf_parser_ctx.pass == 2)
3190    yy_aconf->flags = 0;
3191 } '=' gdeny_types ';'
3192 {
3193  if (conf_parser_ctx.pass == 2)
3194  {
3195    struct CollectItem *yy_tmp = NULL;
3196    dlink_node *ptr, *next_ptr;
3197
3198    DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
3199    {
3200      struct AccessItem *new_aconf;
3201      struct ConfItem *new_conf;
3202
3203      yy_tmp = ptr->data;
3204      new_conf = make_conf_item(GDENY_TYPE);
3205      new_aconf = map_to_conf(new_conf);
3206
3207      new_aconf->flags = yy_aconf->flags;
3208
3209      if (yy_conf->name != NULL)
3210        DupString(new_conf->name, yy_conf->name);
3211      else
3212        DupString(new_conf->name, "*");
3213      if (yy_aconf->user != NULL)
3214         DupString(new_aconf->user, yy_tmp->user);
3215      else  
3216        DupString(new_aconf->user, "*");
3217      if (yy_aconf->host != NULL)
3218        DupString(new_aconf->host, yy_tmp->host);
3219      else
3220        DupString(new_aconf->host, "*");
3221
3222      dlinkDelete(&yy_tmp->node, &col_conf_list);
3223    }
3224
3225    /*
3226     * In case someone has fed us with more than one action= after user/name
3227     * which would leak memory  -Michael
3228     */
3229    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3230      delete_conf_item(yy_conf);
3231
3232    yy_conf = make_conf_item(GDENY_TYPE);
3233    yy_aconf = map_to_conf(yy_conf);
3234  }
3235 };
3236
3237 gdeny_types: gdeny_types ',' gdeny_type_item | gdeny_type_item;
3238 gdeny_type_item: T_REJECT
3239 {
3240  if (conf_parser_ctx.pass == 2)
3241    yy_aconf->flags |= GDENY_REJECT;
3242 } | T_BLOCK
3243 {
3244  if (conf_parser_ctx.pass == 2)
3245    yy_aconf->flags |= GDENY_BLOCK;
3246 };
2926  
2927   /***************************************************************************
2928   *  section channel
# Line 3252 | Line 2931 | channel_entry: CHANNEL
2931    '{' channel_items '}' ';';
2932  
2933   channel_items:      channel_items channel_item | channel_item;
2934 < channel_item:       channel_disable_local_channels | channel_use_except |
2935 <                    channel_use_invex | channel_use_knock |
2936 <                    channel_max_bans | channel_knock_delay |
3258 <                    channel_knock_delay_channel | channel_max_chans_per_user |
2934 > channel_item:       channel_max_bans |
2935 >                    channel_knock_delay | channel_knock_delay_channel |
2936 >                    channel_max_chans_per_user | channel_max_chans_per_oper |
2937                      channel_quiet_on_ban | channel_default_split_user_count |
2938                      channel_default_split_server_count |
2939                      channel_no_create_on_split | channel_restrict_channels |
2940 <                    channel_no_join_on_split | channel_burst_topicwho |
2940 >                    channel_no_join_on_split |
2941                      channel_jflood_count | channel_jflood_time |
2942                      channel_disable_fake_channels | error;
2943  
# Line 3273 | Line 2951 | channel_restrict_channels: RESTRICT_CHAN
2951    ConfigChannel.restrict_channels = yylval.number;
2952   };
2953  
3276 channel_disable_local_channels: DISABLE_LOCAL_CHANNELS '=' TBOOL ';'
3277 {
3278  ConfigChannel.disable_local_channels = yylval.number;
3279 };
3280
3281 channel_use_except: USE_EXCEPT '=' TBOOL ';'
3282 {
3283  ConfigChannel.use_except = yylval.number;
3284 };
3285
3286 channel_use_invex: USE_INVEX '=' TBOOL ';'
3287 {
3288  ConfigChannel.use_invex = yylval.number;
3289 };
3290
3291 channel_use_knock: USE_KNOCK '=' TBOOL ';'
3292 {
3293  ConfigChannel.use_knock = yylval.number;
3294 };
3295
2954   channel_knock_delay: KNOCK_DELAY '=' timespec ';'
2955   {
2956    ConfigChannel.knock_delay = $3;
# Line 3308 | Line 2966 | channel_max_chans_per_user: MAX_CHANS_PE
2966    ConfigChannel.max_chans_per_user = $3;
2967   };
2968  
2969 + channel_max_chans_per_oper: MAX_CHANS_PER_OPER '=' NUMBER ';'
2970 + {
2971 +  ConfigChannel.max_chans_per_oper = $3;
2972 + };
2973 +
2974   channel_quiet_on_ban: QUIET_ON_BAN '=' TBOOL ';'
2975   {
2976    ConfigChannel.quiet_on_ban = yylval.number;
# Line 3338 | Line 3001 | channel_no_join_on_split: NO_JOIN_ON_SPL
3001    ConfigChannel.no_join_on_split = yylval.number;
3002   };
3003  
3341 channel_burst_topicwho: BURST_TOPICWHO '=' TBOOL ';'
3342 {
3343  ConfigChannel.burst_topicwho = yylval.number;
3344 };
3345
3004   channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
3005   {
3006    GlobalSetOptions.joinfloodcount = yylval.number;
# Line 3362 | Line 3020 | serverhide_entry: SERVERHIDE
3020   serverhide_items:   serverhide_items serverhide_item | serverhide_item;
3021   serverhide_item:    serverhide_flatten_links | serverhide_hide_servers |
3022                      serverhide_links_delay |
3365                    serverhide_disable_hidden |
3023                      serverhide_hidden | serverhide_hidden_name |
3024                      serverhide_hide_server_ips |
3025                      error;
# Line 3408 | Line 3065 | serverhide_hidden: HIDDEN '=' TBOOL ';'
3065      ConfigServerHide.hidden = yylval.number;
3066   };
3067  
3411 serverhide_disable_hidden: DISABLE_HIDDEN '=' TBOOL ';'
3412 {
3413  if (conf_parser_ctx.pass == 2)
3414    ConfigServerHide.disable_hidden = yylval.number;
3415 };
3416
3068   serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';'
3069   {
3070    if (conf_parser_ctx.pass == 2)

Diff Legend

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