David Bustos wrote:
> Quoth Nicolas Williams on Wed, Jun 04, 2008 at 02:41:25PM -0500:
> > If I understand your proposal you're suggestion one svcprop invocation
> > to find how many values for a property, and then a per-value invocation
> > of svcprop.  Sounds rather wasteful (lots of fork/execs), though that
> > too will do -- but think about how you use that from a shell program and
> > compare to my usage above.
> 
> No, sorry I wasn't clear enough.  I'm proposing that svcprop print the
> values in such a way that you can do
> 
>         for val in `svcprop ...`; do
>                 ...
>         done
> 
> or
> 
>         set -- `svcprop ...`
>         # use positional parameters
> 
> Though I suspect that there should also be a way for a script to obtain
> the number of values and abort if there are too many.  Though that could
> be defeated by an intervening modification.

Note that the example above relies in the use of IFS _and_ may be
vulnerable to attributary (shell) code execution. Technically the use of
"for ... in ..." and "set -- ..." is "discuraged" when you expact that
the input may be under control of a user and/or may contain stuff like
whitespaces or other characters used in IFS (please ask David Korn in
shell-disucss at opensolaris.org about the details behind this - he wrote
several papers on script security (and did some research about securing
setid scripts))

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz at nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)

Reply via email to