diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2008-11-10 00:29:34 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2008-11-10 00:29:34 +0000 |
commit | a3eec907fbf8d8ca500077872de89f7efb8b2223 (patch) | |
tree | f0d705ffe5caddc64780d74e938f592f4ae5d18f | |
parent | 80e584cf06f38df3cbe640e8ca713db369236b4f (diff) |
- recognize '=>' as one token instead of trying to match '=' and '>'. this
prevents: "foo = > bar" from being valid
-rw-r--r-- | usr.sbin/smtpd/parse.y | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index d5e06b8fb5a..4d928c26b13 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.3 2008/11/05 12:14:45 sobrado Exp $ */ +/* $OpenBSD: parse.y,v 1.4 2008/11/10 00:29:33 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -113,6 +113,7 @@ typedef struct { %token DNS DB TFILE EXTERNAL DOMAIN CONFIG SOURCE %token RELAY VIA DELIVER TO MAILDIR MBOX HOSTNAME %token ACCEPT REJECT INCLUDE NETWORK ERROR MDA FROM FOR +%token KVSEP %token <v.string> STRING %token <v.number> NUMBER %type <v.map> map @@ -346,7 +347,7 @@ map : MAP STRING { } ; -keyval : STRING '=' '>' STRING { +keyval : STRING KVSEP STRING { struct mapel *me; if ((me = calloc(1, sizeof(*me))) == NULL) @@ -355,18 +356,18 @@ keyval : STRING '=' '>' STRING { if (strlcpy(me->me_key.med_string, $1, sizeof(me->me_key.med_string)) >= sizeof(me->me_key.med_string) || - strlcpy(me->me_val.med_string, $4, + strlcpy(me->me_val.med_string, $3, sizeof(me->me_val.med_string)) >= sizeof(me->me_val.med_string)) { yyerror("map elements too long: %s, %s", - $1, $4); + $1, $3); free(me); free($1); - free($4); + free($3); YYERROR; } free($1); - free($4); + free($3); TAILQ_INSERT_TAIL(contents, me, me_entry); } @@ -753,6 +754,7 @@ lookup(char *s) { /* this has to be sorted always */ static const struct keywords keywords[] = { + { "=>", KVSEP }, { "accept", ACCEPT }, { "all", ALL }, { "certificate", CERTIFICATE }, |