My GTK application was reporting not able to open socket
when in user mode, But with root as root user, socket opened properly.
To further investigate, i wrote the below simple socket code and found
that
socket is opened successfully if application is executed with root
permission
while in user mode, socket open fails. 
Since my GTK app uses socket and i want to run it in user mode, 
i tried to give root permission for entire GTK (using chmod and chown) 
so that socket is created successfully and GTK app is executed in user
login
which is where i faced the problem.

int main(int argc, char* argv[])
{
 int s;

/*open socket*/
    s = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
    if (s == -1) {
        printf("socket():error");
            exit(1);
    }
    printf("Successfully opened socket: %i\n", s);
}

Thanks,
Robin

On Tue, 2010-04-20 at 08:02 +0100, Robert Pearce wrote:

> Hi robin,
> 
> On Tue, 20 Apr 2010 09:51:42 +0530 you wrote:
> > 
> > My question is there any other work around for this problem?
> > My need is the user should not be asked for root password each time (log
> > off and log in)
> > for the GTK application.
> 
> The problem is that GTK is a huge library of complex stuff that is
> added to all the time, and as such is quite a likely place for security
> vulnerabilities to appear. The developers therefore (quite rightly)
> decided it shouldn't be run setuid. The intended way to work is to
> gather the bits that really need to be setuid into a small (and
> therefore probably quite secure) helper program that your big GUI can
> talk to (probably through pipes, maybe through sockets).
> 
> 
> What I don't understand is why you think "making use of socket"
> requires your application to be run as root.
> 
> 
> Rob
> _______________________________________________
> gtk-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 
> -------------------------------------------------------------------------------
>  
> DISCLAIMER: This e-mail and any attachment (s) is for authorised use by the
> intended recipient (s) only. It may contain proprietary material, confidential
> information and/or be subject to the legal privilege of iWave Systems
> Technologies Private Limited. If you have received this message in error,
> please notify the originator immediately. If you are not the intended
> recipient, you are notified that you are strictly prohibited from retaining,
> using, copying, alerting or disclosing the content of this message. Thank you
> for your co-operation. 
> ------------------------------------------------------------------------------



------------------------------------------------------------------------------- 
DISCLAIMER: This e-mail and any attachment (s) is for authorised use by the
intended recipient (s) only. It may contain proprietary material, confidential
information and/or be subject to the legal privilege of iWave Systems
Technologies Private Limited. If you have received this message in error,
please notify the originator immediately. If you are not the intended
recipient, you are notified that you are strictly prohibited from retaining,
using, copying, alerting or disclosing the content of this message. Thank you
for your co-operation. 
------------------------------------------------------------------------------

_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to