[master] 4b48f88 vcc: return no symbol when types don't match

Nils Goroll nils.goroll at uplex.de
Mon Nov 20 18:33:09 UTC 2017


commit 4b48f886a5d9937fbd5b56a1560c755d6e42669f
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Nov 20 19:25:36 2017 +0100

    vcc: return no symbol when types don't match
    
    When we are looking for ! SYM_NONE and find ! SYM_NONE, do not
    return the symbol we found.
    
    The semantics of (kind != SYM_NONE && sym->kind != kind) are
    inclusive because the next conditional is not true for this case.
    
    Ref: 9d81a71a1987f07021ae9f653b0f8f4c54544dbe
    
    Fixes: #2497

diff --git a/bin/varnishtest/tests/v00016.vtc b/bin/varnishtest/tests/v00016.vtc
index dd81a8c..798beae 100644
--- a/bin/varnishtest/tests/v00016.vtc
+++ b/bin/varnishtest/tests/v00016.vtc
@@ -88,3 +88,17 @@ varnish v1 -errvcl {resolves to too many addresses} {
 		if (remote.ip == "varnish-cache.org") {}
 	}
 }
+
+varnish v1 -errvcl {Undefined acl foo} {
+	import directors;
+	backend b { .host = "127.0.0.1"; }
+
+	sub vcl_init {
+		new foo = directors.shard();
+	}
+	sub vcl_recv {
+		if (client.ip ~ foo) {
+			return (synth(200));
+		}
+	}
+}
diff --git a/lib/libvcc/vcc_symb.c b/lib/libvcc/vcc_symb.c
index 2ee26b4..83ec097 100644
--- a/lib/libvcc/vcc_symb.c
+++ b/lib/libvcc/vcc_symb.c
@@ -146,8 +146,9 @@ VCC_Symbol(struct vcc *tl, struct symbol *parent,
 			continue;
 		if (q < e)
 			break;
-		if (kind != SYM_NONE && sym->kind != kind)
-			break;
+		if (kind != SYM_NONE && sym->kind != SYM_NONE &&
+		    kind != sym->kind)
+			sym = NULL;
 		if (kind == SYM_NONE && sym->kind == kind)
 			continue;
 		break;


More information about the varnish-commit mailing list