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

Comparing ircd-hybrid-8/src/conf_parser.y (file contents):
Revision 1458 by michael, Sat Jun 9 19:40:08 2012 UTC vs.
Revision 1459 by michael, Fri Jul 6 14:23:09 2012 UTC

# Line 156 | Line 156 | free_collect_item(struct CollectItem *it
156   %token  GECOS
157   %token  GENERAL
158   %token  GLINE
159 < %token  GLINES
159 > %token  GLINE_DURATION
160 > %token  GLINE_ENABLE
161   %token  GLINE_EXEMPT
162   %token  GLINE_TIME
163 + %token  GLINE_REQUEST_DURATION
164   %token  GLINE_MIN_CIDR
165   %token  GLINE_MIN_CIDR6
166   %token  GLOBAL_KILL
# Line 373 | Line 375 | conf_item:        admin_entry
375                  | deny_entry
376                  | exempt_entry
377                  | general_entry
376                | gline_entry
378                  | gecos_entry
379                  | modules_entry
380                  | error ';'
# Line 2537 | Line 2538 | general_item:       general_hide_spoof_i
2538                      general_throttle_time | general_havent_read_conf |
2539                      general_ping_cookie |
2540                      general_disable_auth |
2541 <                    general_tkline_expire_notices | general_gline_min_cidr |
2541 >                    general_tkline_expire_notices | general_gline_enable |
2542 >                    general_gline_duration | general_gline_request_duration |
2543 >                    general_gline_min_cidr |
2544                      general_gline_min_cidr6 | general_use_whois_actually |
2545                      general_reject_hold_time | general_stats_e_disabled |
2546                      general_max_watch | general_services_name |
# Line 2549 | Line 2552 | general_max_watch: MAX_WATCH '=' NUMBER
2552    ConfigFileEntry.max_watch = $3;
2553   };
2554  
2555 + general_gline_enable: GLINE_ENABLE '=' TBOOL ';'
2556 + {
2557 +  if (conf_parser_ctx.pass == 2)
2558 +    ConfigFileEntry.glines = yylval.number;
2559 + };
2560 +
2561 + general_gline_duration: GLINE_DURATION '=' timespec ';'
2562 + {
2563 +  if (conf_parser_ctx.pass == 2)
2564 +    ConfigFileEntry.gline_time = $3;
2565 + };
2566 +
2567 + general_gline_request_duration: GLINE_REQUEST_DURATION '=' timespec ';'
2568 + {
2569 +  if (conf_parser_ctx.pass == 2)
2570 +    ConfigFileEntry.gline_request_time = $3;
2571 + };
2572 +
2573   general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2574   {
2575    ConfigFileEntry.gline_min_cidr = $3;
# Line 2957 | Line 2978 | general_client_flood: T_CLIENT_FLOOD '='
2978   };
2979  
2980  
2960 /***************************************************************************
2961 *  section glines
2962 ***************************************************************************/
2963 gline_entry: GLINES
2964 {
2965  if (conf_parser_ctx.pass == 2)
2966  {
2967    yy_conf = make_conf_item(GDENY_TYPE);
2968    yy_aconf = map_to_conf(yy_conf);
2969  }
2970 } '{' gline_items '}' ';'
2971 {
2972  if (conf_parser_ctx.pass == 2)
2973  {
2974    /*
2975     * since we re-allocate yy_conf/yy_aconf after the end of action=, at the
2976     * end we will have one extra, so we should free it.
2977     */
2978    if (yy_conf->name == NULL || yy_aconf->user == NULL)
2979    {
2980      delete_conf_item(yy_conf);
2981      yy_conf = NULL;
2982      yy_aconf = NULL;
2983    }
2984  }
2985 };
2986
2987 gline_items:        gline_items gline_item | gline_item;
2988 gline_item:         gline_enable |
2989                    gline_duration |
2990                    gline_logging |
2991                    gline_user |
2992                    gline_server |
2993                    gline_action |
2994                    error;
2995
2996 gline_enable: ENABLE '=' TBOOL ';'
2997 {
2998  if (conf_parser_ctx.pass == 2)
2999    ConfigFileEntry.glines = yylval.number;
3000 };
3001
3002 gline_duration: DURATION '=' timespec ';'
3003 {
3004  if (conf_parser_ctx.pass == 2)
3005    ConfigFileEntry.gline_time = $3;
3006 };
3007
3008 gline_logging: T_LOG
3009 {
3010  if (conf_parser_ctx.pass == 2)
3011    ConfigFileEntry.gline_logging = 0;
3012 } '=' gline_logging_types ';';
3013 gline_logging_types:     gline_logging_types ',' gline_logging_type_item | gline_logging_type_item;
3014 gline_logging_type_item: T_REJECT
3015 {
3016  if (conf_parser_ctx.pass == 2)
3017    ConfigFileEntry.gline_logging |= GDENY_REJECT;
3018 } | T_BLOCK
3019 {
3020  if (conf_parser_ctx.pass == 2)
3021    ConfigFileEntry.gline_logging |= GDENY_BLOCK;
3022 };
3023
3024 gline_user: USER '=' QSTRING ';'
3025 {
3026  if (conf_parser_ctx.pass == 2)
3027  {
3028    struct split_nuh_item nuh;
3029
3030    nuh.nuhmask  = yylval.string;
3031    nuh.nickptr  = NULL;
3032    nuh.userptr  = userbuf;
3033    nuh.hostptr  = hostbuf;
3034
3035    nuh.nicksize = 0;
3036    nuh.usersize = sizeof(userbuf);
3037    nuh.hostsize = sizeof(hostbuf);
3038
3039    split_nuh(&nuh);
3040
3041    if (yy_aconf->user == NULL)
3042    {
3043      DupString(yy_aconf->user, userbuf);
3044      DupString(yy_aconf->host, hostbuf);
3045    }
3046    else
3047    {
3048      struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
3049
3050      DupString(yy_tmp->user, userbuf);
3051      DupString(yy_tmp->host, hostbuf);
3052
3053      dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
3054    }
3055  }
3056 };
3057
3058 gline_server: NAME '=' QSTRING ';'
3059 {
3060  if (conf_parser_ctx.pass == 2)  
3061  {
3062    MyFree(yy_conf->name);
3063    DupString(yy_conf->name, yylval.string);
3064  }
3065 };
3066
3067 gline_action: ACTION
3068 {
3069  if (conf_parser_ctx.pass == 2)
3070    yy_aconf->flags = 0;
3071 } '=' gdeny_types ';'
3072 {
3073  if (conf_parser_ctx.pass == 2)
3074  {
3075    struct CollectItem *yy_tmp = NULL;
3076    dlink_node *ptr, *next_ptr;
3077
3078    DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
3079    {
3080      struct AccessItem *new_aconf;
3081      struct ConfItem *new_conf;
3082
3083      yy_tmp = ptr->data;
3084      new_conf = make_conf_item(GDENY_TYPE);
3085      new_aconf = map_to_conf(new_conf);
3086
3087      new_aconf->flags = yy_aconf->flags;
3088
3089      if (yy_conf->name != NULL)
3090        DupString(new_conf->name, yy_conf->name);
3091      else
3092        DupString(new_conf->name, "*");
3093      if (yy_aconf->user != NULL)
3094         DupString(new_aconf->user, yy_tmp->user);
3095      else  
3096        DupString(new_aconf->user, "*");
3097      if (yy_aconf->host != NULL)
3098        DupString(new_aconf->host, yy_tmp->host);
3099      else
3100        DupString(new_aconf->host, "*");
3101
3102      dlinkDelete(&yy_tmp->node, &col_conf_list);
3103    }
3104
3105    /*
3106     * In case someone has fed us with more than one action= after user/name
3107     * which would leak memory  -Michael
3108     */
3109    if (yy_conf->name == NULL || yy_aconf->user == NULL)
3110      delete_conf_item(yy_conf);
3111
3112    yy_conf = make_conf_item(GDENY_TYPE);
3113    yy_aconf = map_to_conf(yy_conf);
3114  }
3115 };
3116
3117 gdeny_types: gdeny_types ',' gdeny_type_item | gdeny_type_item;
3118 gdeny_type_item: T_REJECT
3119 {
3120  if (conf_parser_ctx.pass == 2)
3121    yy_aconf->flags |= GDENY_REJECT;
3122 } | T_BLOCK
3123 {
3124  if (conf_parser_ctx.pass == 2)
3125    yy_aconf->flags |= GDENY_BLOCK;
3126 };
3127
2981   /***************************************************************************
2982   *  section channel
2983   ***************************************************************************/

Diff Legend

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