Permalink
Browse files

Refuse vcl.label if it would cause a return(vcl)'ed VCL to return(vcl)

  • Loading branch information...
1 parent 85b8250 commit 1e6affcea87a2a4444ee54552599577a1509a4b6 @bsdphk bsdphk committed Jan 11, 2017
Showing with 12 additions and 0 deletions.
  1. +12 −0 bin/varnishd/mgt/mgt_vcl.c
@@ -691,6 +691,18 @@ mcf_vcl_label(struct cli *cli, const char * const *av, void *priv)
VCLI_Out(cli, "%s is not a label", vpl->name);
return;
}
+ if (!VTAILQ_EMPTY(&vpt->dfrom) &&
+ !VTAILQ_EMPTY(&vpl->dto)) {
+ VCLI_SetResult(cli, CLIS_PARAM);
+ VCLI_Out(cli, "return(vcl) can only be used from"
+ " the active VCL.\n\n");
+ VCLI_Out(cli,
+ "Label %s is used in return(vcl) from VCL %s\n",
+ vpl->name, VTAILQ_FIRST(&vpl->dto)->from->name);
+ VCLI_Out(cli, "and VCL %s also has return(vcl)",
+ vpt->name);
+ return;
+ }
mgt_vcl_dep_del(VTAILQ_FIRST(&vpl->dfrom));
AN(VTAILQ_EMPTY(&vpl->dfrom));
} else {

0 comments on commit 1e6affc

Please sign in to comment.