]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG: proxy: fix server name lookup in get_backend_server()
authorWilly Tarreau <w@1wt.eu>
Wed, 14 Nov 2012 23:15:18 +0000 (00:15 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 14 Nov 2012 23:15:18 +0000 (00:15 +0100)
The lookup was broken by commit 050536d5. The server ID is
initialized to a negative value but unfortunately not all the
tests were converted. Thanks to Igor at owind for reporting it.

src/proxy.c

index 914d97940dc92078c94e4880c4f022764ccfb0b8..9ccd25ad83d6702edebfcedfcb353614492e8b0e 100644 (file)
@@ -115,8 +115,8 @@ int get_backend_server(const char *bk_name, const char *sv_name,
                return 0;
 
        for (s = p->srv; s; s = s->next)
-               if ((sid && s->puid == sid) ||
-                   (!sid && strcmp(s->id, sv_name) == 0))
+               if ((sid >= 0 && s->puid == sid) ||
+                   (sid < 0 && strcmp(s->id, sv_name) == 0))
                        break;
        *sv = s;
        if (!s)