On Thu, May 13, 2021 at 12:24:02PM +0200, Tim Düsterhus wrote:
> > So what I'm proposing is to simply change vars_get_by_name() to call
> > register_name() with alloc=0 in order to fix this mess. We can then
> > check during 2.5 how to refine this to also consider the scope with
> > the variable's name. It's just this, and fixes Joao's test case to
> > always return 403:
> > 
> > diff --git a/src/vars.c b/src/vars.c
> > index 996141f5d..15dcb3c3d 100644
> > --- a/src/vars.c
> > +++ b/src/vars.c
> > @@ -583,7 +583,7 @@ int vars_get_by_name(const char *name, size_t len, 
> > struct sample *smp)
> >          enum vars_scope scope;
> >          /* Resolve name and scope. */
> > -       name = register_name(name, len, &scope, 1, NULL);
> > +       name = register_name(name, len, &scope, 0, NULL);
> >          if (!name)
> >                  return 0;
> > Tim, do you agree with this analysis ?
> > 
> 
> Yes, that change makes sense to me.

Great, thanks for the fast response, I'm going to do that and mark it as
a bugfix so that after some observation we can consider backporting it.

> If you'd see my full use case then I
> recommend taking a look at haproxy-auth-request. It's super simple and even
> comes with VTest tests:
> 
> https://github.com/TimWolla/haproxy-auth-request#usage
> https://github.com/TimWolla/haproxy-auth-request/blob/main/auth-request.lua#L50
> https://github.com/TimWolla/haproxy-auth-request/tree/main/test

Thanks. I vaguely remembered it was something simple but I really can't
remember every use case that end up as a patch :-)

Cheers,
Willy

Reply via email to