TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:10871] CPP Question



Jonathan Kline wrote:
> 
> Hello All:
> 
> My C's a bit rusty, but as I remeber there is a system function that can
> be used to execute shell commands.
>         Basically what I want to do is change to a directory, run a
> command (eg /usr/bin/wesetup).
>         Anyone know hod to do this?  I know it's realitivly insecure, but
> that should be alright!  And yes the program is setuid root, yes again
> it's insecure but the cgi program needs access to the filesystem and
> everyone's mail!
> 

give this a shot: system("/usr/bin/wesetup");

That should exec the command in sh.  If that's not what you need, take a
look at the exec*() functions.

--
-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^
Ryan Hankins 
University Of Minnesota, Duluth
-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^