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

Comparing ircd-hybrid-7.2/src/ircd_parser.y (file contents):
Revision 136 by db, Sat Oct 15 23:39:54 2005 UTC vs.
Revision 601 by michael, Sat May 13 16:59:28 2006 UTC

# Line 28 | Line 28
28   #include <sys/types.h>
29  
30   #include "stdinc.h"
31 #include "dalloca.h"
31   #include "ircd.h"
32   #include "tools.h"
33   #include "list.h"
# Line 79 | Line 78 | static char *resv_reason = NULL;
78   static char *listener_address = NULL;
79   static int not_atom = 0;
80  
81 < struct CollectItem {
81 > struct CollectItem
82 > {
83    dlink_node node;
84    char *name;
85    char *user;
# Line 273 | Line 273 | unhook_hub_leaf_confs(void)
273   %token  OPER_PASS_RESV
274   %token  OPER_SPY_T
275   %token  OPER_UMODES
276 %token  INVITE_OPS_ONLY
276   %token  JOIN_FLOOD_COUNT
277   %token  JOIN_FLOOD_TIME
278   %token  PACE_WAIT
# Line 316 | Line 315 | unhook_hub_leaf_confs(void)
315   %token  SILENT
316   %token  SPOOF
317   %token  SPOOF_NOTICE
318 + %token  STATS_E_DISABLED
319   %token  STATS_I_OPER_ONLY
320   %token  STATS_K_OPER_ONLY
321   %token  STATS_O_OPER_ONLY
# Line 617 | Line 617 | serverinfo_sid: IRCD_SID '=' QSTRING ';'
617    /* this isn't rehashable */
618    if (ypass == 2 && !ServerInfo.sid)
619    {
620 <    if ((strlen(yylval.string) == IRC_MAXSID) && IsDigit(yylval.string[0])
621 <        && IsAlNum(yylval.string[1]) && IsAlNum(yylval.string[2]))
622 <    {
620 >    if (valid_sid(yylval.string))
621        DupString(ServerInfo.sid, yylval.string);
624    }
622      else
623      {
624        ilog(L_ERROR, "Ignoring config file entry SID -- invalid SID. Aborting.");
# Line 1080 | Line 1077 | oper_user: USER '=' QSTRING ';'
1077   {
1078    if (ypass == 2)
1079    {
1080 <    struct CollectItem *yy_tmp;
1080 >    struct split_nuh_item nuh;
1081 >
1082 >    nuh.nuhmask  = yylval.string;
1083 >    nuh.nickptr  = NULL;
1084 >    nuh.userptr  = userbuf;
1085 >    nuh.hostptr  = hostbuf;
1086 >
1087 >    nuh.nicksize = 0;
1088 >    nuh.usersize = sizeof(userbuf);
1089 >    nuh.hostsize = sizeof(hostbuf);
1090 >
1091 >    split_nuh(&nuh);
1092  
1093      if (yy_aconf->user == NULL)
1094      {
1095 <      split_nuh(yylval.string, NULL, &yy_aconf->user, &yy_aconf->host);
1095 >      DupString(yy_aconf->user, userbuf);
1096 >      DupString(yy_aconf->host, hostbuf);
1097      }
1098      else
1099      {
1100 <      yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
1101 <      split_nuh(yylval.string, NULL, &yy_tmp->user, &yy_tmp->host);
1100 >      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
1101 >
1102 >      DupString(yy_tmp->user, userbuf);
1103 >      DupString(yy_tmp->host, hostbuf);
1104 >
1105        dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1106      }
1107    }
# Line 1171 | Line 1183 | oper_class: CLASS '=' QSTRING ';'
1183  
1184   oper_umodes: T_UMODES
1185   {
1186 <  yy_aconf->modes = 0;
1186 >  if (ypass == 2)
1187 >    yy_aconf->modes = 0;
1188   } '='  oper_umodes_items ';' ;
1189  
1190   oper_umodes_items: oper_umodes_items ',' oper_umodes_item | oper_umodes_item;
1191   oper_umodes_item:  T_BOTS
1192   {
1193 <  yy_aconf->modes |= UMODE_BOTS;
1193 >  if (ypass == 2)
1194 >    yy_aconf->modes |= UMODE_BOTS;
1195   } | T_CCONN
1196   {
1197 <  yy_aconf->modes |= UMODE_CCONN;
1197 >  if (ypass == 2)
1198 >    yy_aconf->modes |= UMODE_CCONN;
1199   } | T_DEAF
1200   {
1201 <  yy_aconf->modes |= UMODE_DEAF;
1201 >  if (ypass == 2)
1202 >    yy_aconf->modes |= UMODE_DEAF;
1203   } | T_DEBUG
1204   {
1205 <  yy_aconf->modes |= UMODE_DEBUG;
1205 >  if (ypass == 2)
1206 >    yy_aconf->modes |= UMODE_DEBUG;
1207   } | T_FULL
1208   {
1209 <  yy_aconf->modes |= UMODE_FULL;
1209 >  if (ypass == 2)
1210 >    yy_aconf->modes |= UMODE_FULL;
1211   } | T_SKILL
1212   {
1213 <  yy_aconf->modes |= UMODE_SKILL;
1213 >  if (ypass == 2)
1214 >    yy_aconf->modes |= UMODE_SKILL;
1215   } | T_NCHANGE
1216   {
1217 <  yy_aconf->modes |= UMODE_NCHANGE;
1217 >  if (ypass == 2)
1218 >    yy_aconf->modes |= UMODE_NCHANGE;
1219   } | T_REJ
1220   {
1221 <  yy_aconf->modes |= UMODE_REJ;
1221 >  if (ypass == 2)
1222 >    yy_aconf->modes |= UMODE_REJ;
1223   } | T_UNAUTH
1224   {
1225 <  yy_aconf->modes |= UMODE_UNAUTH;
1225 >  if (ypass == 2)
1226 >    yy_aconf->modes |= UMODE_UNAUTH;
1227   } | T_SPY
1228   {
1229 <  yy_aconf->modes |= UMODE_SPY;
1229 >  if (ypass == 2)
1230 >    yy_aconf->modes |= UMODE_SPY;
1231   } | T_EXTERNAL
1232   {
1233 <  yy_aconf->modes |= UMODE_EXTERNAL;
1233 >  if (ypass == 2)
1234 >    yy_aconf->modes |= UMODE_EXTERNAL;
1235   } | T_OPERWALL
1236   {
1237 <  yy_aconf->modes |= UMODE_OPERWALL;
1237 >  if (ypass == 2)
1238 >    yy_aconf->modes |= UMODE_OPERWALL;
1239   } | T_SERVNOTICE
1240   {
1241 <  yy_aconf->modes |= UMODE_SERVNOTICE;
1241 >  if (ypass == 2)
1242 >    yy_aconf->modes |= UMODE_SERVNOTICE;
1243   } | T_INVISIBLE
1244   {
1245 <  yy_aconf->modes |= UMODE_INVISIBLE;
1245 >  if (ypass == 2)
1246 >    yy_aconf->modes |= UMODE_INVISIBLE;
1247   } | T_WALLOP
1248   {
1249 <  yy_aconf->modes |= UMODE_WALLOP;
1249 >  if (ypass == 2)
1250 >    yy_aconf->modes |= UMODE_WALLOP;
1251   } | T_SOFTCALLERID
1252   {
1253 <  yy_aconf->modes |= UMODE_SOFTCALLERID;
1253 >  if (ypass == 2)
1254 >    yy_aconf->modes |= UMODE_SOFTCALLERID;
1255   } | T_CALLERID
1256   {
1257 <  yy_aconf->modes |= UMODE_CALLERID;
1257 >  if (ypass == 2)
1258 >    yy_aconf->modes |= UMODE_CALLERID;
1259   } | T_LOCOPS
1260   {
1261 <  yy_aconf->modes |= UMODE_LOCOPS;
1261 >  if (ypass == 2)
1262 >    yy_aconf->modes |= UMODE_LOCOPS;
1263   };
1264  
1265   oper_global_kill: GLOBAL_KILL '=' TBOOL ';'
# Line 1681 | Line 1712 | listen_entry: LISTEN
1712  
1713   listen_flags: IRCD_FLAGS
1714   {
1715 +  listener_flags = 0;
1716   } '='  listen_flags_items ';';
1717  
1718   listen_flags_items: listen_flags_items ',' listen_flags_item | listen_flags_item;
# Line 1695 | Line 1727 | listen_flags_item: T_SSL
1727   };
1728  
1729   listen_items:   listen_items listen_item | listen_item;
1730 < listen_item:    listen_port | listen_flags | listen_address | listen_host | error ';' ;
1730 > listen_item:    listen_port | listen_flags | listen_address | listen_host | error ';';
1731  
1732 < listen_port: PORT '=' port_items ';' ;
1732 > listen_port: PORT '=' port_items { listener_flags = 0; } ';';
1733  
1734   port_items: port_items ',' port_item | port_item;
1735  
# Line 1714 | Line 1746 | port_item: NUMBER
1746          break;
1747        }
1748      add_listener($1, listener_address, listener_flags);
1717    listener_flags = 0;
1749    }
1750   } | NUMBER TWODOTS NUMBER
1751   {
# Line 1733 | Line 1764 | port_item: NUMBER
1764  
1765      for (i = $1; i <= $3; ++i)
1766        add_listener(i, listener_address, listener_flags);
1736
1737    listener_flags = 0;
1767    }
1768   };
1769  
# Line 1840 | Line 1869 | auth_user: USER '=' QSTRING ';'
1869   {
1870    if (ypass == 2)
1871    {
1872 <    struct CollectItem *yy_tmp;
1872 >    struct CollectItem *yy_tmp = NULL;
1873 >    struct split_nuh_item nuh;
1874 >
1875 >    nuh.nuhmask  = yylval.string;
1876 >    nuh.nickptr  = NULL;
1877 >    nuh.userptr  = userbuf;
1878 >    nuh.hostptr  = hostbuf;
1879 >
1880 >    nuh.nicksize = 0;
1881 >    nuh.usersize = sizeof(userbuf);
1882 >    nuh.hostsize = sizeof(hostbuf);
1883 >
1884 >    split_nuh(&nuh);
1885  
1886      if (yy_aconf->user == NULL)
1887 <      split_nuh(yylval.string, NULL, &yy_aconf->user, &yy_aconf->host);
1887 >    {
1888 >      DupString(yy_aconf->user, userbuf);
1889 >      DupString(yy_aconf->host, hostbuf);
1890 >    }
1891      else
1892      {
1893        yy_tmp = MyMalloc(sizeof(struct CollectItem));
1894 <      split_nuh(yylval.string, NULL, &yy_tmp->user, &yy_tmp->host);
1894 >
1895 >      DupString(yy_tmp->user, userbuf);
1896 >      DupString(yy_tmp->host, hostbuf);
1897 >
1898        dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1899      }
1900    }
# Line 2188 | Line 2235 | shared_user: USER '=' QSTRING ';'
2235   {
2236    if (ypass == 2)
2237    {
2238 <    split_nuh(yylval.string, NULL, &yy_match_item->user, &yy_match_item->host);
2238 >    struct split_nuh_item nuh;
2239 >
2240 >    nuh.nuhmask  = yylval.string;
2241 >    nuh.nickptr  = NULL;
2242 >    nuh.userptr  = userbuf;
2243 >    nuh.hostptr  = hostbuf;
2244 >
2245 >    nuh.nicksize = 0;
2246 >    nuh.usersize = sizeof(userbuf);
2247 >    nuh.hostsize = sizeof(hostbuf);
2248 >
2249 >    split_nuh(&nuh);
2250 >
2251 >    DupString(yy_match_item->user, userbuf);
2252 >    DupString(yy_match_item->host, hostbuf);
2253    }
2254   };
2255  
# Line 2365 | Line 2426 | connect_entry: CONNECT
2426            yy_aconf->passwd && yy_aconf->spasswd)
2427   #endif /* !HAVE_LIBCRYPTO */
2428          {
2429 <          if (conf_add_server(yy_conf, scount, class_name) >= 0)
2369 <          {
2370 <            ++scount;
2371 <          }
2372 <          else
2429 >          if (conf_add_server(yy_conf, class_name) == -1)
2430            {
2431              delete_conf_item(yy_conf);
2432              yy_conf = NULL;
# Line 2489 | Line 2546 | connect_item:   connect_name | connect_h
2546                  connect_leaf_mask | connect_class | connect_auto |
2547                  connect_encrypted | connect_compressed | connect_cryptlink |
2548                  connect_rsa_public_key_file | connect_cipher_preference |
2549 <                error ';' ;
2549 >                connect_topicburst | error ';' ;
2550  
2551   connect_name: NAME '=' QSTRING ';'
2552   {
# Line 2759 | Line 2816 | connect_auto: AUTOCONN '=' TBOOL ';'
2816    }
2817   };
2818  
2819 + connect_topicburst: TOPICBURST '=' TBOOL ';'
2820 + {
2821 +  if (ypass == 2)
2822 +  {
2823 +    if (yylval.number)
2824 +      SetConfTopicBurst(yy_aconf);
2825 +    else
2826 +      ClearConfTopicBurst(yy_aconf);
2827 +  }
2828 + };
2829 +
2830   connect_hub_mask: HUB_MASK '=' QSTRING ';'
2831   {
2832    if (ypass == 2)
# Line 2851 | Line 2919 | kill_entry: KILL
2919          if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) ||
2920              !(exp_host = ircd_pcre_compile(hostbuf, &errptr)))
2921          {
2922 <          ilog(L_ERROR, "Failed to add regular expression based K-Line: %s", errptr);
2922 >          ilog(L_ERROR, "Failed to add regular expression based K-Line: %s",
2923 >               errptr);
2924            break;
2925          }
2926  
2927          yy_conf = make_conf_item(RKLINE_TYPE);
2928 +        yy_aconf = map_to_conf(yy_conf);
2929 +
2930          yy_aconf->regexuser = exp_user;
2931          yy_aconf->regexhost = exp_host;
2932  
# Line 2908 | Line 2979 | kill_user: USER '=' QSTRING ';'
2979   {
2980    if (ypass == 2)
2981    {
2982 <    char *user = NULL, *host = NULL;
2912 <
2913 <    split_nuh(yylval.string, NULL, &user, &host);
2982 >    struct split_nuh_item nuh;
2983  
2984 <    strlcpy(userbuf, user, sizeof(userbuf));
2985 <    strlcpy(hostbuf, host, sizeof(hostbuf));
2984 >    nuh.nuhmask  = yylval.string;
2985 >    nuh.nickptr  = NULL;
2986 >    nuh.userptr  = userbuf;
2987 >    nuh.hostptr  = hostbuf;
2988 >
2989 >    nuh.nicksize = 0;
2990 >    nuh.usersize = sizeof(userbuf);
2991 >    nuh.hostsize = sizeof(hostbuf);
2992  
2993 <    MyFree(user);
2919 <    MyFree(host);
2993 >    split_nuh(&nuh);
2994    }
2995   };
2996  
# Line 3021 | Line 3095 | gecos_entry: GECOS
3095  
3096          if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr)))
3097          {
3098 <          ilog(L_ERROR, "Failed to add regular expression based X-Line: %s", errptr);
3098 >          ilog(L_ERROR, "Failed to add regular expression based X-Line: %s",
3099 >               errptr);
3100            break;
3101          }
3102  
# Line 3102 | Line 3177 | general_item:       general_hide_spoof_i
3177                      general_disable_auth | general_burst_away |
3178                      general_tkline_expire_notices | general_gline_min_cidr |
3179                      general_gline_min_cidr6 | general_use_whois_actually |
3180 <                    general_reject_hold_time |
3180 >                    general_reject_hold_time | general_stats_e_disabled |
3181                      error;
3182  
3183  
# Line 3233 | Line 3308 | general_warn_no_nline: WARN_NO_NLINE '='
3308    ConfigFileEntry.warn_no_nline = yylval.number;
3309   };
3310  
3311 + general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
3312 + {
3313 +  ConfigFileEntry.stats_e_disabled = yylval.number;
3314 + };
3315 +
3316   general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
3317   {
3318    ConfigFileEntry.stats_o_oper_only = yylval.number;
# Line 3630 | Line 3710 | gline_user: USER '=' QSTRING ';'
3710   {
3711    if (ypass == 2)
3712    {
3713 <    struct CollectItem *yy_tmp = NULL;
3713 >    struct split_nuh_item nuh;
3714 >
3715 >    nuh.nuhmask  = yylval.string;
3716 >    nuh.nickptr  = NULL;
3717 >    nuh.userptr  = userbuf;
3718 >    nuh.hostptr  = hostbuf;
3719 >
3720 >    nuh.nicksize = 0;
3721 >    nuh.usersize = sizeof(userbuf);
3722 >    nuh.hostsize = sizeof(hostbuf);
3723 >
3724 >    split_nuh(&nuh);
3725  
3726      if (yy_aconf->user == NULL)
3727      {
3728 <      split_nuh(yylval.string, NULL, &yy_aconf->user, &yy_aconf->host);
3728 >      DupString(yy_aconf->user, userbuf);
3729 >      DupString(yy_aconf->host, hostbuf);
3730      }
3731      else
3732      {
3733 <      yy_tmp = MyMalloc(sizeof(struct CollectItem));
3734 <      split_nuh(yylval.string, NULL, &yy_tmp->user, &yy_tmp->host);
3733 >      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
3734 >
3735 >      DupString(yy_tmp->user, userbuf);
3736 >      DupString(yy_tmp->host, hostbuf);
3737 >
3738        dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
3739      }
3740    }
# Line 3725 | Line 3820 | channel_items:      channel_items channe
3820   channel_item:       channel_disable_local_channels | channel_use_except |
3821                      channel_use_invex | channel_use_knock |
3822                      channel_max_bans | channel_knock_delay |
3823 <                    channel_knock_delay_channel | channel_invite_ops_only |
3824 <                    channel_max_chans_per_user | channel_quiet_on_ban |
3825 <                    channel_default_split_user_count |
3826 <                    channel_default_split_server_count |
3827 <                    channel_no_create_on_split | channel_restrict_channels |
3828 <                    channel_no_join_on_split | channel_burst_topicwho |
3829 <                    channel_jflood_count | channel_jflood_time |
3735 <                    error;
3823 >                    channel_knock_delay_channel | channel_max_chans_per_user |
3824 >                    channel_quiet_on_ban | channel_default_split_user_count |
3825 >                    channel_default_split_server_count |
3826 >                    channel_no_create_on_split | channel_restrict_channels |
3827 >                    channel_no_join_on_split | channel_burst_topicwho |
3828 >                    channel_jflood_count | channel_jflood_time |
3829 >                    error;
3830  
3831   channel_restrict_channels: RESTRICT_CHANNELS '=' TBOOL ';'
3832   {
# Line 3769 | Line 3863 | channel_knock_delay_channel: KNOCK_DELAY
3863    ConfigChannel.knock_delay_channel = $3;
3864   };
3865  
3772 channel_invite_ops_only: INVITE_OPS_ONLY '=' TBOOL ';'
3773 {
3774  ConfigChannel.invite_ops_only = yylval.number;
3775 };
3776
3866   channel_max_chans_per_user: MAX_CHANS_PER_USER '=' NUMBER ';'
3867   {
3868    ConfigChannel.max_chans_per_user = $3;

Diff Legend

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