From aa82c35307ac93f9f8516d4168a7cb0e7eaf56c4 Mon Sep 17 00:00:00 2001 From: Marco Pfatschbacher Date: Mon, 12 Nov 2007 23:59:42 +0000 Subject: Remove space/tab compression function from lgetc() and replace it with a simple filter in the yylex() loop. The compression in lgetc() didn't happen for quoted strings, thus creating a regression when tabs were used in variables. Some testing by todd@ and pyr@ OK deraadt@ --- sbin/ipsecctl/parse.y | 12 ++---------- sbin/pfctl/parse.y | 12 ++---------- 2 files changed, 4 insertions(+), 20 deletions(-) (limited to 'sbin') diff --git a/sbin/ipsecctl/parse.y b/sbin/ipsecctl/parse.y index c826fa21686..a9bfec5bf17 100644 --- a/sbin/ipsecctl/parse.y +++ b/sbin/ipsecctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.131 2007/10/22 16:35:33 pyr Exp $ */ +/* $OpenBSD: parse.y,v 1.132 2007/11/12 23:59:41 mpf Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -959,14 +959,6 @@ lgetc(int quotec) yylval.lineno = file->lineno; file->lineno++; } - if (c == '\t' || c == ' ') { - /* Compress blanks to a single space. */ - do { - c = getc(file->stream); - } while (c == '\t' || c == ' '); - ungetc(c, file->stream); - c = ' '; - } while (c == EOF) { if (popfile() == EOF) @@ -1023,7 +1015,7 @@ yylex(void) top: p = buf; - while ((c = lgetc(0)) == ' ') + while ((c = lgetc(0)) == ' ' || c == '\t') ; /* nothing */ yylval.lineno = file->lineno; diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index dddd199d80f..362c1e0969a 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.533 2007/10/25 21:36:21 mpf Exp $ */ +/* $OpenBSD: parse.y,v 1.534 2007/11/12 23:59:41 mpf Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -5228,14 +5228,6 @@ lgetc(int quotec) yylval.lineno = file->lineno; file->lineno++; } - if (c == '\t' || c == ' ') { - /* Compress blanks to a single space. */ - do { - c = getc(file->stream); - } while (c == '\t' || c == ' '); - ungetc(c, file->stream); - c = ' '; - } while (c == EOF) { if (popfile() == EOF) @@ -5292,7 +5284,7 @@ yylex(void) top: p = buf; - while ((c = lgetc(0)) == ' ') + while ((c = lgetc(0)) == ' ' || c == '\t') ; /* nothing */ yylval.lineno = file->lineno; -- cgit v1.2.3