Re: ping driving me nuts!
Re: ping driving me nuts!
- Subject: Re: ping driving me nuts!
- From: "Duane Murphy" <email@hidden>
- Date: Wed, 23 Jul 2003 23:05:05 -0700
--- At Wed, 23 Jul 2003 22:52:07 -0500, Aaron Ballman wrote:
>
I would like to implement an ICMP ping (echo and reply) socket using BSD
>
sockets, yet I am finding that unless root owns the executable, it's
>
chmod'ed to u+s and I setuid to root... I can't make a SOCK_RAW socket.
>
Now, I can understand the security issues if we let anyone make a raw
>
socket as an unprivelaged user... but all I would like to do is send a
>
ping out (and obviously receive the replies back).
>
>
Does anyone know of a way that I can create a socket descriptor for
>
pinging without needing the end-user to be root? While googling I saw a
>
suggestion for making it a SOCK_DGRAM, but then how do I stuff the ICMP
>
header into the packet?
I think there is a sample code on the apple web site that shows how to do
this. I think it might be able to do it without being privileged.
Before that example, which is restricted to some version of 10.2, you
must be root to open a SOCK_RAW socket. There is a discussion in
Richard's (?) Unix book that talks about how to transfer sockets from one
app to another. This is how you open a privileged socket without the
entire app being priv.
For our purposes we just exec ping and let it do the work for us.
...Duane
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.