]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MAJOR: vars: always retrieve the stream and session from the sample
authorWilly Tarreau <w@1wt.eu>
Thu, 10 Mar 2016 15:33:04 +0000 (16:33 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 10 Mar 2016 16:28:04 +0000 (17:28 +0100)
commit6204cd9f278c4e4733328a78dead6f3d0e69740f
tree5f25e7a64fb0f81ce77d98376995719a30292358
parent7560dd4b6a4b4f8ee2c002cd3ecb36e854cb8de1
BUG/MAJOR: vars: always retrieve the stream and session from the sample

This is the continuation of previous patch called "BUG/MAJOR: samples:
check smp->strm before using it".

It happens that variables may have a session-wide scope, and that their
session is retrieved by dereferencing the stream. But nothing prevents them
from being used from a streamless context such as tcp-request connection,
thus crashing the process. Example :

    tcp-request connection accept if { src,set-var(sess.foo) -m found }

In order to fix this, we have to always ensure that variable manipulation
only happens via the sample, which contains the correct owner and context,
and that we never use one from a different source. This results in quite a
large change since a lot of functions are inderctly involved in the call
chain, but the change is easy to follow.

This fix must be backported to 1.6, and requires the last two patches.
include/proto/vars.h
src/hlua.c
src/proto_http.c
src/sample.c
src/stream.c
src/vars.c