how to use exev?

how to use exev?

Post by Shen Lia » Sat, 28 Sep 1996 04:00:00



Hi,

since I must write a SUID program under UNIX, I use the

fork; execv("/sbin/mount", args) ... args=("/sbin/mount", "/dev/disk", "/disk",
NULL)
but I want to know the status of the shell command "/sbin/mount /dev/disk
/disk". (Let me assume, that the command /sbin/mount exists), how can I do it?

the routine exec doesn't give any useful information. someone tells me, that I
should use "system(...)" or "popen(...)", but they have a lot of disavantage,
esp. security problems. (I am writing a SUID root program!!)

I want to ask you how this problem is solved under the bash, where you can get
the status of the last issued command using "echo $?". Under the shell, I am
quite sure, the exec(s) are very intensively used. But how can I get the
status?

thanks!

lian

 
 
 

how to use exev?

Post by Kevin Darc » Sat, 28 Sep 1996 04:00:00



> Hi,

> since I must write a SUID program under UNIX, I use the

> fork; execv("/sbin/mount", args) ... args=("/sbin/mount", "/dev/disk", "/disk",
> NULL)
> but I want to know the status of the shell command "/sbin/mount /dev/disk
> /disk".

Terminology alert: if you're exec()'ing it directly, it's not really a
"shell" command...

Quote:> (Let me assume, that the command /sbin/mount exists), how can I do it?

> the routine exec doesn't give any useful information. someone tells me, that I
> should use "system(...)" or "popen(...)", but they have a lot of disavantage,
> esp. security problems. (I am writing a SUID root program!!)

I'm no security expert, but I do know that if you want to write a secure
SUID root program, you need to take care of a lot more things than just
avoiding system() or popen().

Quote:> I want to ask you how this problem is solved under the bash, where you can get
> the status of the last issued command using "echo $?". Under the shell, I am
> quite sure, the exec(s) are very intensively used. But how can I get the
> status?

And what is the parent process going to be doing while the child process
is busy exec()'ing ? Probably sitting in a wait() call, right? Perhaps
you should consult the documentation for the wait() call.

                                                        - Kevin

 
 
 

1. enlightenment keyboard shortcuts Q's: using the win key, using c+a+sh, conf file?

Hi,

I like the keyboard shortcuts in enlightenment, however, I'm runing into a
few problems:

1. I can't use the WIN key for any shortcuts. For example, I would like WIN
to open the menu (like windows)
2. I tried setting keys to Ctrl + Alt + Shift + <some key>. They work while
I'm in session, but as soon as I log out, they get changed to Ctrl + Shift.
Even if I save the session.
3. When I change settings, do they get stored in some conf file? That would
be nice so that I could perform edits to import changes quickly instead of
going through the GUI. I grepped on obvious strings, but I couldn't find a
configuration file.

Any help would be greatly appreciated.

David

2. I got the webserver to work - mostly...

3. cannot print using lpr without PPP connection using Caldera (Red Hat)

4. This is Cool 5643

5. Problem using CD in Win98 after using Linux

6. xdm w/ shadow local display won't open

7. Using telnet from standalone PC using dialup? How?

8. Virtual WU-FTPD Uploading problems: Bad File Number

9. Using Linux as a gateway to the internet (using ppp) for win95

10. Can the accept() be used after using one successful connect() with the same TCP port ?

11. Using C, what ports are being used by which programs?

12. using network boot to install RedHat using Anaconda

13. Using Sed and Shell Variables in Multiple Lines Search and Replace using /c\