You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Paul J. Reder" <re...@remulak.net> on 2002/08/19 22:31:21 UTC

Question about command parsing in mod_ext_filter.

After fixing the parse_cmd code to be able to handle escaped quotes (so that
it would process the full
          <"/bin/awk '{print NR\": \" $N}'">
instead of just
          <"/bin/awk '{print NR\">
(and then an error for the <: \" $N}'"> part)) I ran into what appears to be
the next problem.

In parse_cmd it runs

         /* parms now has the command-line to parse */
         while (filter->numArgs < 30 &&
                strlen(filter->args[filter->numArgs] = ap_getword_white_nc(p, &parms))) {
             ++filter->numArgs;
         }

to break the command string into an args list of tokens. This code uses *only* white
space as delimeters. Thus the input command string
          "/bin/awk '{print NR\": \" $N}'"

gets broken into
           /bin/awk
           '{print
           NR\":
           \"
           $N}'

The question I have is, shouldn't this break down into either
           /bin/awk
           '{print NR\": \" $N}'
or
           /bin/awk
           '{print NR\
           ": \"
           $N}'

The above listed pieces end up as the args list passed on the apr_proc_create
call.


Thanks,

-- 
Paul J. Reder
-----------------------------------------------------------
"The strength of the Constitution lies entirely in the determination of each
citizen to defend it.  Only if every single citizen feels duty bound to do
his share in this defense are the constitutional rights secure."
-- Albert Einstein



Re: Question about command parsing in mod_ext_filter.

Posted by Jeff Trawick <tr...@attglobal.net>.
"William A. Rowe, Jr." wrote:

> Don't we -already- have some argv parsing code in either proc.c or the mod_cgi
> that could be used for this purpose???  Let's make that exported, accessible
> code from apr itself.

My thoughts exactly, but then I'm the moron who put something different in
mod_ext_filter :)

--
Jeff Trawick




Re: Question about command parsing in mod_ext_filter.

Posted by "Paul J. Reder" <re...@remulak.net>.
Will do.

rbb@apache.org wrote:

> On Mon, 19 Aug 2002, William A. Rowe, Jr. wrote:
> 
> 
>>Don't we -already- have some argv parsing code in either proc.c or the mod_cgi
>>that could be used for this purpose???  Let's make that exported, accessible
>>code from apr itself.
>>
> 
> We already have it, and it is exported from APR.  Look in
> strings/apr_cpystrn.c for apr_tokenize_to_argv.
> 
> Ryan
> 
> 
>>Bill
>>
>>At 03:31 PM 8/19/2002, Paul J. Reder wrote:
>>
>>>After fixing the parse_cmd code to be able to handle escaped quotes (so that
>>>it would process the full
>>>         <"/bin/awk '{print NR\": \" $N}'">
>>>instead of just
>>>         <"/bin/awk '{print NR\">
>>>(and then an error for the <: \" $N}'"> part)) I ran into what appears to be
>>>the next problem.
>>>
>>>In parse_cmd it runs
>>>
>>>        /* parms now has the command-line to parse */
>>>        while (filter->numArgs < 30 &&
>>>               strlen(filter->args[filter->numArgs] = 
>>>ap_getword_white_nc(p, &parms))) {
>>>            ++filter->numArgs;
>>>        }
>>>
>>>to break the command string into an args list of tokens. This code uses 
>>>*only* white
>>>space as delimeters. Thus the input command string
>>>         "/bin/awk '{print NR\": \" $N}'"
>>>
>>>gets broken into
>>>          /bin/awk
>>>          '{print
>>>          NR\":
>>>          \"
>>>          $N}'
>>>
>>>The question I have is, shouldn't this break down into either
>>>          /bin/awk
>>>          '{print NR\": \" $N}'
>>>or
>>>          /bin/awk
>>>          '{print NR\
>>>          ": \"
>>>          $N}'
>>>
>>>The above listed pieces end up as the args list passed on the apr_proc_create
>>>call.
>>>
>>>
>>>Thanks,
>>>
>>>--
>>>Paul J. Reder
>>>-----------------------------------------------------------
>>>"The strength of the Constitution lies entirely in the determination of each
>>>citizen to defend it.  Only if every single citizen feels duty bound to do
>>>his share in this defense are the constitutional rights secure."
>>>-- Albert Einstein
>>>
>>>
>>
> 


-- 
Paul J. Reder
-----------------------------------------------------------
"The strength of the Constitution lies entirely in the determination of each
citizen to defend it.  Only if every single citizen feels duty bound to do
his share in this defense are the constitutional rights secure."
-- Albert Einstein



Re: Question about command parsing in mod_ext_filter.

Posted by rb...@apache.org.
On Mon, 19 Aug 2002, William A. Rowe, Jr. wrote:

> Don't we -already- have some argv parsing code in either proc.c or the mod_cgi
> that could be used for this purpose???  Let's make that exported, accessible
> code from apr itself.

We already have it, and it is exported from APR.  Look in
strings/apr_cpystrn.c for apr_tokenize_to_argv.

Ryan

> 
> Bill
> 
> At 03:31 PM 8/19/2002, Paul J. Reder wrote:
> >After fixing the parse_cmd code to be able to handle escaped quotes (so that
> >it would process the full
> >          <"/bin/awk '{print NR\": \" $N}'">
> >instead of just
> >          <"/bin/awk '{print NR\">
> >(and then an error for the <: \" $N}'"> part)) I ran into what appears to be
> >the next problem.
> >
> >In parse_cmd it runs
> >
> >         /* parms now has the command-line to parse */
> >         while (filter->numArgs < 30 &&
> >                strlen(filter->args[filter->numArgs] = 
> > ap_getword_white_nc(p, &parms))) {
> >             ++filter->numArgs;
> >         }
> >
> >to break the command string into an args list of tokens. This code uses 
> >*only* white
> >space as delimeters. Thus the input command string
> >          "/bin/awk '{print NR\": \" $N}'"
> >
> >gets broken into
> >           /bin/awk
> >           '{print
> >           NR\":
> >           \"
> >           $N}'
> >
> >The question I have is, shouldn't this break down into either
> >           /bin/awk
> >           '{print NR\": \" $N}'
> >or
> >           /bin/awk
> >           '{print NR\
> >           ": \"
> >           $N}'
> >
> >The above listed pieces end up as the args list passed on the apr_proc_create
> >call.
> >
> >
> >Thanks,
> >
> >--
> >Paul J. Reder
> >-----------------------------------------------------------
> >"The strength of the Constitution lies entirely in the determination of each
> >citizen to defend it.  Only if every single citizen feels duty bound to do
> >his share in this defense are the constitutional rights secure."
> >-- Albert Einstein
> >
> 
> 

-- 

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
550 Jean St
Oakland CA 94610
-------------------------------------------------------------------------------


Re: Question about command parsing in mod_ext_filter.

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Don't we -already- have some argv parsing code in either proc.c or the mod_cgi
that could be used for this purpose???  Let's make that exported, accessible
code from apr itself.

Bill

At 03:31 PM 8/19/2002, Paul J. Reder wrote:
>After fixing the parse_cmd code to be able to handle escaped quotes (so that
>it would process the full
>          <"/bin/awk '{print NR\": \" $N}'">
>instead of just
>          <"/bin/awk '{print NR\">
>(and then an error for the <: \" $N}'"> part)) I ran into what appears to be
>the next problem.
>
>In parse_cmd it runs
>
>         /* parms now has the command-line to parse */
>         while (filter->numArgs < 30 &&
>                strlen(filter->args[filter->numArgs] = 
> ap_getword_white_nc(p, &parms))) {
>             ++filter->numArgs;
>         }
>
>to break the command string into an args list of tokens. This code uses 
>*only* white
>space as delimeters. Thus the input command string
>          "/bin/awk '{print NR\": \" $N}'"
>
>gets broken into
>           /bin/awk
>           '{print
>           NR\":
>           \"
>           $N}'
>
>The question I have is, shouldn't this break down into either
>           /bin/awk
>           '{print NR\": \" $N}'
>or
>           /bin/awk
>           '{print NR\
>           ": \"
>           $N}'
>
>The above listed pieces end up as the args list passed on the apr_proc_create
>call.
>
>
>Thanks,
>
>--
>Paul J. Reder
>-----------------------------------------------------------
>"The strength of the Constitution lies entirely in the determination of each
>citizen to defend it.  Only if every single citizen feels duty bound to do
>his share in this defense are the constitutional rights secure."
>-- Albert Einstein
>