[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: shell programming



On Tue, Jan 11, 2000 at 11:46:54PM +1100, Roland Gerlach wrote:
> "Jeremy C. Reed" <reed@wcug.wwu.edu> writes:
> 
> Why not redirect the output to a file and then test if the file
> contains any output:
> 
[snip]
> 	grep `date +"%d-%b-%Y"` $LOGFILE | \
> 	  egrep 'reject|failed|error' | \
> 	  cut -f 3-100 -d " " | \
> 	  sort | \
> 	  uniq > /tmp/$$.out
[snip]

You'll want to keep in mind that scripts like this can be a security
hazzard.  You'll likely want to have a directory that only the user that
is running this script can write to, to avoid symlinks that overwrite
or create important files. (such as /etc/nologin or ~/.rhosts)

i.e. if "/tmp/$$.out" is a symlink that points to /etc/nologin, and this
script is run as root, /etc/nologin will be created, possibly resulting
in a denial of service.

- Chris

-- 
-------------------------------------------
"Chase the dream, not the competition."
     - motto of the Nemesis Air Racing Team


Reply to: