Bug 55062 - mod_cache_socache can't parse CacheSocache providers correctly
Summary: mod_cache_socache can't parse CacheSocache providers correctly
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_cache (show other bugs)
Version: 2.5-HEAD
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2013-06-05 08:05 UTC by Martin Ksellmann
Modified: 2013-10-04 20:23 UTC (History)
1 user (show)



Attachments
patch for the reported bug (474 bytes, patch)
2013-06-05 08:05 UTC, Martin Ksellmann
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Ksellmann 2013-06-05 08:05:51 UTC
Created attachment 30397 [details]
patch for the reported bug

mod_cache_socache is the intermediary layer between mod_cache and e.g. mod_socache_memcache. In order to activate such a socache provider you would typically use a directive like

    CacheSocache memcache:localhost:11211

Unfortunately the parsing code for this directive in modules/cache/mod_cache_socache.c is buggy.

In lines 1264 - 1273 it correctly parses the name of the socache_provider into a variable "name" (as the directives argument resides in variable "arg" but this can also contain configuration arguments after the colon).

Unfortunately in lines 1275-1276 it tries to verify the existence of the socache_provider against the variable "arg" instead of "name".
The effect of this is, that a directive "CacheSocache" without any additional arguments passes this check, but the socache_provider doesn't get any additional configuration values. If you use "CacheSocache" with any configuring arguments, the check compares the whole directive's argument against the valid socache_providers and fails.

Using the variable "name" in line 1276 instead of "arg" fixes the problem.
(see attacched patch against rev 1489734.

Please apologize if this is a duplicate, but I couldn't find this bug reported elsewhere. Also this bug is present in version 2.4.4 as well and I used mod_cache as a components as mod_cache_socache is missing as component.
Comment 1 Graham Leggett 2013-06-10 14:12:44 UTC
Thanks for catching this.

Applied to httpd-trunk in http://svn.apache.org/r1491458, and proposed for backport to v2.4.
Comment 2 Christophe JAILLET 2013-10-04 20:23:48 UTC
This is part of 2.4.5
It has been backported in r1492202