"Fossies" - the Fresh Open Source Software Archive

Member "hitch-1.5.2/src/cfg_parser.y" (26 Nov 2019, 14307 Bytes) of package /linux/www/hitch-1.5.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bison source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "cfg_parser.y": 1.5.0_vs_1.5.1.

    1 %{
    2 #include "config.h"
    3 
    4 #include <stdio.h>
    5 #include <stdlib.h>
    6 
    7 #include "configuration.h"
    8 #include "foreign/vas.h"
    9 #include "foreign/miniobj.h"
   10 #include "foreign/uthash.h"
   11 
   12 extern int yylex (void);
   13 extern int yyparse(hitch_config *);
   14 extern FILE *yyin;
   15 int yyget_lineno(void);
   16 
   17 void config_error_set(char *, ...);
   18 int config_param_validate(char *k, char *v, hitch_config *cfg,
   19     char *file, int line);
   20 int front_arg_add(hitch_config *cfg, struct front_arg *fa);
   21 struct front_arg *front_arg_new(void);
   22 void front_arg_destroy(struct front_arg *fa);
   23 struct cfg_cert_file *
   24 cfg_cert_file_new(void);
   25 void cfg_cert_file_free(struct cfg_cert_file **cfptr);
   26 int cfg_cert_vfy(struct cfg_cert_file *cf);
   27 void yyerror(hitch_config *, const char *);
   28 void cfg_cert_add(struct cfg_cert_file *cf, struct cfg_cert_file **dst);
   29 
   30 static struct front_arg *cur_fa;
   31 static struct cfg_cert_file *cur_pem;
   32 extern char input_line[512];
   33 
   34 %}
   35 
   36 %union {
   37     int i;
   38     char    *s;
   39 }
   40 
   41 %token <i> INT
   42 %token <i> UINT
   43 %token <i> BOOL
   44 %token <s> STRING
   45 
   46 %token TOK_CIPHERS TOK_SSL_ENGINE TOK_PREFER_SERVER_CIPHERS TOK_BACKEND
   47 %token TOK_FRONTEND TOK_WORKERS TOK_BACKLOG TOK_KEEPALIVE TOK_CHROOT
   48 %token TOK_USER TOK_GROUP TOK_QUIET TOK_SYSLOG TOK_SYSLOG_FACILITY
   49 %token TOK_PARAM_SYSLOG_FACILITY TOK_DAEMON TOK_WRITE_IP TOK_WRITE_PROXY
   50 %token TOK_WRITE_PROXY_V1 TOK_WRITE_PROXY_V2 TOK_PEM_FILE TOK_PROXY_PROXY
   51 %token TOK_BACKEND_CONNECT_TIMEOUT TOK_SSL_HANDSHAKE_TIMEOUT TOK_RECV_BUFSIZE
   52 %token TOK_SEND_BUFSIZE TOK_LOG_FILENAME TOK_RING_SLOTS TOK_RING_DATA_LEN
   53 %token TOK_PIDFILE TOK_SNI_NOMATCH_ABORT TOK_SSL TOK_TLS TOK_HOST TOK_PORT
   54 %token TOK_MATCH_GLOBAL TOK_PB_CERT TOK_PB_OCSP_FILE TOK_OCSP_VERIFY
   55 %token TOK_OCSP_DIR TOK_OCSP_RESP_TMO TOK_OCSP_CONN_TMO TOK_ALPN_PROTOS
   56 %token TOK_TLS_PROTOS TOK_SSLv3 TOK_TLSv1_0 TOK_TLSv1_1 TOK_TLSv1_2
   57 %token TOK_TLSv1_3
   58 %token TOK_SESSION_CACHE TOK_SHARED_CACHE_LISTEN TOK_SHARED_CACHE_PEER
   59 %token TOK_SHARED_CACHE_IF TOK_PRIVATE_KEY TOK_BACKEND_REFRESH
   60 %token TOK_OCSP_REFRESH_INTERVAL TOK_PEM_DIR TOK_PEM_DIR_GLOB
   61 %token TOK_LOG_LEVEL TOK_PROXY_TLV TOK_PROXY_AUTHORITY TOK_TFO
   62 
   63 %parse-param { hitch_config *cfg }
   64 
   65 %%
   66 CFG
   67     : CFG_RECORDS
   68     ;
   69 
   70 CFG_RECORDS
   71     : CFG_RECORD
   72     | CFG_RECORDS CFG_RECORD
   73     ;
   74 
   75 CFG_RECORD
   76     : FRONTEND_REC
   77     | BACKEND_REC
   78     | PEM_FILE_REC
   79     | CIPHERS_REC
   80     | TLS_REC
   81     | SSL_REC
   82     | TLS_PROTOS_REC
   83     | PREFER_SERVER_CIPHERS_REC
   84     | SSL_ENGINE_REC
   85     | WORKERS_REC
   86     | BACKLOG_REC
   87     | KEEPALIVE_REC
   88     | CHROOT_REC
   89     | USER_REC
   90     | GROUP_REC
   91     | QUIET_REC
   92     | SYSLOG_REC
   93     | SYSLOG_FACILITY_REC
   94     | DAEMON_REC
   95     | WRITE_IP_REC
   96     | WRITE_PROXY_REC
   97     | WRITE_PROXY_V1_REC
   98     | WRITE_PROXY_V2_REC
   99     | PROXY_PROXY_REC
  100     | ALPN_PROTOS_REC
  101     | PROXY_TLV_REC
  102     | SNI_NOMATCH_ABORT_REC
  103     | OCSP_VERIFY
  104     | OCSP_RESP_TMO
  105     | OCSP_CONN_TMO
  106     | OCSP_REFRESH_INTERVAL
  107     | OCSP_DIR
  108     | PEM_DIR
  109     | PEM_DIR_GLOB
  110     | SESSION_CACHE_REC
  111     | SHARED_CACHE_LISTEN_REC
  112     | SHARED_CACHE_PEER_REC
  113     | SHARED_CACHE_IF_REC
  114     | LOG_FILENAME_REC
  115     | LOG_LEVEL_REC
  116     | SEND_BUFSIZE_REC
  117     | RECV_BUFSIZE_REC
  118     | BACKEND_REFRESH_REC
  119     | TFO
  120     ;
  121 
  122 FRONTEND_REC
  123     : TOK_FRONTEND '=' STRING {
  124         /* XXX: passing an empty string for file */
  125         if ($3 && config_param_validate("frontend", $3, cfg, "",
  126             yyget_lineno()) != 0)
  127             YYABORT;
  128     }
  129     | TOK_FRONTEND '=' '{' {
  130         /* NB: Mid-rule action */
  131         AZ(cur_fa);
  132         cur_fa = front_arg_new();
  133     }
  134     FRONTEND_BLK '}' {
  135         if (front_arg_add(cfg, cur_fa) != 1)
  136             YYABORT;
  137         cur_fa = NULL;
  138     };
  139 
  140 FRONTEND_BLK: FB_RECS;
  141 FB_RECS
  142     : FB_REC
  143     | FB_RECS FB_REC
  144     ;
  145 
  146 FB_REC
  147     : FB_HOST
  148     | FB_PORT
  149     | FB_CERT
  150     | FB_MATCH_GLOBAL
  151     | FB_SNI_NOMATCH_ABORT
  152     | FB_TLS
  153     | FB_SSL
  154     | FB_TLS_PROTOS
  155     | FB_CIPHERS
  156     | FB_PREF_SRV_CIPH
  157     ;
  158 
  159 FB_HOST: TOK_HOST '=' STRING {
  160     if ($3) {
  161         if (strcmp($3, "*") == 0)
  162             cur_fa->ip = NULL;
  163         else
  164             cur_fa->ip = strdup($3);
  165     }
  166 };
  167 
  168 FB_PORT: TOK_PORT '=' STRING { if ($3) cur_fa->port = strdup($3); };
  169 
  170 PEM_BLK: PB_RECS;
  171 
  172 PB_RECS
  173     : PB_REC
  174     | PB_RECS PB_REC
  175     ;
  176 
  177 PB_REC
  178     : PB_CERT
  179     | PB_OCSP_RESP_FILE;
  180     | OCSP_VERIFY
  181     | PRIVATE_KEY
  182     ;
  183 
  184 PB_CERT: TOK_PB_CERT '=' STRING { if ($3) cur_pem->filename = strdup($3); };
  185 
  186 PB_OCSP_RESP_FILE: TOK_PB_OCSP_FILE '=' STRING {
  187     if ($3)
  188         cur_pem->ocspfn = strdup($3);
  189 };
  190 
  191 OCSP_VERIFY: TOK_OCSP_VERIFY '=' BOOL {
  192     if (cur_pem != NULL)
  193         cur_pem->ocsp_vfy = $3;
  194     else
  195         cfg->OCSP_VFY = $3;
  196 };
  197 
  198 PRIVATE_KEY: TOK_PRIVATE_KEY '=' STRING {
  199     if ($3) cur_pem->priv_key_filename = strdup($3);
  200 };
  201 
  202 PEM_DIR: TOK_PEM_DIR '=' STRING {
  203     if ($3) {
  204         size_t l;
  205         l = strlen($3);
  206         cfg->PEM_DIR = malloc(l + 2);
  207         strcpy(cfg->PEM_DIR, $3);
  208         if (cfg->PEM_DIR[l-1] != '/')
  209             strcat(cfg->PEM_DIR, "/");
  210     }
  211     else
  212         cfg->PEM_DIR = NULL;
  213 };
  214 
  215 PEM_DIR_GLOB: TOK_PEM_DIR_GLOB '=' STRING {
  216     if ($3)
  217         cfg->PEM_DIR_GLOB = strdup($3);
  218     else
  219         cfg->PEM_DIR_GLOB = NULL;
  220 
  221 };
  222 
  223 OCSP_DIR: TOK_OCSP_DIR '=' STRING {
  224     if ($3)
  225         cfg->OCSP_DIR = strdup($3);
  226     else
  227         cfg->OCSP_DIR = NULL;
  228 };
  229 
  230 OCSP_RESP_TMO: TOK_OCSP_RESP_TMO '=' UINT {
  231     cfg->OCSP_RESP_TMO = $3;
  232 };
  233 
  234 OCSP_CONN_TMO: TOK_OCSP_CONN_TMO '=' UINT {
  235     cfg->OCSP_CONN_TMO = $3;
  236 };
  237 
  238 OCSP_REFRESH_INTERVAL: TOK_OCSP_REFRESH_INTERVAL '=' UINT {
  239     cfg->OCSP_REFRESH_INTERVAL = $3;
  240 }
  241 
  242 FB_CERT
  243     : TOK_PEM_FILE '=' STRING {
  244         if ($3 != NULL) {
  245             int r;
  246             struct cfg_cert_file *cert;
  247             cert = cfg_cert_file_new();
  248             cert->filename = strdup($3);
  249             r = cfg_cert_vfy(cert);
  250             if (r == 0) {
  251                 cfg_cert_file_free(&cert);
  252                 YYABORT;
  253             }
  254             cfg_cert_add(cert, &cur_fa->certs);
  255         }
  256     }
  257     | TOK_PEM_FILE '=' '{' {
  258         /* NB: Mid-rule action */
  259         AZ(cur_pem);
  260         cur_pem = cfg_cert_file_new();
  261     }
  262     PEM_BLK '}' {
  263         if (cfg_cert_vfy(cur_pem) != 0)
  264             cfg_cert_add(cur_pem, &cur_fa->certs);
  265         else {
  266             cfg_cert_file_free(&cur_pem);
  267             YYABORT;
  268         }
  269         cur_pem = NULL;
  270     };
  271 
  272 FB_MATCH_GLOBAL: TOK_MATCH_GLOBAL '=' BOOL { cur_fa->match_global_certs = $3; };
  273 
  274 FB_SNI_NOMATCH_ABORT:TOK_SNI_NOMATCH_ABORT '=' BOOL {
  275         cur_fa->sni_nomatch_abort = $3;
  276 };
  277 
  278 // this is not optimal, but it was not before, either.
  279 FB_TLS: TOK_TLS '=' BOOL {
  280     if (cur_fa->selected_protos != 0) {
  281         fprintf(stderr, "%s (%s, line %d):"
  282             " It is illegal to specify tls after ssl,"
  283             " tls or tls-protos.\n",
  284             __func__, __FILE__, __LINE__);
  285         front_arg_destroy(cur_fa);
  286         cur_fa = NULL;
  287         YYABORT;
  288     }
  289     if ($3)
  290         cur_fa->selected_protos = TLS_OPTION_PROTOS;
  291     else
  292         fprintf(stderr,
  293             "Warning: tls = off is deprecated and has no effect.\n");
  294 }
  295 
  296 FB_SSL: TOK_SSL '=' BOOL {
  297     if (cur_fa->selected_protos != 0) {
  298         fprintf(stderr, "%s (%s, line %d):"
  299             " It is illegal to specify ssl after ssl,"
  300             " tls or tls-protos.\n",
  301             __func__, __FILE__, __LINE__);
  302         front_arg_destroy(cur_fa);
  303         cur_fa = NULL;
  304         YYABORT;
  305     }
  306     if ($3)
  307         cur_fa->selected_protos = SSL_OPTION_PROTOS;
  308     else
  309         fprintf(stderr,
  310             "Warning: ssl = off is deprecated and has no effect.\n");
  311 }
  312 
  313 FB_TLS_PROTOS: TOK_TLS_PROTOS {
  314     if (cur_fa->selected_protos != 0) {
  315         fprintf(stderr, "%s (%s, line %d):"
  316             " It is illegal to specify tls-protos after"
  317             " ssl, tls or tls-protos\nSelected before was %d\n",
  318             __func__, __FILE__, __LINE__, cur_fa->selected_protos);
  319         front_arg_destroy(cur_fa);
  320         cur_fa = NULL;
  321         YYABORT;
  322     }
  323 } '=' FB_TLS_PROTOS_LIST;
  324 
  325 FB_TLS_PROTOS_LIST: FB_TLS_PROTO | FB_TLS_PROTOS_LIST FB_TLS_PROTO;
  326 FB_TLS_PROTO
  327     : TOK_SSLv3 { cur_fa->selected_protos |= SSLv3_PROTO; }
  328     | TOK_TLSv1_0 { cur_fa->selected_protos |= TLSv1_0_PROTO; }
  329     | TOK_TLSv1_1 { cur_fa->selected_protos |= TLSv1_1_PROTO; }
  330     | TOK_TLSv1_2 { cur_fa->selected_protos |= TLSv1_2_PROTO; }
  331     | TOK_TLSv1_3 { cur_fa->selected_protos |= TLSv1_3_PROTO; };
  332 
  333 FB_CIPHERS: TOK_CIPHERS '=' STRING {
  334     if ($3) cur_fa->ciphers = strdup($3);
  335 };
  336 
  337 FB_PREF_SRV_CIPH: TOK_PREFER_SERVER_CIPHERS '=' BOOL {
  338     cur_fa->prefer_server_ciphers = $3;
  339 };
  340 
  341 QUIET_REC: TOK_QUIET '=' BOOL {
  342     if ($3)
  343         cfg->LOG_LEVEL = 0;
  344     else
  345         cfg->LOG_LEVEL = 1;
  346 };
  347 
  348 WORKERS_REC: TOK_WORKERS '=' UINT { cfg->NCORES = $3; };
  349 
  350 BACKLOG_REC: TOK_BACKLOG '=' UINT { cfg->BACKLOG = $3; };
  351 
  352 KEEPALIVE_REC: TOK_KEEPALIVE '=' UINT { cfg->TCP_KEEPALIVE_TIME = $3; };
  353 
  354 TLS_REC: TOK_TLS '=' BOOL {
  355     if (cfg->SELECTED_TLS_PROTOS != 0) {
  356         fprintf(stderr, "%s (%s, line %d):"
  357             " It is illegal to specify tls after ssl,"
  358             " tls or tls-protos\n",
  359             __func__, __FILE__, __LINE__);
  360         YYABORT;
  361     }
  362     if ($3)
  363         cfg->SELECTED_TLS_PROTOS = TLS_OPTION_PROTOS;
  364     else
  365         fprintf(stderr,
  366             "Warning: tls = off is deprecated and has no effect.\n");
  367 };
  368 
  369 SSL_REC: TOK_SSL '=' BOOL {
  370     if (cfg->SELECTED_TLS_PROTOS != 0) {
  371         fprintf(stderr, "%s (%s, line %d):"
  372             " It is illegal to specify ssl after ssl,"
  373             " tls or tls-protos.\n",
  374             __func__, __FILE__, __LINE__);
  375         YYABORT;
  376     }
  377     if ($3)
  378         cfg->SELECTED_TLS_PROTOS = SSL_OPTION_PROTOS;
  379     else
  380         fprintf(stderr,
  381             "Warning: ssl = off is deprecated and has no effect.\n");
  382 };
  383 
  384 TLS_PROTOS_REC: TOK_TLS_PROTOS {
  385     if (cfg->SELECTED_TLS_PROTOS != 0) {
  386         fprintf(stderr, "%s (%s, line %d):"
  387             " It is illegal to specify tls-protos after"
  388             " ssl, tls or tls-protos\n",
  389             __func__, __FILE__, __LINE__);
  390         YYABORT;
  391     }
  392 } '=' TLS_PROTOS_LIST;
  393 
  394 TLS_PROTOS_LIST: TLS_PROTO | TLS_PROTOS_LIST TLS_PROTO;
  395 TLS_PROTO
  396     : TOK_SSLv3 { cfg->SELECTED_TLS_PROTOS |= SSLv3_PROTO; }
  397     | TOK_TLSv1_0 { cfg->SELECTED_TLS_PROTOS |= TLSv1_0_PROTO; }
  398     | TOK_TLSv1_1 { cfg->SELECTED_TLS_PROTOS |= TLSv1_1_PROTO; }
  399     | TOK_TLSv1_2 { cfg->SELECTED_TLS_PROTOS |= TLSv1_2_PROTO; }
  400     | TOK_TLSv1_3 { cfg->SELECTED_TLS_PROTOS |= TLSv1_3_PROTO; };
  401 
  402 SSL_ENGINE_REC: TOK_SSL_ENGINE '=' STRING { if ($3) cfg->ENGINE = strdup($3); };
  403 
  404 PREFER_SERVER_CIPHERS_REC: TOK_PREFER_SERVER_CIPHERS '=' BOOL {
  405     cfg->PREFER_SERVER_CIPHERS = $3;
  406 };
  407 
  408 CHROOT_REC: TOK_CHROOT '=' STRING {
  409     /* XXX: passing an empty string for file */
  410     if ($3 && config_param_validate("chroot", $3, cfg, "",
  411         yyget_lineno()) != 0)
  412         YYABORT;
  413 };
  414 
  415 BACKEND_REC: TOK_BACKEND '=' STRING {
  416     /* XXX: passing an empty string for file */
  417     if ($3 && config_param_validate("backend", $3, cfg, "",
  418         yyget_lineno()) != 0)
  419         YYABORT;
  420 };
  421 
  422 PEM_FILE_REC
  423     : TOK_PEM_FILE '=' STRING {
  424         /* XXX: passing an empty string for file */
  425         if ($3 && config_param_validate("pem-file", $3, cfg, "",
  426             yyget_lineno()) != 0)
  427             YYABORT;
  428     }
  429     | TOK_PEM_FILE '=' '{' {
  430         /* NB: Mid-rule action */
  431         AZ(cur_pem);
  432         cur_pem = cfg_cert_file_new();
  433     }
  434     PEM_BLK '}' {
  435         if (cfg_cert_vfy(cur_pem) != 0) {
  436             if (cfg->CERT_DEFAULT != NULL) {
  437                 struct cfg_cert_file *tmp = cfg->CERT_DEFAULT;
  438                 cfg_cert_add(tmp, &cfg->CERT_FILES);
  439             }
  440             cfg->CERT_DEFAULT = cur_pem;
  441         } else {
  442             cfg_cert_file_free(&cur_pem);
  443             YYABORT;
  444         }
  445         cur_pem = NULL;
  446     };
  447 
  448 SYSLOG_REC: TOK_SYSLOG '=' BOOL { cfg->SYSLOG = $3; };
  449 DAEMON_REC: TOK_DAEMON '=' BOOL { cfg->DAEMONIZE = $3; };
  450 SNI_NOMATCH_ABORT_REC : TOK_SNI_NOMATCH_ABORT '=' BOOL {
  451     cfg->SNI_NOMATCH_ABORT = $3;
  452 };
  453 
  454 CIPHERS_REC: TOK_CIPHERS '=' STRING { if ($3) cfg->CIPHER_SUITE = strdup($3); };
  455 
  456 USER_REC: TOK_USER '=' STRING {
  457     /* XXX: passing an empty string for file */
  458     if ($3 && config_param_validate("user", $3, cfg, "",
  459         yyget_lineno()) != 0)
  460         YYABORT;
  461 };
  462 
  463 GROUP_REC: TOK_GROUP '=' STRING {
  464     /* XXX: passing an empty string for file */
  465     if ($3 && config_param_validate("group", $3, cfg, "",
  466         yyget_lineno()) != 0)
  467         YYABORT;
  468 };
  469 
  470 WRITE_IP_REC: TOK_WRITE_IP '=' BOOL { cfg->WRITE_IP_OCTET = $3; };
  471 
  472 WRITE_PROXY_REC: TOK_WRITE_PROXY '=' BOOL { cfg->WRITE_PROXY_LINE_V2 = $3; };
  473 
  474 WRITE_PROXY_V1_REC: TOK_WRITE_PROXY_V1 '=' BOOL {
  475     cfg->WRITE_PROXY_LINE_V1 = $3;
  476 };
  477 
  478 WRITE_PROXY_V2_REC: TOK_WRITE_PROXY_V2 '=' BOOL {
  479     cfg->WRITE_PROXY_LINE_V2 = $3;
  480 };
  481 
  482 PROXY_TLV_REC: TOK_PROXY_TLV '=' BOOL { cfg->PROXY_TLV = $3; };
  483 
  484 PROXY_TLV_REC: TOK_PROXY_AUTHORITY '=' BOOL { cfg->PROXY_AUTHORITY = $3; };
  485 
  486 PROXY_PROXY_REC: TOK_PROXY_PROXY '=' BOOL { cfg->PROXY_PROXY_LINE = $3; };
  487 
  488 ALPN_PROTOS_REC: TOK_ALPN_PROTOS '=' STRING {
  489     /* XXX: passing an empty string for file */
  490     if ($3 && config_param_validate("alpn-protos", $3, cfg, "",
  491         yyget_lineno()) != 0)
  492         YYABORT;
  493 };
  494 
  495 SYSLOG_FACILITY_REC: TOK_SYSLOG_FACILITY '=' STRING {
  496     /* XXX: passing an empty string for file */
  497     if ($3 &&
  498         config_param_validate("syslog-facility", $3, cfg, "",
  499         yyget_lineno()) != 0)
  500         YYABORT;
  501 };
  502 
  503 SEND_BUFSIZE_REC: TOK_SEND_BUFSIZE '=' UINT { cfg->SEND_BUFSIZE = $3; };
  504 
  505 RECV_BUFSIZE_REC: TOK_RECV_BUFSIZE '=' UINT { cfg->RECV_BUFSIZE = $3; };
  506 
  507 LOG_FILENAME_REC: TOK_LOG_FILENAME '=' STRING {
  508     /* XXX: passing an empty string for file */
  509     if ($3 &&
  510         config_param_validate("log-filename", $3, cfg, "",
  511         yyget_lineno()) != 0)
  512         YYABORT;
  513 };
  514 
  515 LOG_LEVEL_REC: TOK_LOG_LEVEL '=' UINT { cfg->LOG_LEVEL = $3; };
  516 
  517 SESSION_CACHE_REC: TOK_SESSION_CACHE '=' UINT {
  518 #ifdef USE_SHARED_CACHE
  519     cfg->SHARED_CACHE = $3;
  520 #else
  521     fprintf(stderr, "Hitch needs to be compiled with --enable-sessioncache "
  522             "for '%s'", input_line);
  523     YYABORT;
  524 #endif
  525 };
  526 
  527 SHARED_CACHE_LISTEN_REC: TOK_SHARED_CACHE_LISTEN '=' STRING {
  528 #ifdef USE_SHARED_CACHE
  529     /* XXX: passing an empty string for file */
  530     if ($3 && config_param_validate("shared-cache-listen", $3, cfg,
  531         "", yyget_lineno()) != 0)
  532         YYABORT;
  533 #else
  534     fprintf(stderr, "Hitch needs to be compiled with --enable-sessioncache "
  535             "for '%s'", input_line);
  536     YYABORT;
  537 #endif
  538 };
  539 
  540 SHARED_CACHE_PEER_REC: TOK_SHARED_CACHE_PEER  '=' STRING {
  541 #ifdef USE_SHARED_CACHE
  542     /* XXX: passing an empty string for file */
  543     if ($3 && config_param_validate("shared-cache-peer", $3, cfg,
  544         "", yyget_lineno()) != 0)
  545         YYABORT;
  546 #else
  547     fprintf(stderr, "Hitch needs to be compiled with --enable-sessioncache "
  548             "for '%s'", input_line);
  549     YYABORT;
  550 #endif
  551 };
  552 
  553 SHARED_CACHE_IF_REC: TOK_SHARED_CACHE_IF '=' STRING {
  554 #ifdef USE_SHARED_CACHE
  555     /* XXX: passing an empty string for file */
  556     if ($3 && config_param_validate("shared-cache-if", $3, cfg,
  557         "", yyget_lineno()) != 0)
  558         YYABORT;
  559 #else
  560     fprintf(stderr, "Hitch needs to be compiled with --enable-sessioncache "
  561             "for '%s'", input_line);
  562     YYABORT;
  563 #endif
  564 };
  565 
  566 TFO: TOK_TFO '=' BOOL {
  567 #ifdef TCP_FASTOPEN_WORKS
  568     { cfg->TFO = $3; };
  569 #else
  570     fprintf(stderr, "Hitch needs to be compiled with --enable-tfo"
  571             "for '%s'", input_line);
  572     YYABORT;
  573 #endif
  574 };
  575 
  576 BACKEND_REFRESH_REC: TOK_BACKEND_REFRESH '=' UINT {
  577     cfg->BACKEND_REFRESH_TIME = $3;
  578 };
  579 
  580 %%
  581 
  582 void
  583 yyerror(hitch_config *cfg, const char *s)
  584 {
  585     (void) cfg;
  586 
  587     /* Clean up if FRONTEND_BLK parsing failed */
  588     if (cur_fa != NULL)
  589         FREE_OBJ(cur_fa);
  590 
  591     config_error_set("Parsing error in line %d: %s: '%s'",
  592         yyget_lineno(), s, strlen(input_line) > 0 ? input_line : "");
  593 }