Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
50a59f10
Commit
50a59f10
authored
Jul 13, 2020
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fail on recursive use of vcl `include`
Fixes: #3360
parent
7bb73c58
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
0 deletions
+34
-0
r03360.vtc
bin/varnishtest/tests/r03360.vtc
+15
-0
vcc_compile.c
lib/libvcc/vcc_compile.c
+17
-0
vcc_compile.h
lib/libvcc/vcc_compile.h
+2
-0
No files found.
bin/varnishtest/tests/r03360.vtc
0 → 100644
View file @
50a59f10
varnishtest "Test recusive vcl includes"
shell {echo include '"_recurse.vcl";' > ${tmpdir}/_recurse.vcl}
shell {echo include '"_recurse2.vcl";' > ${tmpdir}/_recurse1.vcl}
shell {echo include '"_recurse1.vcl";' > ${tmpdir}/_recurse2.vcl}
varnish v1 -arg "-p vcl_path=${tmpdir}" -errvcl "Recursive include of" {
backend b { .host = "127.0.0.1"; }
include "_recurse.vcl" ;
}
varnish v2 -arg "-p vcl_path=${tmpdir}" -errvcl "Recursive include of" {
backend b { .host = "127.0.0.1"; }
include "_recurse1.vcl" ;
}
lib/libvcc/vcc_compile.c
View file @
50a59f10
...
...
@@ -553,6 +553,7 @@ vcc_resolve_includes(struct vcc *tl)
{
struct
token
*
t
,
*
t1
,
*
t2
;
struct
source
*
sp
;
const
struct
source
*
sp1
;
struct
vsb
*
vsb
;
const
char
*
p
;
...
...
@@ -607,6 +608,22 @@ vcc_resolve_includes(struct vcc *tl)
vcc_ErrWhere
(
tl
,
t1
);
return
;
}
for
(
sp1
=
t
->
src
;
sp1
!=
NULL
;
sp1
=
sp1
->
parent
)
if
(
!
strcmp
(
sp1
->
name
,
sp
->
name
))
break
;
if
(
sp1
!=
NULL
)
{
VSB_printf
(
tl
->
sb
,
"Recursive include of
\"
%s
\"\n\n
"
,
sp
->
name
);
vcc_ErrWhere
(
tl
,
t1
);
for
(
sp1
=
t
->
src
;
sp1
!=
NULL
;
sp1
=
sp1
->
parent
)
{
if
(
sp1
->
parent_tok
)
vcc_ErrWhere
(
tl
,
sp1
->
parent_tok
);
}
return
;
}
sp
->
parent
=
t
->
src
;
sp
->
parent_tok
=
t1
;
VTAILQ_INSERT_TAIL
(
&
tl
->
sources
,
sp
,
list
);
sp
->
idx
=
tl
->
nsources
++
;
tl
->
t
=
t2
;
...
...
lib/libvcc/vcc_compile.h
View file @
50a59f10
...
...
@@ -85,6 +85,8 @@ struct source {
const
char
*
e
;
unsigned
idx
;
char
*
freeit
;
const
struct
source
*
parent
;
const
struct
token
*
parent_tok
;
};
struct
token
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment