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.2/src/ircd_parser.y (file contents):
Revision 440 by michael, Sat Feb 11 23:11:38 2006 UTC vs.
Revision 853 by db, Thu Feb 22 06:01:30 2007 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 169 | Line 169 | unhook_hub_leaf_confs(void)
169   %token  DESCRIPTION
170   %token  DIE
171   %token  DISABLE_AUTH
172 + %token  DISABLE_FAKE_CHANNELS
173   %token  DISABLE_HIDDEN
174   %token  DISABLE_LOCAL_CHANNELS
175   %token  DISABLE_REMOTE_COMMANDS
# Line 315 | Line 316 | unhook_hub_leaf_confs(void)
316   %token  SILENT
317   %token  SPOOF
318   %token  SPOOF_NOTICE
319 + %token  STATS_E_DISABLED
320   %token  STATS_I_OPER_ONLY
321   %token  STATS_K_OPER_ONLY
322   %token  STATS_O_OPER_ONLY
# Line 330 | Line 332 | unhook_hub_leaf_confs(void)
332   %token  T_SOFTCALLERID
333   %token  T_CALLERID
334   %token  T_CCONN
335 + %token  T_CCONN_FULL
336   %token  T_CLIENT_FLOOD
337   %token  T_DEAF
338   %token  T_DEBUG
# Line 616 | Line 619 | serverinfo_sid: IRCD_SID '=' QSTRING ';'
619    /* this isn't rehashable */
620    if (ypass == 2 && !ServerInfo.sid)
621    {
622 <    if ((strlen(yylval.string) == IRC_MAXSID) && IsDigit(yylval.string[0])
620 <        && IsAlNum(yylval.string[1]) && IsAlNum(yylval.string[2]))
621 <    {
622 >    if (valid_sid(yylval.string))
623        DupString(ServerInfo.sid, yylval.string);
623    }
624      else
625      {
626        ilog(L_ERROR, "Ignoring config file entry SID -- invalid SID. Aborting.");
# Line 1079 | Line 1079 | oper_user: USER '=' QSTRING ';'
1079   {
1080    if (ypass == 2)
1081    {
1082 <    struct CollectItem *yy_tmp;
1082 >    struct split_nuh_item nuh;
1083 >
1084 >    nuh.nuhmask  = yylval.string;
1085 >    nuh.nickptr  = NULL;
1086 >    nuh.userptr  = userbuf;
1087 >    nuh.hostptr  = hostbuf;
1088 >
1089 >    nuh.nicksize = 0;
1090 >    nuh.usersize = sizeof(userbuf);
1091 >    nuh.hostsize = sizeof(hostbuf);
1092 >
1093 >    split_nuh(&nuh);
1094  
1095      if (yy_aconf->user == NULL)
1096      {
1097 <      split_nuh(yylval.string, NULL, &yy_aconf->user, &yy_aconf->host);
1097 >      DupString(yy_aconf->user, userbuf);
1098 >      DupString(yy_aconf->host, hostbuf);
1099      }
1100      else
1101      {
1102 <      yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
1103 <      split_nuh(yylval.string, NULL, &yy_tmp->user, &yy_tmp->host);
1102 >      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
1103 >
1104 >      DupString(yy_tmp->user, userbuf);
1105 >      DupString(yy_tmp->host, hostbuf);
1106 >
1107        dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1108      }
1109    }
# Line 1183 | Line 1198 | oper_umodes_item:  T_BOTS
1198   {
1199    if (ypass == 2)
1200      yy_aconf->modes |= UMODE_CCONN;
1201 + } | T_CCONN_FULL
1202 + {
1203 +  if (ypass == 2)
1204 +    yy_aconf->modes |= UMODE_CCONN_FULL;
1205   } | T_DEAF
1206   {
1207    if (ypass == 2)
# Line 1534 | Line 1553 | class_entry: CLASS
1553    if (ypass == 1)
1554    {
1555      yy_conf = make_conf_item(CLASS_TYPE);
1556 <    yy_class = (struct ClassItem *)map_to_conf(yy_conf);
1556 >    yy_class = map_to_conf(yy_conf);
1557    }
1558   } class_name_b '{' class_items '}' ';'
1559   {
1560    if (ypass == 1)
1561    {
1562 <    struct ConfItem *cconf;
1562 >    struct ConfItem *cconf = NULL;
1563      struct ClassItem *class = NULL;
1564  
1565      if (yy_class_name == NULL)
1547    {
1566        delete_conf_item(yy_conf);
1549    }
1567      else
1568      {
1569        cconf = find_exact_name_conf(CLASS_TYPE, yy_class_name, NULL, NULL);
1570  
1571        if (cconf != NULL)                /* The class existed already */
1572        {
1573 +        int user_count = 0;
1574 +
1575          rebuild_cidr_class(cconf, yy_class);
1576 <        class = (struct ClassItem *) map_to_conf(cconf);
1577 <        *class = *yy_class;
1576 >
1577 >        class = map_to_conf(cconf);
1578 >
1579 >        user_count = class->curr_user_count;
1580 >        memcpy(class, yy_class, sizeof(*class));
1581 >        class->curr_user_count = user_count;
1582 >        class->active = 1;
1583 >
1584          delete_conf_item(yy_conf);
1585  
1586          MyFree(cconf->name);            /* Allows case change of class name */
# Line 1565 | Line 1590 | class_entry: CLASS
1590        {
1591          MyFree(yy_conf->name);          /* just in case it was allocated */
1592          yy_conf->name = yy_class_name;
1593 +        yy_class->active = 1;
1594        }
1595      }
1596 +
1597      yy_class_name = NULL;
1598    }
1599   };
# Line 1856 | Line 1883 | auth_user: USER '=' QSTRING ';'
1883   {
1884    if (ypass == 2)
1885    {
1886 <    struct CollectItem *yy_tmp;
1886 >    struct CollectItem *yy_tmp = NULL;
1887 >    struct split_nuh_item nuh;
1888 >
1889 >    nuh.nuhmask  = yylval.string;
1890 >    nuh.nickptr  = NULL;
1891 >    nuh.userptr  = userbuf;
1892 >    nuh.hostptr  = hostbuf;
1893 >
1894 >    nuh.nicksize = 0;
1895 >    nuh.usersize = sizeof(userbuf);
1896 >    nuh.hostsize = sizeof(hostbuf);
1897 >
1898 >    split_nuh(&nuh);
1899  
1900      if (yy_aconf->user == NULL)
1901 <      split_nuh(yylval.string, NULL, &yy_aconf->user, &yy_aconf->host);
1901 >    {
1902 >      DupString(yy_aconf->user, userbuf);
1903 >      DupString(yy_aconf->host, hostbuf);
1904 >    }
1905      else
1906      {
1907        yy_tmp = MyMalloc(sizeof(struct CollectItem));
1908 <      split_nuh(yylval.string, NULL, &yy_tmp->user, &yy_tmp->host);
1908 >
1909 >      DupString(yy_tmp->user, userbuf);
1910 >      DupString(yy_tmp->host, hostbuf);
1911 >
1912        dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1913      }
1914    }
# Line 2204 | Line 2249 | shared_user: USER '=' QSTRING ';'
2249   {
2250    if (ypass == 2)
2251    {
2252 <    split_nuh(yylval.string, NULL, &yy_match_item->user, &yy_match_item->host);
2252 >    struct split_nuh_item nuh;
2253 >
2254 >    nuh.nuhmask  = yylval.string;
2255 >    nuh.nickptr  = NULL;
2256 >    nuh.userptr  = userbuf;
2257 >    nuh.hostptr  = hostbuf;
2258 >
2259 >    nuh.nicksize = 0;
2260 >    nuh.usersize = sizeof(userbuf);
2261 >    nuh.hostsize = sizeof(hostbuf);
2262 >
2263 >    split_nuh(&nuh);
2264 >
2265 >    DupString(yy_match_item->user, userbuf);
2266 >    DupString(yy_match_item->host, hostbuf);
2267    }
2268   };
2269  
# Line 2381 | Line 2440 | connect_entry: CONNECT
2440            yy_aconf->passwd && yy_aconf->spasswd)
2441   #endif /* !HAVE_LIBCRYPTO */
2442          {
2443 <          if (conf_add_server(yy_conf, scount, class_name) >= 0)
2385 <          {
2386 <            ++scount;
2387 <          }
2388 <          else
2443 >          if (conf_add_server(yy_conf, class_name) == -1)
2444            {
2445              delete_conf_item(yy_conf);
2446              yy_conf = NULL;
# Line 2878 | Line 2933 | kill_entry: KILL
2933          if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) ||
2934              !(exp_host = ircd_pcre_compile(hostbuf, &errptr)))
2935          {
2936 <          ilog(L_ERROR, "Failed to add regular expression based K-Line: %s", errptr);
2936 >          ilog(L_ERROR, "Failed to add regular expression based K-Line: %s",
2937 >               errptr);
2938            break;
2939          }
2940  
2941          yy_conf = make_conf_item(RKLINE_TYPE);
2942 +        yy_aconf = map_to_conf(yy_conf);
2943 +
2944          yy_aconf->regexuser = exp_user;
2945          yy_aconf->regexhost = exp_host;
2946  
# Line 2935 | Line 2993 | kill_user: USER '=' QSTRING ';'
2993   {
2994    if (ypass == 2)
2995    {
2996 <    char *user = NULL, *host = NULL;
2939 <
2940 <    split_nuh(yylval.string, NULL, &user, &host);
2996 >    struct split_nuh_item nuh;
2997  
2998 <    strlcpy(userbuf, user, sizeof(userbuf));
2999 <    strlcpy(hostbuf, host, sizeof(hostbuf));
2998 >    nuh.nuhmask  = yylval.string;
2999 >    nuh.nickptr  = NULL;
3000 >    nuh.userptr  = userbuf;
3001 >    nuh.hostptr  = hostbuf;
3002 >
3003 >    nuh.nicksize = 0;
3004 >    nuh.usersize = sizeof(userbuf);
3005 >    nuh.hostsize = sizeof(hostbuf);
3006  
3007 <    MyFree(user);
2946 <    MyFree(host);
3007 >    split_nuh(&nuh);
3008    }
3009   };
3010  
# Line 3048 | Line 3109 | gecos_entry: GECOS
3109  
3110          if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr)))
3111          {
3112 <          ilog(L_ERROR, "Failed to add regular expression based X-Line: %s", errptr);
3112 >          ilog(L_ERROR, "Failed to add regular expression based X-Line: %s",
3113 >               errptr);
3114            break;
3115          }
3116  
# Line 3129 | Line 3191 | general_item:       general_hide_spoof_i
3191                      general_disable_auth | general_burst_away |
3192                      general_tkline_expire_notices | general_gline_min_cidr |
3193                      general_gline_min_cidr6 | general_use_whois_actually |
3194 <                    general_reject_hold_time |
3194 >                    general_reject_hold_time | general_stats_e_disabled |
3195                      error;
3196  
3197  
# Line 3260 | Line 3322 | general_warn_no_nline: WARN_NO_NLINE '='
3322    ConfigFileEntry.warn_no_nline = yylval.number;
3323   };
3324  
3325 + general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
3326 + {
3327 +  ConfigFileEntry.stats_e_disabled = yylval.number;
3328 + };
3329 +
3330   general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
3331   {
3332    ConfigFileEntry.stats_o_oper_only = yylval.number;
# Line 3452 | Line 3519 | umode_oitem:     T_BOTS
3519   } | T_CCONN
3520   {
3521    ConfigFileEntry.oper_umodes |= UMODE_CCONN;
3522 + } | T_CCONN_FULL
3523 + {
3524 +  ConfigFileEntry.oper_umodes |= UMODE_CCONN_FULL;
3525   } | T_DEAF
3526   {
3527    ConfigFileEntry.oper_umodes |= UMODE_DEAF;
# Line 3514 | Line 3584 | umode_item:    T_BOTS
3584   } | T_CCONN
3585   {
3586    ConfigFileEntry.oper_only_umodes |= UMODE_CCONN;
3587 + } | T_CCONN_FULL
3588 + {
3589 +  ConfigFileEntry.oper_only_umodes |= UMODE_CCONN_FULL;
3590   } | T_DEAF
3591   {
3592    ConfigFileEntry.oper_only_umodes |= UMODE_DEAF;
# Line 3657 | Line 3730 | gline_user: USER '=' QSTRING ';'
3730   {
3731    if (ypass == 2)
3732    {
3733 <    struct CollectItem *yy_tmp = NULL;
3733 >    struct split_nuh_item nuh;
3734 >
3735 >    nuh.nuhmask  = yylval.string;
3736 >    nuh.nickptr  = NULL;
3737 >    nuh.userptr  = userbuf;
3738 >    nuh.hostptr  = hostbuf;
3739 >
3740 >    nuh.nicksize = 0;
3741 >    nuh.usersize = sizeof(userbuf);
3742 >    nuh.hostsize = sizeof(hostbuf);
3743 >
3744 >    split_nuh(&nuh);
3745  
3746      if (yy_aconf->user == NULL)
3747      {
3748 <      split_nuh(yylval.string, NULL, &yy_aconf->user, &yy_aconf->host);
3748 >      DupString(yy_aconf->user, userbuf);
3749 >      DupString(yy_aconf->host, hostbuf);
3750      }
3751      else
3752      {
3753 <      yy_tmp = MyMalloc(sizeof(struct CollectItem));
3754 <      split_nuh(yylval.string, NULL, &yy_tmp->user, &yy_tmp->host);
3753 >      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
3754 >
3755 >      DupString(yy_tmp->user, userbuf);
3756 >      DupString(yy_tmp->host, hostbuf);
3757 >
3758        dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
3759      }
3760    }
# Line 3758 | Line 3846 | channel_item:       channel_disable_loca
3846                      channel_no_create_on_split | channel_restrict_channels |
3847                      channel_no_join_on_split | channel_burst_topicwho |
3848                      channel_jflood_count | channel_jflood_time |
3849 <                    error;
3849 >                    channel_disable_fake_channels | error;
3850 >
3851 > channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';'
3852 > {
3853 >  ConfigChannel.disable_fake_channels = yylval.number;
3854 > };
3855  
3856   channel_restrict_channels: RESTRICT_CHANNELS '=' TBOOL ';'
3857   {

Diff Legend

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