Bug 14453 - mod_rewrite external programs disrupted by URLs with newlines in
Summary: mod_rewrite external programs disrupted by URLs with newlines in
Status: CLOSED FIXED
Alias: None
Product: Apache httpd-1.3
Classification: Unclassified
Component: mod_rewrite (show other bugs)
Version: 1.3.26
Hardware: Sun Solaris
: P3 critical with 2 votes (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-11 17:53 UTC by Dr Philip J. Naylor
Modified: 2004-11-16 19:05 UTC (History)
1 user (show)



Attachments
Patch we use successfully since monthes about this problem (363 bytes, patch)
2003-07-28 11:08 UTC, Cedric Gavage
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dr Philip J. Naylor 2002-11-11 17:53:01 UTC
We are using mod_rewrite with an external rewrite program to produce an inbound 
proxy that splits requests between staff and student back-end servers.

Occassionally the rewrite program starts returning results that relate to 
previous requests, rather than the current one and the server has to be
restarted.

Having added some extra debugging to mod_rewrite.c I have determined that (at
least on the last occassion) the problem is with someone trying to access a
URL that has a newline character encoded in it :

http://www.cems.uwe.ac.uk/~opkgyaas%0a/images/livingeaston.JPG

The customised debug output when this happens is :

lookup_map_program: called for /~jsmith/ec/perm+csp/sld026.htm
rewritelock_alloc: called for /~jsmith/ec/perm+csp/sld026.htm
fd_lock: called for /~jsmith/ec/perm+csp/sld026.htm
fd_lock: ended fcntl() loop [rc=0, errno=11, EINTR=4] for /~jsmith/ec/perm+csp/s
ld026.htm
fd_lock: got lock for /~jsmith/ec/perm+csp/sld026.htm
lookup_map_program: rewrote -
        203.197.98.2,/~jsmith/ec/perm+csp/sld026.htm to http://web03.cems.uwe.ac
.uk/~jsmith/ec/perm+csp/sld026.htm
                 for /~jsmith/ec/perm+csp/sld026.htm
rewritelock_free: called for /~jsmith/ec/perm+csp/sld026.htm
fd_unlock: called for /~jsmith/ec/perm+csp/sld026.htm
fd_unlock: unlocked for /~jsmith/ec/perm+csp/sld026.htm
lookup_map_program: called for /~jsmith/ec/perm+csp/img026.gif
rewritelock_alloc: called for /~jsmith/ec/perm+csp/img026.gif
fd_lock: called for /~jsmith/ec/perm+csp/img026.gif
fd_lock: ended fcntl() loop [rc=0, errno=11, EINTR=4] for /~jsmith/ec/perm+csp/i
mg026.gif
fd_lock: got lock for /~jsmith/ec/perm+csp/img026.gif
lookup_map_program: rewrote -
        203.197.98.2,/~jsmith/ec/perm+csp/img026.gif to http://web03.cems.uwe.ac
.uk/~jsmith/ec/perm+csp/img026.gif
                 for /~jsmith/ec/perm+csp/img026.gif
rewritelock_free: called for /~jsmith/ec/perm+csp/img026.gif
fd_unlock: called for /~jsmith/ec/perm+csp/img026.gif
fd_unlock: unlocked for /~jsmith/ec/perm+csp/img026.gif
lookup_map_program: called for /~opkgyaas
/images/livingeaston.JPG
rewritelock_alloc: called for /~opkgyaas
/images/livingeaston.JPG
fd_lock: called for /~opkgyaas
/images/livingeaston.JPG
fd_lock: ended fcntl() loop [rc=0, errno=2, EINTR=4] for /~opkgyaas
/images/livingeaston.JPG
fd_lock: got lock for /~opkgyaas
/images/livingeaston.JPG
lookup_map_program: rewrote -
        209.237.238.163,/~opkgyaas
/images/livingeaston.JPG to http://www.cems.uwe.ac.uk/blocked.html
                 for /~opkgyaas
/images/livingeaston.JPG
rewritelock_free: called for /~opkgyaas
/images/livingeaston.JPG
fd_unlock: called for /~opkgyaas
/images/livingeaston.JPG
fd_unlock: unlocked for /~opkgyaas
/images/livingeaston.JPG
lookup_map_program: called for /~jsmith/ec/perm+csp/sld027.htm
rewritelock_alloc: called for /~jsmith/ec/perm+csp/sld027.htm
fd_lock: called for /~jsmith/ec/perm+csp/sld027.htm
fd_lock: ended fcntl() loop [rc=0, errno=11, EINTR=4] for /~jsmith/ec/perm+csp/s
ld027.htm
fd_lock: got lock for /~jsmith/ec/perm+csp/sld027.htm
lookup_map_program: rewrote -
        203.197.98.2,/~jsmith/ec/perm+csp/sld027.htm to NULL
                 for /~jsmith/ec/perm+csp/sld027.htm
rewritelock_free: called for /~jsmith/ec/perm+csp/sld027.htm
fd_unlock: called for /~jsmith/ec/perm+csp/sld027.htm
fd_unlock: unlocked for /~jsmith/ec/perm+csp/sld027.htm
lookup_map_program: called for /~ngunton/worksheets/shell.pdf
rewritelock_alloc: called for /~ngunton/worksheets/shell.pdf
fd_lock: called for /~ngunton/worksheets/shell.pdf
fd_lock: ended fcntl() loop [rc=0, errno=11, EINTR=4] for /~ngunton/worksheets/s
hell.pdf
fd_lock: got lock for /~ngunton/worksheets/shell.pdf
lookup_map_program: rewrote -
        66.130.224.176,/~ngunton/worksheets/shell.pdf to http://web03.cems.uwe.a
c.uk/~jsmith/ec/perm+csp/sld027.htm
                 for /~ngunton/worksheets/shell.pdf
rewritelock_free: called for /~ngunton/worksheets/shell.pdf
fd_unlock: called for /~ngunton/worksheets/shell.pdf
fd_unlock: unlocked for /~ngunton/worksheets/shell.pdf
lookup_map_program: called for /~ngunton/worksheets/first.gif
rewritelock_alloc: called for /~ngunton/worksheets/first.gif
fd_lock: called for /~ngunton/worksheets/first.gif
fd_lock: ended fcntl() loop [rc=0, errno=9, EINTR=4] for /~ngunton/worksheets/fi
rst.gif
fd_lock: got lock for /~ngunton/worksheets/first.gif
lookup_map_program: rewrote -
        66.130.224.176,/~ngunton/worksheets/first.gif to http://web03.cems.uwe.a
c.uk/~ngunton/worksheets/shell.pdf
                 for /~ngunton/worksheets/first.gif
rewritelock_free: called for /~ngunton/worksheets/first.gif
fd_unlock: called for /~ngunton/worksheets/first.gif
fd_unlock: unlocked for /~ngunton/worksheets/first.gif


Since the external rewrite programs rely on receiving newline delimited data
on stdin, any newlines should really be stripped out, or URL encoded, before
they receive them.
Comment 1 Cedric Gavage 2003-07-28 11:08:52 UTC
Created attachment 7543 [details]
Patch we use successfully since monthes about this problem
Comment 2 André Malo 2003-10-06 10:02:21 UTC
This was fixed in 2.1 some time ago and waits for backport approval (another
vote from a core developer).

Thanks for your report!
Comment 3 André Malo 2003-10-06 10:18:55 UTC
*** Bug 21975 has been marked as a duplicate of this bug. ***
Comment 4 André Malo 2004-01-12 19:32:15 UTC
It will be fixed in 1.3.30 and 2.0.49 versions.