Commit a1b74f7b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Allow ACLs to be unreferenced when vcc_err_unref=off.

Add a reference from the init function to any non-anonymous match_acl_*()
functions to ensure the compiler does not barf.

Fixes	#1504
parent d3b8f34b
varnishtest "unreferenced acls"
varnish v1 -arg "-p vcc_err_unref=off" -vcl {
backend s1 {
.host = "${bad_ip}";
}
acl foo {
"127.0.0.1";
}
}
......@@ -343,13 +343,14 @@ vcc_acl_entry(struct vcc *tl)
*/
static void
vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
vcc_acl_emit(struct vcc *tl, const char *acln, int anon)
{
struct acl_e *ae;
int depth, l, m, i;
unsigned at[VRT_ACL_MAXADDR + 1];
const char *oc;
struct token *t;
struct inifin *ifp;
Fh(tl, 0, "\nstatic int\n");
Fh(tl, 0,
......@@ -364,6 +365,11 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
Fh(tl, 0, "\t\tVRT_acl_log(ctx, \"NO_FAM %s\");\n", acln);
Fh(tl, 0, "\t\treturn(0);\n");
Fh(tl, 0, "\t}\n\n");
if (!tl->err_unref && !anon ) {
ifp = New_IniFin(tl);
VSB_printf(ifp->ini,
"\tif (0) match_acl_named_%s(0, 0);\n", acln);
}
depth = -1;
oc = 0;
at[0] = 256;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment