Re: [glade--] System call



On Sat, 2005-02-19 at 22:51 -0300, Arthur wrote:
> Hey, guys.
> Glade and glade-- are running ok here. The fact is I want to build an 
> application (I've built it on glade) to run "/etc/init.d/net.ath0 start" 
> and "stop", too. For this, I need the root password, asked by 'su' command.
> I thought trying:
> 
> (...)
> #include <iostream>
> 
> void on_connectbutton_clicked()
> {
>     system("su -");
>     // Then I would have to give the root password with a command - I 
> don't know how.
>     system("/etc/init.d/net.ath0 start);
>     (...)
> }
> 

su spawns a new (shell) process. This is a new Process, so its
completely separated from the process it have been called. After the
line system("su -") you program would be sleeping and the opened shell
would not get any new commands like the call to your init script.

Simple solution:
Just pop up a box saying that the user has to start /etc/init.d/net.ath0
start before using your program.

> The root password should be typed in a entry box, let's say 
> 'rootpasswordentry'. I know I could get it's text with 
> rootpasswordentry->get_text().

This does not help either since your box would ask the root passwort in
the user process. su instead spawns the new process before asksing the
passwort. This reduces the risk that the passwort gets keylogged. 
In fact program would be a root passwort sniffer which has to be
rejected.


> Any idea, guys? What do you recommend me to read? Should I continue with 
> Gtkmm 2.4 Book (it seems just like a reference book since the ¨ "Button" 
> chapter)?

Well your problem isnt gtkmm or glade based. But read on :)

> Thank you very much. I really want to learn how to program with Gtkmm 
> and Glade.

Maybe you want to beek into Advanced UNIX Programming (2nd Edition):
http://www.amazon.com/exec/obidos/tg/detail/-/0131411543/qid=1108891477/sr=8-1/ref=pd_csp_1/002-2061515-3535227?v=glance&s=books&n=507846

Bye Gunther

Attachment: signature.asc
Description: This is a digitally signed message part



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