-/* $OpenBSD: parse.y,v 1.180 2014/04/22 08:04:23 reyk Exp $ */
+/* $OpenBSD: parse.y,v 1.181 2014/05/08 16:11:06 reyk Exp $ */
/*
* Copyright (c) 2007-2011 Reyk Floeter <reyk@openbsd.org>
;
protonode : nodetype APPEND STRING TO STRING nodeopts {
+ if (node.type != NODE_TYPE_HEADER) {
+ yyerror("action only supported for headers");
+ free($5);
+ free($3);
+ YYERROR;
+ }
node.action = NODE_ACTION_APPEND;
node.key = strdup($5);
node.value = strdup($3);
free($3);
}
| nodetype CHANGE STRING TO STRING nodeopts {
+ if (node.type != NODE_TYPE_HEADER) {
+ yyerror("action only supported for headers");
+ free($5);
+ free($3);
+ YYERROR;
+ }
node.action = NODE_ACTION_CHANGE;
node.key = strdup($3);
node.value = strdup($5);
free($3);
}
| nodetype REMOVE STRING nodeopts {
+ if (node.type != NODE_TYPE_HEADER) {
+ yyerror("action only supported for headers");
+ free($3);
+ YYERROR;
+ }
node.action = NODE_ACTION_REMOVE;
node.key = strdup($3);
node.value = NULL;
free($3);
}
| nodetype REMOVE {
+ if (node.type != NODE_TYPE_HEADER) {
+ yyerror("action only supported for headers");
+ YYERROR;
+ }
node.action = NODE_ACTION_REMOVE;
node.key = NULL;
node.value = NULL;
free($5);
}
| nodetype MARK STRING WITH mark nodeopts {
+ if (node.mark) {
+ yyerror("either mark or marked");
+ YYERROR;
+ }
node.action = NODE_ACTION_MARK;
node.key = strdup($3);
node.value = strdup("*");