-/* $OpenBSD: parse.y,v 1.25 2014/08/05 15:36:59 reyk Exp $ */
+/* $OpenBSD: parse.y,v 1.26 2014/08/05 16:46:35 reyk Exp $ */
/*
* Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org>
uint32_t last_server_id = 0;
static struct server *srv = NULL, *parentsrv = NULL;
+static struct server_config *srv_conf = NULL;
struct serverlist servers;
struct media_type media;
YYERROR;
}
srv = s;
+ srv_conf = &srv->srv_conf;
SPLAY_INIT(&srv->srv_clients);
TAILQ_INSERT_TAIL(conf->sc_servers, srv, srv_entry);
YYERROR;
}
srv = NULL;
+ srv_conf = NULL;
}
;
}
parentsrv = srv;
srv = s;
+ srv_conf = &srv->srv_conf;
SPLAY_INIT(&srv->srv_clients);
TAILQ_INSERT_TAIL(conf->sc_servers, srv, srv_entry);
} '{' optnl serveropts_l '}' {
srv = parentsrv;
+ srv_conf = &parentsrv->srv_conf;
parentsrv = NULL;
}
;
fastcgi : NO FCGI {
- srv->srv_conf.flags &= ~SRVFLAG_FCGI;
- srv->srv_conf.flags |= SRVFLAG_NO_FCGI;
+ srv_conf->flags &= ~SRVFLAG_FCGI;
+ srv_conf->flags |= SRVFLAG_NO_FCGI;
}
| FCGI {
- srv->srv_conf.flags &= ~SRVFLAG_NO_FCGI;
- srv->srv_conf.flags |= SRVFLAG_FCGI;
+ srv_conf->flags &= ~SRVFLAG_NO_FCGI;
+ srv_conf->flags |= SRVFLAG_FCGI;
}
| FCGI {
- srv->srv_conf.flags &= ~SRVFLAG_NO_FCGI;
- srv->srv_conf.flags |= SRVFLAG_FCGI;
+ srv_conf->flags &= ~SRVFLAG_NO_FCGI;
+ srv_conf->flags |= SRVFLAG_FCGI;
} '{' fcgiflags_l '}'
| FCGI {
- srv->srv_conf.flags &= ~SRVFLAG_NO_FCGI;
- srv->srv_conf.flags |= SRVFLAG_FCGI;
+ srv_conf->flags &= ~SRVFLAG_NO_FCGI;
+ srv_conf->flags |= SRVFLAG_FCGI;
} fcgiflags
;
;
fcgiflags : SOCKET STRING {
- if (strlcpy(srv->srv_conf.socket, $2,
- sizeof(srv->srv_conf.socket)) >=
- sizeof(srv->srv_conf.socket)) {
+ if (strlcpy(srv_conf->socket, $2,
+ sizeof(srv_conf->socket)) >=
+ sizeof(srv_conf->socket)) {
yyerror("fastcgi socket too long");
free($2);
YYERROR;
}
free($2);
- srv->srv_conf.flags |= SRVFLAG_SOCKET;
+ srv_conf->flags |= SRVFLAG_SOCKET;
}
;
;
dirflags : INDEX STRING {
- if (strlcpy(srv->srv_conf.index, $2,
- sizeof(srv->srv_conf.index)) >=
- sizeof(srv->srv_conf.index)) {
+ if (strlcpy(srv_conf->index, $2,
+ sizeof(srv_conf->index)) >=
+ sizeof(srv_conf->index)) {
yyerror("index file too long");
free($2);
YYERROR;
}
- srv->srv_conf.flags &= ~SRVFLAG_NO_INDEX;
- srv->srv_conf.flags |= SRVFLAG_INDEX;
+ srv_conf->flags &= ~SRVFLAG_NO_INDEX;
+ srv_conf->flags |= SRVFLAG_INDEX;
free($2);
}
| NO INDEX {
- srv->srv_conf.flags &= ~SRVFLAG_INDEX;
- srv->srv_conf.flags |= SRVFLAG_NO_INDEX;
+ srv_conf->flags &= ~SRVFLAG_INDEX;
+ srv_conf->flags |= SRVFLAG_NO_INDEX;
}
| AUTO INDEX {
- srv->srv_conf.flags &= ~SRVFLAG_NO_AUTO_INDEX;
- srv->srv_conf.flags |= SRVFLAG_AUTO_INDEX;
+ srv_conf->flags &= ~SRVFLAG_NO_AUTO_INDEX;
+ srv_conf->flags |= SRVFLAG_AUTO_INDEX;
}
| NO AUTO INDEX {
- srv->srv_conf.flags &= ~SRVFLAG_AUTO_INDEX;
- srv->srv_conf.flags |= SRVFLAG_NO_AUTO_INDEX;
+ srv_conf->flags &= ~SRVFLAG_AUTO_INDEX;
+ srv_conf->flags |= SRVFLAG_NO_AUTO_INDEX;
}
;
logformat : LOG logflags
| LOG '{' logflags_l '}'
| NO LOG {
- srv->srv_conf.flags &= ~SRVFLAG_LOG;
- srv->srv_conf.flags |= SRVFLAG_NO_LOG;
+ srv_conf->flags &= ~SRVFLAG_LOG;
+ srv_conf->flags |= SRVFLAG_NO_LOG;
}
;
logflags : STYLE logstyle
| SYSLOG {
- srv->srv_conf.flags &= ~SRVFLAG_NO_SYSLOG;
- srv->srv_conf.flags |= SRVFLAG_SYSLOG;
+ srv_conf->flags &= ~SRVFLAG_NO_SYSLOG;
+ srv_conf->flags |= SRVFLAG_SYSLOG;
}
| NO SYSLOG {
- srv->srv_conf.flags &= ~SRVFLAG_SYSLOG;
- srv->srv_conf.flags |= SRVFLAG_NO_SYSLOG;
+ srv_conf->flags &= ~SRVFLAG_SYSLOG;
+ srv_conf->flags |= SRVFLAG_NO_SYSLOG;
}
| ACCESS STRING {
- if (strlcpy(srv->srv_conf.accesslog, $2,
- sizeof(srv->srv_conf.accesslog)) >=
- sizeof(srv->srv_conf.accesslog)) {
+ if (strlcpy(srv_conf->accesslog, $2,
+ sizeof(srv_conf->accesslog)) >=
+ sizeof(srv_conf->accesslog)) {
yyerror("access log name too long");
free($2);
YYERROR;
}
free($2);
- srv->srv_conf.flags |= SRVFLAG_ACCESS_LOG;
+ srv_conf->flags |= SRVFLAG_ACCESS_LOG;
}
| ERR STRING {
- if (strlcpy(srv->srv_conf.errorlog, $2,
- sizeof(srv->srv_conf.errorlog)) >=
- sizeof(srv->srv_conf.errorlog)) {
+ if (strlcpy(srv_conf->errorlog, $2,
+ sizeof(srv_conf->errorlog)) >=
+ sizeof(srv_conf->errorlog)) {
yyerror("error log name too long");
free($2);
YYERROR;
}
free($2);
- srv->srv_conf.flags |= SRVFLAG_ERROR_LOG;
+ srv_conf->flags |= SRVFLAG_ERROR_LOG;
}
;
logstyle : COMMON {
- srv->srv_conf.flags &= ~SRVFLAG_NO_LOG;
- srv->srv_conf.flags |= SRVFLAG_LOG;
- srv->srv_conf.logformat = LOG_FORMAT_COMMON;
+ srv_conf->flags &= ~SRVFLAG_NO_LOG;
+ srv_conf->flags |= SRVFLAG_LOG;
+ srv_conf->logformat = LOG_FORMAT_COMMON;
}
| COMBINED {
- srv->srv_conf.flags &= ~SRVFLAG_NO_LOG;
- srv->srv_conf.flags |= SRVFLAG_LOG;
- srv->srv_conf.logformat = LOG_FORMAT_COMBINED;
+ srv_conf->flags &= ~SRVFLAG_NO_LOG;
+ srv_conf->flags |= SRVFLAG_LOG;
+ srv_conf->logformat = LOG_FORMAT_COMBINED;
}
| CONNECTION {
- srv->srv_conf.flags &= ~SRVFLAG_NO_LOG;
- srv->srv_conf.flags |= SRVFLAG_LOG;
- srv->srv_conf.logformat = LOG_FORMAT_CONNECTION;
+ srv_conf->flags &= ~SRVFLAG_NO_LOG;
+ srv_conf->flags |= SRVFLAG_LOG;
+ srv_conf->logformat = LOG_FORMAT_CONNECTION;
}
;