You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.5 KiB

  1. From 9c017e541bb3cee2e2884cdc53a4cb4627be5dad Mon Sep 17 00:00:00 2001
  2. From: Christopher Faulet <cfaulet@haproxy.com>
  3. Date: Wed, 9 Nov 2016 16:15:32 +0100
  4. Subject: [PATCH 31/31] BUG: vars: Fix 'set-var' converter because of a typo
  5. The 'set-var' converter uses function smp_conv_store (vars.c). In this function,
  6. we should use the first argument (index 0) to retrieve the variable name and its
  7. scope. But because of a typo, we get the scope of the second argument (index
  8. 1). In this case, there is no second argument. So the scope used was always 0
  9. (SCOPE_SESS), always setting the variable in the session scope.
  10. So, due to this bug, this rules
  11. tcp-request content accept if { src,set-var(txn.foo) -m found }
  12. always set the variable 'sess.foo' instead of 'txn.foo'.
  13. (cherry picked from commit 0099a8ca9d58cb4cff943bf6374b55b42a23fbfb)
  14. ---
  15. src/vars.c | 2 +-
  16. 1 file changed, 1 insertion(+), 1 deletion(-)
  17. diff --git a/src/vars.c b/src/vars.c
  18. index a3dd85c..8645905 100644
  19. --- a/src/vars.c
  20. +++ b/src/vars.c
  21. @@ -379,7 +379,7 @@ static inline int sample_store_stream(const char *name, enum vars_scope scope, s
  22. /* Returns 0 if fails, else returns 1. */
  23. static int smp_conv_store(const struct arg *args, struct sample *smp, void *private)
  24. {
  25. - return sample_store_stream(args[0].data.var.name, args[1].data.var.scope, smp);
  26. + return sample_store_stream(args[0].data.var.name, args[0].data.var.scope, smp);
  27. }
  28. /* This fucntions check an argument entry and fill it with a variable
  29. --
  30. 2.7.3