Re: header_access broken?

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Thu, 06 Sep 2001 21:52:19 +0200

Fix committed (a somewhat expanded version, adding braces on all the
cases)

--
Henrik
Andres Kroonmaa wrote:
>  it seems that header_access doesn't work due to retval always
>  being set.
>
> ------- Forwarded message follows -------
>
> Index: HttpHeaderTools.c
> ===================================================================
> RCS file: /cvsroot/squid/squid/src/HttpHeaderTools.c,v
> retrieving revision 1.6
> diff -u -r1.6 HttpHeaderTools.c
> --- HttpHeaderTools.c   2001/02/07 19:11:47     1.6
> +++ HttpHeaderTools.c   2001/09/05 10:53:40
> @@ -420,9 +420,10 @@
>      else if (NULL == hm->replacement)
>         retval = 0;
>      /* yes, we do */
> -    else
> +    else {
>         stringReset(&e->value, hm->replacement);
> -    retval = 1;
> +       retval = 1;
> +    }
>
>      aclChecklistFree(checklist);
>      return retval;
> ------- End of forwarded message -------
>
> /*
>  * httpHdrMangle checks the anonymizer (header_access) configuration.
>  * Returns 1 if the header is allowed.
>  */
> static int
> httpHdrMangle(HttpHeaderEntry * e, request_t * request)
> {
>     int retval;
>
>     /* check with anonymizer tables */
>     header_mangler *hm;
>     aclCheck_t *checklist;
>     assert(e);
>     hm = &Config.header_access[e->id];
>     checklist = aclChecklistCreate(hm->access_list, request, NULL);
>     /* aclCheckFast returns 1 for allow. */
>     if (1 == aclCheckFast(hm->access_list, checklist))
>         retval = 1;
>     /* It was denied; Do we replace it with something else? */
>     else if (NULL == hm->replacement)
>         retval = 0;
>     /* yes, we do */
>     else
>         stringReset(&e->value, hm->replacement);
>     retval = 1;
>
>     aclChecklistFree(checklist);
>     return retval;
> }
>
> ------------------------------------
>  Andres Kroonmaa <andre@online.ee>
>  CTO, Microlink Online
>  Tel: 6501 731, Fax: 6501 725
>  Pärnu mnt. 158, Tallinn,
>  11317 Estonia
Received on Thu Sep 06 2001 - 13:52:55 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:20 MST