www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Pentcheff <de...@biol.sc.edu>
Subject mod_rewrite/7087: Expansion of %{LA-U:REMOTE_USER} fails in RewriteCond
Date Thu, 18 Jan 2001 04:32:13 GMT

>Number:         7087
>Category:       mod_rewrite
>Synopsis:       Expansion of %{LA-U:REMOTE_USER} fails in RewriteCond
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Wed Jan 17 20:40:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     dean2@biol.sc.edu
>Release:        1.3.14
>Organization:
apache
>Environment:
Redhat Linux 6.1, kernel 2.2.14-6.0.1smp, gcc 2.7.2.3
>Description:
Preliminaries: this rewrite pattern worked on 1.3.11 but fails on
1.3.14.  It is NOT fixed by apache_1.3.14-fix.diff.  A temporary
workaround for me has been to simply use the mod_rewrite.{c,h} from
1.3.11 inside an otherwise normal 1.3.14 tree.

Briefly, the %{LA-U:REMOTE_USER} variable fails proper expansion in
(at least) the RewriteCond pattern context.  Based on logfiles, it
appears that it may be due to a parsing error that whacks off the
final "}" which leads to interpretation as a string rather than being
variable-expanded.  I suspect that this has to do with the new
"do_expand()" parsing rather than the old method (note that's a
suspicion, not a certainty).

If you look at the working trace below (the upper set), you can see
that initially the REMOTE_USER variable is empty prior to the
lookahead, therefore failing to trigger a rewrite because of the
RewriteCond.  Next, the the lookahead triggers, finds the variable's
value ("mailtest"), and the rewrite succeeds in inserting the value
into the URL.

In the non-working trace (the lower set), the initial check on the
RewriteCond succeeds when it shouldn't.  The RewriteCond pattern
appears to have its trailing "}" lost, leading to treatment of the
variable expression as a string to match.  Since the RewriteCond
succeeds, the rewrite occurs, filling in an empty string (generating
"//pab.na2").  That suggests that variable expansion at that point is
working (in contrast to the RewriteCond stage).  Weirdly, then the
lookahead goes ahead with what looks like a good variable name, but
fails to find the value.  The upshot is that the variable's proper
value never gets inserted into the URL.

Following are the data (trace lines have had IPs and dates trimmed).
The working trace is generated from a 1.3.14 tree with the 1.3.11
mod_rewrite substituted into it; the failing trace is straight 1.3.14.


Rewrite pattern (tokens are tab-separated)
==========================================
RewriteCond	%{LA-U:REMOTE_USER}	!^$
RewriteRule	^.*/(.*)		/%{LA-U:REMOTE_USER}/$1	[L]


Trace from a RewriteLogLevel 9 with the 1.3.11 mod_rewrite (WORKING)
====================================================================
client - - [date] [server/sid#8332fb8][rid#8398708/initial] (2) init rewrite engine with requested
uri /pab.na2
client - - [date] [server/sid#8332fb8][rid#8398708/initial] (3) applying pattern '^.*/(.*)'
to uri '/pab.na2'
client - - [date] [server/sid#8332fb8][rid#83835e0/subreq] (2) init rewrite engine with requested
uri /pab.na2
client - - [date] [server/sid#8332fb8][rid#83835e0/subreq] (3) applying pattern '^.*/(.*)'
to uri '/pab.na2'
client - - [date] [server/sid#8332fb8][rid#83835e0/subreq] (4) RewriteCond: input='' pattern='!^$'
=> not-matched
client - - [date] [server/sid#8332fb8][rid#83835e0/subreq] (1) pass through /pab.na2
client - mailtest [date] [server/sid#8332fb8][rid#8398708/initial] (5) lookahead: path=/pab.na2
var=REMOTE_USER -> val=mailtest
client - mailtest [date] [server/sid#8332fb8][rid#8398708/initial] (4) RewriteCond: input='mailtest'
pattern='!^$' => matched
client - mailtest [date] [server/sid#8332fb8][rid#83835e0/subreq] (2) init rewrite engine
with requested uri /pab.na2
client - mailtest [date] [server/sid#8332fb8][rid#83835e0/subreq] (3) applying pattern '^.*/(.*)'
to uri '/pab.na2'
client - mailtest [date] [server/sid#8332fb8][rid#83835e0/subreq] (4) RewriteCond: input=''
pattern='!^$' => not-matched
client - mailtest [date] [server/sid#8332fb8][rid#83835e0/subreq] (1) pass through /pab.na2
client - mailtest [date] [server/sid#8332fb8][rid#8398708/initial] (5) lookahead: path=/pab.na2
var=REMOTE_USER -> val=mailtest
client - mailtest [date] [server/sid#8332fb8][rid#8398708/initial] (2) rewrite /pab.na2 ->
/mailtest/pab.na2
client - mailtest [date] [server/sid#8332fb8][rid#8398708/initial] (2) local path result:
/mailtest/pab.na2
client - mailtest [date] [server/sid#8332fb8][rid#8398708/initial] (2) prefixed with document_root
to /usr/local/apache/mail/mailtest/pab.na2
client - mailtest [date] [server/sid#8332fb8][rid#8398708/initial] (1) go-ahead with /usr/local/apache/mail/mailtest/pab.na2
[OK]


Trace from a RewriteLogLevel 9 with the 1.3.14 mod_rewrite (FAILING)
====================================================================
client - - [date] [server/sid#8332558][rid#836c340/initial] (2) init rewrite engine with requested
uri /pab.na2
client - - [date] [server/sid#8332558][rid#836c340/initial] (3) applying pattern '^.*/(.*)'
to uri '/pab.na2'
client - - [date] [server/sid#8332558][rid#8394790/subreq] (2) init rewrite engine with requested
uri /pab.na2
client - - [date] [server/sid#8332558][rid#8394790/subreq] (3) applying pattern '^.*/(.*)'
to uri '/pab.na2'
client - - [date] [server/sid#8332558][rid#8394790/subreq] (4) RewriteCond: input='%{LA-U:REMOTE_USER'
pattern='!^$' => matched
client - - [date] [server/sid#8332558][rid#8394790/subreq] (2) rewrite /pab.na2 -> //pab.na2
client - - [date] [server/sid#8332558][rid#8394790/subreq] (2) local path result: //pab.na2
client - - [date] [server/sid#8332558][rid#8394790/subreq] (1) go-ahead with //pab.na2 [OK]
client - - [date] [server/sid#8332558][rid#836c340/initial] (5) lookahead: path=/pab.na2 var=REMOTE_USER
-> val=
client - - [date] [server/sid#8332558][rid#836c340/initial] (4) RewriteCond: input='' pattern='!^$'
=> not-matched
client - - [date] [server/sid#8332558][rid#836c340/initial] (1) pass through /pab.na2

=== end of bug report ===
>How-To-Repeat:

>Fix:
Possibly an error introduced in the rewriting of variable parsing into the
"do_expand()" routine.
>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <apbugs@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]
 
 


Mime
View raw message