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 1324 by michael, Fri Mar 30 21:40:38 2012 UTC vs.
ircd-hybrid/trunk/src/conf_parser.y (file contents), Revision 1592 by michael, Sat Oct 27 21:02:32 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
# Line 292 | Line 256 | unhook_hub_leaf_confs(void)
256   %token  T_CLUSTER
257   %token  TYPE
258   %token  SHORT_MOTD
295 %token  SILENT
259   %token  SPOOF
260   %token  SPOOF_NOTICE
261   %token  STATS_E_DISABLED
# Line 302 | Line 265 | unhook_hub_leaf_confs(void)
265   %token  STATS_P_OPER_ONLY
266   %token  TBOOL
267   %token  TMASKED
305 %token  T_REJECT
268   %token  TS_MAX_DELTA
269   %token  TS_WARN_DELTA
270   %token  TWODOTS
# Line 313 | Line 275 | unhook_hub_leaf_confs(void)
275   %token  T_CCONN
276   %token  T_CCONN_FULL
277   %token  T_SSL_CIPHER_LIST
316 %token  T_CLIENT_FLOOD
278   %token  T_DEAF
279   %token  T_DEBUG
280   %token  T_DLINE
320 %token  T_DRONE
281   %token  T_EXTERNAL
282   %token  T_FULL
283   %token  T_INVISIBLE
# Line 327 | 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 345 | Line 307 | unhook_hub_leaf_confs(void)
307   %token  T_SERVICE
308   %token  T_SERVICES_NAME
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 622 | 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 958 | 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 975 | 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 1016 | Line 972 | oper_name: NAME '=' QSTRING ';'
972   {
973    if (conf_parser_ctx.pass == 2)
974    {
1019    if (strlen(yylval.string) > OPERNICKLEN)
1020      yylval.string[OPERNICKLEN] = '\0';
1021
975      MyFree(yy_conf->name);
976      DupString(yy_conf->name, yylval.string);
977    }
# Line 1046 | 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 1112 | 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 1299 | 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 1371 | 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 1386 | 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 1667 | Line 1631 | auth_user: USER '=' QSTRING ';'
1631    }
1632   };
1633  
1670 /* XXX - IP/IPV6 tags don't exist anymore - put IP/IPV6 into user. */
1671
1634   auth_passwd: PASSWORD '=' QSTRING ';'
1635   {
1636    if (conf_parser_ctx.pass == 2)
# Line 1745 | Line 1707 | auth_flags_item: SPOOF_NOTICE
1707      yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
1708   };
1709  
1748 /* 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 2063 | Line 2024 | connect_entry: CONNECT
2024   {
2025    if (conf_parser_ctx.pass == 2)
2026    {
2027 <    struct CollectItem *yy_hconf=NULL;
2067 <    struct CollectItem *yy_lconf=NULL;
2068 <    dlink_node *ptr = NULL, *next_ptr = NULL;
2069 <
2070 <    if (yy_aconf->host &&
2071 <        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)
2074      {
2030          delete_conf_item(yy_conf);
2076        yy_conf = NULL;
2077        yy_aconf = NULL;
2078      }
2031      }
2032      else
2033      {
2082      /* Even if yy_conf ->name is NULL
2083       * should still unhook any hub/leaf confs still pending
2084       */
2085      unhook_hub_leaf_confs();
2086
2034        if (yy_conf->name != NULL)
2035        {
2036          if (yy_aconf->host == NULL)
# Line 2092 | Line 2039 | connect_entry: CONNECT
2039            yyerror("Ignoring connect block -- missing password");
2040        }
2041  
2095
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 2101 | Line 2047 | connect_entry: CONNECT
2047         * a doubly linked list immediately without any sanity checks!  -Michael
2048         */
2049        delete_conf_item(yy_conf);
2104
2105      yy_aconf = NULL;
2106      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.
2113 <       * Now this new server has a set or even just one hub_mask (or leaf_mask)
2114 <       * given in the link list at yy_hconf. Fill in the HUB confs
2115 <       * from this link list now.
2116 <       */        
2117 <      DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head)
2118 <      {
2119 <        struct ConfItem *new_hub_conf;
2120 <        struct MatchItem *match_item;
2121 <
2122 <        yy_hconf = ptr->data;
2123 <
2124 <        /* yy_conf == NULL is a fatal error for this connect block! */
2125 <        if ((yy_conf != NULL) && (yy_conf->name != NULL))
2126 <        {
2127 <          new_hub_conf = make_conf_item(HUB_TYPE);
2128 <          match_item = (struct MatchItem *)map_to_conf(new_hub_conf);
2129 <          DupString(new_hub_conf->name, yy_conf->name);
2130 <          if (yy_hconf->user != NULL)
2131 <            DupString(match_item->user, yy_hconf->user);
2132 <          else
2133 <            DupString(match_item->user, "*");
2134 <          if (yy_hconf->host != NULL)
2135 <            DupString(match_item->host, yy_hconf->host);
2136 <          else
2137 <            DupString(match_item->host, "*");
2138 <        }
2139 <        dlinkDelete(&yy_hconf->node, &hub_conf_list);
2140 <        free_collect_item(yy_hconf);
2141 <      }
2142 <
2143 <      /* Ditto for the LEAF confs */
2144 <
2145 <      DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head)
2146 <      {
2147 <        struct ConfItem *new_leaf_conf;
2148 <        struct MatchItem *match_item;
2149 <
2150 <        yy_lconf = ptr->data;
2151 <
2152 <        if ((yy_conf != NULL) && (yy_conf->name != NULL))
2153 <        {
2154 <          new_leaf_conf = make_conf_item(LEAF_TYPE);
2155 <          match_item = (struct MatchItem *)map_to_conf(new_leaf_conf);
2156 <          DupString(new_leaf_conf->name, yy_conf->name);
2157 <          if (yy_lconf->user != NULL)
2158 <            DupString(match_item->user, yy_lconf->user);
2159 <          else
2160 <            DupString(match_item->user, "*");
2161 <          if (yy_lconf->host != NULL)
2162 <            DupString(match_item->host, yy_lconf->host);
2163 <          else
2164 <            DupString(match_item->host, "*");
2165 <        }
2166 <        dlinkDelete(&yy_lconf->node, &leaf_conf_list);
2167 <        free_collect_item(yy_lconf);
2168 <      }
2169 <      MyFree(class_name);
2170 <      class_name = NULL;
2171 <      yy_conf = NULL;
2172 <      yy_aconf = NULL;
2052 >    MyFree(class_name);
2053 >    class_name = NULL;
2054 >    yy_conf = NULL;
2055 >    yy_aconf = NULL;
2056    }
2057   };
2058  
# Line 2185 | Line 2068 | connect_name: NAME '=' QSTRING ';'
2068   {
2069    if (conf_parser_ctx.pass == 2)
2070    {
2188    if (yy_conf->name != NULL)
2189      yyerror("Multiple connect name entry");
2190
2071      MyFree(yy_conf->name);
2072      DupString(yy_conf->name, yylval.string);
2073    }
# Line 2220 | 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 2291 | Line 2171 | connect_flags_item: AUTOCONN
2171   {
2172    if (conf_parser_ctx.pass == 2)
2173      SetConfAllowAutoConn(yy_aconf);
2294 } | BURST_AWAY
2295 {
2296  if (conf_parser_ctx.pass == 2)
2297    SetConfAwayBurst(yy_aconf);
2298 } | TOPICBURST
2299 {
2300  if (conf_parser_ctx.pass == 2)
2301    SetConfTopicBurst(yy_aconf);
2174   } | T_SSL
2175   {
2176    if (conf_parser_ctx.pass == 2)
# Line 2320 | 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);
2327 <    DupString(yy_tmp->user, "*");
2328 <    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 2333 | 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);
2340 <    DupString(yy_tmp->user, "*");
2341 <    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 2415 | 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 2424 | 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 2484 | 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 2623 | 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 2638 | 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 |
2641                    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 2654 | 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 >  ConfigFileEntry.gline_min_cidr = $3;
2551 > };
2552 >
2553 > general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';'
2554   {
2555 <  GlobalSetOptions.rejecttime = yylval.number;
2555 >  ConfigFileEntry.gline_min_cidr6 = $3;
2556   };
2557  
2558   general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
# Line 2751 | Line 2632 | general_havent_read_conf: HAVENT_READ_CO
2632    }
2633   };
2634  
2754 general_kline_with_reason: KLINE_WITH_REASON '=' TBOOL ';'
2755 {
2756  ConfigFileEntry.kline_with_reason = yylval.number;
2757 };
2758
2759 general_kline_reason: KLINE_REASON '=' QSTRING ';'
2760 {
2761  if (conf_parser_ctx.pass == 2)
2762  {
2763    MyFree(ConfigFileEntry.kline_reason);
2764    DupString(ConfigFileEntry.kline_reason, yylval.string);
2765  }
2766 };
2767
2635   general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2636   {
2637    ConfigFileEntry.invisible_on_connect = yylval.number;
# Line 3056 | Line 2923 | general_default_floodcount: DEFAULT_FLOO
2923    ConfigFileEntry.default_floodcount = $3;
2924   };
2925  
3059 general_client_flood: T_CLIENT_FLOOD '=' sizespec ';'
3060 {
3061  ConfigFileEntry.client_flood = $3;
3062 };
3063
3064
3065 /***************************************************************************
3066 *  section glines
3067 ***************************************************************************/
3068 gline_entry: GLINES
3069 {
3070  if (conf_parser_ctx.pass == 2)
3071  {
3072    yy_conf = make_conf_item(GDENY_TYPE);
3073    yy_aconf = map_to_conf(yy_conf);
3074  }
3075 } '{' gline_items '}' ';'
3076 {
3077  if (conf_parser_ctx.pass == 2)
3078  {
3079    /*
3080     * since we re-allocate yy_conf/yy_aconf after the end of action=, at the
3081     * end we will have one extra, so we should free it.
3082     */
3083    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3084    {
3085      delete_conf_item(yy_conf);
3086      yy_conf = NULL;
3087      yy_aconf = NULL;
3088    }
3089  }
3090 };
3091
3092 gline_items:        gline_items gline_item | gline_item;
3093 gline_item:         gline_enable |
3094                    gline_duration |
3095                    gline_logging |
3096                    gline_user |
3097                    gline_server |
3098                    gline_action |
3099                    error;
3100
3101 gline_enable: ENABLE '=' TBOOL ';'
3102 {
3103  if (conf_parser_ctx.pass == 2)
3104    ConfigFileEntry.glines = yylval.number;
3105 };
3106
3107 gline_duration: DURATION '=' timespec ';'
3108 {
3109  if (conf_parser_ctx.pass == 2)
3110    ConfigFileEntry.gline_time = $3;
3111 };
3112
3113 gline_logging: T_LOG
3114 {
3115  if (conf_parser_ctx.pass == 2)
3116    ConfigFileEntry.gline_logging = 0;
3117 } '=' gline_logging_types ';';
3118 gline_logging_types:     gline_logging_types ',' gline_logging_type_item | gline_logging_type_item;
3119 gline_logging_type_item: T_REJECT
3120 {
3121  if (conf_parser_ctx.pass == 2)
3122    ConfigFileEntry.gline_logging |= GDENY_REJECT;
3123 } | T_BLOCK
3124 {
3125  if (conf_parser_ctx.pass == 2)
3126    ConfigFileEntry.gline_logging |= GDENY_BLOCK;
3127 };
3128
3129 gline_user: USER '=' QSTRING ';'
3130 {
3131  if (conf_parser_ctx.pass == 2)
3132  {
3133    struct split_nuh_item nuh;
3134
3135    nuh.nuhmask  = yylval.string;
3136    nuh.nickptr  = NULL;
3137    nuh.userptr  = userbuf;
3138    nuh.hostptr  = hostbuf;
3139
3140    nuh.nicksize = 0;
3141    nuh.usersize = sizeof(userbuf);
3142    nuh.hostsize = sizeof(hostbuf);
3143
3144    split_nuh(&nuh);
3145
3146    if (yy_aconf->user == NULL)
3147    {
3148      DupString(yy_aconf->user, userbuf);
3149      DupString(yy_aconf->host, hostbuf);
3150    }
3151    else
3152    {
3153      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
3154
3155      DupString(yy_tmp->user, userbuf);
3156      DupString(yy_tmp->host, hostbuf);
3157
3158      dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
3159    }
3160  }
3161 };
3162
3163 gline_server: NAME '=' QSTRING ';'
3164 {
3165  if (conf_parser_ctx.pass == 2)  
3166  {
3167    MyFree(yy_conf->name);
3168    DupString(yy_conf->name, yylval.string);
3169  }
3170 };
3171
3172 gline_action: ACTION
3173 {
3174  if (conf_parser_ctx.pass == 2)
3175    yy_aconf->flags = 0;
3176 } '=' gdeny_types ';'
3177 {
3178  if (conf_parser_ctx.pass == 2)
3179  {
3180    struct CollectItem *yy_tmp = NULL;
3181    dlink_node *ptr, *next_ptr;
3182
3183    DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
3184    {
3185      struct AccessItem *new_aconf;
3186      struct ConfItem *new_conf;
3187
3188      yy_tmp = ptr->data;
3189      new_conf = make_conf_item(GDENY_TYPE);
3190      new_aconf = map_to_conf(new_conf);
3191
3192      new_aconf->flags = yy_aconf->flags;
3193
3194      if (yy_conf->name != NULL)
3195        DupString(new_conf->name, yy_conf->name);
3196      else
3197        DupString(new_conf->name, "*");
3198      if (yy_aconf->user != NULL)
3199         DupString(new_aconf->user, yy_tmp->user);
3200      else  
3201        DupString(new_aconf->user, "*");
3202      if (yy_aconf->host != NULL)
3203        DupString(new_aconf->host, yy_tmp->host);
3204      else
3205        DupString(new_aconf->host, "*");
3206
3207      dlinkDelete(&yy_tmp->node, &col_conf_list);
3208    }
3209
3210    /*
3211     * In case someone has fed us with more than one action= after user/name
3212     * which would leak memory  -Michael
3213     */
3214    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3215      delete_conf_item(yy_conf);
3216
3217    yy_conf = make_conf_item(GDENY_TYPE);
3218    yy_aconf = map_to_conf(yy_conf);
3219  }
3220 };
3221
3222 gdeny_types: gdeny_types ',' gdeny_type_item | gdeny_type_item;
3223 gdeny_type_item: T_REJECT
3224 {
3225  if (conf_parser_ctx.pass == 2)
3226    yy_aconf->flags |= GDENY_REJECT;
3227 } | T_BLOCK
3228 {
3229  if (conf_parser_ctx.pass == 2)
3230    yy_aconf->flags |= GDENY_BLOCK;
3231 };
2926  
2927   /***************************************************************************
2928   *  section channel
# Line 3237 | 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 |
3243 <                    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 3258 | Line 2951 | channel_restrict_channels: RESTRICT_CHAN
2951    ConfigChannel.restrict_channels = yylval.number;
2952   };
2953  
3261 channel_disable_local_channels: DISABLE_LOCAL_CHANNELS '=' TBOOL ';'
3262 {
3263  ConfigChannel.disable_local_channels = yylval.number;
3264 };
3265
3266 channel_use_except: USE_EXCEPT '=' TBOOL ';'
3267 {
3268  ConfigChannel.use_except = yylval.number;
3269 };
3270
3271 channel_use_invex: USE_INVEX '=' TBOOL ';'
3272 {
3273  ConfigChannel.use_invex = yylval.number;
3274 };
3275
3276 channel_use_knock: USE_KNOCK '=' TBOOL ';'
3277 {
3278  ConfigChannel.use_knock = yylval.number;
3279 };
3280
2954   channel_knock_delay: KNOCK_DELAY '=' timespec ';'
2955   {
2956    ConfigChannel.knock_delay = $3;
# Line 3293 | 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 3323 | Line 3001 | channel_no_join_on_split: NO_JOIN_ON_SPL
3001    ConfigChannel.no_join_on_split = yylval.number;
3002   };
3003  
3326 channel_burst_topicwho: BURST_TOPICWHO '=' TBOOL ';'
3327 {
3328  ConfigChannel.burst_topicwho = yylval.number;
3329 };
3330
3004   channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
3005   {
3006    GlobalSetOptions.joinfloodcount = yylval.number;
# Line 3347 | 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 |
3350                    serverhide_disable_hidden |
3023                      serverhide_hidden | serverhide_hidden_name |
3024                      serverhide_hide_server_ips |
3025                      error;
# Line 3393 | Line 3065 | serverhide_hidden: HIDDEN '=' TBOOL ';'
3065      ConfigServerHide.hidden = yylval.number;
3066   };
3067  
3396 serverhide_disable_hidden: DISABLE_HIDDEN '=' TBOOL ';'
3397 {
3398  if (conf_parser_ctx.pass == 2)
3399    ConfigServerHide.disable_hidden = yylval.number;
3400 };
3401
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)