[master] b2d18f480 reserve vcl_* but not vcl*
Nils Goroll
nils.goroll at uplex.de
Wed Mar 20 16:18:09 UTC 2019
commit b2d18f4804df1bc778540a72cd01efc2027df5db
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Wed Mar 20 17:16:14 2019 +0100
reserve vcl_* but not vcl*
Fixes #2953
diff --git a/bin/varnishtest/tests/v00020.vtc b/bin/varnishtest/tests/v00020.vtc
index 3cbe2678e..1c61f02e5 100644
--- a/bin/varnishtest/tests/v00020.vtc
+++ b/bin/varnishtest/tests/v00020.vtc
@@ -208,7 +208,7 @@ varnish v1 -errvcl {Name of function, 'foo.bar', contains illegal character '.'}
}
}
-varnish v1 -errvcl {The names 'vcl*' are reserved for subroutines.} {
+varnish v1 -errvcl {The names 'vcl_*' are reserved for subroutines.} {
sub vcl_bar {
}
sub vcl_recv {
diff --git a/lib/libvcc/vcc_parse.c b/lib/libvcc/vcc_parse.c
index af8e6a45e..faa929d5f 100644
--- a/lib/libvcc/vcc_parse.c
+++ b/lib/libvcc/vcc_parse.c
@@ -235,9 +235,10 @@ vcc_ParseFunction(struct vcc *tl)
if (p == NULL) {
if ((t->b[0] == 'v'|| t->b[0] == 'V') &&
(t->b[1] == 'c'|| t->b[1] == 'C') &&
- (t->b[2] == 'l'|| t->b[2] == 'L')) {
- VSB_printf(tl->sb,
- "The names 'vcl*' are reserved for subroutines.\n");
+ (t->b[2] == 'l'|| t->b[2] == 'L') &&
+ (t->b[3] == '_')) {
+ VSB_printf(tl->sb,"The names 'vcl_*'"
+ " are reserved for subroutines.\n");
vcc_ErrWhere(tl, t);
VSB_printf(tl->sb, "Valid vcl_* subroutines are:\n");
VTAILQ_FOREACH(p, &tl->procs, list) {
diff --git a/lib/libvcc/vcc_symb.c b/lib/libvcc/vcc_symb.c
index 8f19a0005..67d4d8707 100644
--- a/lib/libvcc/vcc_symb.c
+++ b/lib/libvcc/vcc_symb.c
@@ -206,7 +206,8 @@ VCC_SymbolGet(struct vcc *tl, vcc_kind_t kind, const char *e, const char *x)
if (tl->syntax >= VCL_41 && e == SYMTAB_CREATE && kind != SYM_SUB &&
(tl->t->b[0] == 'v'|| tl->t->b[0] == 'V') &&
(tl->t->b[1] == 'c'|| tl->t->b[1] == 'C') &&
- (tl->t->b[2] == 'l'|| tl->t->b[2] == 'L')) {
+ (tl->t->b[2] == 'l'|| tl->t->b[2] == 'L') &&
+ (tl->t->b[3] == '_')) {
VSB_printf(tl->sb,
"Symbols named 'vcl_*' are reserved.\nAt:");
vcc_ErrWhere(tl, tl->t);
More information about the varnish-commit
mailing list