do not allow whitespace in macro names, i.e. "this is" = "a variable".
authorbenno <benno@openbsd.org>
Tue, 21 Jun 2016 21:35:24 +0000 (21:35 +0000)
committerbenno <benno@openbsd.org>
Tue, 21 Jun 2016 21:35:24 +0000 (21:35 +0000)
change this in all config parsers in our tree that support macros.
problem reported by sven falempin.

feedback from henning@, stsp@, deraadt@
ok florian@ mikeb@

20 files changed:
sbin/iked/parse.y
sbin/ipsecctl/parse.y
sbin/pfctl/parse.y
usr.sbin/bgpd/parse.y
usr.sbin/dvmrpd/parse.y
usr.sbin/eigrpd/parse.y
usr.sbin/hostapd/parse.y
usr.sbin/httpd/parse.y
usr.sbin/ifstated/parse.y
usr.sbin/iscsictl/parse.y
usr.sbin/ldapd/parse.y
usr.sbin/ldpd/parse.y
usr.sbin/ospf6d/parse.y
usr.sbin/ospfd/parse.y
usr.sbin/relayd/parse.y
usr.sbin/ripd/parse.y
usr.sbin/smtpd/parse.y
usr.sbin/snmpd/parse.y
usr.sbin/vmd/parse.y
usr.sbin/ypldap/parse.y

index 958e51a..db43864 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.54 2015/12/09 21:41:49 naddy Exp $        */
+/*     $OpenBSD: parse.y,v 1.55 2016/06/21 21:35:24 benno Exp $        */
 
 /*
  * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -1005,7 +1005,15 @@ string           : string STRING
 
 varset         : STRING '=' string
                {
+                       char *s = $1;
                        log_debug("%s = \"%s\"\n", $1, $3);
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                err(1, "cannot store variable");
                        free($1);
index fe9cee0..4bfc1de 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.164 2015/12/09 21:41:50 naddy Exp $       */
+/*     $OpenBSD: parse.y,v 1.165 2016/06/21 21:35:24 benno Exp $       */
 
 /*
  * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -881,8 +881,16 @@ string             : string STRING
 
 varset         : STRING '=' string
                {
+                       char *s = $1;
                        if (ipsec->opts & IPSECCTL_OPT_VERBOSE)
                                printf("%s = \"%s\"\n", $1, $3);
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                err(1, "cannot store variable");
                        free($1);
index 776eb12..e03b003 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.651 2016/06/21 13:40:43 benno Exp $       */
+/*     $OpenBSD: parse.y,v 1.652 2016/06/21 21:35:24 benno Exp $       */
 
 /*
  * Copyright (c) 2001 Markus Friedl.  All rights reserved.
@@ -712,8 +712,16 @@ numberstring       : NUMBER                                {
                ;
 
 varset         : STRING '=' varstring  {
+                       char *s = $1;
                        if (pf->opts & PF_OPT_VERBOSE)
                                printf("%s = \"%s\"\n", $1, $3);
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                err(1, "cannot store variable %s", $1);
                        free($1);
index e7fd5e1..44edc31 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.287 2016/06/03 17:36:37 benno Exp $ */
+/*     $OpenBSD: parse.y,v 1.288 2016/06/21 21:35:24 benno Exp $ */
 
 /*
  * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -337,8 +337,16 @@ yesno              :  STRING                       {
                ;
 
 varset         : STRING '=' string             {
+                       char *s = $1;
                        if (cmd_opts & BGPD_OPT_VERBOSE)
                                printf("%s = \"%s\"\n", $1, $3);
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                fatal("cannot store variable");
                        free($1);
index 66b7b73..e78843f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.29 2014/11/20 05:51:20 jsg Exp $ */
+/*     $OpenBSD: parse.y,v 1.30 2016/06/21 21:35:24 benno Exp $ */
 
 /*
  * Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org>
@@ -163,8 +163,16 @@ yesno              : STRING {
                ;
 
 varset         : STRING '=' string             {
+                       char *s = $1;
                        if (conf->opts & DVMRPD_OPT_VERBOSE)
                                printf("%s = \"%s\"\n", $1, $3);
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                fatal("cannot store variable");
                        free($1);
index 02e010f..f020df1 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.15 2016/06/05 03:36:41 renato Exp $ */
+/*     $OpenBSD: parse.y,v 1.16 2016/06/21 21:35:24 benno Exp $ */
 
 /*
  * Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -197,8 +197,16 @@ eigrp_af   : IPV4  { $$ = AF_INET; }
                ;
 
 varset         : STRING '=' string {
+                       char *s = $1;
                        if (global.cmd_opts & EIGRPD_OPT_VERBOSE)
                                printf("%s = \"%s\"\n", $1, $3);
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                fatal("cannot store variable");
                        free($1);
index c6a8beb..662f2bc 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.50 2015/08/20 22:39:29 deraadt Exp $      */
+/*     $OpenBSD: parse.y,v 1.51 2016/06/21 21:35:24 benno Exp $        */
 
 /*
  * Copyright (c) 2004, 2005, 2006 Reyk Floeter <reyk@openbsd.org>
@@ -971,6 +971,14 @@ string             : string STRING
 
 varset         : STRING '=' string
                {
+                       char *s = $1;
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                hostapd_fatal("cannot store variable");
                        free($1);
index 080f319..2995f89 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.77 2015/11/22 13:27:13 reyk Exp $ */
+/*     $OpenBSD: parse.y,v 1.78 2016/06/21 21:35:24 benno Exp $        */
 
 /*
  * Copyright (c) 2007 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -171,6 +171,14 @@ include            : INCLUDE STRING                {
                ;
 
 varset         : STRING '=' STRING     {
+                       char *s = $1;
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                fatal("cannot store variable");
                        free($1);
index 5679164..c716546 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.37 2016/01/29 02:22:57 mmcc Exp $ */
+/*     $OpenBSD: parse.y,v 1.38 2016/06/21 21:35:24 benno Exp $        */
 
 /*
  * Copyright (c) 2004 Ryan McBride <mcbride@openbsd.org>
@@ -142,8 +142,16 @@ string             : string STRING                         {
                ;
 
 varset         : STRING '=' string             {
+                       char *s = $1;
                        if (conf->opts & IFSD_OPT_VERBOSE)
                                printf("%s = \"%s\"\n", $1, $3);
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1) {
                                free($1);
                                free($3);
index b39b2e1..efb0fbe 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.7 2014/11/20 05:51:20 jsg Exp $ */
+/*     $OpenBSD: parse.y,v 1.8 2016/06/21 21:35:24 benno Exp $ */
 
 /*
  * Copyright (c) 2010 David Gwynne <dlg@openbsd.org>
@@ -155,6 +155,14 @@ string             : string STRING {
                ;
 
 varset         : STRING '=' string             {
+                       char *s = $1;
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                err(1, "cannot store variable");
                        free($1);
index aec1d12..77ba1cd 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.17 2016/05/01 00:32:37 jmatthew Exp $ */
+/*     $OpenBSD: parse.y,v 1.18 2016/06/21 21:35:24 benno Exp $ */
 
 /*
  * Copyright (c) 2009, 2010 Martin Hedenfalk <martinh@openbsd.org>
@@ -359,6 +359,14 @@ include            : INCLUDE STRING                {
                ;
 
 varset         : STRING '=' STRING             {
+                       char *s = $1;
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                fatal("cannot store variable");
                        free($1);
index d332b9e..4ba0249 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.55 2016/06/18 01:33:02 renato Exp $ */
+/*     $OpenBSD: parse.y,v 1.56 2016/06/21 21:35:24 benno Exp $ */
 
 /*
  * Copyright (c) 2013, 2015, 2016 Renato Westphal <renato@openbsd.org>
@@ -208,8 +208,16 @@ pw_type            : ETHERNET              { $$ = PW_TYPE_ETHERNET; }
                ;
 
 varset         : STRING '=' string {
+                       char *s = $1;
                        if (global.cmd_opts & LDPD_OPT_VERBOSE)
                                printf("%s = \"%s\"\n", $1, $3);
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                fatal("cannot store variable");
                        free($1);
index 70e7d3e..f6303d1 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.27 2014/11/20 05:51:20 jsg Exp $ */
+/*     $OpenBSD: parse.y,v 1.28 2016/06/21 21:35:25 benno Exp $ */
 
 /*
  * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -179,8 +179,16 @@ no         : /* empty */   { $$ = 0; }
                | NO            { $$ = 1; }
 
 varset         : STRING '=' string             {
+                       char *s = $1;
                        if (conf->opts & OSPFD_OPT_VERBOSE)
                                printf("%s = \"%s\"\n", $1, $3);
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                fatal("cannot store variable");
                        free($1);
index 9b886ad..f617e5c 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.80 2015/12/05 12:20:13 claudio Exp $ */
+/*     $OpenBSD: parse.y,v 1.81 2016/06/21 21:35:25 benno Exp $ */
 
 /*
  * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -195,8 +195,16 @@ msec               : MSEC NUMBER {
                ;
 
 varset         : STRING '=' string             {
+                       char *s = $1;
                        if (conf->opts & OSPFD_OPT_VERBOSE)
                                printf("%s = \"%s\"\n", $1, $3);
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                fatal("cannot store variable");
                        free($1);
index a6bf390..7e9afb8 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.206 2015/11/22 13:27:13 reyk Exp $        */
+/*     $OpenBSD: parse.y,v 1.207 2016/06/21 21:35:25 benno Exp $       */
 
 /*
  * Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -349,6 +349,14 @@ port               : PORT STRING {
                ;
 
 varset         : STRING '=' STRING     {
+                       char *s = $1;
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                fatal("cannot store variable");
                        free($1);
index ddaca13..4851038 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.34 2014/11/20 05:51:20 jsg Exp $ */
+/*     $OpenBSD: parse.y,v 1.35 2016/06/21 21:35:25 benno Exp $ */
 
 /*
  * Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
@@ -147,8 +147,16 @@ no         : /* empty */   { $$ = 0; }
                | NO            { $$ = 1; }
 
 varset         : STRING '=' string {
+                       char *s = $1;
                        if (conf->opts & RIPD_OPT_VERBOSE)
                                printf("%s = \"%s\"\n", $1, $3);
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                fatal("cannot store variable");
                        free($1);
index ab02719..d4c0fcb 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.184 2016/04/21 14:27:41 jsing Exp $       */
+/*     $OpenBSD: parse.y,v 1.185 2016/06/21 21:35:25 benno Exp $       */
 
 /*
  * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -213,6 +213,14 @@ include            : INCLUDE STRING                {
                ;
 
 varset         : STRING '=' STRING             {
+                       char *s = $1;
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                fatal("cannot store variable");
                        free($1);
index 5e288ee..8ad6fcc 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.38 2015/11/22 13:27:13 reyk Exp $ */
+/*     $OpenBSD: parse.y,v 1.39 2016/06/21 21:35:25 benno Exp $        */
 
 /*
  * Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -165,6 +165,14 @@ include            : INCLUDE STRING                {
                ;
 
 varset         : STRING '=' STRING     {
+                       char *s = $1;
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                fatal("cannot store variable");
                        free($1);
index 23cea73..f7fece0 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.6 2016/03/13 13:11:47 stefan Exp $        */
+/*     $OpenBSD: parse.y,v 1.7 2016/06/21 21:35:25 benno Exp $ */
 
 /*
  * Copyright (c) 2007-2015 Reyk Floeter <reyk@openbsd.org>
@@ -129,6 +129,14 @@ include            : INCLUDE string                {
                ;
 
 varset         : STRING '=' STRING             {
+                       char *s = $1;
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                fatalx("cannot store variable");
                        free($1);
index 39be696..2dbeb97 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.18 2015/01/16 06:40:22 deraadt Exp $      */
+/*     $OpenBSD: parse.y,v 1.19 2016/06/21 21:35:25 benno Exp $        */
 
 /*
  * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -142,6 +142,14 @@ include            : INCLUDE STRING                        {
                ;
 
 varset         : STRING '=' STRING                     {
+                       char *s = $1;
+                       while (*s++) {
+                               if (isspace((unsigned char)*s)) {
+                                       yyerror("macro name cannot contain "
+                                           "whitespace");
+                                       YYERROR;
+                               }
+                       }
                        if (symset($1, $3, 0) == -1)
                                fatal("cannot store variable");
                        free($1);