From: Willy Tarreau Date: Wed, 6 Jun 2012 14:07:00 +0000 (+0200) Subject: BUG/MAJOR: cookie prefix doesn't support cookie-less servers X-Git-Tag: v1.5-dev12~148 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a05903174f251907e8d129f0aa593f60c80d9737;p=thirdparty%2Fhaproxy.git BUG/MAJOR: cookie prefix doesn't support cookie-less servers Commit 827aee91 merged in 1.5-dev5 introduced a regression causing the srv pointer to be tested twice instead of srv then srv->cookie. The result is that if a server has no cookie in prefix mode, haproxy will crash when trying to modify it. Such a config is very unlikely to happen, except maybe with a backup server, which would cause haproxy to die with the last server in the farm. No backport is needed, only 1.5-dev was affected. --- diff --git a/src/proto_http.c b/src/proto_http.c index 8834532289..054c6ac140 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -6907,7 +6907,7 @@ void manage_server_side_cookies(struct session *t, struct buffer *res) txn->flags &= ~TX_SCK_MASK; txn->flags |= TX_SCK_REPLACED; } - else if (srv && srv && (t->be->ck_opts & PR_CK_PFX)) { + else if (srv && srv->cookie && (t->be->ck_opts & PR_CK_PFX)) { /* insert the cookie name associated with this server * before existing cookie, and insert a delimiter between them.. */