You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2002/05/22 18:50:27 UTC

DO NOT REPLY [Bug 8464] - mod_rewrite not executing external rewriting engine if args are supplied

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8464

mod_rewrite not executing external rewriting engine if args are supplied

JTait@wyrddreams.demon.co.uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|mod_rewrite not executing   |mod_rewrite not executing
                   |external rewriting engine   |external rewriting engine if
                   |                            |args are supplied



------- Additional Comments From JTait@wyrddreams.demon.co.uk  2002-05-22 16:50 -------
I've looked into this a bit further with 2.0.36, and also compared to 1.3.24.

In 1.3.24, mod_rewrite execl's a shell process itself in the function
rewritemap_program_child(), passing the user-supplied config line as an argument:

execl(SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL);


This works, even if you supply arguments to the program to be run.

In 2.0.36 it leaves the exec to APR:

    if (((rc = apr_procattr_create(&procattr, p)) != APR_SUCCESS) ||
        ((rc = apr_procattr_io_set(procattr, APR_FULL_BLOCK,
                                  APR_FULL_NONBLOCK,
                                  APR_FULL_NONBLOCK)) != APR_SUCCESS) ||
        ((rc = apr_procattr_dir_set(procattr,
                                   ap_make_dirstr_parent(p, progname)))
         != APR_SUCCESS) ||
        ((rc = apr_procattr_cmdtype_set(procattr, APR_PROGRAM)) != APR_SUCCESS)) {
        /* Something bad happened, give up and go away. */
    }
    else {
        procnew = apr_pcalloc(p, sizeof(*procnew));
        rc = apr_proc_create(procnew, progname, NULL, NULL, procattr, p);


This works when the program doesn't have arguments to be passed, but fails if
there are arguments.  Looking at the apr_proc_create() function:

        else if (attr->cmdtype == APR_PROGRAM) {
            if (attr->detached) {
                apr_proc_detach(APR_PROC_DETACH_DAEMONIZE);
            }

            execve(progname, (char * const *)args, (char * const *)env);
        }


NERK!  The whole user-supplied string is passed as progname, with args and env
empty.

I can get around this by running a shell script that runs my program with
arguments, but that's kinda messy.  I'd prefer to see mod_rewrite handle this
correctly and pass in the args.

If I get time, I'll settle down and fix this.  If anyone wants to beat me to it....

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org