You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Lee <le...@gmail.com> on 2011/02/22 07:55:49 UTC

Re: [users@httpd] PCRE Syntax or bug? (was "Require group" help required)

> On 21 Feb 2011, at 09:12, Lee Goddard wrote:
>
>> Dear Apache Users,
>>
>> I have been looking at a problem for so many hours now that I think it has made me blind.
>>
>> The below configuration is intended to restrict access to /admin-cgi/ to members of the group "admin", which is defined in a plain text file, whilst users and passwords are in a DBM file.
>> [...]
>>
>>     AuthGroupFile /Users/leegoddard/src/www/northfoto2/auth/northfoto_groups.db

The problem seems to be solved, but the solution does not seem valid.

There appears to have been a conflict between these two groups of 
directives:

ScriptAlias /adminjr-cgi/ 
"/Users/leegoddard/src/www/northfoto2/adminjr-cgi/"
<Directory "/Users/leegoddard/src/www/northfoto2/adminjr-cgi/">
...    Require group admin ...
</Directory>

Conflicted with:

<LocationMatch "/admin/*">

At least, when I changed the latter to the below, all behaved as expected:

<LocationMatch "/admin/index.shtml">
...    Require group adminjr ...
</Location>

Have I misunderstood the PCRE engine, or is this a bug...?

Thanks
Lee





---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] PCRE Syntax or bug? (was "Require group" help required)

Posted by Eric Covener <co...@gmail.com>.
> <LocationMatch "/admin/*">

This matches a URL with /admin anywhere inside of it, followed by 0 or
more slashes.  So it matches and overrides your <Directory> block.

No regex or wildcard is required for what you probably intended
(Location /admin/), but if you use a regex and intend it to match
things that "start with" the arg, you have to anchor with ^.  You also
need to get the wildcard right (* modifies what comes before it, e.g.
.*)

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] PCRE Syntax or bug? (was "Require group" help required)

Posted by Lee <le...@gmail.com>.

On 22/02/2011 08:06, Nick Kew wrote:
> On 22 Feb 2011, at 06:55, Lee wrote:
>
>> Have I misunderstood the PCRE engine, or is this a bug...?
> Thou shalt not mix<Directory>  and<Location>!
>
> (the gory details are explained somewhere in the docs; I'm not
> about to look it up).
No, don't look it up, I'll have a poke around. I have done a fair amount 
of reading recently, but this commandment did not stick in my mind. I 
realise it would be foolish to mix Directory and Location on the same 
resource, but the URIs resulting from those directives bore no relation 
to each other, there is no way that /admin-cgi/ can map to /admin/*
> Oh, and you clearly don't want PCRE or any *Match directive.
I agree that the LocationMatch in question was ugly and silly, and I 
would not put it into production, but it should have worked, I think. At 
least, I await reason as to why it ought not to.

Thanks for your help
Lee



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] PCRE Syntax or bug? (was "Require group" help required)

Posted by Nick Kew <ni...@webthing.com>.
On 22 Feb 2011, at 06:55, Lee wrote:

> Have I misunderstood the PCRE engine, or is this a bug...?

Thou shalt not mix <Directory> and <Location>!

(the gory details are explained somewhere in the docs; I'm not
about to look it up).

Oh, and you clearly don't want PCRE or any *Match directive.

-- 
Nick Kew

Available for work, contract or permanent
http://www.webthing.com/~nick/cv.html


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org