On Apr 29, 5:19 am, wadhah dawahi <wadhah.daw...@gmail.com> wrote:

> i want to execute ifconfig and iwconfig with all arguments without
> root (with the owner) under android with some modification of the code
> su.c

You'd probably do better to use an existing implementation rather than
write your own.

> and with using   setuid(0)  and setgid(0)  why this dont work ???

These calls are not magic.  Nothing within the code of an executable
can get you root, unless it exploits a bug.

Rather, the setuid bit on the file containing the executable makes it
start as root; it's then up to the program logic to decide if it
should exit with an error, run a command as root, or drop privileges
and become some (different) ordinary user to run a command.

> > Why are you calling two exec functions?
>
> i want to call the first but in the code su.c i found two functions
> and i dont understand the role of the second function

You broke the program logic with your edits.  They key thing to
realize is that once one of the exec calls executes, your program
ceases to exist, because it is replaced by the program it exec'd.  So
only one of them will be run.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Security Discussions" group.
To post to this group, send email to android-security-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
android-security-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/android-security-discuss?hl=en.

Reply via email to